@forklaunch/internal 0.0.3 → 0.0.4
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 +12 -12
- package/lib/index.d.ts +12 -12
- package/lib/index.js +4 -4
- package/lib/index.mjs +3 -3
- package/package.json +3 -3
package/lib/index.d.mts
CHANGED
|
@@ -41,7 +41,7 @@ declare function serviceSchemaResolver<Options extends Record<string, unknown>,
|
|
|
41
41
|
validator: SchemaValidator;
|
|
42
42
|
}) => SchemasByValidator<SchemaValidator, (options: Options) => TypeBoxSchemas, (options: Options) => ZodSchemas>;
|
|
43
43
|
|
|
44
|
-
type
|
|
44
|
+
type InternalMapper<Mapper extends Record<string, {
|
|
45
45
|
dto: unknown;
|
|
46
46
|
_Entity: unknown;
|
|
47
47
|
serializeEntityToDto: unknown;
|
|
@@ -50,22 +50,22 @@ type InternalDtoMapper<DtoMapper extends Record<string, {
|
|
|
50
50
|
_Entity: unknown;
|
|
51
51
|
deserializeDtoToEntity: unknown;
|
|
52
52
|
}>> = {
|
|
53
|
-
[K in keyof
|
|
53
|
+
[K in keyof Mapper]: Mapper[K] extends {
|
|
54
54
|
dto: unknown;
|
|
55
55
|
_Entity: unknown;
|
|
56
56
|
serializeEntityToDto: unknown;
|
|
57
57
|
} ? {
|
|
58
|
-
serializeEntityToDto:
|
|
59
|
-
} :
|
|
58
|
+
serializeEntityToDto: Mapper[K]['serializeEntityToDto'];
|
|
59
|
+
} : Mapper[K] extends {
|
|
60
60
|
dto: unknown;
|
|
61
61
|
_Entity: unknown;
|
|
62
62
|
deserializeDtoToEntity: unknown;
|
|
63
63
|
} ? {
|
|
64
|
-
deserializeDtoToEntity:
|
|
64
|
+
deserializeDtoToEntity: Mapper[K]['deserializeDtoToEntity'];
|
|
65
65
|
} : never;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
declare function
|
|
68
|
+
declare function transformIntoInternalMapper<SchemaValidator extends AnySchemaValidator, Mapper extends Record<string, new (schemaValidator: SchemaValidator) => {
|
|
69
69
|
dto: unknown;
|
|
70
70
|
_Entity: unknown;
|
|
71
71
|
serializeEntityToDto: unknown;
|
|
@@ -73,15 +73,15 @@ declare function transformIntoInternalDtoMapper<SchemaValidator extends AnySchem
|
|
|
73
73
|
dto: unknown;
|
|
74
74
|
_Entity: unknown;
|
|
75
75
|
deserializeDtoToEntity: unknown;
|
|
76
|
-
}>>(mappers:
|
|
76
|
+
}>>(mappers: Mapper, schemaValidator: SchemaValidator): InternalMapper<InstanceTypeRecord<Mapper>>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Type representing a schema validator object for an entity mapper.
|
|
80
80
|
*
|
|
81
81
|
* @template SV - A type that extends AnySchemaValidator.
|
|
82
|
-
* @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>}
|
|
82
|
+
* @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>} MapperSchemaValidatorObject
|
|
83
83
|
*/
|
|
84
|
-
type
|
|
84
|
+
type MapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>;
|
|
85
85
|
/**
|
|
86
86
|
* Type representing a response DTO mapper for an entity mapper.
|
|
87
87
|
*
|
|
@@ -89,7 +89,7 @@ type DtoMapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidS
|
|
|
89
89
|
* @template Dto - The type of the DTO object.
|
|
90
90
|
* @template Entity - The type of the entity object.
|
|
91
91
|
*/
|
|
92
|
-
type
|
|
92
|
+
type ResponseMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, SerializeEntityToDto extends (schemaValidator: SchemaValidator, entity: Entity, ...additionalArgs: never[]) => Promise<Dto> = (schemaValidator: SchemaValidator, entity: Entity, ...additionalArgs: never[]) => Promise<Dto>> = new (schemaValidator: SchemaValidator) => {
|
|
93
93
|
dto: Dto;
|
|
94
94
|
_Entity: Entity;
|
|
95
95
|
serializeEntityToDto: SerializeEntityToDto;
|
|
@@ -101,10 +101,10 @@ type ResponseDtoMapperConstructor<SchemaValidator extends AnySchemaValidator, Dt
|
|
|
101
101
|
* @template Dto - The type of the DTO object.
|
|
102
102
|
* @template Entity - The type of the entity object.
|
|
103
103
|
*/
|
|
104
|
-
type
|
|
104
|
+
type RequestMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, DeserializeDtoToEntity extends (schemaValidator: SchemaValidator, dto: Dto, em?: EntityManager, ...additionalArgs: never[]) => Promise<Entity> = (schemaValidator: SchemaValidator, dto: Dto, em?: EntityManager, ...additionalArgs: never[]) => Promise<Entity>> = new (schemaValidator: SchemaValidator) => {
|
|
105
105
|
dto: Dto;
|
|
106
106
|
_Entity: Entity;
|
|
107
107
|
deserializeDtoToEntity: DeserializeDtoToEntity;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
export {
|
|
110
|
+
export { DummyEnum, IdentityRequestMapper, IdentityResponseMapper, type InternalMapper, type MapperSchemaValidatorObject, type RequestMapperConstructor, type ResponseMapperConstructor, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality, transformIntoInternalMapper };
|
package/lib/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ declare function serviceSchemaResolver<Options extends Record<string, unknown>,
|
|
|
41
41
|
validator: SchemaValidator;
|
|
42
42
|
}) => SchemasByValidator<SchemaValidator, (options: Options) => TypeBoxSchemas, (options: Options) => ZodSchemas>;
|
|
43
43
|
|
|
44
|
-
type
|
|
44
|
+
type InternalMapper<Mapper extends Record<string, {
|
|
45
45
|
dto: unknown;
|
|
46
46
|
_Entity: unknown;
|
|
47
47
|
serializeEntityToDto: unknown;
|
|
@@ -50,22 +50,22 @@ type InternalDtoMapper<DtoMapper extends Record<string, {
|
|
|
50
50
|
_Entity: unknown;
|
|
51
51
|
deserializeDtoToEntity: unknown;
|
|
52
52
|
}>> = {
|
|
53
|
-
[K in keyof
|
|
53
|
+
[K in keyof Mapper]: Mapper[K] extends {
|
|
54
54
|
dto: unknown;
|
|
55
55
|
_Entity: unknown;
|
|
56
56
|
serializeEntityToDto: unknown;
|
|
57
57
|
} ? {
|
|
58
|
-
serializeEntityToDto:
|
|
59
|
-
} :
|
|
58
|
+
serializeEntityToDto: Mapper[K]['serializeEntityToDto'];
|
|
59
|
+
} : Mapper[K] extends {
|
|
60
60
|
dto: unknown;
|
|
61
61
|
_Entity: unknown;
|
|
62
62
|
deserializeDtoToEntity: unknown;
|
|
63
63
|
} ? {
|
|
64
|
-
deserializeDtoToEntity:
|
|
64
|
+
deserializeDtoToEntity: Mapper[K]['deserializeDtoToEntity'];
|
|
65
65
|
} : never;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
declare function
|
|
68
|
+
declare function transformIntoInternalMapper<SchemaValidator extends AnySchemaValidator, Mapper extends Record<string, new (schemaValidator: SchemaValidator) => {
|
|
69
69
|
dto: unknown;
|
|
70
70
|
_Entity: unknown;
|
|
71
71
|
serializeEntityToDto: unknown;
|
|
@@ -73,15 +73,15 @@ declare function transformIntoInternalDtoMapper<SchemaValidator extends AnySchem
|
|
|
73
73
|
dto: unknown;
|
|
74
74
|
_Entity: unknown;
|
|
75
75
|
deserializeDtoToEntity: unknown;
|
|
76
|
-
}>>(mappers:
|
|
76
|
+
}>>(mappers: Mapper, schemaValidator: SchemaValidator): InternalMapper<InstanceTypeRecord<Mapper>>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Type representing a schema validator object for an entity mapper.
|
|
80
80
|
*
|
|
81
81
|
* @template SV - A type that extends AnySchemaValidator.
|
|
82
|
-
* @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>}
|
|
82
|
+
* @typedef {SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>} MapperSchemaValidatorObject
|
|
83
83
|
*/
|
|
84
|
-
type
|
|
84
|
+
type MapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidSchemaObject'] | UnboxedObjectSchema<SV>;
|
|
85
85
|
/**
|
|
86
86
|
* Type representing a response DTO mapper for an entity mapper.
|
|
87
87
|
*
|
|
@@ -89,7 +89,7 @@ type DtoMapperSchemaValidatorObject<SV extends AnySchemaValidator> = SV['_ValidS
|
|
|
89
89
|
* @template Dto - The type of the DTO object.
|
|
90
90
|
* @template Entity - The type of the entity object.
|
|
91
91
|
*/
|
|
92
|
-
type
|
|
92
|
+
type ResponseMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, SerializeEntityToDto extends (schemaValidator: SchemaValidator, entity: Entity, ...additionalArgs: never[]) => Promise<Dto> = (schemaValidator: SchemaValidator, entity: Entity, ...additionalArgs: never[]) => Promise<Dto>> = new (schemaValidator: SchemaValidator) => {
|
|
93
93
|
dto: Dto;
|
|
94
94
|
_Entity: Entity;
|
|
95
95
|
serializeEntityToDto: SerializeEntityToDto;
|
|
@@ -101,10 +101,10 @@ type ResponseDtoMapperConstructor<SchemaValidator extends AnySchemaValidator, Dt
|
|
|
101
101
|
* @template Dto - The type of the DTO object.
|
|
102
102
|
* @template Entity - The type of the entity object.
|
|
103
103
|
*/
|
|
104
|
-
type
|
|
104
|
+
type RequestMapperConstructor<SchemaValidator extends AnySchemaValidator, Dto, Entity, DeserializeDtoToEntity extends (schemaValidator: SchemaValidator, dto: Dto, em?: EntityManager, ...additionalArgs: never[]) => Promise<Entity> = (schemaValidator: SchemaValidator, dto: Dto, em?: EntityManager, ...additionalArgs: never[]) => Promise<Entity>> = new (schemaValidator: SchemaValidator) => {
|
|
105
105
|
dto: Dto;
|
|
106
106
|
_Entity: Entity;
|
|
107
107
|
deserializeDtoToEntity: DeserializeDtoToEntity;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
export {
|
|
110
|
+
export { DummyEnum, IdentityRequestMapper, IdentityResponseMapper, type InternalMapper, type MapperSchemaValidatorObject, type RequestMapperConstructor, type ResponseMapperConstructor, type SchemasByValidator, serviceSchemaResolver, testSchemaEquality, transformIntoInternalMapper };
|
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
IdentityResponseMapper: () => IdentityResponseMapper,
|
|
26
26
|
serviceSchemaResolver: () => serviceSchemaResolver,
|
|
27
27
|
testSchemaEquality: () => testSchemaEquality,
|
|
28
|
-
|
|
28
|
+
transformIntoInternalMapper: () => transformIntoInternalMapper
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(index_exports);
|
|
31
31
|
|
|
@@ -87,8 +87,8 @@ function serviceSchemaResolver(TypeBoxSchemas, ZodSchemas) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
// src/
|
|
91
|
-
function
|
|
90
|
+
// src/transformIntoInternalMapper.ts
|
|
91
|
+
function transformIntoInternalMapper(mappers, schemaValidator) {
|
|
92
92
|
return Object.fromEntries(
|
|
93
93
|
Object.entries(mappers).map(([key, value]) => [
|
|
94
94
|
key,
|
|
@@ -103,5 +103,5 @@ function transformIntoInternalDtoMapper(mappers, schemaValidator) {
|
|
|
103
103
|
IdentityResponseMapper,
|
|
104
104
|
serviceSchemaResolver,
|
|
105
105
|
testSchemaEquality,
|
|
106
|
-
|
|
106
|
+
transformIntoInternalMapper
|
|
107
107
|
});
|
package/lib/index.mjs
CHANGED
|
@@ -60,8 +60,8 @@ function serviceSchemaResolver(TypeBoxSchemas, ZodSchemas) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// src/
|
|
64
|
-
function
|
|
63
|
+
// src/transformIntoInternalMapper.ts
|
|
64
|
+
function transformIntoInternalMapper(mappers, schemaValidator) {
|
|
65
65
|
return Object.fromEntries(
|
|
66
66
|
Object.entries(mappers).map(([key, value]) => [
|
|
67
67
|
key,
|
|
@@ -75,5 +75,5 @@ export {
|
|
|
75
75
|
IdentityResponseMapper,
|
|
76
76
|
serviceSchemaResolver,
|
|
77
77
|
testSchemaEquality,
|
|
78
|
-
|
|
78
|
+
transformIntoInternalMapper
|
|
79
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/internal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@mikro-orm/core": "^6.4.16",
|
|
32
|
-
"@forklaunch/common": "0.3.
|
|
33
|
-
"@forklaunch/validator": "0.6.
|
|
32
|
+
"@forklaunch/common": "0.3.14",
|
|
33
|
+
"@forklaunch/validator": "0.6.16"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eslint/js": "^9.29.0",
|