@bash-app/bash-common 1.0.8 → 1.0.10

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.
@@ -1,143 +1,145 @@
1
- import {
2
- AmountOfGuests,
3
- EventTask,
4
- AssociatedBash,
5
- BashEvent,
6
- Invitation,
7
- TargetAudience,
8
- Ticket,
9
- User,
10
- TicketTier, Service, Review, Media, BashComment, Recurrence, Contact
11
- } from "@prisma/client";
12
- import {RecordKey} from "./definitions";
13
-
14
- // TODO: Get this to work
15
- type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
16
-
17
- export interface BashEventExt extends BashEvent {
18
- targetAudience?: TargetAudience;
19
- amountOfGuests?: AmountOfGuests;
20
- recurrence?: Recurrence;
21
- creator?: User;
22
- ticketTiers: TicketTierExt[];
23
- media: Media[];
24
- eventTasks: EventTask[];
25
- tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
26
- // Do not include in fetch. Could be hundreds of these
27
- invitations: InvitationExt[];
28
- }
29
-
30
- export const BASH_EVENT_DATA_TO_INCLUDE = {
31
- targetAudience: true,
32
- amountOfGuests: true,
33
- recurrence: true,
34
- ticketTiers: true,
35
- creator: true,
36
- eventTasks: true,
37
- media: true
38
- }
39
-
40
- export const BASH_EVENT_DATA_TO_CLONE = [
41
- 'targetAudience',
42
- 'amountOfGuests',
43
- 'ticketTiers',
44
- 'media',
45
- 'recurrence',
46
- 'invitations',
47
- ] as const;
48
-
49
- type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
50
- type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
51
- type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
52
-
53
- export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
54
- 'creator',
55
- 'eventTasks',
56
- 'tickets'
57
- ];
58
-
59
- export interface InvitationExt extends Invitation {
60
- creator: User;
61
- sentTo: User;
62
- tickets: Ticket[];
63
- }
64
-
65
- export const INVITATION_DATA_TO_INCLUDE = {
66
- creator: true,
67
- sentTo: true,
68
- tickets: true
69
- }
70
-
71
- export interface InvitationExtraData extends Invitation {
72
- isFreeGuest?: boolean;
73
- isOrganizer?: boolean;
74
- }
75
-
76
- export interface AssociatedBashExt extends AssociatedBash {
77
- bashEvent: BashEventExt;
78
- invitation: InvitationExt;
79
- }
80
-
81
-
82
- export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
83
- bashEvent: {
84
- include: BASH_EVENT_DATA_TO_INCLUDE
85
- },
86
- invitation: {
87
- include: INVITATION_DATA_TO_INCLUDE
88
- }
89
- }
90
-
91
- export interface TicketTierExt extends TicketTier {
92
- bashEvent: BashEvent;
93
- tickets: TicketExt[];
94
- }
95
-
96
- export interface TicketExt extends Ticket {
97
- owner: User;
98
- forUser: User;
99
- }
100
-
101
- export interface ReviewExt extends Review {
102
- comments: BashComment[];
103
- }
104
-
105
- export interface UserExtraData extends User {
106
- password: string;
107
- }
108
-
109
- export interface UserExt extends User {
110
- services: Service[];
111
-
112
- // Do not include in fetch as there could be thousands of these
113
- associatedBashes?: AssociatedBash[]
114
- reviews?: ReviewExt[];
115
- contacts?: Contact[];
116
- }
117
-
118
- export const USER_DATA_TO_INCLUDE = {
119
- services: true,
120
- }
121
-
122
- export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
123
- reviews: {
124
- include: {
125
- comments: true
126
- }
127
- }
128
- }
129
-
130
- export const PUBLIC_USER_DATA_TO_SELECT = {
131
- id: true,
132
- email: true,
133
- givenName: true,
134
- familyName: true,
135
- fullName: true,
136
- username: true,
137
- image: true,
138
- uploadedImage: true,
139
- services: true,
140
- }
141
-
142
- export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
143
- & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
1
+ import {
2
+ AmountOfGuests,
3
+ EventTask,
4
+ AssociatedBash,
5
+ BashEvent,
6
+ Invitation,
7
+ TargetAudience,
8
+ Ticket,
9
+ User,
10
+ TicketTier, Service, Review, Media, BashComment, Recurrence, Contact
11
+ } from "@prisma/client";
12
+ import {RecordKey} from "./definitions";
13
+
14
+ // TODO: Get this to work
15
+ type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
16
+
17
+ export interface BashEventExt extends BashEvent {
18
+ targetAudience?: TargetAudience;
19
+ amountOfGuests?: AmountOfGuests;
20
+ recurrence?: Recurrence;
21
+ creator?: User;
22
+ ticketTiers: TicketTierExt[];
23
+ media: Media[];
24
+ eventTasks: EventTask[];
25
+ tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
26
+ // Do not include in fetch. Could be hundreds of these
27
+ invitations: InvitationExt[];
28
+ location: string;
29
+ place?: string;
30
+ }
31
+
32
+ export const BASH_EVENT_DATA_TO_INCLUDE = {
33
+ targetAudience: true,
34
+ amountOfGuests: true,
35
+ recurrence: true,
36
+ ticketTiers: true,
37
+ creator: true,
38
+ eventTasks: true,
39
+ media: true
40
+ }
41
+
42
+ export const BASH_EVENT_DATA_TO_CLONE = [
43
+ 'targetAudience',
44
+ 'amountOfGuests',
45
+ 'ticketTiers',
46
+ 'media',
47
+ 'recurrence',
48
+ 'invitations',
49
+ ] as const;
50
+
51
+ type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
52
+ type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
53
+ type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
54
+
55
+ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
56
+ 'creator',
57
+ 'eventTasks',
58
+ 'tickets'
59
+ ];
60
+
61
+ export interface InvitationExt extends Invitation {
62
+ creator: User;
63
+ sentTo: User;
64
+ tickets: Ticket[];
65
+ }
66
+
67
+ export const INVITATION_DATA_TO_INCLUDE = {
68
+ creator: true,
69
+ sentTo: true,
70
+ tickets: true
71
+ }
72
+
73
+ export interface InvitationExtraData extends Invitation {
74
+ isFreeGuest?: boolean;
75
+ isOrganizer?: boolean;
76
+ }
77
+
78
+ export interface AssociatedBashExt extends AssociatedBash {
79
+ bashEvent: BashEventExt;
80
+ invitation: InvitationExt;
81
+ }
82
+
83
+
84
+ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
85
+ bashEvent: {
86
+ include: BASH_EVENT_DATA_TO_INCLUDE
87
+ },
88
+ invitation: {
89
+ include: INVITATION_DATA_TO_INCLUDE
90
+ }
91
+ }
92
+
93
+ export interface TicketTierExt extends TicketTier {
94
+ bashEvent: BashEvent;
95
+ tickets: TicketExt[];
96
+ }
97
+
98
+ export interface TicketExt extends Ticket {
99
+ owner: User;
100
+ forUser: User;
101
+ }
102
+
103
+ export interface ReviewExt extends Review {
104
+ comments: BashComment[];
105
+ }
106
+
107
+ export interface UserExtraData extends User {
108
+ password: string;
109
+ }
110
+
111
+ export interface UserExt extends User {
112
+ services: Service[];
113
+
114
+ // Do not include in fetch as there could be thousands of these
115
+ associatedBashes?: AssociatedBash[]
116
+ reviews?: ReviewExt[];
117
+ contacts?: Contact[];
118
+ }
119
+
120
+ export const USER_DATA_TO_INCLUDE = {
121
+ services: true,
122
+ }
123
+
124
+ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
125
+ reviews: {
126
+ include: {
127
+ comments: true
128
+ }
129
+ }
130
+ }
131
+
132
+ export const PUBLIC_USER_DATA_TO_SELECT = {
133
+ id: true,
134
+ email: true,
135
+ givenName: true,
136
+ familyName: true,
137
+ fullName: true,
138
+ username: true,
139
+ image: true,
140
+ uploadedImage: true,
141
+ services: true,
142
+ }
143
+
144
+ export type Public_User = Pick<UserExt, keyof typeof PUBLIC_USER_DATA_TO_SELECT>
145
+ & Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./extendedSchemas";
2
- export * from "./definitions";
1
+ export * from "./extendedSchemas";
2
+ export * from "./definitions";
package/tsconfig.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "esModuleInterop": true,
7
- "noEmit": true,
8
- "outDir": "./dist",
9
- "rootDir": "./src",
10
- "strict": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "jsx": "react-jsx",
14
- "noImplicitAny": true,
15
- "sourceMap": true,
16
- },
17
- "include": ["src/**/*.ts", "src/**/*.tsx"],
18
- "exclude": ["node_modules"]
19
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
6
+ "esModuleInterop": true,
7
+ "noEmit": true,
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "jsx": "react-jsx",
14
+ "noImplicitAny": true,
15
+ "sourceMap": true,
16
+ },
17
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
18
+ "exclude": ["node_modules"]
19
+ }
@@ -1,23 +0,0 @@
1
- import shell from 'shelljs';
2
-
3
- const BASH_COMMON_DIR = 'bash-common';
4
- const BASH_APP_PATH = '../node_modules/@bash-app/'; // Need to get to the main project folder
5
- const BASH_COMMON_PATH = `${BASH_APP_PATH}${BASH_COMMON_DIR}`;
6
-
7
- shell.echo('', `Current working dir: ${shell.pwd()}`);
8
- shell.echo('', `Deleting bash-common folder: ${BASH_COMMON_PATH}`);
9
-
10
- shell.rm('-rf', BASH_COMMON_PATH);
11
- shell.mkdir('-p', BASH_COMMON_PATH);
12
-
13
- shell.echo('', `Copying bash-common folder: ${BASH_COMMON_PATH}`);
14
- shell.cp('-rf', `../${BASH_COMMON_DIR}`,`${BASH_APP_PATH}`);
15
-
16
- shell.echo('', `Running npm commands in bash-common folder: ${BASH_COMMON_PATH}`);
17
- shell.exec(`npm --prefix ${BASH_COMMON_PATH} install`);
18
- shell.exec(`npm --prefix ${BASH_COMMON_PATH} run build`);
19
-
20
- shell.echo('', `Copying prisma folder from bash-common folder: ${BASH_COMMON_PATH}`);
21
- shell.cp('-rf', `${BASH_COMMON_PATH}/prisma`, '../'); // Need to get to the main project folder
22
-
23
- shell.echo('', 'Done setting up bash-common!');