colibris-types 1.0.42 → 2.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/lib/index.js CHANGED
@@ -1,13 +1,16 @@
1
- import { organizationDefinitions, } from "./org.js";
2
- import { assetDefinitions, } from "./computers.js";
3
- import { licenseDefintions } from "./licenses.js";
4
- import { telecomDefinitions } from "./telecom.js";
5
- import { carDefinitions, } from "./cars.js";
6
- export { organizationDefinitions, assetDefinitions, licenseDefintions, telecomDefinitions, carDefinitions, };
7
- export const schemasDefinitions = {
8
- ...organizationDefinitions,
9
- ...assetDefinitions,
10
- ...licenseDefintions,
11
- ...telecomDefinitions,
12
- ...carDefinitions,
13
- };
1
+ // Notification
2
+ export { NotificationSchema, NotificationTypeSchema, } from "./notification.js";
3
+ // Notification Settings (user preferences)
4
+ export { NotificationTypePreferenceSchema, NotificationPreferencesSchema, } from "./notification-settings.js";
5
+ // Imports (history + upload schemas)
6
+ export {
7
+ // History
8
+ ImportsHistorySchema, ImportsHistoryTypeSchema, ImportsHistoryStatusSchema,
9
+ // Organization uploads
10
+ PeopleUploadSchema, PeopleUploadRowSchema, SubsidiaryUploadSchema, SubsidiaryUploadRowSchema, organizationDefinitions,
11
+ // Asset uploads
12
+ ComputerUploadSchema, ComputerUploadRowSchema, assetDefinitions,
13
+ // Telecom uploads
14
+ BouyguesGlobalInvoiceUploadSchema, BouyguesGlobalInvoiceUploadRowSchema, BouyguesDetailedInvoiceUploadSchema, BouyguesDetailedInvoiceUploadRowSchema, BouyguesFleetUploadSchema, BouyguesFleetUploadRowSchema, OrangeDetailedInvoiceUploadSchema, OrangeDetailedInvoiceUploadRowSchema, OrangeFleetUploadSchema, OrangeFleetUploadRowSchema, SfrDetailedInvoiceUploadSchema, SfrDetailedInvoiceUploadRowSchema, telecomDefinitions,
15
+ // Consolidated definitions
16
+ schemasDefinitions, } from "./imports/index.js";
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ export declare const NotificationTypePreferenceSchema: z.ZodObject<{
3
+ inApp: z.ZodBoolean;
4
+ email: z.ZodBoolean;
5
+ }, "strip", z.ZodTypeAny, {
6
+ inApp: boolean;
7
+ email: boolean;
8
+ }, {
9
+ inApp: boolean;
10
+ email: boolean;
11
+ }>;
12
+ export declare const NotificationPreferencesSchema: z.ZodObject<{
13
+ monthlyReport: z.ZodObject<{
14
+ inApp: z.ZodBoolean;
15
+ email: z.ZodBoolean;
16
+ }, "strip", z.ZodTypeAny, {
17
+ inApp: boolean;
18
+ email: boolean;
19
+ }, {
20
+ inApp: boolean;
21
+ email: boolean;
22
+ }>;
23
+ thresholds: z.ZodObject<{
24
+ inApp: z.ZodBoolean;
25
+ email: z.ZodBoolean;
26
+ }, "strip", z.ZodTypeAny, {
27
+ inApp: boolean;
28
+ email: boolean;
29
+ }, {
30
+ inApp: boolean;
31
+ email: boolean;
32
+ }>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ monthlyReport: {
35
+ inApp: boolean;
36
+ email: boolean;
37
+ };
38
+ thresholds: {
39
+ inApp: boolean;
40
+ email: boolean;
41
+ };
42
+ }, {
43
+ monthlyReport: {
44
+ inApp: boolean;
45
+ email: boolean;
46
+ };
47
+ thresholds: {
48
+ inApp: boolean;
49
+ email: boolean;
50
+ };
51
+ }>;
52
+ export type NotificationTypePreference = z.infer<typeof NotificationTypePreferenceSchema>;
53
+ export type NotificationPreferences = z.infer<typeof NotificationPreferencesSchema>;
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
3
+ extendZodWithOpenApi(z);
4
+ export const NotificationTypePreferenceSchema = z
5
+ .object({
6
+ inApp: z.boolean().openapi({ description: "Enable in-app notifications" }),
7
+ email: z.boolean().openapi({ description: "Enable email notifications" }),
8
+ })
9
+ .openapi("NotificationTypePreference");
10
+ export const NotificationPreferencesSchema = z
11
+ .object({
12
+ monthlyReport: NotificationTypePreferenceSchema.openapi({
13
+ description: "Monthly report notification preferences",
14
+ }),
15
+ thresholds: NotificationTypePreferenceSchema.openapi({
16
+ description: "Threshold alerts notification preferences",
17
+ }),
18
+ })
19
+ .openapi("NotificationPreferences");
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ export declare const NotificationTypeSchema: z.ZodEnum<["success", "error", "warning", "info", "pending"]>;
3
+ export declare const NotificationSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ user: z.ZodString;
6
+ createdAt: z.ZodString;
7
+ title: z.ZodString;
8
+ content: z.ZodString;
9
+ read: z.ZodBoolean;
10
+ url: z.ZodOptional<z.ZodString>;
11
+ to: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
12
+ type: z.ZodOptional<z.ZodEnum<["success", "error", "warning", "info", "pending"]>>;
13
+ isDownloadable: z.ZodOptional<z.ZodBoolean>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ title: string;
16
+ id: string;
17
+ user: string;
18
+ createdAt: string;
19
+ content: string;
20
+ read: boolean;
21
+ type?: "success" | "error" | "warning" | "info" | "pending" | undefined;
22
+ url?: string | undefined;
23
+ to?: string[] | undefined;
24
+ isDownloadable?: boolean | undefined;
25
+ }, {
26
+ title: string;
27
+ id: string;
28
+ user: string;
29
+ createdAt: string;
30
+ content: string;
31
+ read: boolean;
32
+ type?: "success" | "error" | "warning" | "info" | "pending" | undefined;
33
+ url?: string | undefined;
34
+ to?: string[] | undefined;
35
+ isDownloadable?: boolean | undefined;
36
+ }>;
37
+ export type Notification = z.infer<typeof NotificationSchema>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
3
+ extendZodWithOpenApi(z);
4
+ export const NotificationTypeSchema = z
5
+ .enum(["success", "error", "warning", "info", "pending"])
6
+ .openapi({ description: "Type of notification" });
7
+ export const NotificationSchema = z
8
+ .object({
9
+ id: z.string().openapi({ description: "Unique notification identifier" }),
10
+ user: z
11
+ .string()
12
+ .openapi({ description: "User email associated with the notification" }),
13
+ createdAt: z
14
+ .string()
15
+ .openapi({ description: "ISO 8601 timestamp of creation" }),
16
+ title: z.string().openapi({ description: "Notification title (i18n key)" }),
17
+ content: z
18
+ .string()
19
+ .openapi({ description: "Notification content (i18n key)" }),
20
+ read: z
21
+ .boolean()
22
+ .openapi({ description: "Whether the notification has been read" }),
23
+ url: z
24
+ .string()
25
+ .optional()
26
+ .openapi({ description: "Optional URL for the notification" }),
27
+ to: z
28
+ .array(z.string())
29
+ .optional()
30
+ .openapi({ description: "Optional list of recipients" }),
31
+ type: NotificationTypeSchema.optional(),
32
+ isDownloadable: z
33
+ .boolean()
34
+ .optional()
35
+ .openapi({
36
+ description: "Whether the notification contains downloadable content",
37
+ }),
38
+ })
39
+ .openapi("Notification");
package/package.json CHANGED
@@ -1,28 +1,44 @@
1
1
  {
2
2
  "name": "colibris-types",
3
- "version": "1.0.42",
4
- "description": "",
3
+ "version": "2.0.1",
4
+ "description": "Shared TypeScript types and Zod schemas for Colibris platform",
5
5
  "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
6
8
  "type": "module",
7
- "keywords": [],
8
- "author": "",
9
- "license": "ISC",
10
- "devDependencies": {
11
- "@types/jest": "^29.5.12",
12
- "jest": "^29.7.0",
13
- "ts-jest": "^29.1.2",
14
- "typescript": "^5.4.5"
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./lib/index.d.ts",
15
+ "import": "./lib/index.js"
16
+ }
15
17
  },
