@findatruck/shared-schemas 0.2.0
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/README.md +7 -0
- package/dist/index.cjs +77 -0
- package/dist/index.d.cts +161 -0
- package/dist/index.d.ts +161 -0
- package/dist/index.js +47 -0
- package/package.json +33 -0
package/README.md
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
NewLoginRequest: () => NewLoginRequest,
|
|
24
|
+
NewLoginResponse: () => NewLoginResponse,
|
|
25
|
+
NewLoginResponseFailure: () => NewLoginResponseFailure,
|
|
26
|
+
NewLoginResponseSuccess: () => NewLoginResponseSuccess
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/schemas/new-login.ts
|
|
31
|
+
var import_zod = require("zod");
|
|
32
|
+
var UrlSchema = import_zod.z.string().refine(
|
|
33
|
+
(val) => {
|
|
34
|
+
try {
|
|
35
|
+
new URL(val);
|
|
36
|
+
return true;
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{ message: "Invalid URL" }
|
|
42
|
+
);
|
|
43
|
+
var NewLoginRequest = import_zod.z.object({
|
|
44
|
+
dispatcher_id: import_zod.z.string().min(1),
|
|
45
|
+
providerUrl: UrlSchema,
|
|
46
|
+
username: import_zod.z.string().min(1),
|
|
47
|
+
password: import_zod.z.string().min(1)
|
|
48
|
+
});
|
|
49
|
+
var PublicUser = import_zod.z.object({
|
|
50
|
+
id: import_zod.z.string(),
|
|
51
|
+
dispatcher_id: import_zod.z.string(),
|
|
52
|
+
username: import_zod.z.string(),
|
|
53
|
+
created_at: import_zod.z.coerce.date(),
|
|
54
|
+
updated_at: import_zod.z.coerce.date()
|
|
55
|
+
});
|
|
56
|
+
var PublicProvider = import_zod.z.object({
|
|
57
|
+
name: import_zod.z.string(),
|
|
58
|
+
url: UrlSchema
|
|
59
|
+
});
|
|
60
|
+
var NewLoginResponseSuccess = import_zod.z.object({
|
|
61
|
+
success: import_zod.z.literal(true),
|
|
62
|
+
message: import_zod.z.string(),
|
|
63
|
+
user: PublicUser,
|
|
64
|
+
provider: PublicProvider
|
|
65
|
+
});
|
|
66
|
+
var NewLoginResponseFailure = import_zod.z.object({
|
|
67
|
+
success: import_zod.z.literal(false),
|
|
68
|
+
error: import_zod.z.string()
|
|
69
|
+
});
|
|
70
|
+
var NewLoginResponse = import_zod.z.union([NewLoginResponseSuccess, NewLoginResponseFailure]);
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
NewLoginRequest,
|
|
74
|
+
NewLoginResponse,
|
|
75
|
+
NewLoginResponseFailure,
|
|
76
|
+
NewLoginResponseSuccess
|
|
77
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const NewLoginRequest: z.ZodObject<{
|
|
4
|
+
dispatcher_id: z.ZodString;
|
|
5
|
+
providerUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
username: z.ZodString;
|
|
7
|
+
password: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
dispatcher_id: string;
|
|
10
|
+
providerUrl: string;
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}, {
|
|
14
|
+
dispatcher_id: string;
|
|
15
|
+
providerUrl: string;
|
|
16
|
+
username: string;
|
|
17
|
+
password: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare const NewLoginResponseSuccess: z.ZodObject<{
|
|
20
|
+
success: z.ZodLiteral<true>;
|
|
21
|
+
message: z.ZodString;
|
|
22
|
+
user: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
dispatcher_id: z.ZodString;
|
|
25
|
+
username: z.ZodString;
|
|
26
|
+
created_at: z.ZodDate;
|
|
27
|
+
updated_at: z.ZodDate;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
dispatcher_id: string;
|
|
30
|
+
username: string;
|
|
31
|
+
id: string;
|
|
32
|
+
created_at: Date;
|
|
33
|
+
updated_at: Date;
|
|
34
|
+
}, {
|
|
35
|
+
dispatcher_id: string;
|
|
36
|
+
username: string;
|
|
37
|
+
id: string;
|
|
38
|
+
created_at: Date;
|
|
39
|
+
updated_at: Date;
|
|
40
|
+
}>;
|
|
41
|
+
provider: z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
name: string;
|
|
46
|
+
url: string;
|
|
47
|
+
}, {
|
|
48
|
+
name: string;
|
|
49
|
+
url: string;
|
|
50
|
+
}>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
message: string;
|
|
53
|
+
success: true;
|
|
54
|
+
user: {
|
|
55
|
+
dispatcher_id: string;
|
|
56
|
+
username: string;
|
|
57
|
+
id: string;
|
|
58
|
+
created_at: Date;
|
|
59
|
+
updated_at: Date;
|
|
60
|
+
};
|
|
61
|
+
provider: {
|
|
62
|
+
name: string;
|
|
63
|
+
url: string;
|
|
64
|
+
};
|
|
65
|
+
}, {
|
|
66
|
+
message: string;
|
|
67
|
+
success: true;
|
|
68
|
+
user: {
|
|
69
|
+
dispatcher_id: string;
|
|
70
|
+
username: string;
|
|
71
|
+
id: string;
|
|
72
|
+
created_at: Date;
|
|
73
|
+
updated_at: Date;
|
|
74
|
+
};
|
|
75
|
+
provider: {
|
|
76
|
+
name: string;
|
|
77
|
+
url: string;
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
80
|
+
declare const NewLoginResponseFailure: z.ZodObject<{
|
|
81
|
+
success: z.ZodLiteral<false>;
|
|
82
|
+
error: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
success: false;
|
|
85
|
+
error: string;
|
|
86
|
+
}, {
|
|
87
|
+
success: false;
|
|
88
|
+
error: string;
|
|
89
|
+
}>;
|
|
90
|
+
declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
|
|
91
|
+
success: z.ZodLiteral<true>;
|
|
92
|
+
message: z.ZodString;
|
|
93
|
+
user: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
dispatcher_id: z.ZodString;
|
|
96
|
+
username: z.ZodString;
|
|
97
|
+
created_at: z.ZodDate;
|
|
98
|
+
updated_at: z.ZodDate;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
dispatcher_id: string;
|
|
101
|
+
username: string;
|
|
102
|
+
id: string;
|
|
103
|
+
created_at: Date;
|
|
104
|
+
updated_at: Date;
|
|
105
|
+
}, {
|
|
106
|
+
dispatcher_id: string;
|
|
107
|
+
username: string;
|
|
108
|
+
id: string;
|
|
109
|
+
created_at: Date;
|
|
110
|
+
updated_at: Date;
|
|
111
|
+
}>;
|
|
112
|
+
provider: z.ZodObject<{
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
name: string;
|
|
117
|
+
url: string;
|
|
118
|
+
}, {
|
|
119
|
+
name: string;
|
|
120
|
+
url: string;
|
|
121
|
+
}>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
message: string;
|
|
124
|
+
success: true;
|
|
125
|
+
user: {
|
|
126
|
+
dispatcher_id: string;
|
|
127
|
+
username: string;
|
|
128
|
+
id: string;
|
|
129
|
+
created_at: Date;
|
|
130
|
+
updated_at: Date;
|
|
131
|
+
};
|
|
132
|
+
provider: {
|
|
133
|
+
name: string;
|
|
134
|
+
url: string;
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
137
|
+
message: string;
|
|
138
|
+
success: true;
|
|
139
|
+
user: {
|
|
140
|
+
dispatcher_id: string;
|
|
141
|
+
username: string;
|
|
142
|
+
id: string;
|
|
143
|
+
created_at: Date;
|
|
144
|
+
updated_at: Date;
|
|
145
|
+
};
|
|
146
|
+
provider: {
|
|
147
|
+
name: string;
|
|
148
|
+
url: string;
|
|
149
|
+
};
|
|
150
|
+
}>, z.ZodObject<{
|
|
151
|
+
success: z.ZodLiteral<false>;
|
|
152
|
+
error: z.ZodString;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
success: false;
|
|
155
|
+
error: string;
|
|
156
|
+
}, {
|
|
157
|
+
success: false;
|
|
158
|
+
error: string;
|
|
159
|
+
}>]>;
|
|
160
|
+
|
|
161
|
+
export { NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const NewLoginRequest: z.ZodObject<{
|
|
4
|
+
dispatcher_id: z.ZodString;
|
|
5
|
+
providerUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
username: z.ZodString;
|
|
7
|
+
password: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
dispatcher_id: string;
|
|
10
|
+
providerUrl: string;
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}, {
|
|
14
|
+
dispatcher_id: string;
|
|
15
|
+
providerUrl: string;
|
|
16
|
+
username: string;
|
|
17
|
+
password: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare const NewLoginResponseSuccess: z.ZodObject<{
|
|
20
|
+
success: z.ZodLiteral<true>;
|
|
21
|
+
message: z.ZodString;
|
|
22
|
+
user: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
dispatcher_id: z.ZodString;
|
|
25
|
+
username: z.ZodString;
|
|
26
|
+
created_at: z.ZodDate;
|
|
27
|
+
updated_at: z.ZodDate;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
dispatcher_id: string;
|
|
30
|
+
username: string;
|
|
31
|
+
id: string;
|
|
32
|
+
created_at: Date;
|
|
33
|
+
updated_at: Date;
|
|
34
|
+
}, {
|
|
35
|
+
dispatcher_id: string;
|
|
36
|
+
username: string;
|
|
37
|
+
id: string;
|
|
38
|
+
created_at: Date;
|
|
39
|
+
updated_at: Date;
|
|
40
|
+
}>;
|
|
41
|
+
provider: z.ZodObject<{
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
name: string;
|
|
46
|
+
url: string;
|
|
47
|
+
}, {
|
|
48
|
+
name: string;
|
|
49
|
+
url: string;
|
|
50
|
+
}>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
message: string;
|
|
53
|
+
success: true;
|
|
54
|
+
user: {
|
|
55
|
+
dispatcher_id: string;
|
|
56
|
+
username: string;
|
|
57
|
+
id: string;
|
|
58
|
+
created_at: Date;
|
|
59
|
+
updated_at: Date;
|
|
60
|
+
};
|
|
61
|
+
provider: {
|
|
62
|
+
name: string;
|
|
63
|
+
url: string;
|
|
64
|
+
};
|
|
65
|
+
}, {
|
|
66
|
+
message: string;
|
|
67
|
+
success: true;
|
|
68
|
+
user: {
|
|
69
|
+
dispatcher_id: string;
|
|
70
|
+
username: string;
|
|
71
|
+
id: string;
|
|
72
|
+
created_at: Date;
|
|
73
|
+
updated_at: Date;
|
|
74
|
+
};
|
|
75
|
+
provider: {
|
|
76
|
+
name: string;
|
|
77
|
+
url: string;
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
80
|
+
declare const NewLoginResponseFailure: z.ZodObject<{
|
|
81
|
+
success: z.ZodLiteral<false>;
|
|
82
|
+
error: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
success: false;
|
|
85
|
+
error: string;
|
|
86
|
+
}, {
|
|
87
|
+
success: false;
|
|
88
|
+
error: string;
|
|
89
|
+
}>;
|
|
90
|
+
declare const NewLoginResponse: z.ZodUnion<[z.ZodObject<{
|
|
91
|
+
success: z.ZodLiteral<true>;
|
|
92
|
+
message: z.ZodString;
|
|
93
|
+
user: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
dispatcher_id: z.ZodString;
|
|
96
|
+
username: z.ZodString;
|
|
97
|
+
created_at: z.ZodDate;
|
|
98
|
+
updated_at: z.ZodDate;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
dispatcher_id: string;
|
|
101
|
+
username: string;
|
|
102
|
+
id: string;
|
|
103
|
+
created_at: Date;
|
|
104
|
+
updated_at: Date;
|
|
105
|
+
}, {
|
|
106
|
+
dispatcher_id: string;
|
|
107
|
+
username: string;
|
|
108
|
+
id: string;
|
|
109
|
+
created_at: Date;
|
|
110
|
+
updated_at: Date;
|
|
111
|
+
}>;
|
|
112
|
+
provider: z.ZodObject<{
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
url: z.ZodEffects<z.ZodString, string, string>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
name: string;
|
|
117
|
+
url: string;
|
|
118
|
+
}, {
|
|
119
|
+
name: string;
|
|
120
|
+
url: string;
|
|
121
|
+
}>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
message: string;
|
|
124
|
+
success: true;
|
|
125
|
+
user: {
|
|
126
|
+
dispatcher_id: string;
|
|
127
|
+
username: string;
|
|
128
|
+
id: string;
|
|
129
|
+
created_at: Date;
|
|
130
|
+
updated_at: Date;
|
|
131
|
+
};
|
|
132
|
+
provider: {
|
|
133
|
+
name: string;
|
|
134
|
+
url: string;
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
137
|
+
message: string;
|
|
138
|
+
success: true;
|
|
139
|
+
user: {
|
|
140
|
+
dispatcher_id: string;
|
|
141
|
+
username: string;
|
|
142
|
+
id: string;
|
|
143
|
+
created_at: Date;
|
|
144
|
+
updated_at: Date;
|
|
145
|
+
};
|
|
146
|
+
provider: {
|
|
147
|
+
name: string;
|
|
148
|
+
url: string;
|
|
149
|
+
};
|
|
150
|
+
}>, z.ZodObject<{
|
|
151
|
+
success: z.ZodLiteral<false>;
|
|
152
|
+
error: z.ZodString;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
success: false;
|
|
155
|
+
error: string;
|
|
156
|
+
}, {
|
|
157
|
+
success: false;
|
|
158
|
+
error: string;
|
|
159
|
+
}>]>;
|
|
160
|
+
|
|
161
|
+
export { NewLoginRequest, NewLoginResponse, NewLoginResponseFailure, NewLoginResponseSuccess };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/schemas/new-login.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var UrlSchema = z.string().refine(
|
|
4
|
+
(val) => {
|
|
5
|
+
try {
|
|
6
|
+
new URL(val);
|
|
7
|
+
return true;
|
|
8
|
+
} catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{ message: "Invalid URL" }
|
|
13
|
+
);
|
|
14
|
+
var NewLoginRequest = z.object({
|
|
15
|
+
dispatcher_id: z.string().min(1),
|
|
16
|
+
providerUrl: UrlSchema,
|
|
17
|
+
username: z.string().min(1),
|
|
18
|
+
password: z.string().min(1)
|
|
19
|
+
});
|
|
20
|
+
var PublicUser = z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
dispatcher_id: z.string(),
|
|
23
|
+
username: z.string(),
|
|
24
|
+
created_at: z.coerce.date(),
|
|
25
|
+
updated_at: z.coerce.date()
|
|
26
|
+
});
|
|
27
|
+
var PublicProvider = z.object({
|
|
28
|
+
name: z.string(),
|
|
29
|
+
url: UrlSchema
|
|
30
|
+
});
|
|
31
|
+
var NewLoginResponseSuccess = z.object({
|
|
32
|
+
success: z.literal(true),
|
|
33
|
+
message: z.string(),
|
|
34
|
+
user: PublicUser,
|
|
35
|
+
provider: PublicProvider
|
|
36
|
+
});
|
|
37
|
+
var NewLoginResponseFailure = z.object({
|
|
38
|
+
success: z.literal(false),
|
|
39
|
+
error: z.string()
|
|
40
|
+
});
|
|
41
|
+
var NewLoginResponse = z.union([NewLoginResponseSuccess, NewLoginResponseFailure]);
|
|
42
|
+
export {
|
|
43
|
+
NewLoginRequest,
|
|
44
|
+
NewLoginResponse,
|
|
45
|
+
NewLoginResponseFailure,
|
|
46
|
+
NewLoginResponseSuccess
|
|
47
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@findatruck/shared-schemas",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --clean",
|
|
21
|
+
"prepublishOnly": "npm run build",
|
|
22
|
+
"prepare": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"zod": "^3.23.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@changesets/cli": "^2.29.7",
|
|
29
|
+
"tsup": "^8.0.0",
|
|
30
|
+
"typescript": "^5.6.0",
|
|
31
|
+
"zod": "^3.23.0"
|
|
32
|
+
}
|
|
33
|
+
}
|