@sortipei/api-contracts 0.1.6 → 0.1.8
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/dist/V1/api/event.d.ts +300 -0
- package/dist/V1/api/event.d.ts.map +1 -0
- package/dist/V1/api/index.d.ts +21 -0
- package/dist/V1/api/index.d.ts.map +1 -0
- package/dist/V1/api/organizer.d.ts +42 -0
- package/dist/V1/api/organizer.d.ts.map +1 -0
- package/{src/V1/external/index.ts → dist/V1/external/index.d.ts} +1 -0
- package/dist/V1/external/index.d.ts.map +1 -0
- package/dist/V1/external/partial-imported-event.d.ts +112 -0
- package/dist/V1/external/partial-imported-event.d.ts.map +1 -0
- package/{src/V1/index.ts → dist/V1/index.d.ts} +1 -1
- package/dist/V1/index.d.ts.map +1 -0
- package/dist/api-contracts.mjs +4197 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/flavors.d.ts +8 -0
- package/dist/flavors.d.ts.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/shared/event.d.ts +9 -0
- package/dist/shared/event.d.ts.map +1 -0
- package/{src/shared/index.ts → dist/shared/index.d.ts} +1 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/schemas.d.ts +9 -0
- package/dist/shared/schemas.d.ts.map +1 -0
- package/package.json +6 -3
- package/.eslintrc.cjs +0 -3
- package/src/V1/api/event.ts +0 -96
- package/src/V1/api/index.ts +0 -9
- package/src/V1/api/organizer.ts +0 -27
- package/src/V1/external/partial-imported-event.ts +0 -11
- package/src/errors.ts +0 -3
- package/src/flavors.ts +0 -12
- package/src/shared/event.ts +0 -10
- package/src/shared/schemas.ts +0 -18
- package/tsconfig.json +0 -21
- package/vite.config.ts +0 -15
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,kBAAkB,UAAU;CAC7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const EventIdSchema: z.ZodBranded<z.ZodString, "EventId">;
|
|
3
|
+
export type EventId = z.infer<typeof EventIdSchema>;
|
|
4
|
+
export declare const createEventId: (id?: string) => EventId;
|
|
5
|
+
export declare const OrganizerIdSchema: z.ZodBranded<z.ZodString, "OrganizerId">;
|
|
6
|
+
export type OrganizerId = z.infer<typeof OrganizerIdSchema>;
|
|
7
|
+
export declare const createOrganizerId: (id?: string) => OrganizerId;
|
|
8
|
+
//# sourceMappingURL=flavors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flavors.d.ts","sourceRoot":"","sources":["../src/flavors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa,sCAA8B,CAAC;AACzD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,aAAa,QAAQ,MAAM,KAAyB,OAAkC,CAAC;AAEpG,eAAO,MAAM,iBAAiB,0CAAkC,CAAC;AACjE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB,QAAQ,MAAM,KAAyB,WAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/shared/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,MAAM;IAChB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,eAAO,MAAM,YAAY,gCAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const StringSchema: z.ZodString;
|
|
3
|
+
export declare const UUIDSchema: z.ZodString;
|
|
4
|
+
export declare const CoerceDateSchema: z.ZodPipeline<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodDate]>, z.ZodDate>;
|
|
5
|
+
export declare const CoerceNullableDateSchema: z.ZodNullable<z.ZodPipeline<z.ZodUnion<[z.ZodNumber, z.ZodNull, z.ZodString, z.ZodDate]>, z.ZodDate>>;
|
|
6
|
+
export declare const SafeNonNegativeIntegerSchema: z.ZodNumber;
|
|
7
|
+
export declare const SafeNonNegativeFloatSchema: z.ZodNumber;
|
|
8
|
+
export declare const URLSchema: z.ZodString;
|
|
9
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/shared/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY,aAAoB,CAAC;AAC9C,eAAO,MAAM,UAAU,aAAsB,CAAC;AAK9C,eAAO,MAAM,gBAAgB,6EAAuC,CAAC;AACrE,eAAO,MAAM,wBAAwB,uGAAwD,CAAC;AAK9F,eAAO,MAAM,4BAA4B,aAAkC,CAAC;AAC5E,eAAO,MAAM,0BAA0B,aAAgC,CAAC;AAExE,eAAO,MAAM,SAAS,aAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sortipei/api-contracts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "UNLICENCED",
|
|
5
5
|
"main": "dist/api-contracts.js",
|
|
6
6
|
"module": "dist/api-contracts.mjs",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"vite-plugin-dts": "^4.2.1"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsc
|
|
27
|
-
}
|
|
26
|
+
"build": "tsc && vite build"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
]
|
|
28
31
|
}
|
package/.eslintrc.cjs
DELETED
package/src/V1/api/event.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { EventIdSchema, OrganizerIdSchema } from '../../flavors';
|
|
2
|
-
import {
|
|
3
|
-
RegionSchema,
|
|
4
|
-
SafeNonNegativeFloatSchema,
|
|
5
|
-
SafeNonNegativeIntegerSchema,
|
|
6
|
-
StringSchema,
|
|
7
|
-
URLSchema,
|
|
8
|
-
} from '../../shared';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
|
|
11
|
-
export const EventDTOSchema = z.object({
|
|
12
|
-
capacity: SafeNonNegativeIntegerSchema.nullable(),
|
|
13
|
-
description: StringSchema,
|
|
14
|
-
finishTime: z.string().datetime().nullable(),
|
|
15
|
-
hasHandicapAccess: z.boolean().nullable(),
|
|
16
|
-
id: EventIdSchema,
|
|
17
|
-
imageUrls: URLSchema.array(),
|
|
18
|
-
isDisplayed: z.boolean(),
|
|
19
|
-
isPromoted: z.boolean(),
|
|
20
|
-
link: URLSchema.nullable(),
|
|
21
|
-
price: SafeNonNegativeFloatSchema.nullable(),
|
|
22
|
-
region: RegionSchema,
|
|
23
|
-
startTime: z.string().datetime(),
|
|
24
|
-
title: StringSchema,
|
|
25
|
-
|
|
26
|
-
organizers: z
|
|
27
|
-
.object({
|
|
28
|
-
id: OrganizerIdSchema,
|
|
29
|
-
name: StringSchema,
|
|
30
|
-
})
|
|
31
|
-
.array()
|
|
32
|
-
.min(1),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const CreateEventDTOSchema = z.object({
|
|
36
|
-
capacity: SafeNonNegativeIntegerSchema.nullable(),
|
|
37
|
-
description: StringSchema,
|
|
38
|
-
finishTime: z.string().datetime().nullable(),
|
|
39
|
-
hasHandicapAccess: z.boolean().nullable(),
|
|
40
|
-
id: EventIdSchema,
|
|
41
|
-
imageUrls: URLSchema.array(),
|
|
42
|
-
isDisplayed: z.boolean(),
|
|
43
|
-
link: URLSchema.nullable(),
|
|
44
|
-
organizersIds: OrganizerIdSchema.array().min(1),
|
|
45
|
-
price: SafeNonNegativeFloatSchema.nullable(),
|
|
46
|
-
region: RegionSchema,
|
|
47
|
-
startTime: z.string().datetime(),
|
|
48
|
-
title: StringSchema,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const UpdateEventDTOSchema = CreateEventDTOSchema.omit({
|
|
52
|
-
id: true,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export const DisplayEventDTOSchema = z.object({
|
|
56
|
-
isDisplayed: z.boolean(),
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
export const PromoteEventDTOSchema = z.object({
|
|
60
|
-
isPromoted: z.boolean(),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export const EventFileUploadsDTOSchema = z
|
|
64
|
-
.object({
|
|
65
|
-
publicUrl: URLSchema,
|
|
66
|
-
uploadUrl: URLSchema,
|
|
67
|
-
})
|
|
68
|
-
.array();
|
|
69
|
-
|
|
70
|
-
export type CreateEventDTO = z.infer<typeof CreateEventDTOSchema>;
|
|
71
|
-
export type UpdateEventDTO = z.infer<typeof UpdateEventDTOSchema>;
|
|
72
|
-
export type DisplayEventDTO = z.infer<typeof DisplayEventDTOSchema>;
|
|
73
|
-
export type PromoteEventDTO = z.infer<typeof PromoteEventDTOSchema>;
|
|
74
|
-
export type EventFileUploadsDTO = z.infer<typeof EventFileUploadsDTOSchema>;
|
|
75
|
-
|
|
76
|
-
export type EventDTO = z.infer<typeof EventDTOSchema>;
|
|
77
|
-
|
|
78
|
-
export const constraints = {
|
|
79
|
-
description: {
|
|
80
|
-
minLength: 3,
|
|
81
|
-
maxLength: 10_000,
|
|
82
|
-
},
|
|
83
|
-
title: {
|
|
84
|
-
minLength: 3,
|
|
85
|
-
maxLength: 100,
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const ImportDTOSchema = z.object({
|
|
90
|
-
id: StringSchema,
|
|
91
|
-
userId: StringSchema,
|
|
92
|
-
createdAt: StringSchema.datetime(),
|
|
93
|
-
partialEventState: EventDTOSchema.partial(),
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export type ImportDTO = z.infer<typeof ImportDTOSchema>;
|
package/src/V1/api/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './event';
|
|
2
|
-
export * from './organizer';
|
|
3
|
-
import { constraints as eventsConstraints } from './event';
|
|
4
|
-
import { constraints as organizerConstraints } from './organizer';
|
|
5
|
-
|
|
6
|
-
export const constraints = {
|
|
7
|
-
events: eventsConstraints,
|
|
8
|
-
organizers: organizerConstraints,
|
|
9
|
-
};
|
package/src/V1/api/organizer.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EventIdSchema, OrganizerIdSchema } from '../../flavors';
|
|
2
|
-
import { StringSchema } from '../../shared';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
|
|
5
|
-
export const OrganizerDTOSchema = z.object({
|
|
6
|
-
eventsIds: EventIdSchema.array(),
|
|
7
|
-
id: OrganizerIdSchema,
|
|
8
|
-
name: StringSchema,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export const CreateOrganizerDTOSchema = z.object({
|
|
12
|
-
id: OrganizerIdSchema,
|
|
13
|
-
name: StringSchema,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const UpdateOrganizerDTOSchema = CreateOrganizerDTOSchema.omit({ id: true });
|
|
17
|
-
|
|
18
|
-
export type CreateOrganizerDTO = z.infer<typeof CreateOrganizerDTOSchema>;
|
|
19
|
-
export type UpdateOrganizerDTO = z.infer<typeof UpdateOrganizerDTOSchema>;
|
|
20
|
-
export type OrganizerDTO = z.infer<typeof OrganizerDTOSchema>;
|
|
21
|
-
|
|
22
|
-
export const constraints = {
|
|
23
|
-
name: {
|
|
24
|
-
minLength: 3,
|
|
25
|
-
maxLength: 100,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { StringSchema } from '../../shared';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { EventDTOSchema } from '../api/event';
|
|
4
|
-
|
|
5
|
-
export const CreatePartialImportedEventDTOSchema = z.object({
|
|
6
|
-
partialEventState: EventDTOSchema.partial(),
|
|
7
|
-
token: StringSchema,
|
|
8
|
-
userId: StringSchema,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export type CreatePartialImportedEventDTO = z.infer<typeof CreatePartialImportedEventDTOSchema>;
|
package/src/errors.ts
DELETED
package/src/flavors.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { UUIDSchema } from './shared';
|
|
3
|
-
|
|
4
|
-
export const EventIdSchema = UUIDSchema.brand('EventId');
|
|
5
|
-
export type EventId = z.infer<typeof EventIdSchema>;
|
|
6
|
-
|
|
7
|
-
export const createEventId = (id: string = crypto.randomUUID()): EventId => EventIdSchema.parse(id);
|
|
8
|
-
|
|
9
|
-
export const OrganizerIdSchema = UUIDSchema.brand('OrganizerId');
|
|
10
|
-
export type OrganizerId = z.infer<typeof OrganizerIdSchema>;
|
|
11
|
-
|
|
12
|
-
export const createOrganizerId = (id: string = crypto.randomUUID()): OrganizerId => OrganizerIdSchema.parse(id);
|
package/src/shared/event.ts
DELETED
package/src/shared/schemas.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
export const StringSchema = z.string().trim();
|
|
4
|
-
export const UUIDSchema = StringSchema.uuid();
|
|
5
|
-
|
|
6
|
-
const DateLikeSchema = z.union([z.number(), z.string(), z.date()]);
|
|
7
|
-
const DateLikeOrNullSchema = z.union([z.number(), z.null(), z.string(), z.date()]);
|
|
8
|
-
|
|
9
|
-
export const CoerceDateSchema = DateLikeSchema.pipe(z.coerce.date());
|
|
10
|
-
export const CoerceNullableDateSchema = DateLikeOrNullSchema.pipe(z.coerce.date()).nullable();
|
|
11
|
-
|
|
12
|
-
const SafeFloatSchema = z.number().finite().safe();
|
|
13
|
-
const SafeIntegerSchema = SafeFloatSchema.int();
|
|
14
|
-
|
|
15
|
-
export const SafeNonNegativeIntegerSchema = SafeIntegerSchema.nonnegative();
|
|
16
|
-
export const SafeNonNegativeFloatSchema = SafeFloatSchema.nonnegative();
|
|
17
|
-
|
|
18
|
-
export const URLSchema = StringSchema.url();
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig.packages.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"allowJs": false,
|
|
5
|
-
"alwaysStrict": true,
|
|
6
|
-
"composite": true,
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationDir": "dist",
|
|
9
|
-
"emitDeclarationOnly": true,
|
|
10
|
-
"lib": ["es5", "ES2015", "ES2016"],
|
|
11
|
-
"module": "ES6",
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"rootDir": "src",
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"strict": true,
|
|
18
|
-
"target": "es6"
|
|
19
|
-
},
|
|
20
|
-
"include": ["src"]
|
|
21
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import dts from 'vite-plugin-dts';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [dts()],
|
|
6
|
-
build: {
|
|
7
|
-
emptyOutDir: true,
|
|
8
|
-
outDir: 'dist',
|
|
9
|
-
minify: false,
|
|
10
|
-
lib: {
|
|
11
|
-
entry: 'src/index.ts',
|
|
12
|
-
formats: ['es', 'cjs'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|