16
18
  "files": [
17
19
  "lib/**/*"
18
20
  ],
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "prepare": "yarn build"
24
+ },
25
+ "keywords": [
26
+ "colibris",
27
+ "types",
28
+ "zod",
29
+ "openapi"
30
+ ],
31
+ "author": "",
32
+ "license": "UNLICENSED",
19
33
  "dependencies": {
20
- "zod": "^3.23.4"
34
+ "zod": "^3.23.4",
35
+ "@asteasolutions/zod-to-openapi": "^7.0.0"
21
36
  },
22
- "types": "./lib/index.d.ts",
23
- "scripts": {
24
- "test": "jest",
25
- "cover": "jest --coverage",
26
- "build": "tsc"
37
+ "devDependencies": {
38
+ "@types/node": "^22.9.1",
39
+ "typescript": "^5.4.5"
40
+ },
41
+ "peerDependencies": {
42
+ "zod": "^3.22.0"
27
43
  }
28
- }
44
+ }
package/README.md DELETED
@@ -1,2 +0,0 @@
1
- Update package version: `npm version [patch|minor|major]`
2
- Publish new version: `npm publish`
package/lib/base.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { z } from "zod";
2
- declare const Model: z.ZodObject<{
3
- id_company: z.ZodNumber;
4
- }, "strip", z.ZodTypeAny, {
5
- id_company: number;
6
- }, {
7
- id_company: number;
8
- }>;
9
- export { Model };
package/lib/base.js DELETED
@@ -1,3 +0,0 @@
1
- import { z } from "zod";
2
- const Model = z.object({ id_company: z.number() });
3
- export { Model };
package/lib/cars.d.ts DELETED
@@ -1,206 +0,0 @@
1
- import { z } from "zod";
2
- declare const CarCategory: z.ZodObject<{
3
- id_car_category: z.ZodNumber;
4
- name: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- name: string;
7
- id_car_category: number;
8
- }, {
9
- name: string;
10
- id_car_category: number;
11
- }>;
12
- declare const CarEnegySource: z.ZodObject<{
13
- id_car_energy_source: z.ZodNumber;
14
- name: z.ZodString;
15
- }, "strip", z.ZodTypeAny, {
16
- name: string;
17
- id_car_energy_source: number;
18
- }, {
19
- name: string;
20
- id_car_energy_source: number;
21
- }>;
22
- declare const CarStatus: z.ZodObject<{
23
- id_car_status: z.ZodNumber;
24
- name: z.ZodString;
25
- }, "strip", z.ZodTypeAny, {
26
- name: string;
27
- id_car_status: number;
28
- }, {
29
- name: string;
30
- id_car_status: number;
31
- }>;
32
- declare const Car: z.ZodObject<z.objectUtil.extendShape<{
33
- id_company: z.ZodNumber;
34
- }, {
35
- id_car: z.ZodNumber;
36
- reg_country: z.ZodString;
37
- reg_id_number: z.ZodString;
38
- brand: z.ZodString;
39
- model: z.ZodString;
40
- variant_information: z.ZodOptional<z.ZodString>;
41
- car_category: z.ZodString;
42
- car_energy_source: z.ZodString;
43
- car_status: z.ZodString;
44
- owner: z.ZodString;
45
- renter: z.ZodOptional<z.ZodString>;
46
- renting_subsidiary: z.ZodOptional<z.ZodString>;
47
- affected_subsidiary: z.ZodOptional<z.ZodString>;
48
- rent_amount: z.ZodOptional<z.ZodNumber>;
49
- start_date: z.ZodOptional<z.ZodDate>;
50
- end_date: z.ZodOptional<z.ZodDate>;
51
- expected_delivery_date: z.ZodOptional<z.ZodDate>;
52
- expected_return_date: z.ZodOptional<z.ZodDate>;
53
- expected_duration_months: z.ZodOptional<z.ZodNumber>;
54
- delivery_date: z.ZodOptional<z.ZodDate>;
55
- return_date: z.ZodOptional<z.ZodDate>;
56
- }>, "strip", z.ZodTypeAny, {
57
- brand: string;
58
- id_company: number;
59
- id_car: number;
60
- reg_country: string;
61
- reg_id_number: string;
62
- model: string;
63
- car_category: string;
64
- car_energy_source: string;
65
- car_status: string;
66
- owner: string;
67
- variant_information?: string | undefined;
68
- renter?: string | undefined;
69
- renting_subsidiary?: string | undefined;
70
- affected_subsidiary?: string | undefined;
71
- rent_amount?: number | undefined;
72
- start_date?: Date | undefined;
73
- end_date?: Date | undefined;
74
- expected_delivery_date?: Date | undefined;
75
- expected_return_date?: Date | undefined;
76
- expected_duration_months?: number | undefined;
77
- delivery_date?: Date | undefined;
78
- return_date?: Date | undefined;
79
- }, {
80
- brand: string;
81
- id_company: number;
82
- id_car: number;
83
- reg_country: string;
84
- reg_id_number: string;
85
- model: string;
86
- car_category: string;
87
- car_energy_source: string;
88
- car_status: string;
89
- owner: string;
90
- variant_information?: string | undefined;
91
- renter?: string | undefined;
92
- renting_subsidiary?: string | undefined;
93
- affected_subsidiary?: string | undefined;
94
- rent_amount?: number | undefined;
95
- start_date?: Date | undefined;
96
- end_date?: Date | undefined;
97
- expected_delivery_date?: Date | undefined;
98
- expected_return_date?: Date | undefined;
99
- expected_duration_months?: number | undefined;
100
- delivery_date?: Date | undefined;
101
- return_date?: Date | undefined;
102
- }>;
103
- export declare const carDefinitions: {
104
- car_category: z.ZodObject<{
105
- id_car_category: z.ZodNumber;
106
- name: z.ZodString;
107
- }, "strip", z.ZodTypeAny, {
108
- name: string;
109
- id_car_category: number;
110
- }, {
111
- name: string;
112
- id_car_category: number;
113
- }>;
114
- car_energy_source: z.ZodObject<{
115
- id_car_energy_source: z.ZodNumber;
116
- name: z.ZodString;
117
- }, "strip", z.ZodTypeAny, {
118
- name: string;
119
- id_car_energy_source: number;
120
- }, {
121
- name: string;
122
- id_car_energy_source: number;
123
- }>;
124
- car_status: z.ZodObject<{
125
- id_car_status: z.ZodNumber;
126
- name: z.ZodString;
127
- }, "strip", z.ZodTypeAny, {
128
- name: string;
129
- id_car_status: number;
130
- }, {
131
- name: string;
132
- id_car_status: number;
133
- }>;
134
- car: z.ZodObject<z.objectUtil.extendShape<{
135
- id_company: z.ZodNumber;
136
- }, {
137
- id_car: z.ZodNumber;
138
- reg_country: z.ZodString;
139
- reg_id_number: z.ZodString;
140
- brand: z.ZodString;
141
- model: z.ZodString;
142
- variant_information: z.ZodOptional<z.ZodString>;
143
- car_category: z.ZodString;
144
- car_energy_source: z.ZodString;
145
- car_status: z.ZodString;
146
- owner: z.ZodString;
147
- renter: z.ZodOptional<z.ZodString>;
148
- renting_subsidiary: z.ZodOptional<z.ZodString>;
149
- affected_subsidiary: z.ZodOptional<z.ZodString>;
150
- rent_amount: z.ZodOptional<z.ZodNumber>;
151
- start_date: z.ZodOptional<z.ZodDate>;
152
- end_date: z.ZodOptional<z.ZodDate>;
153
- expected_delivery_date: z.ZodOptional<z.ZodDate>;
154
- expected_return_date: z.ZodOptional<z.ZodDate>;
155
- expected_duration_months: z.ZodOptional<z.ZodNumber>;
156
- delivery_date: z.ZodOptional<z.ZodDate>;
157
- return_date: z.ZodOptional<z.ZodDate>;
158
- }>, "strip", z.ZodTypeAny, {
159
- brand: string;
160
- id_company: number;
161
- id_car: number;
162
- reg_country: string;
163
- reg_id_number: string;
164
- model: string;
165
- car_category: string;
166
- car_energy_source: string;
167
- car_status: string;
168
- owner: string;
169
- variant_information?: string | undefined;
170
- renter?: string | undefined;
171
- renting_subsidiary?: string | undefined;
172
- affected_subsidiary?: string | undefined;
173
- rent_amount?: number | undefined;
174
- start_date?: Date | undefined;
175
- end_date?: Date | undefined;
176
- expected_delivery_date?: Date | undefined;
177
- expected_return_date?: Date | undefined;
178
- expected_duration_months?: number | undefined;
179
- delivery_date?: Date | undefined;
180
- return_date?: Date | undefined;
181
- }, {
182
- brand: string;
183
- id_company: number;
184
- id_car: number;
185
- reg_country: string;
186
- reg_id_number: string;
187
- model: string;
188
- car_category: string;
189
- car_energy_source: string;
190
- car_status: string;
191
- owner: string;
192
- variant_information?: string | undefined;
193
- renter?: string | undefined;
194
- renting_subsidiary?: string | undefined;
195
- affected_subsidiary?: string | undefined;
196
- rent_amount?: number | undefined;
197
- start_date?: Date | undefined;
198
- end_date?: Date | undefined;
199
- expected_delivery_date?: Date | undefined;
200
- expected_return_date?: Date | undefined;
201
- expected_duration_months?: number | undefined;
202
- delivery_date?: Date | undefined;
203
- return_date?: Date | undefined;
204
- }>;
205
- };
206
- export { CarCategory, CarEnegySource, CarStatus, Car };
package/lib/cars.js DELETED
@@ -1,44 +0,0 @@
1
- import { z } from "zod";
2
- import { Model } from "./base.js";
3
- const CarCategory = z.object({
4
- id_car_category: z.number(),
5
- name: z.string().max(250),
6
- });
7
- const CarEnegySource = z.object({
8
- id_car_energy_source: z.number(),
9
- name: z.string().max(250),
10
- });
11
- const CarStatus = z.object({
12
- id_car_status: z.number(),
13
- name: z.string().max(250),
14
- });
15
- const Car = Model.extend({
16
- id_car: z.number(),
17
- reg_country: z.string().max(50),
18
- reg_id_number: z.string().max(20),
19
- brand: z.string().max(50),
20
- model: z.string().max(50),
21
- variant_information: z.string().max(50).optional(),
22
- car_category: z.string().max(250),
23
- car_energy_source: z.string().max(250),
24
- car_status: z.string().max(250),
25
- owner: z.string().max(250),
26
- renter: z.string().max(250).optional(),
27
- renting_subsidiary: z.string().max(250).optional(),
28
- affected_subsidiary: z.string().max(250).optional(),
29
- rent_amount: z.number().optional(),
30
- start_date: z.coerce.date().optional(),
31
- end_date: z.coerce.date().optional(),
32
- expected_delivery_date: z.coerce.date().optional(),
33
- expected_return_date: z.coerce.date().optional(),
34
- expected_duration_months: z.number().optional(),
35
- delivery_date: z.coerce.date().optional(),
36
- return_date: z.coerce.date().optional(),
37
- });
38
- export const carDefinitions = {
39
- car_category: CarCategory,
40
- car_energy_source: CarEnegySource,
41
- car_status: CarStatus,
42
- car: Car,
43
- };
44
- export { CarCategory, CarEnegySource, CarStatus, Car };