@forklaunch/core 0.16.1 → 0.17.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/lib/{apiDefinition.types-BYizofKE.d.mts → apiDefinition.types-XZ0lrfFc.d.mts} +10 -6
- package/lib/{apiDefinition.types-BYizofKE.d.ts → apiDefinition.types-XZ0lrfFc.d.ts} +10 -6
- package/lib/http/index.d.mts +113 -8
- package/lib/http/index.d.ts +113 -8
- package/lib/http/index.js +789 -649
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +760 -625
- package/lib/http/index.mjs.map +1 -1
- package/lib/mappers/index.d.mts +14 -4
- package/lib/mappers/index.d.ts +14 -4
- package/lib/mappers/index.js +20 -8
- package/lib/mappers/index.js.map +1 -1
- package/lib/mappers/index.mjs +20 -8
- package/lib/mappers/index.mjs.map +1 -1
- package/lib/persistence/index.d.mts +6 -3
- package/lib/persistence/index.d.ts +6 -3
- package/lib/persistence/index.js +11 -3
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +11 -3
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/ws/index.d.mts +2 -2
- package/lib/ws/index.d.ts +2 -2
- package/package.json +33 -33
package/lib/mappers/index.d.mts
CHANGED
|
@@ -2,13 +2,23 @@ import { Prettify } from '@forklaunch/common';
|
|
|
2
2
|
import { AnySchemaValidator, IdiomaticSchema, Schema } from '@forklaunch/validator';
|
|
3
3
|
import { Constructor } from '@mikro-orm/core';
|
|
4
4
|
|
|
5
|
-
declare function requestMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>(schemaValidator
|
|
6
|
-
|
|
5
|
+
declare function requestMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>({ schemaValidator, schema, entity, mapperDefinition }: {
|
|
6
|
+
schemaValidator: SV;
|
|
7
|
+
schema: DomainSchema;
|
|
8
|
+
entity: Constructor<Entity>;
|
|
9
|
+
mapperDefinition: {
|
|
10
|
+
toEntity: (dto: Schema<DomainSchema, SV>, ...args: AdditionalArgs) => Promise<Entity>;
|
|
11
|
+
};
|
|
7
12
|
}): {
|
|
8
13
|
schema: DomainSchema;
|
|
9
14
|
} & typeof mapperDefinition;
|
|
10
|
-
declare function responseMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>(schemaValidator
|
|
11
|
-
|
|
15
|
+
declare function responseMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>({ schemaValidator, schema, entity, mapperDefinition }: {
|
|
16
|
+
schemaValidator: SV;
|
|
17
|
+
schema: DomainSchema;
|
|
18
|
+
entity: Constructor<Entity>;
|
|
19
|
+
mapperDefinition: {
|
|
20
|
+
toDto: (entity: Entity, ...args: AdditionalArgs) => Promise<Schema<DomainSchema, SV>>;
|
|
21
|
+
};
|
|
12
22
|
}): Prettify<{
|
|
13
23
|
schema: DomainSchema;
|
|
14
24
|
} & typeof mapperDefinition>;
|
package/lib/mappers/index.d.ts
CHANGED
|
@@ -2,13 +2,23 @@ import { Prettify } from '@forklaunch/common';
|
|
|
2
2
|
import { AnySchemaValidator, IdiomaticSchema, Schema } from '@forklaunch/validator';
|
|
3
3
|
import { Constructor } from '@mikro-orm/core';
|
|
4
4
|
|
|
5
|
-
declare function requestMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>(schemaValidator
|
|
6
|
-
|
|
5
|
+
declare function requestMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>({ schemaValidator, schema, entity, mapperDefinition }: {
|
|
6
|
+
schemaValidator: SV;
|
|
7
|
+
schema: DomainSchema;
|
|
8
|
+
entity: Constructor<Entity>;
|
|
9
|
+
mapperDefinition: {
|
|
10
|
+
toEntity: (dto: Schema<DomainSchema, SV>, ...args: AdditionalArgs) => Promise<Entity>;
|
|
11
|
+
};
|
|
7
12
|
}): {
|
|
8
13
|
schema: DomainSchema;
|
|
9
14
|
} & typeof mapperDefinition;
|
|
10
|
-
declare function responseMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>(schemaValidator
|
|
11
|
-
|
|
15
|
+
declare function responseMapper<SV extends AnySchemaValidator, DomainSchema extends IdiomaticSchema<SV>, Entity, AdditionalArgs extends unknown[] = []>({ schemaValidator, schema, entity, mapperDefinition }: {
|
|
16
|
+
schemaValidator: SV;
|
|
17
|
+
schema: DomainSchema;
|
|
18
|
+
entity: Constructor<Entity>;
|
|
19
|
+
mapperDefinition: {
|
|
20
|
+
toDto: (entity: Entity, ...args: AdditionalArgs) => Promise<Schema<DomainSchema, SV>>;
|
|
21
|
+
};
|
|
12
22
|
}): Prettify<{
|
|
13
23
|
schema: DomainSchema;
|
|
14
24
|
} & typeof mapperDefinition>;
|
package/lib/mappers/index.js
CHANGED
|
@@ -28,13 +28,19 @@ module.exports = __toCommonJS(mappers_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/mappers/mapper.ts
|
|
30
30
|
var import_validator = require("@forklaunch/validator");
|
|
31
|
-
function requestMapper(
|
|
31
|
+
function requestMapper({
|
|
32
|
+
schemaValidator,
|
|
33
|
+
schema,
|
|
34
|
+
// eslint-disable-next-line
|
|
35
|
+
entity,
|
|
36
|
+
mapperDefinition
|
|
37
|
+
}) {
|
|
32
38
|
const sv = schemaValidator;
|
|
33
39
|
return {
|
|
34
40
|
...mapperDefinition,
|
|
35
|
-
schema
|
|
41
|
+
schema,
|
|
36
42
|
toEntity: async (dto, ...args) => {
|
|
37
|
-
const parsedSchema = sv.parse(sv.schemify(
|
|
43
|
+
const parsedSchema = sv.parse(sv.schemify(schema), dto);
|
|
38
44
|
if (!parsedSchema.ok) {
|
|
39
45
|
throw new Error((0, import_validator.prettyPrintParseErrors)(parsedSchema.errors, "DTO"));
|
|
40
46
|
}
|
|
@@ -45,14 +51,20 @@ function requestMapper(schemaValidator, domainSchema, _entityConstructor, mapper
|
|
|
45
51
|
}
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
|
-
function responseMapper(
|
|
54
|
+
function responseMapper({
|
|
55
|
+
schemaValidator,
|
|
56
|
+
schema,
|
|
57
|
+
// eslint-disable-next-line
|
|
58
|
+
entity,
|
|
59
|
+
mapperDefinition
|
|
60
|
+
}) {
|
|
49
61
|
const sv = schemaValidator;
|
|
50
62
|
return {
|
|
51
63
|
...mapperDefinition,
|
|
52
|
-
schema
|
|
53
|
-
toDto: async (
|
|
54
|
-
const domain = await mapperDefinition.toDto(
|
|
55
|
-
const parsedSchema = sv.parse(sv.schemify(
|
|
64
|
+
schema,
|
|
65
|
+
toDto: async (entity2, ...args) => {
|
|
66
|
+
const domain = await mapperDefinition.toDto(entity2, ...args);
|
|
67
|
+
const parsedSchema = sv.parse(sv.schemify(schema), domain);
|
|
56
68
|
if (!parsedSchema.ok) {
|
|
57
69
|
throw new Error((0, import_validator.prettyPrintParseErrors)(parsedSchema.errors, "DTO"));
|
|
58
70
|
}
|
package/lib/mappers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mappers/index.ts","../../src/mappers/mapper.ts","../../src/mappers/guards/isSchemaResolutionFunction.ts","../../src/mappers/mapServiceSchemas.ts"],"sourcesContent":["export * from './mapper';\nexport * from './mapServiceSchemas';\n","import { Prettify } from '@forklaunch/common';\nimport {\n AnySchemaValidator,\n IdiomaticSchema,\n prettyPrintParseErrors,\n Schema,\n SchemaValidator\n} from '@forklaunch/validator';\nimport { Constructor } from '@mikro-orm/core';\n\nexport function requestMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>(\n schemaValidator: SV
|
|
1
|
+
{"version":3,"sources":["../../src/mappers/index.ts","../../src/mappers/mapper.ts","../../src/mappers/guards/isSchemaResolutionFunction.ts","../../src/mappers/mapServiceSchemas.ts"],"sourcesContent":["export * from './mapper';\nexport * from './mapServiceSchemas';\n","import { Prettify } from '@forklaunch/common';\nimport {\n AnySchemaValidator,\n IdiomaticSchema,\n prettyPrintParseErrors,\n Schema,\n SchemaValidator\n} from '@forklaunch/validator';\nimport { Constructor } from '@mikro-orm/core';\n\nexport function requestMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>({\n schemaValidator,\n schema,\n // eslint-disable-next-line\n entity,\n mapperDefinition\n}: {\n schemaValidator: SV;\n schema: DomainSchema;\n entity: Constructor<Entity>;\n mapperDefinition: {\n toEntity: (\n dto: Schema<DomainSchema, SV>,\n ...args: AdditionalArgs\n ) => Promise<Entity>;\n };\n}): {\n schema: DomainSchema;\n} & typeof mapperDefinition {\n const sv = schemaValidator as SchemaValidator;\n return {\n ...mapperDefinition,\n schema,\n\n toEntity: async (\n dto: Schema<DomainSchema, SV>,\n ...args: AdditionalArgs\n ) => {\n const parsedSchema = sv.parse(sv.schemify(schema), dto);\n if (!parsedSchema.ok) {\n throw new Error(prettyPrintParseErrors(parsedSchema.errors, 'DTO'));\n }\n return mapperDefinition.toEntity(\n dto as Schema<DomainSchema, SV>,\n ...(args as AdditionalArgs)\n );\n }\n };\n}\n\nexport function responseMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>({\n schemaValidator,\n schema,\n // eslint-disable-next-line\n entity,\n mapperDefinition\n}: {\n schemaValidator: SV;\n schema: DomainSchema;\n entity: Constructor<Entity>;\n mapperDefinition: {\n toDto: (\n entity: Entity,\n ...args: AdditionalArgs\n ) => Promise<Schema<DomainSchema, SV>>;\n };\n}): Prettify<\n {\n schema: DomainSchema;\n } & typeof mapperDefinition\n> {\n const sv = schemaValidator as SchemaValidator;\n return {\n ...mapperDefinition,\n schema,\n\n toDto: async (entity: Entity, ...args: AdditionalArgs) => {\n const domain = await mapperDefinition.toDto(entity, ...args);\n const parsedSchema = sv.parse(sv.schemify(schema), domain);\n if (!parsedSchema.ok) {\n throw new Error(prettyPrintParseErrors(parsedSchema.errors, 'DTO'));\n }\n return domain;\n }\n };\n}\n","import { SchemaResolutionFunction } from '../types/schemaResolution.types';\n\n/**\n * Type guard to determine if a value is a SchemaResolutionFunction.\n *\n * @template Args - The type of the options object expected by the schema resolution function.\n * @param {unknown} value - The value to check.\n * @returns {value is SchemaResolutionFunction<Args>} True if the value is a function (assumed to be a SchemaResolutionFunction), false otherwise.\n */\nexport function isSchemaResolutionFunction<\n Args extends Record<string, unknown>\n>(value: unknown): value is SchemaResolutionFunction<Args> {\n return typeof value === 'function';\n}\n","import { AnySchemaValidator, IdiomaticSchema } from '@forklaunch/validator';\nimport { isSchemaResolutionFunction } from './guards/isSchemaResolutionFunction';\nimport { SchemaResolutionFunction } from './types/schemaResolution.types';\n\n/**\n * Maps a set of service schema factories or pre-instantiated schemas to their resolved schemas using the provided arguments.\n *\n * This utility allows you to provide an object whose values are either:\n * - Schema factory functions (SchemaResolutionFunction) that accept an options object (Args) and return a schema or schema group.\n * - Already-instantiated schemas (IdiomaticSchema).\n *\n * Each factory function will be called with the provided `args` object, and the result will be included in the returned mapping.\n * If a value is already a schema (not a function), it is returned as-is.\n *\n * @template SV - The schema validator type.\n * @template T - An object whose values are either schema factory functions or instantiated schemas.\n * @template Args - The type of the options object passed to each factory function (e.g., { validator, uuidId, ... }).\n *\n * @param {T} schemas - An object mapping schema names to either factory functions (SchemaResolutionFunction) or instantiated schemas (IdiomaticSchema).\n * @param {Args} args - The options object to be passed to each schema factory function.\n * @returns {{ [K in keyof T]: T[K] extends SchemaResolutionFunction<Args> ? ReturnType<T[K]> : T[K] }} An object mapping each schema name to its resolved schema.\n *\n * @example\n * const schemas = {\n * UserSchemas: (opts) => createUserSchemas(opts),\n * ProductSchemas: (opts) => createProductSchemas(opts),\n * AlreadyInstantiated: someSchemaObject\n * };\n * const mapped = mapServiceSchemas(schemas, { validator: myValidator });\n * // mapped.UserSchemas and mapped.ProductSchemas are instantiated, mapped.AlreadyInstantiated is passed through\n */\nexport function mapServiceSchemas<\n SV extends AnySchemaValidator,\n T extends Record<\n string,\n SchemaResolutionFunction<Args> | IdiomaticSchema<SV>\n >,\n Args extends Record<string, unknown>\n>(\n schemas: T,\n args: Args\n): {\n [K in keyof T]: T[K] extends SchemaResolutionFunction<Args>\n ? ReturnType<T[K]>\n : T[K];\n} {\n return Object.fromEntries(\n Object.entries(schemas).map(([key, value]) => [\n key,\n isSchemaResolutionFunction(value) ? value(args) : value\n ])\n ) as {\n [K in keyof T]: T[K] extends SchemaResolutionFunction<Args>\n ? ReturnType<T[K]>\n : T[K];\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,uBAMO;AAGA,SAAS,cAKd;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF,GAY4B;AAC1B,QAAM,KAAK;AACX,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IAEA,UAAU,OACR,QACG,SACA;AACH,YAAM,eAAe,GAAG,MAAM,GAAG,SAAS,MAAM,GAAG,GAAG;AACtD,UAAI,CAAC,aAAa,IAAI;AACpB,cAAM,IAAI,UAAM,yCAAuB,aAAa,QAAQ,KAAK,CAAC;AAAA,MACpE;AACA,aAAO,iBAAiB;AAAA,QACtB;AAAA,QACA,GAAI;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,eAKd;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF,GAcE;AACA,QAAM,KAAK;AACX,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IAEA,OAAO,OAAOA,YAAmB,SAAyB;AACxD,YAAM,SAAS,MAAM,iBAAiB,MAAMA,SAAQ,GAAG,IAAI;AAC3D,YAAM,eAAe,GAAG,MAAM,GAAG,SAAS,MAAM,GAAG,MAAM;AACzD,UAAI,CAAC,aAAa,IAAI;AACpB,cAAM,IAAI,UAAM,yCAAuB,aAAa,QAAQ,KAAK,CAAC;AAAA,MACpE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACtFO,SAAS,2BAEd,OAAyD;AACzD,SAAO,OAAO,UAAU;AAC1B;;;ACkBO,SAAS,kBAQd,SACA,MAKA;AACA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,MAC5C;AAAA,MACA,2BAA2B,KAAK,IAAI,MAAM,IAAI,IAAI;AAAA,IACpD,CAAC;AAAA,EACH;AAKF;","names":["entity"]}
|
package/lib/mappers/index.mjs
CHANGED
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
prettyPrintParseErrors
|
|
4
4
|
} from "@forklaunch/validator";
|
|
5
|
-
function requestMapper(
|
|
5
|
+
function requestMapper({
|
|
6
|
+
schemaValidator,
|
|
7
|
+
schema,
|
|
8
|
+
// eslint-disable-next-line
|
|
9
|
+
entity,
|
|
10
|
+
mapperDefinition
|
|
11
|
+
}) {
|
|
6
12
|
const sv = schemaValidator;
|
|
7
13
|
return {
|
|
8
14
|
...mapperDefinition,
|
|
9
|
-
schema
|
|
15
|
+
schema,
|
|
10
16
|
toEntity: async (dto, ...args) => {
|
|
11
|
-
const parsedSchema = sv.parse(sv.schemify(
|
|
17
|
+
const parsedSchema = sv.parse(sv.schemify(schema), dto);
|
|
12
18
|
if (!parsedSchema.ok) {
|
|
13
19
|
throw new Error(prettyPrintParseErrors(parsedSchema.errors, "DTO"));
|
|
14
20
|
}
|
|
@@ -19,14 +25,20 @@ function requestMapper(schemaValidator, domainSchema, _entityConstructor, mapper
|
|
|
19
25
|
}
|
|
20
26
|
};
|
|
21
27
|
}
|
|
22
|
-
function responseMapper(
|
|
28
|
+
function responseMapper({
|
|
29
|
+
schemaValidator,
|
|
30
|
+
schema,
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
entity,
|
|
33
|
+
mapperDefinition
|
|
34
|
+
}) {
|
|
23
35
|
const sv = schemaValidator;
|
|
24
36
|
return {
|
|
25
37
|
...mapperDefinition,
|
|
26
|
-
schema
|
|
27
|
-
toDto: async (
|
|
28
|
-
const domain = await mapperDefinition.toDto(
|
|
29
|
-
const parsedSchema = sv.parse(sv.schemify(
|
|
38
|
+
schema,
|
|
39
|
+
toDto: async (entity2, ...args) => {
|
|
40
|
+
const domain = await mapperDefinition.toDto(entity2, ...args);
|
|
41
|
+
const parsedSchema = sv.parse(sv.schemify(schema), domain);
|
|
30
42
|
if (!parsedSchema.ok) {
|
|
31
43
|
throw new Error(prettyPrintParseErrors(parsedSchema.errors, "DTO"));
|
|
32
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mappers/mapper.ts","../../src/mappers/guards/isSchemaResolutionFunction.ts","../../src/mappers/mapServiceSchemas.ts"],"sourcesContent":["import { Prettify } from '@forklaunch/common';\nimport {\n AnySchemaValidator,\n IdiomaticSchema,\n prettyPrintParseErrors,\n Schema,\n SchemaValidator\n} from '@forklaunch/validator';\nimport { Constructor } from '@mikro-orm/core';\n\nexport function requestMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>(\n schemaValidator: SV
|
|
1
|
+
{"version":3,"sources":["../../src/mappers/mapper.ts","../../src/mappers/guards/isSchemaResolutionFunction.ts","../../src/mappers/mapServiceSchemas.ts"],"sourcesContent":["import { Prettify } from '@forklaunch/common';\nimport {\n AnySchemaValidator,\n IdiomaticSchema,\n prettyPrintParseErrors,\n Schema,\n SchemaValidator\n} from '@forklaunch/validator';\nimport { Constructor } from '@mikro-orm/core';\n\nexport function requestMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>({\n schemaValidator,\n schema,\n // eslint-disable-next-line\n entity,\n mapperDefinition\n}: {\n schemaValidator: SV;\n schema: DomainSchema;\n entity: Constructor<Entity>;\n mapperDefinition: {\n toEntity: (\n dto: Schema<DomainSchema, SV>,\n ...args: AdditionalArgs\n ) => Promise<Entity>;\n };\n}): {\n schema: DomainSchema;\n} & typeof mapperDefinition {\n const sv = schemaValidator as SchemaValidator;\n return {\n ...mapperDefinition,\n schema,\n\n toEntity: async (\n dto: Schema<DomainSchema, SV>,\n ...args: AdditionalArgs\n ) => {\n const parsedSchema = sv.parse(sv.schemify(schema), dto);\n if (!parsedSchema.ok) {\n throw new Error(prettyPrintParseErrors(parsedSchema.errors, 'DTO'));\n }\n return mapperDefinition.toEntity(\n dto as Schema<DomainSchema, SV>,\n ...(args as AdditionalArgs)\n );\n }\n };\n}\n\nexport function responseMapper<\n SV extends AnySchemaValidator,\n DomainSchema extends IdiomaticSchema<SV>,\n Entity,\n AdditionalArgs extends unknown[] = []\n>({\n schemaValidator,\n schema,\n // eslint-disable-next-line\n entity,\n mapperDefinition\n}: {\n schemaValidator: SV;\n schema: DomainSchema;\n entity: Constructor<Entity>;\n mapperDefinition: {\n toDto: (\n entity: Entity,\n ...args: AdditionalArgs\n ) => Promise<Schema<DomainSchema, SV>>;\n };\n}): Prettify<\n {\n schema: DomainSchema;\n } & typeof mapperDefinition\n> {\n const sv = schemaValidator as SchemaValidator;\n return {\n ...mapperDefinition,\n schema,\n\n toDto: async (entity: Entity, ...args: AdditionalArgs) => {\n const domain = await mapperDefinition.toDto(entity, ...args);\n const parsedSchema = sv.parse(sv.schemify(schema), domain);\n if (!parsedSchema.ok) {\n throw new Error(prettyPrintParseErrors(parsedSchema.errors, 'DTO'));\n }\n return domain;\n }\n };\n}\n","import { SchemaResolutionFunction } from '../types/schemaResolution.types';\n\n/**\n * Type guard to determine if a value is a SchemaResolutionFunction.\n *\n * @template Args - The type of the options object expected by the schema resolution function.\n * @param {unknown} value - The value to check.\n * @returns {value is SchemaResolutionFunction<Args>} True if the value is a function (assumed to be a SchemaResolutionFunction), false otherwise.\n */\nexport function isSchemaResolutionFunction<\n Args extends Record<string, unknown>\n>(value: unknown): value is SchemaResolutionFunction<Args> {\n return typeof value === 'function';\n}\n","import { AnySchemaValidator, IdiomaticSchema } from '@forklaunch/validator';\nimport { isSchemaResolutionFunction } from './guards/isSchemaResolutionFunction';\nimport { SchemaResolutionFunction } from './types/schemaResolution.types';\n\n/**\n * Maps a set of service schema factories or pre-instantiated schemas to their resolved schemas using the provided arguments.\n *\n * This utility allows you to provide an object whose values are either:\n * - Schema factory functions (SchemaResolutionFunction) that accept an options object (Args) and return a schema or schema group.\n * - Already-instantiated schemas (IdiomaticSchema).\n *\n * Each factory function will be called with the provided `args` object, and the result will be included in the returned mapping.\n * If a value is already a schema (not a function), it is returned as-is.\n *\n * @template SV - The schema validator type.\n * @template T - An object whose values are either schema factory functions or instantiated schemas.\n * @template Args - The type of the options object passed to each factory function (e.g., { validator, uuidId, ... }).\n *\n * @param {T} schemas - An object mapping schema names to either factory functions (SchemaResolutionFunction) or instantiated schemas (IdiomaticSchema).\n * @param {Args} args - The options object to be passed to each schema factory function.\n * @returns {{ [K in keyof T]: T[K] extends SchemaResolutionFunction<Args> ? ReturnType<T[K]> : T[K] }} An object mapping each schema name to its resolved schema.\n *\n * @example\n * const schemas = {\n * UserSchemas: (opts) => createUserSchemas(opts),\n * ProductSchemas: (opts) => createProductSchemas(opts),\n * AlreadyInstantiated: someSchemaObject\n * };\n * const mapped = mapServiceSchemas(schemas, { validator: myValidator });\n * // mapped.UserSchemas and mapped.ProductSchemas are instantiated, mapped.AlreadyInstantiated is passed through\n */\nexport function mapServiceSchemas<\n SV extends AnySchemaValidator,\n T extends Record<\n string,\n SchemaResolutionFunction<Args> | IdiomaticSchema<SV>\n >,\n Args extends Record<string, unknown>\n>(\n schemas: T,\n args: Args\n): {\n [K in keyof T]: T[K] extends SchemaResolutionFunction<Args>\n ? ReturnType<T[K]>\n : T[K];\n} {\n return Object.fromEntries(\n Object.entries(schemas).map(([key, value]) => [\n key,\n isSchemaResolutionFunction(value) ? value(args) : value\n ])\n ) as {\n [K in keyof T]: T[K] extends SchemaResolutionFunction<Args>\n ? ReturnType<T[K]>\n : T[K];\n };\n}\n"],"mappings":";AACA;AAAA,EAGE;AAAA,OAGK;AAGA,SAAS,cAKd;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF,GAY4B;AAC1B,QAAM,KAAK;AACX,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IAEA,UAAU,OACR,QACG,SACA;AACH,YAAM,eAAe,GAAG,MAAM,GAAG,SAAS,MAAM,GAAG,GAAG;AACtD,UAAI,CAAC,aAAa,IAAI;AACpB,cAAM,IAAI,MAAM,uBAAuB,aAAa,QAAQ,KAAK,CAAC;AAAA,MACpE;AACA,aAAO,iBAAiB;AAAA,QACtB;AAAA,QACA,GAAI;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,eAKd;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF,GAcE;AACA,QAAM,KAAK;AACX,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IAEA,OAAO,OAAOA,YAAmB,SAAyB;AACxD,YAAM,SAAS,MAAM,iBAAiB,MAAMA,SAAQ,GAAG,IAAI;AAC3D,YAAM,eAAe,GAAG,MAAM,GAAG,SAAS,MAAM,GAAG,MAAM;AACzD,UAAI,CAAC,aAAa,IAAI;AACpB,cAAM,IAAI,MAAM,uBAAuB,aAAa,QAAQ,KAAK,CAAC;AAAA,MACpE;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACtFO,SAAS,2BAEd,OAAyD;AACzD,SAAO,OAAO,UAAU;AAC1B;;;ACkBO,SAAS,kBAQd,SACA,MAKA;AACA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,MAC5C;AAAA,MACA,2BAA2B,KAAK,IAAI,MAAM,IAAI,IAAI;AAAA,IACpD,CAAC;AAAA,EACH;AAKF;","names":["entity"]}
|
|
@@ -20,11 +20,14 @@ declare class BaseEntity extends BaseEntity$1 {
|
|
|
20
20
|
*
|
|
21
21
|
* @template T - Entity type extending BaseEntity
|
|
22
22
|
* @param this - The constructor of the entity
|
|
23
|
-
* @param data - Partial data to update the entity
|
|
24
|
-
* @param em - Optional MikroORM EntityManager. If passed,
|
|
23
|
+
* @param data - Partial data to update the entity. Must include 'id' field to identify the entity.
|
|
24
|
+
* @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update
|
|
25
25
|
* @returns A promise resolving to the updated entity
|
|
26
|
+
* @throws Error if entity with given id is not found (when em is provided)
|
|
26
27
|
*/
|
|
27
|
-
static update<T extends BaseEntity>(this: Constructor<T>, data: EntityData<T
|
|
28
|
+
static update<T extends BaseEntity>(this: Constructor<T>, data: EntityData<T> & {
|
|
29
|
+
id: unknown;
|
|
30
|
+
}, em?: EntityManager, ...constructorArgs: ConstructorParameters<Constructor<T>>): Promise<T>;
|
|
28
31
|
/**
|
|
29
32
|
* Reads the entity, initializing it if necessary, and returns its DTO representation.
|
|
30
33
|
*
|
|
@@ -20,11 +20,14 @@ declare class BaseEntity extends BaseEntity$1 {
|
|
|
20
20
|
*
|
|
21
21
|
* @template T - Entity type extending BaseEntity
|
|
22
22
|
* @param this - The constructor of the entity
|
|
23
|
-
* @param data - Partial data to update the entity
|
|
24
|
-
* @param em - Optional MikroORM EntityManager. If passed,
|
|
23
|
+
* @param data - Partial data to update the entity. Must include 'id' field to identify the entity.
|
|
24
|
+
* @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update
|
|
25
25
|
* @returns A promise resolving to the updated entity
|
|
26
|
+
* @throws Error if entity with given id is not found (when em is provided)
|
|
26
27
|
*/
|
|
27
|
-
static update<T extends BaseEntity>(this: Constructor<T>, data: EntityData<T
|
|
28
|
+
static update<T extends BaseEntity>(this: Constructor<T>, data: EntityData<T> & {
|
|
29
|
+
id: unknown;
|
|
30
|
+
}, em?: EntityManager, ...constructorArgs: ConstructorParameters<Constructor<T>>): Promise<T>;
|
|
28
31
|
/**
|
|
29
32
|
* Reads the entity, initializing it if necessary, and returns its DTO representation.
|
|
30
33
|
*
|
package/lib/persistence/index.js
CHANGED
|
@@ -54,14 +54,22 @@ var BaseEntity = class extends import_core.BaseEntity {
|
|
|
54
54
|
*
|
|
55
55
|
* @template T - Entity type extending BaseEntity
|
|
56
56
|
* @param this - The constructor of the entity
|
|
57
|
-
* @param data - Partial data to update the entity
|
|
58
|
-
* @param em - Optional MikroORM EntityManager. If passed,
|
|
57
|
+
* @param data - Partial data to update the entity. Must include 'id' field to identify the entity.
|
|
58
|
+
* @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update
|
|
59
59
|
* @returns A promise resolving to the updated entity
|
|
60
|
+
* @throws Error if entity with given id is not found (when em is provided)
|
|
60
61
|
*/
|
|
61
62
|
static async update(data, em, ...constructorArgs) {
|
|
62
63
|
const instance = new this(...constructorArgs);
|
|
63
64
|
if (em) {
|
|
64
|
-
|
|
65
|
+
const existingEntity = await em.findOneOrFail(this, { id: data.id });
|
|
66
|
+
const { id, ...updateData } = data;
|
|
67
|
+
void id;
|
|
68
|
+
em.assign(existingEntity, {
|
|
69
|
+
...updateData,
|
|
70
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
71
|
+
});
|
|
72
|
+
return existingEntity;
|
|
65
73
|
} else {
|
|
66
74
|
Object.assign(instance, {
|
|
67
75
|
...data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/persistence/index.ts","../../src/persistence/base.entity.ts"],"sourcesContent":["export * from './base.entity';\n","import {\n Constructor,\n EntityData,\n EntityDTO,\n EntityManager,\n BaseEntity as MikroORMBaseEntity,\n RequiredEntityData,\n wrap\n} from '@mikro-orm/core';\n\n/**\n * BaseEntity class extending MikroORM's BaseEntity to provide\n * convenience static methods for entity creation, updating, and reading.\n */\nexport class BaseEntity extends MikroORMBaseEntity {\n /**\n * Create a new entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Data required to create the entity\n * @param em - Optional MikroORM EntityManager. If passed, this will call em.create()\n * @returns A promise resolving to the created entity\n */\n static async create<T extends BaseEntity>(\n this: Constructor<T>,\n data: RequiredEntityData<T>,\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n return em.create(this, data);\n } else {\n Object.assign(instance, {\n ...data,\n createdAt: new Date(),\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Update an existing entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Partial data to update the entity
|
|
1
|
+
{"version":3,"sources":["../../src/persistence/index.ts","../../src/persistence/base.entity.ts"],"sourcesContent":["export * from './base.entity';\n","import {\n Constructor,\n EntityData,\n EntityDTO,\n EntityManager,\n BaseEntity as MikroORMBaseEntity,\n RequiredEntityData,\n wrap\n} from '@mikro-orm/core';\n\n/**\n * BaseEntity class extending MikroORM's BaseEntity to provide\n * convenience static methods for entity creation, updating, and reading.\n */\nexport class BaseEntity extends MikroORMBaseEntity {\n /**\n * Create a new entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Data required to create the entity\n * @param em - Optional MikroORM EntityManager. If passed, this will call em.create()\n * @returns A promise resolving to the created entity\n */\n static async create<T extends BaseEntity>(\n this: Constructor<T>,\n data: RequiredEntityData<T>,\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n return em.create(this, data);\n } else {\n Object.assign(instance, {\n ...data,\n createdAt: new Date(),\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Update an existing entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Partial data to update the entity. Must include 'id' field to identify the entity.\n * @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update\n * @returns A promise resolving to the updated entity\n * @throws Error if entity with given id is not found (when em is provided)\n */\n static async update<T extends BaseEntity>(\n this: Constructor<T>,\n data: EntityData<T> & { id: unknown },\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n const existingEntity = await em.findOneOrFail(this, { id: data.id });\n\n const { id, ...updateData } = data as Record<string, unknown>;\n void id;\n\n em.assign(existingEntity, {\n ...updateData,\n updatedAt: new Date()\n });\n\n return existingEntity;\n } else {\n Object.assign(instance, {\n ...data,\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Reads the entity, initializing it if necessary, and returns its DTO representation.\n *\n * @param em - Optional MikroORM EntityManager for initialization. If passed, entity will synchronize with database\n * @returns A promise resolving to the entity's DTO (plain object representation)\n * @throws Error if the entity is not initialized and no EntityManager is provided\n */\n async read(em?: EntityManager): Promise<EntityDTO<this>> {\n if (em && !this.isInitialized()) {\n await this.init({ em });\n }\n return wrap(this).toPOJO();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAQO;AAMA,IAAM,aAAN,cAAyB,YAAAA,WAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjD,aAAa,OAEX,MACA,OACG,iBACS;AACZ,UAAM,WAAW,IAAI,KAAK,GAAG,eAAe;AAC5C,QAAI,IAAI;AACN,aAAO,GAAG,OAAO,MAAM,IAAI;AAAA,IAC7B,OAAO;AACL,aAAO,OAAO,UAAU;AAAA,QACtB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,QACpB,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,aAAa,OAEX,MACA,OACG,iBACS;AACZ,UAAM,WAAW,IAAI,KAAK,GAAG,eAAe;AAC5C,QAAI,IAAI;AACN,YAAM,iBAAiB,MAAM,GAAG,cAAc,MAAM,EAAE,IAAI,KAAK,GAAG,CAAC;AAEnE,YAAM,EAAE,IAAI,GAAG,WAAW,IAAI;AAC9B,WAAK;AAEL,SAAG,OAAO,gBAAgB;AAAA,QACxB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAED,aAAO;AAAA,IACT,OAAO;AACL,aAAO,OAAO,UAAU;AAAA,QACtB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KAAK,IAA8C;AACvD,QAAI,MAAM,CAAC,KAAK,cAAc,GAAG;AAC/B,YAAM,KAAK,KAAK,EAAE,GAAG,CAAC;AAAA,IACxB;AACA,eAAO,kBAAK,IAAI,EAAE,OAAO;AAAA,EAC3B;AACF;","names":["MikroORMBaseEntity"]}
|
|
@@ -31,14 +31,22 @@ var BaseEntity = class extends MikroORMBaseEntity {
|
|
|
31
31
|
*
|
|
32
32
|
* @template T - Entity type extending BaseEntity
|
|
33
33
|
* @param this - The constructor of the entity
|
|
34
|
-
* @param data - Partial data to update the entity
|
|
35
|
-
* @param em - Optional MikroORM EntityManager. If passed,
|
|
34
|
+
* @param data - Partial data to update the entity. Must include 'id' field to identify the entity.
|
|
35
|
+
* @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update
|
|
36
36
|
* @returns A promise resolving to the updated entity
|
|
37
|
+
* @throws Error if entity with given id is not found (when em is provided)
|
|
37
38
|
*/
|
|
38
39
|
static async update(data, em, ...constructorArgs) {
|
|
39
40
|
const instance = new this(...constructorArgs);
|
|
40
41
|
if (em) {
|
|
41
|
-
|
|
42
|
+
const existingEntity = await em.findOneOrFail(this, { id: data.id });
|
|
43
|
+
const { id, ...updateData } = data;
|
|
44
|
+
void id;
|
|
45
|
+
em.assign(existingEntity, {
|
|
46
|
+
...updateData,
|
|
47
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
48
|
+
});
|
|
49
|
+
return existingEntity;
|
|
42
50
|
} else {
|
|
43
51
|
Object.assign(instance, {
|
|
44
52
|
...data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/persistence/base.entity.ts"],"sourcesContent":["import {\n Constructor,\n EntityData,\n EntityDTO,\n EntityManager,\n BaseEntity as MikroORMBaseEntity,\n RequiredEntityData,\n wrap\n} from '@mikro-orm/core';\n\n/**\n * BaseEntity class extending MikroORM's BaseEntity to provide\n * convenience static methods for entity creation, updating, and reading.\n */\nexport class BaseEntity extends MikroORMBaseEntity {\n /**\n * Create a new entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Data required to create the entity\n * @param em - Optional MikroORM EntityManager. If passed, this will call em.create()\n * @returns A promise resolving to the created entity\n */\n static async create<T extends BaseEntity>(\n this: Constructor<T>,\n data: RequiredEntityData<T>,\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n return em.create(this, data);\n } else {\n Object.assign(instance, {\n ...data,\n createdAt: new Date(),\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Update an existing entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Partial data to update the entity
|
|
1
|
+
{"version":3,"sources":["../../src/persistence/base.entity.ts"],"sourcesContent":["import {\n Constructor,\n EntityData,\n EntityDTO,\n EntityManager,\n BaseEntity as MikroORMBaseEntity,\n RequiredEntityData,\n wrap\n} from '@mikro-orm/core';\n\n/**\n * BaseEntity class extending MikroORM's BaseEntity to provide\n * convenience static methods for entity creation, updating, and reading.\n */\nexport class BaseEntity extends MikroORMBaseEntity {\n /**\n * Create a new entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Data required to create the entity\n * @param em - Optional MikroORM EntityManager. If passed, this will call em.create()\n * @returns A promise resolving to the created entity\n */\n static async create<T extends BaseEntity>(\n this: Constructor<T>,\n data: RequiredEntityData<T>,\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n return em.create(this, data);\n } else {\n Object.assign(instance, {\n ...data,\n createdAt: new Date(),\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Update an existing entity instance with the given data.\n *\n * @template T - Entity type extending BaseEntity\n * @param this - The constructor of the entity\n * @param data - Partial data to update the entity. Must include 'id' field to identify the entity.\n * @param em - Optional MikroORM EntityManager. If passed, fetches existing entity and applies partial update\n * @returns A promise resolving to the updated entity\n * @throws Error if entity with given id is not found (when em is provided)\n */\n static async update<T extends BaseEntity>(\n this: Constructor<T>,\n data: EntityData<T> & { id: unknown },\n em?: EntityManager,\n ...constructorArgs: ConstructorParameters<Constructor<T>>\n ): Promise<T> {\n const instance = new this(...constructorArgs);\n if (em) {\n const existingEntity = await em.findOneOrFail(this, { id: data.id });\n\n const { id, ...updateData } = data as Record<string, unknown>;\n void id;\n\n em.assign(existingEntity, {\n ...updateData,\n updatedAt: new Date()\n });\n\n return existingEntity;\n } else {\n Object.assign(instance, {\n ...data,\n updatedAt: new Date()\n });\n }\n return instance;\n }\n\n /**\n * Reads the entity, initializing it if necessary, and returns its DTO representation.\n *\n * @param em - Optional MikroORM EntityManager for initialization. If passed, entity will synchronize with database\n * @returns A promise resolving to the entity's DTO (plain object representation)\n * @throws Error if the entity is not initialized and no EntityManager is provided\n */\n async read(em?: EntityManager): Promise<EntityDTO<this>> {\n if (em && !this.isInitialized()) {\n await this.init({ em });\n }\n return wrap(this).toPOJO();\n }\n}\n"],"mappings":";AAAA;AAAA,EAKE,cAAc;AAAA,EAEd;AAAA,OACK;AAMA,IAAM,aAAN,cAAyB,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjD,aAAa,OAEX,MACA,OACG,iBACS;AACZ,UAAM,WAAW,IAAI,KAAK,GAAG,eAAe;AAC5C,QAAI,IAAI;AACN,aAAO,GAAG,OAAO,MAAM,IAAI;AAAA,IAC7B,OAAO;AACL,aAAO,OAAO,UAAU;AAAA,QACtB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,QACpB,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,aAAa,OAEX,MACA,OACG,iBACS;AACZ,UAAM,WAAW,IAAI,KAAK,GAAG,eAAe;AAC5C,QAAI,IAAI;AACN,YAAM,iBAAiB,MAAM,GAAG,cAAc,MAAM,EAAE,IAAI,KAAK,GAAG,CAAC;AAEnE,YAAM,EAAE,IAAI,GAAG,WAAW,IAAI;AAC9B,WAAK;AAEL,SAAG,OAAO,gBAAgB;AAAA,QACxB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAED,aAAO;AAAA,IACT,OAAO;AACL,aAAO,OAAO,UAAU;AAAA,QACtB,GAAG;AAAA,QACH,WAAW,oBAAI,KAAK;AAAA,MACtB,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,KAAK,IAA8C;AACvD,QAAI,MAAM,CAAC,KAAK,cAAc,GAAG;AAC/B,YAAM,KAAK,KAAK,EAAE,GAAG,CAAC;AAAA,IACxB;AACA,WAAO,KAAK,IAAI,EAAE,OAAO;AAAA,EAC3B;AACF;","names":[]}
|
package/lib/ws/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AsyncAPIObject } from '@asyncapi/parser/esm/spec-types/v3';
|
|
2
2
|
import { AnySchemaValidator, IdiomaticSchema, SchemaValidator } from '@forklaunch/validator';
|
|
3
|
-
import { S as StringOnlyObject } from '../apiDefinition.types-
|
|
3
|
+
import { S as StringOnlyObject } from '../apiDefinition.types-XZ0lrfFc.mjs';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'qs';
|
|
8
8
|
import 'stream';
|
|
9
9
|
import 'pino';
|
|
10
|
-
import '@forklaunch/fastmcp-fork';
|
|
11
10
|
import 'cors';
|
|
11
|
+
import 'fastmcp';
|
|
12
12
|
import 'http';
|
|
13
13
|
import '@scalar/express-api-reference';
|
|
14
14
|
|
package/lib/ws/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AsyncAPIObject } from '@asyncapi/parser/esm/spec-types/v3';
|
|
2
2
|
import { AnySchemaValidator, IdiomaticSchema, SchemaValidator } from '@forklaunch/validator';
|
|
3
|
-
import { S as StringOnlyObject } from '../apiDefinition.types-
|
|
3
|
+
import { S as StringOnlyObject } from '../apiDefinition.types-XZ0lrfFc.js';
|
|
4
4
|
import '@forklaunch/common';
|
|
5
5
|
import '@opentelemetry/api';
|
|
6
6
|
import 'jose';
|
|
7
7
|
import 'qs';
|
|
8
8
|
import 'stream';
|
|
9
9
|
import 'pino';
|
|
10
|
-
import '@forklaunch/fastmcp-fork';
|
|
11
10
|
import 'cors';
|
|
11
|
+
import 'fastmcp';
|
|
12
12
|
import 'http';
|
|
13
13
|
import '@scalar/express-api-reference';
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "forklaunch-js core package. Contains useful building blocks.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -77,56 +77,56 @@
|
|
|
77
77
|
],
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@asyncapi/parser": "^3.4.0",
|
|
80
|
-
"@forklaunch/fastmcp-fork": "^1.0.5",
|
|
81
80
|
"@forklaunch/opentelemetry-instrumentation-hyper-express": "0.0.5",
|
|
82
|
-
"@mikro-orm/core": "^6.6.
|
|
83
|
-
"@mikro-orm/mongodb": "^6.6.
|
|
81
|
+
"@mikro-orm/core": "^6.6.4",
|
|
82
|
+
"@mikro-orm/mongodb": "^6.6.4",
|
|
84
83
|
"@opentelemetry/api": "^1.9.0",
|
|
85
|
-
"@opentelemetry/api-logs": "^0.
|
|
86
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.
|
|
87
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
88
|
-
"@opentelemetry/exporter-prometheus": "^0.
|
|
89
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
90
|
-
"@opentelemetry/instrumentation-express": "^0.
|
|
91
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
92
|
-
"@opentelemetry/resources": "^2.
|
|
93
|
-
"@opentelemetry/sdk-logs": "^0.
|
|
94
|
-
"@opentelemetry/sdk-metrics": "^2.
|
|
95
|
-
"@opentelemetry/sdk-node": "^0.
|
|
96
|
-
"@opentelemetry/sdk-trace-node": "^2.
|
|
97
|
-
"@opentelemetry/semantic-conventions": "^1.
|
|
84
|
+
"@opentelemetry/api-logs": "^0.210.0",
|
|
85
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.210.0",
|
|
86
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.210.0",
|
|
87
|
+
"@opentelemetry/exporter-prometheus": "^0.210.0",
|
|
88
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.210.0",
|
|
89
|
+
"@opentelemetry/instrumentation-express": "^0.58.0",
|
|
90
|
+
"@opentelemetry/instrumentation-http": "^0.210.0",
|
|
91
|
+
"@opentelemetry/resources": "^2.4.0",
|
|
92
|
+
"@opentelemetry/sdk-logs": "^0.210.0",
|
|
93
|
+
"@opentelemetry/sdk-metrics": "^2.4.0",
|
|
94
|
+
"@opentelemetry/sdk-node": "^0.210.0",
|
|
95
|
+
"@opentelemetry/sdk-trace-node": "^2.4.0",
|
|
96
|
+
"@opentelemetry/semantic-conventions": "^1.39.0",
|
|
98
97
|
"cors": "^2.8.5",
|
|
99
98
|
"dotenv": "^17.2.3",
|
|
100
|
-
"
|
|
99
|
+
"fastmcp": "^3.26.9",
|
|
100
|
+
"jose": "6.1.3",
|
|
101
101
|
"openapi3-ts": "^4.5.0",
|
|
102
|
-
"pino": "^10.
|
|
102
|
+
"pino": "^10.2.0",
|
|
103
103
|
"pino-http": "^11.0.0",
|
|
104
|
-
"pino-pretty": "^13.1.
|
|
105
|
-
"redis": "^5.
|
|
104
|
+
"pino-pretty": "^13.1.3",
|
|
105
|
+
"redis": "^5.10.0",
|
|
106
106
|
"uuid": "^13.0.0",
|
|
107
|
-
"zod": "^4.
|
|
108
|
-
"@forklaunch/
|
|
109
|
-
"@forklaunch/
|
|
107
|
+
"zod": "^4.3.5",
|
|
108
|
+
"@forklaunch/common": "0.6.25",
|
|
109
|
+
"@forklaunch/validator": "0.10.25"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@eslint/js": "^9.39.
|
|
113
|
-
"@scalar/express-api-reference": "^0.8.
|
|
112
|
+
"@eslint/js": "^9.39.2",
|
|
113
|
+
"@scalar/express-api-reference": "^0.8.34",
|
|
114
114
|
"@types/cors": "^2.8.19",
|
|
115
115
|
"@types/jest": "^30.0.0",
|
|
116
116
|
"@types/qs": "^6.14.0",
|
|
117
117
|
"@types/uuid": "^11.0.0",
|
|
118
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
119
|
-
"globals": "^
|
|
118
|
+
"@typescript/native-preview": "7.0.0-dev.20260118.1",
|
|
119
|
+
"globals": "^17.0.0",
|
|
120
120
|
"jest": "^30.2.0",
|
|
121
121
|
"jose": "5.10.0",
|
|
122
|
-
"prettier": "^3.
|
|
123
|
-
"testcontainers": "^11.
|
|
124
|
-
"ts-jest": "^29.4.
|
|
122
|
+
"prettier": "^3.8.0",
|
|
123
|
+
"testcontainers": "^11.11.0",
|
|
124
|
+
"ts-jest": "^29.4.6",
|
|
125
125
|
"ts-node": "^10.9.2",
|
|
126
126
|
"tsup": "^8.5.1",
|
|
127
|
-
"typedoc": "^0.28.
|
|
127
|
+
"typedoc": "^0.28.16",
|
|
128
128
|
"typescript": "^5.9.3",
|
|
129
|
-
"typescript-eslint": "^8.
|
|
129
|
+
"typescript-eslint": "^8.53.0"
|
|
130
130
|
},
|
|
131
131
|
"scripts": {
|
|
132
132
|
"build": "tsgo --noEmit && tsup ./src/cache/index.ts ./src/controllers/index.ts ./src/mappers/index.ts ./src/objectstore/index.ts ./src/persistence/index.ts ./src/http/index.ts ./src/services/index.ts ./src/environment/index.ts ./src/ws/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean --sourcemap",
|