tonightpass 0.0.15 → 0.0.17
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +50 -29
- package/dist/index.d.ts +50 -29
- package/dist/index.js +28 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/rest/dtos/organizations/create-organization.dto.ts +2 -2
- package/src/rest/dtos/organizations/members/update-organization-member.dto.ts +9 -0
- package/src/rest/types/event/ticket/index.ts +10 -10
- package/src/rest/types/organizations/index.ts +42 -13
- package/src/rest/types/token/index.ts +10 -1
- package/src/rest/types/users/index.ts +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> tonightpass@0.0.
|
|
2
|
+
> tonightpass@0.0.17 build /home/runner/work/tonightpass/tonightpass/packages/node
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Target: esnext
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m10.43 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m31.75 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 257ms
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m12.18 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m31.75 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 342ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 2872ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.00 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m24.00 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# tonightpass
|
|
2
2
|
|
|
3
|
+
## 0.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#248](https://github.com/tonightpass/tonightpass/pull/248) [`4f58bb8`](https://github.com/tonightpass/tonightpass/commit/4f58bb85cc530bed87ace1fb13e4afe34fb09d9e) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Improve organization members structure for invites
|
|
8
|
+
|
|
9
|
+
## 0.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`bc0b252`](https://github.com/tonightpass/tonightpass/commit/bc0b2527533944a433abc10e69a8dceeec773da2) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Update enums names
|
|
14
|
+
|
|
3
15
|
## 0.0.15
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -65,9 +65,9 @@ type UserIdentity = Profile & {
|
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
declare enum UserRole {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
User = "user",
|
|
69
|
+
Developer = "developer",
|
|
70
|
+
Admin = "admin"
|
|
71
71
|
}
|
|
72
72
|
type UserIdentityGender = "male" | "female" | "non-binary" | "gender-fluid" | "neutral" | "other" | string;
|
|
73
73
|
type UserPreferences = {
|
|
@@ -196,16 +196,20 @@ type EventTicket = {
|
|
|
196
196
|
};
|
|
197
197
|
type EventTicketType = "e-ticket" | "other";
|
|
198
198
|
declare enum EventTicketCategory {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
Entry = "entry",
|
|
200
|
+
Package = "package",
|
|
201
|
+
Meal = "meal",
|
|
202
|
+
Drink = "drink",
|
|
203
|
+
Parking = "parking",
|
|
204
|
+
Accommodation = "accommodation",
|
|
205
|
+
Camping = "camping",
|
|
206
|
+
Locker = "locker",
|
|
207
|
+
Shuttle = "shuttle",
|
|
208
|
+
Other = "other"
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class UpdateOrganizationMemberDto {
|
|
212
|
+
role: OrganizationMemberRole;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
type Organization = {
|
|
@@ -241,24 +245,28 @@ declare enum OrganizationSocialType {
|
|
|
241
245
|
Website = "website"
|
|
242
246
|
}
|
|
243
247
|
type OrganizationMember = {
|
|
244
|
-
|
|
248
|
+
organization: Organization;
|
|
245
249
|
role: OrganizationMemberRole;
|
|
246
250
|
status: OrganizationMemberStatus;
|
|
247
251
|
updatedAt: Date;
|
|
248
252
|
createdAt: Date;
|
|
249
|
-
}
|
|
253
|
+
} & ({
|
|
254
|
+
user: User;
|
|
255
|
+
} | {
|
|
256
|
+
token: UserToken;
|
|
257
|
+
});
|
|
250
258
|
declare enum OrganizationMemberStatus {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
259
|
+
Pending = "pending",
|
|
260
|
+
Accepted = "accepted",
|
|
261
|
+
Rejected = "rejected"
|
|
254
262
|
}
|
|
255
263
|
declare enum OrganizationMemberRole {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
264
|
+
Member = "member",
|
|
265
|
+
Manager = "manager",
|
|
266
|
+
Admin = "admin",
|
|
267
|
+
Owner = "owner"
|
|
260
268
|
}
|
|
261
|
-
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"
|
|
269
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]> | Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>;
|
|
262
270
|
|
|
263
271
|
type Event = {
|
|
264
272
|
title: string;
|
|
@@ -331,7 +339,11 @@ type UserToken = {
|
|
|
331
339
|
value: string;
|
|
332
340
|
createdAt: Date;
|
|
333
341
|
expiresAt: Date;
|
|
334
|
-
}
|
|
342
|
+
} & ({
|
|
343
|
+
user: User;
|
|
344
|
+
} | {
|
|
345
|
+
identifier: string;
|
|
346
|
+
});
|
|
335
347
|
declare enum UserTokenType {
|
|
336
348
|
Authentication = "authentication",
|
|
337
349
|
OrganizationInvite = "organization_invite",
|
|
@@ -553,6 +565,9 @@ declare class Client {
|
|
|
553
565
|
}> | Extract<Endpoint<"GET", "/organizations/members", OrganizationMember[]>, {
|
|
554
566
|
path: Path;
|
|
555
567
|
method: "GET";
|
|
568
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>, {
|
|
569
|
+
path: Path;
|
|
570
|
+
method: "GET";
|
|
556
571
|
}> | Extract<ProfileEndpoints, {
|
|
557
572
|
path: Path;
|
|
558
573
|
method: "GET";
|
|
@@ -598,6 +613,9 @@ declare class Client {
|
|
|
598
613
|
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
599
614
|
path: Path;
|
|
600
615
|
method: "POST";
|
|
616
|
+
}> | Extract<Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto>, {
|
|
617
|
+
path: Path;
|
|
618
|
+
method: "POST";
|
|
601
619
|
}>)["res"]>;
|
|
602
620
|
put<Path extends Extract<Endpoints, {
|
|
603
621
|
method: "PUT";
|
|
@@ -607,7 +625,7 @@ declare class Client {
|
|
|
607
625
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
608
626
|
path: Path;
|
|
609
627
|
method: "PUT";
|
|
610
|
-
}> | Extract<Endpoint<"PUT", "/organizations/members/:
|
|
628
|
+
}> | Extract<Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto>, {
|
|
611
629
|
path: Path;
|
|
612
630
|
method: "PUT";
|
|
613
631
|
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
@@ -625,7 +643,10 @@ declare class Client {
|
|
|
625
643
|
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
626
644
|
path: Path;
|
|
627
645
|
method: "DELETE";
|
|
628
|
-
}> | Extract<Endpoint<"DELETE", "/organizations/members/:id",
|
|
646
|
+
}> | Extract<Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>, {
|
|
647
|
+
path: Path;
|
|
648
|
+
method: "DELETE";
|
|
649
|
+
}> | Extract<Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>, {
|
|
629
650
|
path: Path;
|
|
630
651
|
method: "DELETE";
|
|
631
652
|
}>)["res"]>;
|
|
@@ -670,7 +691,7 @@ declare const organizations: (client: Client) => {
|
|
|
670
691
|
delete: (id: string) => Promise<boolean>;
|
|
671
692
|
members: {
|
|
672
693
|
getAll: () => Promise<OrganizationMember[]>;
|
|
673
|
-
delete: (id: string) => Promise<
|
|
694
|
+
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
674
695
|
};
|
|
675
696
|
};
|
|
676
697
|
|
|
@@ -725,7 +746,7 @@ declare class TonightPass {
|
|
|
725
746
|
delete: (id: string) => Promise<boolean>;
|
|
726
747
|
members: {
|
|
727
748
|
getAll: () => Promise<OrganizationMember[]>;
|
|
728
|
-
delete: (id: string) => Promise<
|
|
749
|
+
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
729
750
|
};
|
|
730
751
|
};
|
|
731
752
|
readonly profiles: {
|
|
@@ -747,4 +768,4 @@ declare class TonightPass {
|
|
|
747
768
|
|
|
748
769
|
declare const isBrowser: boolean;
|
|
749
770
|
|
|
750
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
|
771
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateOrganizationIdentityDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberDto, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.d.ts
CHANGED
|
@@ -65,9 +65,9 @@ type UserIdentity = Profile & {
|
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
67
|
declare enum UserRole {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
User = "user",
|
|
69
|
+
Developer = "developer",
|
|
70
|
+
Admin = "admin"
|
|
71
71
|
}
|
|
72
72
|
type UserIdentityGender = "male" | "female" | "non-binary" | "gender-fluid" | "neutral" | "other" | string;
|
|
73
73
|
type UserPreferences = {
|
|
@@ -196,16 +196,20 @@ type EventTicket = {
|
|
|
196
196
|
};
|
|
197
197
|
type EventTicketType = "e-ticket" | "other";
|
|
198
198
|
declare enum EventTicketCategory {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
Entry = "entry",
|
|
200
|
+
Package = "package",
|
|
201
|
+
Meal = "meal",
|
|
202
|
+
Drink = "drink",
|
|
203
|
+
Parking = "parking",
|
|
204
|
+
Accommodation = "accommodation",
|
|
205
|
+
Camping = "camping",
|
|
206
|
+
Locker = "locker",
|
|
207
|
+
Shuttle = "shuttle",
|
|
208
|
+
Other = "other"
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare class UpdateOrganizationMemberDto {
|
|
212
|
+
role: OrganizationMemberRole;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
215
|
type Organization = {
|
|
@@ -241,24 +245,28 @@ declare enum OrganizationSocialType {
|
|
|
241
245
|
Website = "website"
|
|
242
246
|
}
|
|
243
247
|
type OrganizationMember = {
|
|
244
|
-
|
|
248
|
+
organization: Organization;
|
|
245
249
|
role: OrganizationMemberRole;
|
|
246
250
|
status: OrganizationMemberStatus;
|
|
247
251
|
updatedAt: Date;
|
|
248
252
|
createdAt: Date;
|
|
249
|
-
}
|
|
253
|
+
} & ({
|
|
254
|
+
user: User;
|
|
255
|
+
} | {
|
|
256
|
+
token: UserToken;
|
|
257
|
+
});
|
|
250
258
|
declare enum OrganizationMemberStatus {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
259
|
+
Pending = "pending",
|
|
260
|
+
Accepted = "accepted",
|
|
261
|
+
Rejected = "rejected"
|
|
254
262
|
}
|
|
255
263
|
declare enum OrganizationMemberRole {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
264
|
+
Member = "member",
|
|
265
|
+
Manager = "manager",
|
|
266
|
+
Admin = "admin",
|
|
267
|
+
Owner = "owner"
|
|
260
268
|
}
|
|
261
|
-
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"
|
|
269
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]> | Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>;
|
|
262
270
|
|
|
263
271
|
type Event = {
|
|
264
272
|
title: string;
|
|
@@ -331,7 +339,11 @@ type UserToken = {
|
|
|
331
339
|
value: string;
|
|
332
340
|
createdAt: Date;
|
|
333
341
|
expiresAt: Date;
|
|
334
|
-
}
|
|
342
|
+
} & ({
|
|
343
|
+
user: User;
|
|
344
|
+
} | {
|
|
345
|
+
identifier: string;
|
|
346
|
+
});
|
|
335
347
|
declare enum UserTokenType {
|
|
336
348
|
Authentication = "authentication",
|
|
337
349
|
OrganizationInvite = "organization_invite",
|
|
@@ -553,6 +565,9 @@ declare class Client {
|
|
|
553
565
|
}> | Extract<Endpoint<"GET", "/organizations/members", OrganizationMember[]>, {
|
|
554
566
|
path: Path;
|
|
555
567
|
method: "GET";
|
|
568
|
+
}> | Extract<Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>, {
|
|
569
|
+
path: Path;
|
|
570
|
+
method: "GET";
|
|
556
571
|
}> | Extract<ProfileEndpoints, {
|
|
557
572
|
path: Path;
|
|
558
573
|
method: "GET";
|
|
@@ -598,6 +613,9 @@ declare class Client {
|
|
|
598
613
|
}> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
|
|
599
614
|
path: Path;
|
|
600
615
|
method: "POST";
|
|
616
|
+
}> | Extract<Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto>, {
|
|
617
|
+
path: Path;
|
|
618
|
+
method: "POST";
|
|
601
619
|
}>)["res"]>;
|
|
602
620
|
put<Path extends Extract<Endpoints, {
|
|
603
621
|
method: "PUT";
|
|
@@ -607,7 +625,7 @@ declare class Client {
|
|
|
607
625
|
}>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
|
|
608
626
|
path: Path;
|
|
609
627
|
method: "PUT";
|
|
610
|
-
}> | Extract<Endpoint<"PUT", "/organizations/members/:
|
|
628
|
+
}> | Extract<Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto>, {
|
|
611
629
|
path: Path;
|
|
612
630
|
method: "PUT";
|
|
613
631
|
}> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
|
|
@@ -625,7 +643,10 @@ declare class Client {
|
|
|
625
643
|
}>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
|
|
626
644
|
path: Path;
|
|
627
645
|
method: "DELETE";
|
|
628
|
-
}> | Extract<Endpoint<"DELETE", "/organizations/members/:id",
|
|
646
|
+
}> | Extract<Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>, {
|
|
647
|
+
path: Path;
|
|
648
|
+
method: "DELETE";
|
|
649
|
+
}> | Extract<Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>, {
|
|
629
650
|
path: Path;
|
|
630
651
|
method: "DELETE";
|
|
631
652
|
}>)["res"]>;
|
|
@@ -670,7 +691,7 @@ declare const organizations: (client: Client) => {
|
|
|
670
691
|
delete: (id: string) => Promise<boolean>;
|
|
671
692
|
members: {
|
|
672
693
|
getAll: () => Promise<OrganizationMember[]>;
|
|
673
|
-
delete: (id: string) => Promise<
|
|
694
|
+
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
674
695
|
};
|
|
675
696
|
};
|
|
676
697
|
|
|
@@ -725,7 +746,7 @@ declare class TonightPass {
|
|
|
725
746
|
delete: (id: string) => Promise<boolean>;
|
|
726
747
|
members: {
|
|
727
748
|
getAll: () => Promise<OrganizationMember[]>;
|
|
728
|
-
delete: (id: string) => Promise<
|
|
749
|
+
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
729
750
|
};
|
|
730
751
|
};
|
|
731
752
|
readonly profiles: {
|
|
@@ -747,4 +768,4 @@ declare class TonightPass {
|
|
|
747
768
|
|
|
748
769
|
declare const isBrowser: boolean;
|
|
749
770
|
|
|
750
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
|
771
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateOrganizationIdentityDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberDto, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.js
CHANGED
|
@@ -3,39 +3,41 @@
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
4
|
var classValidator = require('class-validator');
|
|
5
5
|
var classTransformer = require('class-transformer');
|
|
6
|
-
var
|
|
6
|
+
var he = require('redaxios');
|
|
7
7
|
var pathcat = require('pathcat');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var he__default = /*#__PURE__*/_interopDefault(he);
|
|
12
12
|
|
|
13
|
-
var ct=Object.defineProperty;var s=(t,e)=>ct(t,"name",{value:e,configurable:!0});var U="https://api.tonightpass.com";var At=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,It=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,j=/(^[\p{L}\d'\\.\s\\-]*$)/u,wt=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,_t=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Dt=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Nt=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;exports.EventTicketCategory = void 0;(function(t){t.ENTRY="entry",t.PACKAGE="package",t.MEAL="meal",t.DRINK="drink",t.PARKING="parking",t.ACCOMMODATION="accommodation",t.CAMPING="camping",t.LOCKER="locker",t.SHUTTLE="shuttle",t.OTHER="other";})(exports.EventTicketCategory||(exports.EventTicketCategory={}));exports.EventType = void 0;(function(t){t.Clubbing="clubbing",t.Concert="concert",t.Afterwork="afterwork",t.DancingLunch="dancing_lunch",t.Diner="diner",t.Garden="garden",t.AfterBeach="after_beach",t.Festival="festival",t.Spectacle="spectacle",t.Cruise="cruise",t.OutsideAnimation="outside_animation",t.Sport="sport",t.Match="match",t.Seminar="seminar",t.Conference="conference",t.WellnessDay="wellness_day",t.Workshop="workshop",t.TradeFair="trade_fair",t.ConsumerShow="consumer_show",t.Membership="membership";})(exports.EventType||(exports.EventType={}));exports.EventStyleType = void 0;(function(t){t.Music="music",t.Dress="dress",t.Sport="sport",t.Food="food",t.Art="art";})(exports.EventStyleType||(exports.EventStyleType={}));exports.OrganizationSocialType = void 0;(function(t){t.Facebook="facebook",t.Twitter="twitter",t.Instagram="instagram",t.Linkedin="linkedin",t.Youtube="youtube",t.Website="website";})(exports.OrganizationSocialType||(exports.OrganizationSocialType={}));exports.OrganizationMemberStatus = void 0;(function(t){t.PENDING="pending",t.ACCEPTED="accepted",t.REJECTED="rejected";})(exports.OrganizationMemberStatus||(exports.OrganizationMemberStatus={}));exports.OrganizationMemberRole = void 0;(function(t){t.MEMBER="member",t.MANAGER="manager",t.ADMINISTRATOR="admin",t.OWNER="owner";})(exports.OrganizationMemberRole||(exports.OrganizationMemberRole={}));exports.UserTokenType = void 0;(function(t){t.Authentication="authentication",t.OrganizationInvite="organization_invite",t.PasswordRecovery="password_recovery",t.EmailValidation="email_validation",t.PhoneValidation="phone_validation";})(exports.UserTokenType||(exports.UserTokenType={}));exports.UserRole = void 0;(function(t){t[t.USER=0]="USER",t[t.DEVELOPER=8]="DEVELOPER",t[t.ADMINISTRATOR=10]="ADMINISTRATOR";})(exports.UserRole||(exports.UserRole={}));exports.OrderStatus = void 0;(function(t){t.Created="created",t.Cancelled="cancelled",t.Completed="completed",t.Pending="pending",t.Confirmed="confirmed",t.Declined="declined",t.Refunded="refunded",t.PartiallyRefunded="partially_refunded",t.Expired="expired";})(exports.OrderStatus||(exports.OrderStatus={}));exports.Currency = void 0;(function(t){t.EUR="EUR",t.USD="USD",t.GBP="GBP";})(exports.Currency||(exports.Currency={}));exports.Language = void 0;(function(t){t.FR="fr",t.EN="en";})(exports.Language||(exports.Language={}));function f(t,e,o,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,r);else for(var u=t.length-1;u>=0;u--)(c=t[u])&&(i=(n<3?c(i):n>3?c(e,o,i):c(e,o))||i);return n>3&&i&&Object.defineProperty(e,o,i),i}s(f,"_ts_decorate");function m(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}s(m,"_ts_metadata");var g=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};f([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,128),m("design:type",String)],g.prototype,"slug",void 0);f([classValidator.IsObject(),m("design:type",typeof y>"u"?Object:y)],g.prototype,"identity",void 0);f([classValidator.IsArray(),m("design:type",Array)],g.prototype,"members",void 0);f([classValidator.IsOptional(),classValidator.IsObject(),m("design:type",typeof Location>"u"?Object:Location)],g.prototype,"location",void 0);var y=class{static{s(this,"CreateOrganizationIdentityDto");}displayName;description;avatarUrl;bannerUrl;socialLinks};f([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(1,32),m("design:type",String)],y.prototype,"displayName",void 0);f([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(16,1024),m("design:type",String)],y.prototype,"description",void 0);f([classValidator.IsUrl({protocols:["http","https"]}),m("design:type",String)],y.prototype,"avatarUrl",void 0);f([classValidator.IsOptional(),classValidator.IsUrl({protocols:["http","https"]}),m("design:type",String)],y.prototype,"bannerUrl",void 0);f([classValidator.IsOptional(),classValidator.IsArray(),m("design:type",Array)],y.prototype,"socialLinks",void 0);var W=class{static{s(this,"OrganizationMemberDto");}user;role};f([classValidator.IsString(),classValidator.IsNotEmpty(),m("design:type",String)],W.prototype,"user",void 0);f([classValidator.IsEnum(exports.OrganizationMemberRole),classValidator.IsNotEmpty(),m("design:type",typeof exports.OrganizationMemberRole>"u"?Object:exports.OrganizationMemberRole)],W.prototype,"role",void 0);var V=class extends g{static{s(this,"UpdateOrganizationDto");}};var K=class{static{s(this,"CreateUserDto");}identifier;password;identity;addresses};var Y=class{static{s(this,"SignInUserDto");}identifier;password};function a(t,e,o,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,r);else for(var u=t.length-1;u>=0;u--)(c=t[u])&&(i=(n<3?c(i):n>3?c(e,o,i):c(e,o))||i);return n>3&&i&&Object.defineProperty(e,o,i),i}s(a,"_ts_decorate");function p(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}s(p,"_ts_metadata");var A=class{static{s(this,"UpdateUserDto");}identifier;identity;password};a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>b),p("design:type",typeof b>"u"?Object:b)],A.prototype,"identifier",void 0);a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>l),p("design:type",typeof l>"u"?Object:l)],A.prototype,"identity",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130),p("design:type",String)],A.prototype,"password",void 0);var b=class{static{s(this,"UpdateIdentifierDto");}email;phoneNumber;username};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail(),p("design:type",String)],b.prototype,"email",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber(),p("design:type",String)],b.prototype,"phoneNumber",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3),p("design:type",String)],b.prototype,"username",void 0);var l=class{static{s(this,"UpdateIdentityDto");}firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(j,{message:"First name must be composed of letters only"}),p("design:type",String)],l.prototype,"firstName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(j,{message:"Last name must be composed of letters only"}),p("design:type",String)],l.prototype,"lastName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32),p("design:type",String)],l.prototype,"displayName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500),p("design:type",String)],l.prototype,"description",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],l.prototype,"avatarUrl",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],l.prototype,"bannerUrl",void 0);a([classValidator.IsOptional(),p("design:type",String)],l.prototype,"gender",void 0);a([classValidator.IsOptional(),classValidator.IsDateString(),p("design:type",typeof Date>"u"?Object:Date)],l.prototype,"birthDate",void 0);var O=typeof window<"u";var yt=ht__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!O&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:O}),ot=s(async(t,e)=>yt(t,{...e}).then(r=>r).catch(r=>{throw r.data}),"request");var v=class extends Error{static{s(this,"TonightPassAPIError");}response;data;status;constructor(e,o){super(o.message),this.response=e,this.data=o,this.status=e.status;}},N=class{static{s(this,"Client");}options;url;constructor(e){this.options=e,this.url=(o,r)=>{let n=this.options.baseURL||U;return pathcat.pathcat(n,o,r)};}setOptions(e){this.options=e;}async get(e,o,r){return this.requester("GET",e,void 0,o,r)}async post(e,o,r,n){return this.requester("POST",e,o,r,n)}async put(e,o,r,n){return this.requester("PUT",e,o,r,n)}async patch(e,o,r,n){return this.requester("PATCH",e,o,r,n)}async delete(e,o,r){return this.requester("DELETE",e,void 0,o,r)}async requester(e,o,r,n={},i={}){let c=this.url(o,n);if(r!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let u=await ot(c,{method:e,data:r,...i}),E=u.data;if(!E.success)throw new v(u,E);return E.data}};function R(t){return t}s(R,"sdk");var rt=t=>({signIn:async e=>t.post("/auth/sign-in",e),signUp:async e=>t.post("/auth/sign-up",e),signOut:async()=>t.post("/auth/sign-out",null),refreshToken:async()=>t.post("/auth/refresh-token",null)});var st=t=>({categories:{getAll:async e=>t.get("/careers/categories",e)},employmentTypes:{getAll:async e=>t.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>t.get("/careers/jobs",e),get:async e=>t.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>t.get("/careers/offices",e)}});var nt=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var it=t=>({getAll:async()=>t.get("/organizations"),get:async e=>t.get("/organizations/:id",{id:e}),create:async e=>t.post("/organizations",e),update:async(e,o)=>t.put("/organizations/:id",o,{id:e}),delete:async e=>t.delete("/organizations/:id",{id:e}),members:{getAll:async()=>t.get("/organizations/members"),delete:async e=>t.delete("/organizations/members/:id",{id:e})}});var at=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var pt=t=>({getAll:async()=>t.get("/users"),get:async e=>t.get("/users",{id:e}),me:async()=>t.get("/users/me"),check:async(e,o)=>t.get("/users/check/:identifier",{identifier:e,suggestions:o}),update:async(e,o)=>t.put("/users/:id",o,{id:e})});var dt=class{static{s(this,"TonightPass");}client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new N(e),this.auth=rt(this.client),this.careers=st(this.client),this.health=nt(this.client),this.organizations=it(this.client),this.profiles=at(this.client),this.users=pt(this.client);}};
|
|
13
|
+
var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var G="https://api.tonightpass.com";var _e=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,D=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,je=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,ve=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Ue=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;exports.EventTicketCategory = void 0;(function(e){e.Entry="entry",e.Package="package",e.Meal="meal",e.Drink="drink",e.Parking="parking",e.Accommodation="accommodation",e.Camping="camping",e.Locker="locker",e.Shuttle="shuttle",e.Other="other";})(exports.EventTicketCategory||(exports.EventTicketCategory={}));exports.EventType = void 0;(function(e){e.Clubbing="clubbing",e.Concert="concert",e.Afterwork="afterwork",e.DancingLunch="dancing_lunch",e.Diner="diner",e.Garden="garden",e.AfterBeach="after_beach",e.Festival="festival",e.Spectacle="spectacle",e.Cruise="cruise",e.OutsideAnimation="outside_animation",e.Sport="sport",e.Match="match",e.Seminar="seminar",e.Conference="conference",e.WellnessDay="wellness_day",e.Workshop="workshop",e.TradeFair="trade_fair",e.ConsumerShow="consumer_show",e.Membership="membership";})(exports.EventType||(exports.EventType={}));exports.EventStyleType = void 0;(function(e){e.Music="music",e.Dress="dress",e.Sport="sport",e.Food="food",e.Art="art";})(exports.EventStyleType||(exports.EventStyleType={}));exports.OrganizationSocialType = void 0;(function(e){e.Facebook="facebook",e.Twitter="twitter",e.Instagram="instagram",e.Linkedin="linkedin",e.Youtube="youtube",e.Website="website";})(exports.OrganizationSocialType||(exports.OrganizationSocialType={}));exports.OrganizationMemberStatus = void 0;(function(e){e.Pending="pending",e.Accepted="accepted",e.Rejected="rejected";})(exports.OrganizationMemberStatus||(exports.OrganizationMemberStatus={}));exports.OrganizationMemberRole = void 0;(function(e){e.Member="member",e.Manager="manager",e.Admin="admin",e.Owner="owner";})(exports.OrganizationMemberRole||(exports.OrganizationMemberRole={}));exports.UserTokenType = void 0;(function(e){e.Authentication="authentication",e.OrganizationInvite="organization_invite",e.PasswordRecovery="password_recovery",e.EmailValidation="email_validation",e.PhoneValidation="phone_validation";})(exports.UserTokenType||(exports.UserTokenType={}));exports.UserRole = void 0;(function(e){e.User="user",e.Developer="developer",e.Admin="admin";})(exports.UserRole||(exports.UserRole={}));exports.OrderStatus = void 0;(function(e){e.Created="created",e.Cancelled="cancelled",e.Completed="completed",e.Pending="pending",e.Confirmed="confirmed",e.Declined="declined",e.Refunded="refunded",e.PartiallyRefunded="partially_refunded",e.Expired="expired";})(exports.OrderStatus||(exports.OrderStatus={}));exports.Currency = void 0;(function(e){e.EUR="EUR",e.USD="USD",e.GBP="GBP";})(exports.Currency||(exports.Currency={}));exports.Language = void 0;(function(e){e.FR="fr",e.EN="en";})(exports.Language||(exports.Language={}));function f(e,t,o,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var u=e.length-1;u>=0;u--)(c=e[u])&&(i=(n<3?c(i):n>3?c(t,o,i):c(t,o))||i);return n>3&&i&&Object.defineProperty(t,o,i),i}s(f,"_ts_decorate");function m(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(m,"_ts_metadata");var h=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};f([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,128),m("design:type",String)],h.prototype,"slug",void 0);f([classValidator.IsObject(),m("design:type",typeof g>"u"?Object:g)],h.prototype,"identity",void 0);f([classValidator.IsArray(),m("design:type",Array)],h.prototype,"members",void 0);f([classValidator.IsOptional(),classValidator.IsObject(),m("design:type",typeof Location>"u"?Object:Location)],h.prototype,"location",void 0);var g=class{static{s(this,"CreateOrganizationIdentityDto");}displayName;description;avatarUrl;bannerUrl;socialLinks};f([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(1,32),m("design:type",String)],g.prototype,"displayName",void 0);f([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(16,1024),m("design:type",String)],g.prototype,"description",void 0);f([classValidator.IsUrl({protocols:["http","https"]}),m("design:type",String)],g.prototype,"avatarUrl",void 0);f([classValidator.IsOptional(),classValidator.IsUrl({protocols:["http","https"]}),m("design:type",String)],g.prototype,"bannerUrl",void 0);f([classValidator.IsOptional(),classValidator.IsArray(),m("design:type",Array)],g.prototype,"socialLinks",void 0);var A=class{static{s(this,"OrganizationMemberDto");}user;role};f([classValidator.IsString(),classValidator.IsNotEmpty(),m("design:type",String)],A.prototype,"user",void 0);f([classValidator.IsEnum(exports.OrganizationMemberRole),classValidator.IsNotEmpty(),m("design:type",typeof exports.OrganizationMemberRole>"u"?Object:exports.OrganizationMemberRole)],A.prototype,"role",void 0);var V=class extends h{static{s(this,"UpdateOrganizationDto");}};var Z=class{static{s(this,"CreateUserDto");}identifier;password;identity;addresses};var Y=class{static{s(this,"SignInUserDto");}identifier;password};function a(e,t,o,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var u=e.length-1;u>=0;u--)(c=e[u])&&(i=(n<3?c(i):n>3?c(t,o,i):c(t,o))||i);return n>3&&i&&Object.defineProperty(t,o,i),i}s(a,"_ts_decorate");function p(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(p,"_ts_metadata");var _=class{static{s(this,"UpdateUserDto");}identifier;identity;password};a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>b),p("design:type",typeof b>"u"?Object:b)],_.prototype,"identifier",void 0);a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>l),p("design:type",typeof l>"u"?Object:l)],_.prototype,"identity",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130),p("design:type",String)],_.prototype,"password",void 0);var b=class{static{s(this,"UpdateIdentifierDto");}email;phoneNumber;username};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail(),p("design:type",String)],b.prototype,"email",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber(),p("design:type",String)],b.prototype,"phoneNumber",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3),p("design:type",String)],b.prototype,"username",void 0);var l=class{static{s(this,"UpdateIdentityDto");}firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(D,{message:"First name must be composed of letters only"}),p("design:type",String)],l.prototype,"firstName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(D,{message:"Last name must be composed of letters only"}),p("design:type",String)],l.prototype,"lastName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32),p("design:type",String)],l.prototype,"displayName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500),p("design:type",String)],l.prototype,"description",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],l.prototype,"avatarUrl",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],l.prototype,"bannerUrl",void 0);a([classValidator.IsOptional(),p("design:type",String)],l.prototype,"gender",void 0);a([classValidator.IsOptional(),classValidator.IsDateString(),p("design:type",typeof Date>"u"?Object:Date)],l.prototype,"birthDate",void 0);var P=typeof window<"u";var xe=he__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!P&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:P}),oe=s(async(e,t)=>xe(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var S=class extends Error{static{s(this,"TonightPassAPIError");}response;data;status;constructor(t,o){super(o.message),this.response=t,this.data=o,this.status=t.status;}},I=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||G;return pathcat.pathcat(n,o,r)};}setOptions(t){this.options=t;}async get(t,o,r){return this.requester("GET",t,void 0,o,r)}async post(t,o,r,n){return this.requester("POST",t,o,r,n)}async put(t,o,r,n){return this.requester("PUT",t,o,r,n)}async patch(t,o,r,n){return this.requester("PATCH",t,o,r,n)}async delete(t,o,r){return this.requester("DELETE",t,void 0,o,r)}async requester(t,o,r,n={},i={}){let c=this.url(o,n);if(r!==void 0&&t==="GET")throw new Error("Cannot send a GET request with a body");let u=await oe(c,{method:t,data:r,...i}),L=u.data;if(!L.success)throw new S(u,L);return L.data}};function w(e){return e}s(w,"sdk");var re=e=>({signIn:async t=>e.post("/auth/sign-in",t),signUp:async t=>e.post("/auth/sign-up",t),signOut:async()=>e.post("/auth/sign-out",null),refreshToken:async()=>e.post("/auth/refresh-token",null)});var se=e=>({categories:{getAll:async t=>e.get("/careers/categories",t)},employmentTypes:{getAll:async t=>e.get("/careers/employmentTypes",t)},jobs:{getAll:async t=>e.get("/careers/jobs",t),get:async t=>e.get("/careers/jobs/:id",{id:t})},offices:{getAll:async t=>e.get("/careers/offices",t)}});var ne=e=>({database:async()=>e.get("/health/database"),http:async()=>e.get("/health/http")});var ie=e=>({getAll:async()=>e.get("/organizations"),get:async t=>e.get("/organizations/:id",{id:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:id",o,{id:t}),delete:async t=>e.delete("/organizations/:id",{id:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",{id:t})}});var ae=e=>({get:async t=>e.get("/profiles/:username",{username:t})});var pe=e=>({getAll:async()=>e.get("/users"),get:async t=>e.get("/users",{id:t}),me:async()=>e.get("/users/me"),check:async(t,o)=>e.get("/users/check/:identifier",{identifier:t,suggestions:o}),update:async(t,o)=>e.put("/users/:id",o,{id:t})});var de=class{static{s(this,"TonightPass");}client;auth;careers;health;organizations;profiles;users;constructor(t){this.client=new I(t),this.auth=re(this.client),this.careers=se(this.client),this.health=ne(this.client),this.organizations=ie(this.client),this.profiles=ae(this.client),this.users=pe(this.client);}};
|
|
14
14
|
|
|
15
|
-
exports.BCRYPT_HASH =
|
|
16
|
-
exports.Client =
|
|
17
|
-
exports.CreateOrganizationDto =
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
15
|
+
exports.BCRYPT_HASH = je;
|
|
16
|
+
exports.Client = I;
|
|
17
|
+
exports.CreateOrganizationDto = h;
|
|
18
|
+
exports.CreateOrganizationIdentityDto = g;
|
|
19
|
+
exports.CreateUserDto = Z;
|
|
20
|
+
exports.DEFAULT_API_URL = G;
|
|
21
|
+
exports.EMAIL_REGEX = _e;
|
|
22
|
+
exports.IMAGE_URL_REGEX = Ue;
|
|
23
|
+
exports.NAME_REGEX = D;
|
|
24
|
+
exports.OrganizationMemberDto = A;
|
|
25
|
+
exports.PASSWORD_REGEX = Ae;
|
|
26
|
+
exports.PHONE_NUMBER_REGEX = ve;
|
|
27
|
+
exports.SLUG_REGEX = Re;
|
|
26
28
|
exports.SignInUserDto = Y;
|
|
27
|
-
exports.TonightPass =
|
|
28
|
-
exports.TonightPassAPIError =
|
|
29
|
+
exports.TonightPass = de;
|
|
30
|
+
exports.TonightPassAPIError = S;
|
|
29
31
|
exports.UpdateOrganizationDto = V;
|
|
30
|
-
exports.UpdateUserDto =
|
|
31
|
-
exports.auth =
|
|
32
|
-
exports.careers =
|
|
33
|
-
exports.health =
|
|
34
|
-
exports.isBrowser =
|
|
35
|
-
exports.organizations =
|
|
36
|
-
exports.profiles =
|
|
37
|
-
exports.request =
|
|
38
|
-
exports.sdk =
|
|
39
|
-
exports.users =
|
|
32
|
+
exports.UpdateUserDto = _;
|
|
33
|
+
exports.auth = re;
|
|
34
|
+
exports.careers = se;
|
|
35
|
+
exports.health = ne;
|
|
36
|
+
exports.isBrowser = P;
|
|
37
|
+
exports.organizations = ie;
|
|
38
|
+
exports.profiles = ae;
|
|
39
|
+
exports.request = oe;
|
|
40
|
+
exports.sdk = w;
|
|
41
|
+
exports.users = pe;
|
|
40
42
|
//# sourceMappingURL=out.js.map
|
|
41
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,YAAAA,EACAC,SAAAA,EACAC,UAAAA,MACK,kCCeKC,EAAAA,mMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCAAC,EAAAA,2dAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBA6BAC,EAAAA,6EAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBClBAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAiBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,iFAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBClDAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCgCAC,EAAAA,yFAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCmBAC,EAAAA,uCAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAOAC,EAAAA,uBAAAA,IAAAA,EAAAA,CAAAA,EAAAA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AAKK,QAAUA,GAAQ,KAAKL,MAAM,EAClC,KAAKY,OAASA,GAAO,KAAKZ,MAAM,EAChC,KAAKe,cAAgBA,GAAc,KAAKf,MAAM,EAC9C,KAAKiB,SAAWA,GAAS,KAAKjB,MAAM,EACpC,KAAKkB,MAAQA,GAAM,KAAKlB,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsOptional,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n OrganizationMemberRole,\n type Location,\n type OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"PUT\", \"/organizations/members/:id\", OrganizationMember>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", { id }),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,YAAAA,EACAC,SAAAA,EACAC,UAAAA,MACK,kCCeKC,EAAAA,mMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCAAC,EAAAA,2dAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBA6BAC,EAAAA,6EAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCbAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAwBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,yEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCrDAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCuBAC,EAAAA,yDAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCmBAC,EAAAA,uCAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAOAC,EAAAA,uBAAAA,IAAAA,EAAAA,CAAAA,EAAAA,6dPbL,IAAMC,EAAN,KAAMA,OAAAA,CAAAA,EAAAA,8BAIXC,KAGAC,SAGAC,QAIAC,QACF,KAdGnB,EAAAA,EACAC,EAAAA,EACAE,EAAO,EAAG,GAAA,2BAHAY,EAAAA,UAAAA,OAAAA,MAAAA,KAMVhB,EAAAA,yBACSqB,EAAA,IAAA,OAAAA,CAAA,GAPCL,EAAAA,UAAAA,WAAAA,MAAAA,KASVnB,EAAAA,0BATUm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0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsOptional,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n OrganizationMemberRole,\n type Location,\n type OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nexport class CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nexport class OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n Entry = \"entry\",\n Package = \"package\",\n Meal = \"meal\",\n Drink = \"drink\",\n Parking = \"parking\",\n Accommodation = \"accommodation\",\n Camping = \"camping\",\n Locker = \"locker\",\n Shuttle = \"shuttle\",\n Other = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata, UserToken } from \"..\";\nimport {\n CreateOrganizationDto,\n OrganizationMemberDto,\n UpdateOrganizationDto,\n} from \"../../dtos\";\nimport { UpdateOrganizationMemberDto } from \"../../dtos/organizations/members/update-organization-member.dto\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n organization: Organization;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n} & (\n | {\n user: User;\n }\n | {\n token: UserToken;\n }\n);\n\nexport enum OrganizationMemberStatus {\n Pending = \"pending\",\n Accepted = \"accepted\",\n Rejected = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n Member = \"member\",\n Manager = \"manager\",\n Admin = \"admin\",\n Owner = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[]>\n | Endpoint<\"GET\", \"/organizations/:id/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:id/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationId/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationId/members/:userId\",\n OrganizationMember[]\n >;\n","import { User } from \"../users\";\n\nexport type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n} & (\n | {\n user: User;\n }\n | {\n identifier: string;\n }\n);\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n User = \"user\",\n Developer = \"developer\",\n Admin = \"admin\",\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", { id }),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { IsOptional, IsString, Length, IsObject, IsArray, IsNotEmpty, IsUrl, IsEnum, ValidateNested, MinLength, MaxLength, IsEmail, IsPhoneNumber, Matches, IsDateString } from 'class-validator';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
|
-
import
|
|
4
|
+
import he from 'redaxios';
|
|
5
5
|
import { pathcat } from 'pathcat';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var G="https://api.tonightpass.com";var _e=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,D=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,je=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,ve=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Ue=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var z;(function(e){e.Entry="entry",e.Package="package",e.Meal="meal",e.Drink="drink",e.Parking="parking",e.Accommodation="accommodation",e.Camping="camping",e.Locker="locker",e.Shuttle="shuttle",e.Other="other";})(z||(z={}));var O;(function(e){e.Clubbing="clubbing",e.Concert="concert",e.Afterwork="afterwork",e.DancingLunch="dancing_lunch",e.Diner="diner",e.Garden="garden",e.AfterBeach="after_beach",e.Festival="festival",e.Spectacle="spectacle",e.Cruise="cruise",e.OutsideAnimation="outside_animation",e.Sport="sport",e.Match="match",e.Seminar="seminar",e.Conference="conference",e.WellnessDay="wellness_day",e.Workshop="workshop",e.TradeFair="trade_fair",e.ConsumerShow="consumer_show",e.Membership="membership";})(O||(O={}));var M;(function(e){e.Music="music",e.Dress="dress",e.Sport="sport",e.Food="food",e.Art="art";})(M||(M={}));var k;(function(e){e.Facebook="facebook",e.Twitter="twitter",e.Instagram="instagram",e.Linkedin="linkedin",e.Youtube="youtube",e.Website="website";})(k||(k={}));var q;(function(e){e.Pending="pending",e.Accepted="accepted",e.Rejected="rejected";})(q||(q={}));var y;(function(e){e.Member="member",e.Manager="manager",e.Admin="admin",e.Owner="owner";})(y||(y={}));var E;(function(e){e.Authentication="authentication",e.OrganizationInvite="organization_invite",e.PasswordRecovery="password_recovery",e.EmailValidation="email_validation",e.PhoneValidation="phone_validation";})(E||(E={}));var F;(function(e){e.User="user",e.Developer="developer",e.Admin="admin";})(F||(F={}));var $;(function(e){e.Created="created",e.Cancelled="cancelled",e.Completed="completed",e.Pending="pending",e.Confirmed="confirmed",e.Declined="declined",e.Refunded="refunded",e.PartiallyRefunded="partially_refunded",e.Expired="expired";})($||($={}));var B;(function(e){e.EUR="EUR",e.USD="USD",e.GBP="GBP";})(B||(B={}));var X;(function(e){e.FR="fr",e.EN="en";})(X||(X={}));function f(e,t,o,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var u=e.length-1;u>=0;u--)(c=e[u])&&(i=(n<3?c(i):n>3?c(t,o,i):c(t,o))||i);return n>3&&i&&Object.defineProperty(t,o,i),i}s(f,"_ts_decorate");function m(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(m,"_ts_metadata");var h=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};f([IsOptional(),IsString(),Length(1,128),m("design:type",String)],h.prototype,"slug",void 0);f([IsObject(),m("design:type",typeof g>"u"?Object:g)],h.prototype,"identity",void 0);f([IsArray(),m("design:type",Array)],h.prototype,"members",void 0);f([IsOptional(),IsObject(),m("design:type",typeof Location>"u"?Object:Location)],h.prototype,"location",void 0);var g=class{static{s(this,"CreateOrganizationIdentityDto");}displayName;description;avatarUrl;bannerUrl;socialLinks};f([IsString(),IsNotEmpty(),Length(1,32),m("design:type",String)],g.prototype,"displayName",void 0);f([IsString(),IsNotEmpty(),Length(16,1024),m("design:type",String)],g.prototype,"description",void 0);f([IsUrl({protocols:["http","https"]}),m("design:type",String)],g.prototype,"avatarUrl",void 0);f([IsOptional(),IsUrl({protocols:["http","https"]}),m("design:type",String)],g.prototype,"bannerUrl",void 0);f([IsOptional(),IsArray(),m("design:type",Array)],g.prototype,"socialLinks",void 0);var A=class{static{s(this,"OrganizationMemberDto");}user;role};f([IsString(),IsNotEmpty(),m("design:type",String)],A.prototype,"user",void 0);f([IsEnum(y),IsNotEmpty(),m("design:type",typeof y>"u"?Object:y)],A.prototype,"role",void 0);var V=class extends h{static{s(this,"UpdateOrganizationDto");}};var Z=class{static{s(this,"CreateUserDto");}identifier;password;identity;addresses};var Y=class{static{s(this,"SignInUserDto");}identifier;password};function a(e,t,o,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var u=e.length-1;u>=0;u--)(c=e[u])&&(i=(n<3?c(i):n>3?c(t,o,i):c(t,o))||i);return n>3&&i&&Object.defineProperty(t,o,i),i}s(a,"_ts_decorate");function p(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(p,"_ts_metadata");var _=class{static{s(this,"UpdateUserDto");}identifier;identity;password};a([IsOptional(),IsObject(),ValidateNested(),Type(()=>b),p("design:type",typeof b>"u"?Object:b)],_.prototype,"identifier",void 0);a([IsOptional(),IsObject(),ValidateNested(),Type(()=>l),p("design:type",typeof l>"u"?Object:l)],_.prototype,"identity",void 0);a([IsOptional(),IsString(),MinLength(6),MaxLength(130),p("design:type",String)],_.prototype,"password",void 0);var b=class{static{s(this,"UpdateIdentifierDto");}email;phoneNumber;username};a([IsOptional(),IsString(),IsEmail(),p("design:type",String)],b.prototype,"email",void 0);a([IsOptional(),IsString(),IsPhoneNumber(),p("design:type",String)],b.prototype,"phoneNumber",void 0);a([IsOptional(),IsString(),MinLength(3),p("design:type",String)],b.prototype,"username",void 0);var l=class{static{s(this,"UpdateIdentityDto");}firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};a([IsOptional(),IsString(),Length(2,50),Matches(D,{message:"First name must be composed of letters only"}),p("design:type",String)],l.prototype,"firstName",void 0);a([IsOptional(),IsString(),Length(2,50),Matches(D,{message:"Last name must be composed of letters only"}),p("design:type",String)],l.prototype,"lastName",void 0);a([IsOptional(),IsString(),Length(1,32),p("design:type",String)],l.prototype,"displayName",void 0);a([IsOptional(),IsString(),Length(15,500),p("design:type",String)],l.prototype,"description",void 0);a([IsOptional(),IsUrl(),p("design:type",Object)],l.prototype,"avatarUrl",void 0);a([IsOptional(),IsUrl(),p("design:type",Object)],l.prototype,"bannerUrl",void 0);a([IsOptional(),p("design:type",String)],l.prototype,"gender",void 0);a([IsOptional(),IsDateString(),p("design:type",typeof Date>"u"?Object:Date)],l.prototype,"birthDate",void 0);var P=typeof window<"u";var xe=he.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!P&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:P}),oe=s(async(e,t)=>xe(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var S=class extends Error{static{s(this,"TonightPassAPIError");}response;data;status;constructor(t,o){super(o.message),this.response=t,this.data=o,this.status=t.status;}},I=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||G;return pathcat(n,o,r)};}setOptions(t){this.options=t;}async get(t,o,r){return this.requester("GET",t,void 0,o,r)}async post(t,o,r,n){return this.requester("POST",t,o,r,n)}async put(t,o,r,n){return this.requester("PUT",t,o,r,n)}async patch(t,o,r,n){return this.requester("PATCH",t,o,r,n)}async delete(t,o,r){return this.requester("DELETE",t,void 0,o,r)}async requester(t,o,r,n={},i={}){let c=this.url(o,n);if(r!==void 0&&t==="GET")throw new Error("Cannot send a GET request with a body");let u=await oe(c,{method:t,data:r,...i}),L=u.data;if(!L.success)throw new S(u,L);return L.data}};function w(e){return e}s(w,"sdk");var re=e=>({signIn:async t=>e.post("/auth/sign-in",t),signUp:async t=>e.post("/auth/sign-up",t),signOut:async()=>e.post("/auth/sign-out",null),refreshToken:async()=>e.post("/auth/refresh-token",null)});var se=e=>({categories:{getAll:async t=>e.get("/careers/categories",t)},employmentTypes:{getAll:async t=>e.get("/careers/employmentTypes",t)},jobs:{getAll:async t=>e.get("/careers/jobs",t),get:async t=>e.get("/careers/jobs/:id",{id:t})},offices:{getAll:async t=>e.get("/careers/offices",t)}});var ne=e=>({database:async()=>e.get("/health/database"),http:async()=>e.get("/health/http")});var ie=e=>({getAll:async()=>e.get("/organizations"),get:async t=>e.get("/organizations/:id",{id:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:id",o,{id:t}),delete:async t=>e.delete("/organizations/:id",{id:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",{id:t})}});var ae=e=>({get:async t=>e.get("/profiles/:username",{username:t})});var pe=e=>({getAll:async()=>e.get("/users"),get:async t=>e.get("/users",{id:t}),me:async()=>e.get("/users/me"),check:async(t,o)=>e.get("/users/check/:identifier",{identifier:t,suggestions:o}),update:async(t,o)=>e.put("/users/:id",o,{id:t})});var de=class{static{s(this,"TonightPass");}client;auth;careers;health;organizations;profiles;users;constructor(t){this.client=new I(t),this.auth=re(this.client),this.careers=se(this.client),this.health=ne(this.client),this.organizations=ie(this.client),this.profiles=ae(this.client),this.users=pe(this.client);}};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { je as BCRYPT_HASH, I as Client, h as CreateOrganizationDto, g as CreateOrganizationIdentityDto, Z as CreateUserDto, B as Currency, G as DEFAULT_API_URL, _e as EMAIL_REGEX, M as EventStyleType, z as EventTicketCategory, O as EventType, Ue as IMAGE_URL_REGEX, X as Language, D as NAME_REGEX, $ as OrderStatus, A as OrganizationMemberDto, y as OrganizationMemberRole, q as OrganizationMemberStatus, k as OrganizationSocialType, Ae as PASSWORD_REGEX, ve as PHONE_NUMBER_REGEX, Re as SLUG_REGEX, Y as SignInUserDto, de as TonightPass, S as TonightPassAPIError, V as UpdateOrganizationDto, _ as UpdateUserDto, F as UserRole, E as UserTokenType, re as auth, se as careers, ne as health, P as isBrowser, ie as organizations, ae as profiles, oe as request, w as sdk, pe as users };
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,YAAAA,EACAC,SAAAA,EACAC,UAAAA,MACK,kCCeKC,EAAAA,mMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCAAC,EAAAA,2dAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBA6BAC,EAAAA,6EAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBClBAC,EAAAA,mIAAAA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OzF,EAAoB0F,IAChCrB,EAAOf,IAAI,2BAA4B,CAAEtD,WAAAA,EAAY0F,YAAAA,CAAY,CAAA,EACnEL,OAAQ,MAAON,EAAY/C,IACzBqC,EAAOT,IAAI,aAAc5B,EAAM,CAAE+C,GAAAA,CAAG,CAAA,CACxC,GCRO,IAAMY,GAAN,KAAMA,CAHb,MAGaA,CAAAA,EAAAA,oBACKtB,OAEAD,KACAM,QACAO,OACAG,cACAE,SACAC,MAEhBvC,YAAYT,EAAwB,CAClC,KAAK8B,OAAS,IAAIpB,EAAOV,CAAAA,EAEzB,KAAK6B,KAAOA,GAAK,KAAKC,MAAM,EAC5B,KAAKK,QAAUA,GAAQ,KAAKL,MAAM,EAClC,KAAKY,OAASA,GAAO,KAAKZ,MAAM,EAChC,KAAKe,cAAgBA,GAAc,KAAKf,MAAM,EAC9C,KAAKiB,SAAWA,GAAS,KAAKjB,MAAM,EACpC,KAAKkB,MAAQA,GAAM,KAAKlB,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsOptional,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n OrganizationMemberRole,\n type Location,\n type OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"PUT\", \"/organizations/members/:id\", OrganizationMember>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", { id }),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,YAAAA,EACAC,SAAAA,EACAC,UAAAA,MACK,kCCeKC,EAAAA,mMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCAAC,EAAAA,2dAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBA6BAC,EAAAA,6EAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCbAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAwBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,yEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCrDAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCuBAC,EAAAA,yDAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAA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ACAC,MAEhBvC,YAAYT,EAAwB,CAClC,KAAK8B,OAAS,IAAIpB,EAAOV,CAAAA,EAEzB,KAAK6B,KAAOA,GAAK,KAAKC,MAAM,EAC5B,KAAKK,QAAUA,GAAQ,KAAKL,MAAM,EAClC,KAAKY,OAASA,GAAO,KAAKZ,MAAM,EAChC,KAAKe,cAAgBA,GAAc,KAAKf,MAAM,EAC9C,KAAKiB,SAAWA,GAAS,KAAKjB,MAAM,EACpC,KAAKkB,MAAQA,GAAM,KAAKlB,MAAM,CAChC,CACF","sourcesContent":["export const DEFAULT_API_URL = \"https://api.tonightpass.com\";\n","export const EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$/;\n\n// checks if a password has at least one uppercase letter and a number or special character\nexport const PASSWORD_REGEX =\n /((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/;\n\n// checks if a string has only letters, numbers, spaces, apostrophes, dots and dashes\nexport const NAME_REGEX = /(^[\\p{L}\\d'\\\\.\\s\\\\-]*$)/u;\n\n// checks if a string is a valid slug, useful for usernames\nexport const SLUG_REGEX = /^[a-z\\d]+(?:(\\.|-|_)[a-z\\d]+)*$/;\n\n// validates if passwords are valid bcrypt hashes\nexport const BCRYPT_HASH = /\\$2[abxy]?\\$\\d{1,2}\\$[A-Za-z\\d\\\\./]{53}/;\n\nexport const PHONE_NUMBER_REGEX =\n /^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$/;\n\nexport const IMAGE_URL_REGEX =\n /(((http:\\/\\/www)|(http:\\/\\/)|(www))[-a-zA-Z0-9@:%_\\\\+.~#?&//=]+)\\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;\n","import \"reflect-metadata\";\n\nexport * from \"./organizations\";\nexport * from \"./users\";\n","import {\n IsArray,\n IsEnum,\n IsNotEmpty,\n IsObject,\n IsOptional,\n IsString,\n IsUrl,\n Length,\n} from \"class-validator\";\n\nimport {\n OrganizationMemberRole,\n type Location,\n type OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nexport class CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nexport class OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n Entry = \"entry\",\n Package = \"package\",\n Meal = \"meal\",\n Drink = \"drink\",\n Parking = \"parking\",\n Accommodation = \"accommodation\",\n Camping = \"camping\",\n Locker = \"locker\",\n Shuttle = \"shuttle\",\n Other = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata, UserToken } from \"..\";\nimport {\n CreateOrganizationDto,\n OrganizationMemberDto,\n UpdateOrganizationDto,\n} from \"../../dtos\";\nimport { UpdateOrganizationMemberDto } from \"../../dtos/organizations/members/update-organization-member.dto\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n organization: Organization;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n} & (\n | {\n user: User;\n }\n | {\n token: UserToken;\n }\n);\n\nexport enum OrganizationMemberStatus {\n Pending = \"pending\",\n Accepted = \"accepted\",\n Rejected = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n Member = \"member\",\n Manager = \"manager\",\n Admin = \"admin\",\n Owner = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[]>\n | Endpoint<\"GET\", \"/organizations/:id/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:id/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationId/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationId/members/:userId\",\n OrganizationMember[]\n >;\n","import { User } from \"../users\";\n\nexport type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n} & (\n | {\n user: User;\n }\n | {\n identifier: string;\n }\n);\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n User = \"user\",\n Developer = \"developer\",\n Admin = \"admin\",\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", { id }),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tonightpass",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "@tonightpass sdk and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@anatine/esbuild-decorators": "^0.2.19",
|
|
25
|
-
"@types/node": "20.12.
|
|
25
|
+
"@types/node": "20.12.7",
|
|
26
26
|
"tsx": "^4.7.1",
|
|
27
27
|
"typescript": "^5.0.0"
|
|
28
28
|
},
|
|
@@ -32,7 +32,7 @@ export class CreateOrganizationDto {
|
|
|
32
32
|
location?: Location;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
class CreateOrganizationIdentityDto {
|
|
35
|
+
export class CreateOrganizationIdentityDto {
|
|
36
36
|
@IsString()
|
|
37
37
|
@IsNotEmpty()
|
|
38
38
|
@Length(1, 32)
|
|
@@ -59,7 +59,7 @@ class CreateOrganizationIdentityDto {
|
|
|
59
59
|
socialLinks?: OrganizationSocialLink[];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
class OrganizationMemberDto {
|
|
62
|
+
export class OrganizationMemberDto {
|
|
63
63
|
@IsString()
|
|
64
64
|
@IsNotEmpty()
|
|
65
65
|
user: string;
|
|
@@ -23,14 +23,14 @@ export type EventTicket = {
|
|
|
23
23
|
export type EventTicketType = "e-ticket" | "other";
|
|
24
24
|
|
|
25
25
|
export enum EventTicketCategory {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
Entry = "entry",
|
|
27
|
+
Package = "package",
|
|
28
|
+
Meal = "meal",
|
|
29
|
+
Drink = "drink",
|
|
30
|
+
Parking = "parking",
|
|
31
|
+
Accommodation = "accommodation",
|
|
32
|
+
Camping = "camping",
|
|
33
|
+
Locker = "locker",
|
|
34
|
+
Shuttle = "shuttle",
|
|
35
|
+
Other = "other",
|
|
36
36
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { Location, Profile, ProfileMetadata } from "..";
|
|
2
|
-
import {
|
|
1
|
+
import { Location, Profile, ProfileMetadata, UserToken } from "..";
|
|
2
|
+
import {
|
|
3
|
+
CreateOrganizationDto,
|
|
4
|
+
OrganizationMemberDto,
|
|
5
|
+
UpdateOrganizationDto,
|
|
6
|
+
} from "../../dtos";
|
|
7
|
+
import { UpdateOrganizationMemberDto } from "../../dtos/organizations/members/update-organization-member.dto";
|
|
3
8
|
import { Endpoint } from "../../endpoints";
|
|
4
9
|
import { Event } from "../event";
|
|
5
10
|
import { EventTicket } from "../event/ticket";
|
|
@@ -43,24 +48,31 @@ export enum OrganizationSocialType {
|
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
export type OrganizationMember = {
|
|
46
|
-
|
|
51
|
+
organization: Organization;
|
|
47
52
|
role: OrganizationMemberRole;
|
|
48
53
|
status: OrganizationMemberStatus;
|
|
49
54
|
updatedAt: Date;
|
|
50
55
|
createdAt: Date;
|
|
51
|
-
}
|
|
56
|
+
} & (
|
|
57
|
+
| {
|
|
58
|
+
user: User;
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
token: UserToken;
|
|
62
|
+
}
|
|
63
|
+
);
|
|
52
64
|
|
|
53
65
|
export enum OrganizationMemberStatus {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
Pending = "pending",
|
|
67
|
+
Accepted = "accepted",
|
|
68
|
+
Rejected = "rejected",
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
export enum OrganizationMemberRole {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
Member = "member",
|
|
73
|
+
Manager = "manager",
|
|
74
|
+
Admin = "admin",
|
|
75
|
+
Owner = "owner",
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
export type OrganizationEndpoints =
|
|
@@ -70,5 +82,22 @@ export type OrganizationEndpoints =
|
|
|
70
82
|
| Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>
|
|
71
83
|
| Endpoint<"DELETE", "/organizations/:id", boolean>
|
|
72
84
|
| Endpoint<"GET", "/organizations/members", OrganizationMember[]>
|
|
73
|
-
| Endpoint<"
|
|
74
|
-
| Endpoint<"
|
|
85
|
+
| Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>
|
|
86
|
+
| Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>
|
|
87
|
+
| Endpoint<
|
|
88
|
+
"POST",
|
|
89
|
+
"/organizations/:id/members",
|
|
90
|
+
OrganizationMember,
|
|
91
|
+
OrganizationMemberDto
|
|
92
|
+
>
|
|
93
|
+
| Endpoint<
|
|
94
|
+
"PUT",
|
|
95
|
+
"/organizations/:organizationId/members/:userId",
|
|
96
|
+
OrganizationMember,
|
|
97
|
+
UpdateOrganizationMemberDto
|
|
98
|
+
>
|
|
99
|
+
| Endpoint<
|
|
100
|
+
"DELETE",
|
|
101
|
+
"/organizations/:organizationId/members/:userId",
|
|
102
|
+
OrganizationMember[]
|
|
103
|
+
>;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { User } from "../users";
|
|
2
|
+
|
|
1
3
|
export type UserToken = {
|
|
2
4
|
id: string;
|
|
3
5
|
type: UserTokenType;
|
|
4
6
|
value: string;
|
|
5
7
|
createdAt: Date;
|
|
6
8
|
expiresAt: Date;
|
|
7
|
-
}
|
|
9
|
+
} & (
|
|
10
|
+
| {
|
|
11
|
+
user: User;
|
|
12
|
+
}
|
|
13
|
+
| {
|
|
14
|
+
identifier: string;
|
|
15
|
+
}
|
|
16
|
+
);
|
|
8
17
|
|
|
9
18
|
export enum UserTokenType {
|
|
10
19
|
Authentication = "authentication",
|