@forklaunch/core 0.9.13 → 0.9.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.
- package/lib/__test__/index.d.mts +1 -1
- package/lib/__test__/index.d.ts +1 -1
- package/lib/__test__/index.js +11 -9
- package/lib/__test__/index.js.map +1 -1
- package/lib/__test__/index.mjs +11 -9
- package/lib/__test__/index.mjs.map +1 -1
- package/lib/src/http/index.js +6 -7
- package/lib/src/http/index.js.map +1 -1
- package/lib/src/http/index.mjs +6 -7
- package/lib/src/http/index.mjs.map +1 -1
- package/package.json +4 -4
package/lib/__test__/index.d.mts
CHANGED
@@ -2,7 +2,7 @@ import { IdiomaticSchema, Schema } from '@forklaunch/validator';
|
|
2
2
|
import { TypeboxSchemaValidator } from '@forklaunch/validator/typebox';
|
3
3
|
import { ZodSchemaValidator } from '@forklaunch/validator/zod';
|
4
4
|
|
5
|
-
declare function testSchemaEquality<Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schema<Z, ZodSchemaValidator>)
|
5
|
+
declare function testSchemaEquality<Schematic>(): <Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schema<Z, ZodSchemaValidator> & Schematic) => EqualityWithoutFunction<T, Z>;
|
6
6
|
type InjectiveWithoutFunction<O, T> = {
|
7
7
|
[K in keyof O]: K extends keyof T ? O[K] extends object ? T[K] extends object ? InjectiveWithoutFunction<O[K], T[K]> : false : O[K] extends (...args: never[]) => unknown ? T[K] extends (...args: never[]) => unknown ? true : false : O[K] extends T[K] ? T[K] extends O[K] ? true : false : false : false;
|
8
8
|
} extends infer R ? R extends {
|
package/lib/__test__/index.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { IdiomaticSchema, Schema } from '@forklaunch/validator';
|
|
2
2
|
import { TypeboxSchemaValidator } from '@forklaunch/validator/typebox';
|
3
3
|
import { ZodSchemaValidator } from '@forklaunch/validator/zod';
|
4
4
|
|
5
|
-
declare function testSchemaEquality<Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schema<Z, ZodSchemaValidator>)
|
5
|
+
declare function testSchemaEquality<Schematic>(): <Z extends IdiomaticSchema<ZodSchemaValidator>, T extends IdiomaticSchema<TypeboxSchemaValidator>>(zodSchema: Z, typeBoxSchema: T, testData: Schema<Z, ZodSchemaValidator> & Schematic) => EqualityWithoutFunction<T, Z>;
|
6
6
|
type InjectiveWithoutFunction<O, T> = {
|
7
7
|
[K in keyof O]: K extends keyof T ? O[K] extends object ? T[K] extends object ? InjectiveWithoutFunction<O[K], T[K]> : false : O[K] extends (...args: never[]) => unknown ? T[K] extends (...args: never[]) => unknown ? true : false : O[K] extends T[K] ? T[K] extends O[K] ? true : false : false : false;
|
8
8
|
} extends infer R ? R extends {
|
package/lib/__test__/index.js
CHANGED
@@ -29,15 +29,17 @@ module.exports = __toCommonJS(test_exports);
|
|
29
29
|
var import_common = require("@forklaunch/common");
|
30
30
|
var import_typebox = require("@forklaunch/validator/typebox");
|
31
31
|
var import_zod = require("@forklaunch/validator/zod");
|
32
|
-
function testSchemaEquality(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
function testSchemaEquality() {
|
33
|
+
return (zodSchema, typeBoxSchema, testData) => {
|
34
|
+
const zodParseResult = (0, import_zod.parse)(zodSchema, testData);
|
35
|
+
const typeboxParseResult = (0, import_typebox.parse)(typeBoxSchema, testData);
|
36
|
+
const isEqual = (0, import_common.safeStringify)(
|
37
|
+
zodParseResult.ok ? (0, import_common.sortObjectKeys)(zodParseResult.value) : "-1"
|
38
|
+
) === (0, import_common.safeStringify)(
|
39
|
+
typeboxParseResult.ok ? (0, import_common.sortObjectKeys)(typeboxParseResult.value) : "1"
|
40
|
+
);
|
41
|
+
return isEqual;
|
42
|
+
};
|
41
43
|
}
|
42
44
|
var DummyEnum = /* @__PURE__ */ ((DummyEnum2) => {
|
43
45
|
DummyEnum2["A"] = "A";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../__test__/index.ts","../../__test__/utils/schemaEquality.ts"],"sourcesContent":["export * from './utils/schemaEquality';\n","import { safeStringify, sortObjectKeys } from '@forklaunch/common';\nimport { IdiomaticSchema } from '@forklaunch/validator';\n\nimport { Schema } from '@forklaunch/validator';\nimport {\n TypeboxSchemaValidator,\n parse as typeboxParse\n} from '@forklaunch/validator/typebox';\nimport {\n ZodSchemaValidator,\n parse as zodParse\n} from '@forklaunch/validator/zod';\n\nexport function testSchemaEquality<\n
|
1
|
+
{"version":3,"sources":["../../__test__/index.ts","../../__test__/utils/schemaEquality.ts"],"sourcesContent":["export * from './utils/schemaEquality';\n","import { safeStringify, sortObjectKeys } from '@forklaunch/common';\nimport { IdiomaticSchema } from '@forklaunch/validator';\n\nimport { Schema } from '@forklaunch/validator';\nimport {\n TypeboxSchemaValidator,\n parse as typeboxParse\n} from '@forklaunch/validator/typebox';\nimport {\n ZodSchemaValidator,\n parse as zodParse\n} from '@forklaunch/validator/zod';\n\nexport function testSchemaEquality<Schematic>() {\n return <\n Z extends IdiomaticSchema<ZodSchemaValidator>,\n T extends IdiomaticSchema<TypeboxSchemaValidator>\n >(\n zodSchema: Z,\n typeBoxSchema: T,\n testData: Schema<Z, ZodSchemaValidator> & Schematic\n ) => {\n const zodParseResult = zodParse(zodSchema, testData);\n const typeboxParseResult = typeboxParse(typeBoxSchema, testData);\n\n const isEqual =\n safeStringify(\n zodParseResult.ok ? sortObjectKeys(zodParseResult.value) : '-1'\n ) ===\n safeStringify(\n typeboxParseResult.ok\n ? sortObjectKeys(typeboxParseResult.value as Record<string, unknown>)\n : '1'\n );\n\n return isEqual as EqualityWithoutFunction<T, Z>;\n };\n}\n\ntype InjectiveWithoutFunction<O, T> = {\n [K in keyof O]: K extends keyof T\n ? O[K] extends object\n ? T[K] extends object\n ? InjectiveWithoutFunction<O[K], T[K]>\n : false\n : O[K] extends (...args: never[]) => unknown\n ? T[K] extends (...args: never[]) => unknown\n ? true\n : false\n : O[K] extends T[K]\n ? T[K] extends O[K]\n ? true\n : false\n : false\n : false;\n} extends infer R\n ? R extends {\n [K in keyof R]: true;\n }\n ? true\n : false\n : false;\n\ntype EqualityWithoutFunction<\n T extends IdiomaticSchema<TypeboxSchemaValidator>,\n Z extends IdiomaticSchema<ZodSchemaValidator>\n> =\n Schema<T, TypeboxSchemaValidator> extends infer TypeboxSchema\n ? Schema<Z, ZodSchemaValidator> extends infer ZodSchema\n ? InjectiveWithoutFunction<\n TypeboxSchema,\n ZodSchema\n > extends InjectiveWithoutFunction<ZodSchema, TypeboxSchema>\n ? true\n : false\n : false\n : false;\n\nexport enum DummyEnum {\n A = 'A',\n B = 'B'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA8C;AAI9C,qBAGO;AACP,iBAGO;AAEA,SAAS,qBAAgC;AAC9C,SAAO,CAIL,WACA,eACA,aACG;AACH,UAAM,qBAAiB,WAAAA,OAAS,WAAW,QAAQ;AACnD,UAAM,yBAAqB,eAAAC,OAAa,eAAe,QAAQ;AAE/D,UAAM,cACJ;AAAA,MACE,eAAe,SAAK,8BAAe,eAAe,KAAK,IAAI;AAAA,IAC7D,UACA;AAAA,MACE,mBAAmB,SACf,8BAAe,mBAAmB,KAAgC,IAClE;AAAA,IACN;AAEF,WAAO;AAAA,EACT;AACF;AAyCO,IAAK,YAAL,kBAAKC,eAAL;AACL,EAAAA,WAAA,OAAI;AACJ,EAAAA,WAAA,OAAI;AAFM,SAAAA;AAAA,GAAA;","names":["zodParse","typeboxParse","DummyEnum"]}
|
package/lib/__test__/index.mjs
CHANGED
@@ -6,15 +6,17 @@ import {
|
|
6
6
|
import {
|
7
7
|
parse as zodParse
|
8
8
|
} from "@forklaunch/validator/zod";
|
9
|
-
function testSchemaEquality(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
function testSchemaEquality() {
|
10
|
+
return (zodSchema, typeBoxSchema, testData) => {
|
11
|
+
const zodParseResult = zodParse(zodSchema, testData);
|
12
|
+
const typeboxParseResult = typeboxParse(typeBoxSchema, testData);
|
13
|
+
const isEqual = safeStringify(
|
14
|
+
zodParseResult.ok ? sortObjectKeys(zodParseResult.value) : "-1"
|
15
|
+
) === safeStringify(
|
16
|
+
typeboxParseResult.ok ? sortObjectKeys(typeboxParseResult.value) : "1"
|
17
|
+
);
|
18
|
+
return isEqual;
|
19
|
+
};
|
18
20
|
}
|
19
21
|
var DummyEnum = /* @__PURE__ */ ((DummyEnum2) => {
|
20
22
|
DummyEnum2["A"] = "A";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../__test__/utils/schemaEquality.ts"],"sourcesContent":["import { safeStringify, sortObjectKeys } from '@forklaunch/common';\nimport { IdiomaticSchema } from '@forklaunch/validator';\n\nimport { Schema } from '@forklaunch/validator';\nimport {\n TypeboxSchemaValidator,\n parse as typeboxParse\n} from '@forklaunch/validator/typebox';\nimport {\n ZodSchemaValidator,\n parse as zodParse\n} from '@forklaunch/validator/zod';\n\nexport function testSchemaEquality<\n
|
1
|
+
{"version":3,"sources":["../../__test__/utils/schemaEquality.ts"],"sourcesContent":["import { safeStringify, sortObjectKeys } from '@forklaunch/common';\nimport { IdiomaticSchema } from '@forklaunch/validator';\n\nimport { Schema } from '@forklaunch/validator';\nimport {\n TypeboxSchemaValidator,\n parse as typeboxParse\n} from '@forklaunch/validator/typebox';\nimport {\n ZodSchemaValidator,\n parse as zodParse\n} from '@forklaunch/validator/zod';\n\nexport function testSchemaEquality<Schematic>() {\n return <\n Z extends IdiomaticSchema<ZodSchemaValidator>,\n T extends IdiomaticSchema<TypeboxSchemaValidator>\n >(\n zodSchema: Z,\n typeBoxSchema: T,\n testData: Schema<Z, ZodSchemaValidator> & Schematic\n ) => {\n const zodParseResult = zodParse(zodSchema, testData);\n const typeboxParseResult = typeboxParse(typeBoxSchema, testData);\n\n const isEqual =\n safeStringify(\n zodParseResult.ok ? sortObjectKeys(zodParseResult.value) : '-1'\n ) ===\n safeStringify(\n typeboxParseResult.ok\n ? sortObjectKeys(typeboxParseResult.value as Record<string, unknown>)\n : '1'\n );\n\n return isEqual as EqualityWithoutFunction<T, Z>;\n };\n}\n\ntype InjectiveWithoutFunction<O, T> = {\n [K in keyof O]: K extends keyof T\n ? O[K] extends object\n ? T[K] extends object\n ? InjectiveWithoutFunction<O[K], T[K]>\n : false\n : O[K] extends (...args: never[]) => unknown\n ? T[K] extends (...args: never[]) => unknown\n ? true\n : false\n : O[K] extends T[K]\n ? T[K] extends O[K]\n ? true\n : false\n : false\n : false;\n} extends infer R\n ? R extends {\n [K in keyof R]: true;\n }\n ? true\n : false\n : false;\n\ntype EqualityWithoutFunction<\n T extends IdiomaticSchema<TypeboxSchemaValidator>,\n Z extends IdiomaticSchema<ZodSchemaValidator>\n> =\n Schema<T, TypeboxSchemaValidator> extends infer TypeboxSchema\n ? Schema<Z, ZodSchemaValidator> extends infer ZodSchema\n ? InjectiveWithoutFunction<\n TypeboxSchema,\n ZodSchema\n > extends InjectiveWithoutFunction<ZodSchema, TypeboxSchema>\n ? true\n : false\n : false\n : false;\n\nexport enum DummyEnum {\n A = 'A',\n B = 'B'\n}\n"],"mappings":";AAAA,SAAS,eAAe,sBAAsB;AAI9C;AAAA,EAEE,SAAS;AAAA,OACJ;AACP;AAAA,EAEE,SAAS;AAAA,OACJ;AAEA,SAAS,qBAAgC;AAC9C,SAAO,CAIL,WACA,eACA,aACG;AACH,UAAM,iBAAiB,SAAS,WAAW,QAAQ;AACnD,UAAM,qBAAqB,aAAa,eAAe,QAAQ;AAE/D,UAAM,UACJ;AAAA,MACE,eAAe,KAAK,eAAe,eAAe,KAAK,IAAI;AAAA,IAC7D,MACA;AAAA,MACE,mBAAmB,KACf,eAAe,mBAAmB,KAAgC,IAClE;AAAA,IACN;AAEF,WAAO;AAAA,EACT;AACF;AAyCO,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,OAAI;AACJ,EAAAA,WAAA,OAAI;AAFM,SAAAA;AAAA,GAAA;","names":["DummyEnum"]}
|
package/lib/src/http/index.js
CHANGED
@@ -493,7 +493,7 @@ var OpenTelemetryCollector = class {
|
|
493
493
|
return this.metrics[metricId];
|
494
494
|
}
|
495
495
|
};
|
496
|
-
import_dotenv.default.config({ path: (0, import_common3.getEnvVar)("
|
496
|
+
import_dotenv.default.config({ path: (0, import_common3.getEnvVar)("DOTENV_FILE_PATH") });
|
497
497
|
new import_sdk_node.NodeSDK({
|
498
498
|
resource: (0, import_resources.resourceFromAttributes)({
|
499
499
|
[import_semantic_conventions2.ATTR_SERVICE_NAME]: (0, import_common3.getEnvVar)("OTEL_SERVICE_NAME")
|
@@ -1384,15 +1384,14 @@ var ForklaunchExpressLikeApplication = class extends ForklaunchExpressLikeRouter
|
|
1384
1384
|
this.openTelemetryCollector = openTelemetryCollector;
|
1385
1385
|
this.appOptions = appOptions;
|
1386
1386
|
process.on("uncaughtException", (err) => {
|
1387
|
-
this.openTelemetryCollector.log("error",
|
1388
|
-
err
|
1389
|
-
});
|
1387
|
+
this.openTelemetryCollector.log("error", `Uncaught exception: ${err}`);
|
1390
1388
|
process.exit(1);
|
1391
1389
|
});
|
1392
1390
|
process.on("unhandledRejection", (reason) => {
|
1393
|
-
this.openTelemetryCollector.log(
|
1394
|
-
|
1395
|
-
|
1391
|
+
this.openTelemetryCollector.log(
|
1392
|
+
"error",
|
1393
|
+
`Unhandled rejection: ${reason}`
|
1394
|
+
);
|
1396
1395
|
process.exit(1);
|
1397
1396
|
});
|
1398
1397
|
process.on("exit", () => {
|