@domain-first/types 0.0.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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/errors/async-schema-in-sync-parsing-error.d.ts +46 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/invalid-data-parsing-error.d.ts +62 -0
- package/dist/errors/structured-clone-not-found-error.d.ts +46 -0
- package/dist/index.cjs +103 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +56 -0
- package/dist/parse.d.ts +0 -0
- package/dist/types.d.ts +3 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/parse-async.d.ts +2 -0
- package/dist/utils/parse-async.spec.d.ts +1 -0
- package/dist/utils/parse-sync.d.ts +2 -0
- package/dist/utils/parse-sync.spec.d.ts +1 -0
- package/dist/value-object.d.ts +18 -0
- package/dist/value-object.spec.d.ts +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 alevnyacow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<img src='https://raw.githubusercontent.com/alevnyacow/domain-first-types/refs/heads/main/logo.svg?sanitize=true'>
|
|
4
|
+
</picture>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Type-safe Entities and Value Objects with Standard Schema validation.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
# Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm i @domain-first/types
|
|
15
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const AsyncSchemaInSyncParsingError: {
|
|
2
|
+
new (details: Record<string, any>, options?: ErrorOptions): {
|
|
3
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
readonly details: Record<string, any>;
|
|
7
|
+
readonly formattedDetails: import("@domain-first/errors").PlainPrimitivesObject;
|
|
8
|
+
readonly serialized: import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
9
|
+
code: string;
|
|
10
|
+
}>;
|
|
11
|
+
readonly serializedWithNativeData: import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
12
|
+
code: string;
|
|
13
|
+
}>;
|
|
14
|
+
readonly serializedFull: import("@domain-first/errors").FullTransportedError<Record<string, any>, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
15
|
+
code: string;
|
|
16
|
+
}>;
|
|
17
|
+
name: string;
|
|
18
|
+
message: string;
|
|
19
|
+
stack?: string;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
};
|
|
22
|
+
matches: (target: unknown) => boolean | null;
|
|
23
|
+
is: (target: unknown) => target is {
|
|
24
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
25
|
+
code: string;
|
|
26
|
+
};
|
|
27
|
+
readonly details: Record<string, any>;
|
|
28
|
+
readonly formattedDetails: import("@domain-first/errors").PlainPrimitivesObject;
|
|
29
|
+
readonly serialized: import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
30
|
+
code: string;
|
|
31
|
+
}>;
|
|
32
|
+
readonly serializedWithNativeData: import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
33
|
+
code: string;
|
|
34
|
+
}>;
|
|
35
|
+
readonly serializedFull: import("@domain-first/errors").FullTransportedError<Record<string, any>, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
36
|
+
code: string;
|
|
37
|
+
}>;
|
|
38
|
+
name: string;
|
|
39
|
+
message: string;
|
|
40
|
+
stack?: string;
|
|
41
|
+
cause?: unknown;
|
|
42
|
+
};
|
|
43
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
44
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
45
|
+
stackTraceLimit: number;
|
|
46
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export declare const InvalidDataParsingError: {
|
|
3
|
+
new (details: {
|
|
4
|
+
parsingIssues: readonly StandardSchemaV1.Issue[];
|
|
5
|
+
value: unknown;
|
|
6
|
+
}, options?: ErrorOptions): {
|
|
7
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
8
|
+
code: string;
|
|
9
|
+
};
|
|
10
|
+
readonly details: {
|
|
11
|
+
parsingIssues: readonly StandardSchemaV1.Issue[];
|
|
12
|
+
value: unknown;
|
|
13
|
+
};
|
|
14
|
+
readonly formattedDetails: import("@domain-first/errors").PlainPrimitivesObject;
|
|
15
|
+
readonly serialized: import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
16
|
+
code: string;
|
|
17
|
+
}>;
|
|
18
|
+
readonly serializedWithNativeData: import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
19
|
+
code: string;
|
|
20
|
+
}>;
|
|
21
|
+
readonly serializedFull: import("@domain-first/errors").FullTransportedError<{
|
|
22
|
+
parsingIssues: readonly StandardSchemaV1.Issue[];
|
|
23
|
+
value: unknown;
|
|
24
|
+
}, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
25
|
+
code: string;
|
|
26
|
+
}>;
|
|
27
|
+
name: string;
|
|
28
|
+
message: string;
|
|
29
|
+
stack?: string;
|
|
30
|
+
cause?: unknown;
|
|
31
|
+
};
|
|
32
|
+
matches: (target: unknown) => boolean | null;
|
|
33
|
+
is: (target: unknown) => target is {
|
|
34
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
35
|
+
code: string;
|
|
36
|
+
};
|
|
37
|
+
readonly details: {
|
|
38
|
+
parsingIssues: readonly StandardSchemaV1.Issue[];
|
|
39
|
+
value: unknown;
|
|
40
|
+
};
|
|
41
|
+
get formattedDetails(): import("@domain-first/errors").PlainPrimitivesObject;
|
|
42
|
+
get serialized(): import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
43
|
+
code: string;
|
|
44
|
+
}>;
|
|
45
|
+
get serializedWithNativeData(): import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
46
|
+
code: string;
|
|
47
|
+
}>;
|
|
48
|
+
get serializedFull(): import("@domain-first/errors").FullTransportedError<{
|
|
49
|
+
parsingIssues: readonly StandardSchemaV1.Issue[];
|
|
50
|
+
value: unknown;
|
|
51
|
+
}, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
52
|
+
code: string;
|
|
53
|
+
}>;
|
|
54
|
+
name: string;
|
|
55
|
+
message: string;
|
|
56
|
+
stack?: string;
|
|
57
|
+
cause?: unknown;
|
|
58
|
+
};
|
|
59
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
60
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
61
|
+
stackTraceLimit: number;
|
|
62
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const StructuredCloneNotFoundError: {
|
|
2
|
+
new (details: Record<string, any>, options?: ErrorOptions): {
|
|
3
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
readonly details: Record<string, any>;
|
|
7
|
+
readonly formattedDetails: import("@domain-first/errors").PlainPrimitivesObject;
|
|
8
|
+
readonly serialized: import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
9
|
+
code: string;
|
|
10
|
+
}>;
|
|
11
|
+
readonly serializedWithNativeData: import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
12
|
+
code: string;
|
|
13
|
+
}>;
|
|
14
|
+
readonly serializedFull: import("@domain-first/errors").FullTransportedError<Record<string, any>, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
15
|
+
code: string;
|
|
16
|
+
}>;
|
|
17
|
+
name: string;
|
|
18
|
+
message: string;
|
|
19
|
+
stack?: string;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
};
|
|
22
|
+
matches: (target: unknown) => boolean | null;
|
|
23
|
+
is: (target: unknown) => target is {
|
|
24
|
+
readonly metadata: import("@domain-first/errors").PlainPrimitivesObject & {
|
|
25
|
+
code: string;
|
|
26
|
+
};
|
|
27
|
+
readonly details: Record<string, any>;
|
|
28
|
+
readonly formattedDetails: import("@domain-first/errors").PlainPrimitivesObject;
|
|
29
|
+
readonly serialized: import("@domain-first/errors").TransportedError<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
30
|
+
code: string;
|
|
31
|
+
}>;
|
|
32
|
+
readonly serializedWithNativeData: import("@domain-first/errors").TransportedErrorWithNativeData<import("@domain-first/errors").PlainPrimitivesObject & {
|
|
33
|
+
code: string;
|
|
34
|
+
}>;
|
|
35
|
+
readonly serializedFull: import("@domain-first/errors").FullTransportedError<Record<string, any>, import("@domain-first/errors").PlainPrimitivesObject & {
|
|
36
|
+
code: string;
|
|
37
|
+
}>;
|
|
38
|
+
name: string;
|
|
39
|
+
message: string;
|
|
40
|
+
stack?: string;
|
|
41
|
+
cause?: unknown;
|
|
42
|
+
};
|
|
43
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
44
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
45
|
+
stackTraceLimit: number;
|
|
46
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
AsyncSchemaInSyncParsingError: ()=>AsyncSchemaInSyncParsingError,
|
|
32
|
+
InvalidDataParsingError: ()=>InvalidDataParsingError,
|
|
33
|
+
StructuredCloneNotFoundError: ()=>StructuredCloneNotFoundError,
|
|
34
|
+
defineValueObjectClass: ()=>defineValueObjectClass
|
|
35
|
+
});
|
|
36
|
+
const errors_namespaceObject = require("@domain-first/errors");
|
|
37
|
+
const AsyncSchemaInSyncParsingError = (0, errors_namespaceObject.defineErrorClass)({
|
|
38
|
+
code: 'ASYNC_SCHEMA_IN_SYNC_PARSING'
|
|
39
|
+
});
|
|
40
|
+
const InvalidDataParsingError = (0, errors_namespaceObject.defineErrorClass)({
|
|
41
|
+
code: 'INVALID_DATA_PARSING'
|
|
42
|
+
});
|
|
43
|
+
const StructuredCloneNotFoundError = (0, errors_namespaceObject.defineErrorClass)({
|
|
44
|
+
code: 'STRUCTURED_CLONE_NOT_FOUND'
|
|
45
|
+
});
|
|
46
|
+
async function parseAsync(schema, value) {
|
|
47
|
+
const result = await schema['~standard'].validate(value);
|
|
48
|
+
if ('issues' in result && result.issues) throw new InvalidDataParsingError({
|
|
49
|
+
parsingIssues: result.issues,
|
|
50
|
+
value
|
|
51
|
+
});
|
|
52
|
+
return result.value;
|
|
53
|
+
}
|
|
54
|
+
function parseSync(schema, value) {
|
|
55
|
+
const result = schema['~standard'].validate(value);
|
|
56
|
+
if (result instanceof Promise) throw new AsyncSchemaInSyncParsingError({
|
|
57
|
+
schema,
|
|
58
|
+
value
|
|
59
|
+
});
|
|
60
|
+
if ('issues' in result && result.issues) throw new InvalidDataParsingError({
|
|
61
|
+
parsingIssues: result.issues,
|
|
62
|
+
value
|
|
63
|
+
});
|
|
64
|
+
return result.value;
|
|
65
|
+
}
|
|
66
|
+
const defineValueObjectClass = (schema)=>{
|
|
67
|
+
const modelSymbol = Symbol();
|
|
68
|
+
class ValueObject {
|
|
69
|
+
static schema = schema;
|
|
70
|
+
constructor(data){
|
|
71
|
+
Object.defineProperty(this, modelSymbol, {
|
|
72
|
+
value: data
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
get model() {
|
|
76
|
+
const thisWithSymbol = this;
|
|
77
|
+
if (!('structuredClone' in globalThis)) throw new StructuredCloneNotFoundError({});
|
|
78
|
+
return structuredClone(thisWithSymbol[modelSymbol]);
|
|
79
|
+
}
|
|
80
|
+
static create = (data)=>{
|
|
81
|
+
const parsedData = parseSync(schema, data);
|
|
82
|
+
return new ValueObject(parsedData);
|
|
83
|
+
};
|
|
84
|
+
static createWithAsyncSchema = async (data)=>{
|
|
85
|
+
const parsedData = await parseAsync(schema, data);
|
|
86
|
+
return new ValueObject(parsedData);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return ValueObject;
|
|
90
|
+
};
|
|
91
|
+
exports.AsyncSchemaInSyncParsingError = __webpack_exports__.AsyncSchemaInSyncParsingError;
|
|
92
|
+
exports.InvalidDataParsingError = __webpack_exports__.InvalidDataParsingError;
|
|
93
|
+
exports.StructuredCloneNotFoundError = __webpack_exports__.StructuredCloneNotFoundError;
|
|
94
|
+
exports.defineValueObjectClass = __webpack_exports__.defineValueObjectClass;
|
|
95
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
96
|
+
"AsyncSchemaInSyncParsingError",
|
|
97
|
+
"InvalidDataParsingError",
|
|
98
|
+
"StructuredCloneNotFoundError",
|
|
99
|
+
"defineValueObjectClass"
|
|
100
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
101
|
+
Object.defineProperty(exports, '__esModule', {
|
|
102
|
+
value: true
|
|
103
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineErrorClass } from "@domain-first/errors";
|
|
2
|
+
const AsyncSchemaInSyncParsingError = defineErrorClass({
|
|
3
|
+
code: 'ASYNC_SCHEMA_IN_SYNC_PARSING'
|
|
4
|
+
});
|
|
5
|
+
const InvalidDataParsingError = defineErrorClass({
|
|
6
|
+
code: 'INVALID_DATA_PARSING'
|
|
7
|
+
});
|
|
8
|
+
const StructuredCloneNotFoundError = defineErrorClass({
|
|
9
|
+
code: 'STRUCTURED_CLONE_NOT_FOUND'
|
|
10
|
+
});
|
|
11
|
+
async function parseAsync(schema, value) {
|
|
12
|
+
const result = await schema['~standard'].validate(value);
|
|
13
|
+
if ('issues' in result && result.issues) throw new InvalidDataParsingError({
|
|
14
|
+
parsingIssues: result.issues,
|
|
15
|
+
value
|
|
16
|
+
});
|
|
17
|
+
return result.value;
|
|
18
|
+
}
|
|
19
|
+
function parseSync(schema, value) {
|
|
20
|
+
const result = schema['~standard'].validate(value);
|
|
21
|
+
if (result instanceof Promise) throw new AsyncSchemaInSyncParsingError({
|
|
22
|
+
schema,
|
|
23
|
+
value
|
|
24
|
+
});
|
|
25
|
+
if ('issues' in result && result.issues) throw new InvalidDataParsingError({
|
|
26
|
+
parsingIssues: result.issues,
|
|
27
|
+
value
|
|
28
|
+
});
|
|
29
|
+
return result.value;
|
|
30
|
+
}
|
|
31
|
+
const defineValueObjectClass = (schema)=>{
|
|
32
|
+
const modelSymbol = Symbol();
|
|
33
|
+
class ValueObject {
|
|
34
|
+
static schema = schema;
|
|
35
|
+
constructor(data){
|
|
36
|
+
Object.defineProperty(this, modelSymbol, {
|
|
37
|
+
value: data
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
get model() {
|
|
41
|
+
const thisWithSymbol = this;
|
|
42
|
+
if (!('structuredClone' in globalThis)) throw new StructuredCloneNotFoundError({});
|
|
43
|
+
return structuredClone(thisWithSymbol[modelSymbol]);
|
|
44
|
+
}
|
|
45
|
+
static create = (data)=>{
|
|
46
|
+
const parsedData = parseSync(schema, data);
|
|
47
|
+
return new ValueObject(parsedData);
|
|
48
|
+
};
|
|
49
|
+
static createWithAsyncSchema = async (data)=>{
|
|
50
|
+
const parsedData = await parseAsync(schema, data);
|
|
51
|
+
return new ValueObject(parsedData);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return ValueObject;
|
|
55
|
+
};
|
|
56
|
+
export { AsyncSchemaInSyncParsingError, InvalidDataParsingError, StructuredCloneNotFoundError, defineValueObjectClass };
|
package/dist/parse.d.ts
ADDED
|
File without changes
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export declare const defineValueObjectClass: <Schema extends StandardSchemaV1>(schema: Schema) => {
|
|
3
|
+
new (data: StandardSchemaV1.InferOutput<Schema>): {
|
|
4
|
+
get model(): StandardSchemaV1.InferOutput<Schema>;
|
|
5
|
+
};
|
|
6
|
+
schema: Schema;
|
|
7
|
+
create: (data: StandardSchemaV1.InferInput<Schema>) => {
|
|
8
|
+
get model(): StandardSchemaV1.InferOutput<Schema>;
|
|
9
|
+
};
|
|
10
|
+
createWithAsyncSchema: (data: StandardSchemaV1.InferInput<Schema>) => Promise<{
|
|
11
|
+
get model(): StandardSchemaV1.InferOutput<Schema>;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export type InferValueObjectSchema<T> = T extends {
|
|
15
|
+
schema: StandardSchemaV1;
|
|
16
|
+
} ? StandardSchemaV1.InferOutput<T['schema']> : T extends {
|
|
17
|
+
model: infer M;
|
|
18
|
+
} ? M : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@domain-first/types",
|
|
3
|
+
"description": "Type-safe Entities and Value Objects with Standard Schema validation",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/alevnyacow/domain-first-types.git"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rslib",
|
|
28
|
+
"check": "biome check --write",
|
|
29
|
+
"dev": "rslib --watch",
|
|
30
|
+
"format": "biome format --write",
|
|
31
|
+
"test": "rstest",
|
|
32
|
+
"test:watch": "rstest --watch"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@biomejs/biome": "2.4.15",
|
|
36
|
+
"@rslib/core": "^0.23.2",
|
|
37
|
+
"@rstest/adapter-rslib": "^0.10.6",
|
|
38
|
+
"@rstest/core": "^0.10.6",
|
|
39
|
+
"@types/node": "^24.13.2",
|
|
40
|
+
"typescript": "^6.0.3",
|
|
41
|
+
"valibot": "^1.4.2",
|
|
42
|
+
"zod": "^4.4.3"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@domain-first/errors": "^1.7.0",
|
|
46
|
+
"@standard-schema/spec": "^1.1.0"
|
|
47
|
+
}
|
|
48
|
+
}
|