tonightpass 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > tonightpass@0.0.16 build /home/runner/work/tonightpass/tonightpass/packages/node
2
+ > tonightpass@0.0.18 build /home/runner/work/tonightpass/tonightpass/packages/node
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,13 +9,13 @@
9
9
  CLI Target: esnext
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/index.js 12.11 KB
13
- CJS dist/index.js.map 31.03 KB
14
- CJS ⚡️ Build success in 287ms
15
- ESM dist/index.mjs 10.37 KB
16
- ESM dist/index.mjs.map 31.03 KB
17
- ESM ⚡️ Build success in 287ms
12
+ ESM dist/index.mjs 10.46 KB
13
+ ESM dist/index.mjs.map 31.75 KB
14
+ ESM ⚡️ Build success in 354ms
15
+ CJS dist/index.js 12.22 KB
16
+ CJS dist/index.js.map 31.75 KB
17
+ CJS ⚡️ Build success in 356ms
18
18
  DTS Build start
19
- DTS ⚡️ Build success in 2463ms
20
- DTS dist/index.d.ts 22.97 KB
21
- DTS dist/index.d.mts 22.97 KB
19
+ DTS ⚡️ Build success in 2883ms
20
+ DTS dist/index.d.ts 24.90 KB
21
+ DTS dist/index.d.mts 24.90 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # tonightpass
2
2
 
3
+ ## 0.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9b2d618`](https://github.com/tonightpass/tonightpass/commit/9b2d61837809607233152c69dadc7861f5eed469) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add missing endpoints
8
+
9
+ ## 0.0.17
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
3
15
  ## 0.0.16
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -114,7 +114,7 @@ type UserEndpoints = Endpoint<"GET", "/users", User[]> | Endpoint<"GET", "/users
114
114
  suggestions?: boolean;
115
115
  }> | Endpoint<"PUT", "/users/:id", User, UpdateUserDto>;
116
116
 
117
- type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null>;
117
+ type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null> | Endpoint<"GET", "/oauth2/google", void> | Endpoint<"GET", "/oauth2/google/callback", void> | Endpoint<"GET", "/oauth2/twitter", void> | Endpoint<"GET", "/oauth2/twitter/callback", void>;
118
118
 
119
119
  type CareersOffice = {
120
120
  id: number | null;
@@ -208,6 +208,10 @@ declare enum EventTicketCategory {
208
208
  Other = "other"
209
209
  }
210
210
 
211
+ declare class UpdateOrganizationMemberDto {
212
+ role: OrganizationMemberRole;
213
+ }
214
+
211
215
  type Organization = {
212
216
  id: string;
213
217
  slug: string;
@@ -241,12 +245,13 @@ declare enum OrganizationSocialType {
241
245
  Website = "website"
242
246
  }
243
247
  type OrganizationMember = {
244
- user: User;
245
248
  organization: Organization;
246
249
  role: OrganizationMemberRole;
247
250
  status: OrganizationMemberStatus;
248
251
  updatedAt: Date;
249
252
  createdAt: Date;
253
+ user?: User;
254
+ token?: UserToken;
250
255
  };
251
256
  declare enum OrganizationMemberStatus {
252
257
  Pending = "pending",
@@ -259,7 +264,7 @@ declare enum OrganizationMemberRole {
259
264
  Admin = "admin",
260
265
  Owner = "owner"
261
266
  }
262
- 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<"PUT", "/organizations/members/:id", OrganizationMember> | Endpoint<"DELETE", "/organizations/members/:id", boolean>;
267
+ 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[]>;
263
268
 
264
269
  type Event = {
265
270
  title: string;
@@ -324,15 +329,16 @@ type Health<Key extends string> = {
324
329
  };
325
330
  };
326
331
  };
327
- type HealthEndpoints = Endpoint<"GET", "/health/database", Health<"database">> | Endpoint<"GET", "/health/http", Health<"app">>;
332
+ type HealthEndpoints = Endpoint<"GET", "/health", [Health<"app">, Health<"database">]> | Endpoint<"GET", "/health/database", Health<"database">> | Endpoint<"GET", "/health/http", Health<"app">>;
328
333
 
329
334
  type UserToken = {
330
335
  id: string;
331
- user: User;
332
336
  type: UserTokenType;
333
337
  value: string;
334
338
  createdAt: Date;
335
339
  expiresAt: Date;
340
+ user?: User;
341
+ identifier?: string;
336
342
  };
337
343
  declare enum UserTokenType {
338
344
  Authentication = "authentication",
@@ -502,7 +508,19 @@ declare class Client {
502
508
  readonly url: (path: string, params: Record<string, ParamValue>) => string;
503
509
  constructor(options: ClientOptions);
504
510
  setOptions(options: ClientOptions): void;
505
- get<Path extends PathsFor<"GET">>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"GET", "/careers/categories", CareersCategory[], {
511
+ get<Path extends PathsFor<"GET">>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"GET", "/oauth2/google", void>, {
512
+ path: Path;
513
+ method: "GET";
514
+ }> | Extract<Endpoint<"GET", "/oauth2/google/callback", void>, {
515
+ path: Path;
516
+ method: "GET";
517
+ }> | Extract<Endpoint<"GET", "/oauth2/twitter", void>, {
518
+ path: Path;
519
+ method: "GET";
520
+ }> | Extract<Endpoint<"GET", "/oauth2/twitter/callback", void>, {
521
+ path: Path;
522
+ method: "GET";
523
+ }> | Extract<Endpoint<"GET", "/careers/categories", CareersCategory[], {
506
524
  language?: string | undefined;
507
525
  }>, {
508
526
  path: Path;
@@ -540,6 +558,9 @@ declare class Client {
540
558
  }>, {
541
559
  path: Path;
542
560
  method: "GET";
561
+ }> | Extract<Endpoint<"GET", "/health", [Health<"app">, Health<"database">]>, {
562
+ path: Path;
563
+ method: "GET";
543
564
  }> | Extract<Endpoint<"GET", "/health/database", Health<"database">>, {
544
565
  path: Path;
545
566
  method: "GET";
@@ -555,6 +576,9 @@ declare class Client {
555
576
  }> | Extract<Endpoint<"GET", "/organizations/members", OrganizationMember[]>, {
556
577
  path: Path;
557
578
  method: "GET";
579
+ }> | Extract<Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>, {
580
+ path: Path;
581
+ method: "GET";
558
582
  }> | Extract<ProfileEndpoints, {
559
583
  path: Path;
560
584
  method: "GET";
@@ -600,6 +624,9 @@ declare class Client {
600
624
  }> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
601
625
  path: Path;
602
626
  method: "POST";
627
+ }> | Extract<Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto>, {
628
+ path: Path;
629
+ method: "POST";
603
630
  }>)["res"]>;
604
631
  put<Path extends Extract<Endpoints, {
605
632
  method: "PUT";
@@ -609,7 +636,7 @@ declare class Client {
609
636
  }>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
610
637
  path: Path;
611
638
  method: "PUT";
612
- }> | Extract<Endpoint<"PUT", "/organizations/members/:id", OrganizationMember>, {
639
+ }> | Extract<Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto>, {
613
640
  path: Path;
614
641
  method: "PUT";
615
642
  }> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
@@ -627,7 +654,10 @@ declare class Client {
627
654
  }>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
628
655
  path: Path;
629
656
  method: "DELETE";
630
- }> | Extract<Endpoint<"DELETE", "/organizations/members/:id", boolean>, {
657
+ }> | Extract<Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>, {
658
+ path: Path;
659
+ method: "DELETE";
660
+ }> | Extract<Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>, {
631
661
  path: Path;
632
662
  method: "DELETE";
633
663
  }>)["res"]>;
@@ -660,6 +690,7 @@ declare const careers: (client: Client) => {
660
690
  declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
661
691
 
662
692
  declare const health: (client: Client) => {
693
+ getAll: () => Promise<[Health<"app">, Health<"database">]>;
663
694
  database: () => Promise<Health<"database">>;
664
695
  http: () => Promise<Health<"app">>;
665
696
  };
@@ -672,7 +703,7 @@ declare const organizations: (client: Client) => {
672
703
  delete: (id: string) => Promise<boolean>;
673
704
  members: {
674
705
  getAll: () => Promise<OrganizationMember[]>;
675
- delete: (id: string) => Promise<boolean>;
706
+ delete: (id: string) => Promise<OrganizationMember[]>;
676
707
  };
677
708
  };
678
709
 
@@ -716,6 +747,7 @@ declare class TonightPass {
716
747
  };
717
748
  };
718
749
  readonly health: {
750
+ getAll: () => Promise<[Health<"app">, Health<"database">]>;
719
751
  database: () => Promise<Health<"database">>;
720
752
  http: () => Promise<Health<"app">>;
721
753
  };
@@ -727,7 +759,7 @@ declare class TonightPass {
727
759
  delete: (id: string) => Promise<boolean>;
728
760
  members: {
729
761
  getAll: () => Promise<OrganizationMember[]>;
730
- delete: (id: string) => Promise<boolean>;
762
+ delete: (id: string) => Promise<OrganizationMember[]>;
731
763
  };
732
764
  };
733
765
  readonly profiles: {
@@ -749,4 +781,4 @@ declare class TonightPass {
749
781
 
750
782
  declare const isBrowser: boolean;
751
783
 
752
- 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 };
784
+ 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
@@ -114,7 +114,7 @@ type UserEndpoints = Endpoint<"GET", "/users", User[]> | Endpoint<"GET", "/users
114
114
  suggestions?: boolean;
115
115
  }> | Endpoint<"PUT", "/users/:id", User, UpdateUserDto>;
116
116
 
117
- type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null>;
117
+ type AuthEndpoints = Endpoint<"POST", "/auth/sign-up", User, CreateUserDto> | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto> | Endpoint<"POST", "/auth/sign-out", null, null> | Endpoint<"POST", "/auth/refresh-token", null, null> | Endpoint<"GET", "/oauth2/google", void> | Endpoint<"GET", "/oauth2/google/callback", void> | Endpoint<"GET", "/oauth2/twitter", void> | Endpoint<"GET", "/oauth2/twitter/callback", void>;
118
118
 
119
119
  type CareersOffice = {
120
120
  id: number | null;
@@ -208,6 +208,10 @@ declare enum EventTicketCategory {
208
208
  Other = "other"
209
209
  }
210
210
 
211
+ declare class UpdateOrganizationMemberDto {
212
+ role: OrganizationMemberRole;
213
+ }
214
+
211
215
  type Organization = {
212
216
  id: string;
213
217
  slug: string;
@@ -241,12 +245,13 @@ declare enum OrganizationSocialType {
241
245
  Website = "website"
242
246
  }
243
247
  type OrganizationMember = {
244
- user: User;
245
248
  organization: Organization;
246
249
  role: OrganizationMemberRole;
247
250
  status: OrganizationMemberStatus;
248
251
  updatedAt: Date;
249
252
  createdAt: Date;
253
+ user?: User;
254
+ token?: UserToken;
250
255
  };
251
256
  declare enum OrganizationMemberStatus {
252
257
  Pending = "pending",
@@ -259,7 +264,7 @@ declare enum OrganizationMemberRole {
259
264
  Admin = "admin",
260
265
  Owner = "owner"
261
266
  }
262
- 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<"PUT", "/organizations/members/:id", OrganizationMember> | Endpoint<"DELETE", "/organizations/members/:id", boolean>;
267
+ 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[]>;
263
268
 
264
269
  type Event = {
265
270
  title: string;
@@ -324,15 +329,16 @@ type Health<Key extends string> = {
324
329
  };
325
330
  };
326
331
  };
327
- type HealthEndpoints = Endpoint<"GET", "/health/database", Health<"database">> | Endpoint<"GET", "/health/http", Health<"app">>;
332
+ type HealthEndpoints = Endpoint<"GET", "/health", [Health<"app">, Health<"database">]> | Endpoint<"GET", "/health/database", Health<"database">> | Endpoint<"GET", "/health/http", Health<"app">>;
328
333
 
329
334
  type UserToken = {
330
335
  id: string;
331
- user: User;
332
336
  type: UserTokenType;
333
337
  value: string;
334
338
  createdAt: Date;
335
339
  expiresAt: Date;
340
+ user?: User;
341
+ identifier?: string;
336
342
  };
337
343
  declare enum UserTokenType {
338
344
  Authentication = "authentication",
@@ -502,7 +508,19 @@ declare class Client {
502
508
  readonly url: (path: string, params: Record<string, ParamValue>) => string;
503
509
  constructor(options: ClientOptions);
504
510
  setOptions(options: ClientOptions): void;
505
- get<Path extends PathsFor<"GET">>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"GET", "/careers/categories", CareersCategory[], {
511
+ get<Path extends PathsFor<"GET">>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"GET", "/oauth2/google", void>, {
512
+ path: Path;
513
+ method: "GET";
514
+ }> | Extract<Endpoint<"GET", "/oauth2/google/callback", void>, {
515
+ path: Path;
516
+ method: "GET";
517
+ }> | Extract<Endpoint<"GET", "/oauth2/twitter", void>, {
518
+ path: Path;
519
+ method: "GET";
520
+ }> | Extract<Endpoint<"GET", "/oauth2/twitter/callback", void>, {
521
+ path: Path;
522
+ method: "GET";
523
+ }> | Extract<Endpoint<"GET", "/careers/categories", CareersCategory[], {
506
524
  language?: string | undefined;
507
525
  }>, {
508
526
  path: Path;
@@ -540,6 +558,9 @@ declare class Client {
540
558
  }>, {
541
559
  path: Path;
542
560
  method: "GET";
561
+ }> | Extract<Endpoint<"GET", "/health", [Health<"app">, Health<"database">]>, {
562
+ path: Path;
563
+ method: "GET";
543
564
  }> | Extract<Endpoint<"GET", "/health/database", Health<"database">>, {
544
565
  path: Path;
545
566
  method: "GET";
@@ -555,6 +576,9 @@ declare class Client {
555
576
  }> | Extract<Endpoint<"GET", "/organizations/members", OrganizationMember[]>, {
556
577
  path: Path;
557
578
  method: "GET";
579
+ }> | Extract<Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>, {
580
+ path: Path;
581
+ method: "GET";
558
582
  }> | Extract<ProfileEndpoints, {
559
583
  path: Path;
560
584
  method: "GET";
@@ -600,6 +624,9 @@ declare class Client {
600
624
  }> | Extract<Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto>, {
601
625
  path: Path;
602
626
  method: "POST";
627
+ }> | Extract<Endpoint<"POST", "/organizations/:id/members", OrganizationMember, OrganizationMemberDto>, {
628
+ path: Path;
629
+ method: "POST";
603
630
  }>)["res"]>;
604
631
  put<Path extends Extract<Endpoints, {
605
632
  method: "PUT";
@@ -609,7 +636,7 @@ declare class Client {
609
636
  }>["body"], query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>, {
610
637
  path: Path;
611
638
  method: "PUT";
612
- }> | Extract<Endpoint<"PUT", "/organizations/members/:id", OrganizationMember>, {
639
+ }> | Extract<Endpoint<"PUT", "/organizations/:organizationId/members/:userId", OrganizationMember, UpdateOrganizationMemberDto>, {
613
640
  path: Path;
614
641
  method: "PUT";
615
642
  }> | Extract<Endpoint<"PUT", "/users/:id", User, UpdateUserDto>, {
@@ -627,7 +654,10 @@ declare class Client {
627
654
  }>["path"]>(path: Path, query?: Query<Path>, options?: APIRequestOptions): Promise<(Extract<Endpoint<"DELETE", "/organizations/:id", boolean>, {
628
655
  path: Path;
629
656
  method: "DELETE";
630
- }> | Extract<Endpoint<"DELETE", "/organizations/members/:id", boolean>, {
657
+ }> | Extract<Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>, {
658
+ path: Path;
659
+ method: "DELETE";
660
+ }> | Extract<Endpoint<"DELETE", "/organizations/:organizationId/members/:userId", OrganizationMember[]>, {
631
661
  path: Path;
632
662
  method: "DELETE";
633
663
  }>)["res"]>;
@@ -660,6 +690,7 @@ declare const careers: (client: Client) => {
660
690
  declare function sdk<T>(builder: (client: Client) => T): (client: Client) => T;
661
691
 
662
692
  declare const health: (client: Client) => {
693
+ getAll: () => Promise<[Health<"app">, Health<"database">]>;
663
694
  database: () => Promise<Health<"database">>;
664
695
  http: () => Promise<Health<"app">>;
665
696
  };
@@ -672,7 +703,7 @@ declare const organizations: (client: Client) => {
672
703
  delete: (id: string) => Promise<boolean>;
673
704
  members: {
674
705
  getAll: () => Promise<OrganizationMember[]>;
675
- delete: (id: string) => Promise<boolean>;
706
+ delete: (id: string) => Promise<OrganizationMember[]>;
676
707
  };
677
708
  };
678
709
 
@@ -716,6 +747,7 @@ declare class TonightPass {
716
747
  };
717
748
  };
718
749
  readonly health: {
750
+ getAll: () => Promise<[Health<"app">, Health<"database">]>;
719
751
  database: () => Promise<Health<"database">>;
720
752
  http: () => Promise<Health<"app">>;
721
753
  };
@@ -727,7 +759,7 @@ declare class TonightPass {
727
759
  delete: (id: string) => Promise<boolean>;
728
760
  members: {
729
761
  getAll: () => Promise<OrganizationMember[]>;
730
- delete: (id: string) => Promise<boolean>;
762
+ delete: (id: string) => Promise<OrganizationMember[]>;
731
763
  };
732
764
  };
733
765
  readonly profiles: {
@@ -749,4 +781,4 @@ declare class TonightPass {
749
781
 
750
782
  declare const isBrowser: boolean;
751
783
 
752
- 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 };
784
+ 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
@@ -10,28 +10,30 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
11
  var he__default = /*#__PURE__*/_interopDefault(he);
12
12
 
13
- var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var z="https://api.tonightpass.com";var _e=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,U=/(^[\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*$/,De=/(((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 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 H=class{static{s(this,"OrganizationMemberDto");}user;role};f([classValidator.IsString(),classValidator.IsNotEmpty(),m("design:type",String)],H.prototype,"user",void 0);f([classValidator.IsEnum(exports.OrganizationMemberRole),classValidator.IsNotEmpty(),m("design:type",typeof exports.OrganizationMemberRole>"u"?Object:exports.OrganizationMemberRole)],H.prototype,"role",void 0);var V=class extends g{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(U,{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(U,{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 N=typeof window<"u";var ye=he__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!N&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:N}),oe=s(async(e,t)=>ye(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var P=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;}},D=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||z;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}),I=u.data;if(!I.success)throw new P(u,I);return I.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 D(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);}};
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=>({getAll:async()=>e.get("/health"),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
15
  exports.BCRYPT_HASH = je;
16
- exports.Client = D;
17
- exports.CreateOrganizationDto = g;
16
+ exports.Client = I;
17
+ exports.CreateOrganizationDto = h;
18
+ exports.CreateOrganizationIdentityDto = g;
18
19
  exports.CreateUserDto = Z;
19
- exports.DEFAULT_API_URL = z;
20
+ exports.DEFAULT_API_URL = G;
20
21
  exports.EMAIL_REGEX = _e;
21
- exports.IMAGE_URL_REGEX = De;
22
- exports.NAME_REGEX = U;
22
+ exports.IMAGE_URL_REGEX = Ue;
23
+ exports.NAME_REGEX = D;
24
+ exports.OrganizationMemberDto = A;
23
25
  exports.PASSWORD_REGEX = Ae;
24
26
  exports.PHONE_NUMBER_REGEX = ve;
25
27
  exports.SLUG_REGEX = Re;
26
28
  exports.SignInUserDto = Y;
27
29
  exports.TonightPass = de;
28
- exports.TonightPassAPIError = P;
30
+ exports.TonightPassAPIError = S;
29
31
  exports.UpdateOrganizationDto = V;
30
32
  exports.UpdateUserDto = _;
31
33
  exports.auth = re;
32
34
  exports.careers = se;
33
35
  exports.health = ne;
34
- exports.isBrowser = N;
36
+ exports.isBrowser = P;
35
37
  exports.organizations = ie;
36
38
  exports.profiles = ae;
37
39
  exports.request = oe;
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,EACA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ACjD,GCFO,IAAMsE,GAAalB,IAAY,CACpCO,OAAQ,SAAYP,EAAOf,IAAI,QAAA,EAC/BA,IAAK,MAAOyB,GAAeV,EAAOf,IAAI,SAAU,CAAEyB,GAAAA,CAAG,CAAA,EACrDS,GAAI,SAAYnB,EAAOf,IAAI,WAAA,EAC3BmC,MAAO,MAAOzF,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 organization: Organization;\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 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<\"PUT\", \"/organizations/members/:id\", OrganizationMember>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", boolean>;\n","import { User } from \"../users\";\n\nexport type UserToken = {\n id: string;\n user: User;\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 = \"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"]}
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,kBAmBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,E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tD,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\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 user?: User;\n token?: UserToken;\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 user?: User;\n identifier?: string;\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 getAll: async () => client.get(\"/health\"),\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
@@ -4,8 +4,8 @@ import { Type } from 'class-transformer';
4
4
  import he from 'redaxios';
5
5
  import { pathcat } from 'pathcat';
6
6
 
7
- var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var z="https://api.tonightpass.com";var _e=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,U=/(^[\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*$/,De=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var O;(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";})(O||(O={}));var S;(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";})(S||(S={}));var G;(function(e){e.Music="music",e.Dress="dress",e.Sport="sport",e.Food="food",e.Art="art";})(G||(G={}));var M;(function(e){e.Facebook="facebook",e.Twitter="twitter",e.Instagram="instagram",e.Linkedin="linkedin",e.Youtube="youtube",e.Website="website";})(M||(M={}));var k;(function(e){e.Pending="pending",e.Accepted="accepted",e.Rejected="rejected";})(k||(k={}));var x;(function(e){e.Member="member",e.Manager="manager",e.Admin="admin",e.Owner="owner";})(x||(x={}));var q;(function(e){e.Authentication="authentication",e.OrganizationInvite="organization_invite",e.PasswordRecovery="password_recovery",e.EmailValidation="email_validation",e.PhoneValidation="phone_validation";})(q||(q={}));var C;(function(e){e.User="user",e.Developer="developer",e.Admin="admin";})(C||(C={}));var E;(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";})(E||(E={}));var F;(function(e){e.EUR="EUR",e.USD="USD",e.GBP="GBP";})(F||(F={}));var $;(function(e){e.FR="fr",e.EN="en";})($||($={}));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 g=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};f([IsOptional(),IsString(),Length(1,128),m("design:type",String)],g.prototype,"slug",void 0);f([IsObject(),m("design:type",typeof y>"u"?Object:y)],g.prototype,"identity",void 0);f([IsArray(),m("design:type",Array)],g.prototype,"members",void 0);f([IsOptional(),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([IsString(),IsNotEmpty(),Length(1,32),m("design:type",String)],y.prototype,"displayName",void 0);f([IsString(),IsNotEmpty(),Length(16,1024),m("design:type",String)],y.prototype,"description",void 0);f([IsUrl({protocols:["http","https"]}),m("design:type",String)],y.prototype,"avatarUrl",void 0);f([IsOptional(),IsUrl({protocols:["http","https"]}),m("design:type",String)],y.prototype,"bannerUrl",void 0);f([IsOptional(),IsArray(),m("design:type",Array)],y.prototype,"socialLinks",void 0);var H=class{static{s(this,"OrganizationMemberDto");}user;role};f([IsString(),IsNotEmpty(),m("design:type",String)],H.prototype,"user",void 0);f([IsEnum(x),IsNotEmpty(),m("design:type",typeof x>"u"?Object:x)],H.prototype,"role",void 0);var V=class extends g{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(U,{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(U,{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 N=typeof window<"u";var ye=he.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!N&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:N}),oe=s(async(e,t)=>ye(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var P=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;}},D=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||z;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}),I=u.data;if(!I.success)throw new P(u,I);return I.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 D(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);}};
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=>({getAll:async()=>e.get("/health"),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 { je as BCRYPT_HASH, D as Client, g as CreateOrganizationDto, Z as CreateUserDto, F as Currency, z as DEFAULT_API_URL, _e as EMAIL_REGEX, G as EventStyleType, O as EventTicketCategory, S as EventType, De as IMAGE_URL_REGEX, $ as Language, U as NAME_REGEX, E as OrderStatus, x as OrganizationMemberRole, k as OrganizationMemberStatus, M as OrganizationSocialType, Ae as PASSWORD_REGEX, ve as PHONE_NUMBER_REGEX, Re as SLUG_REGEX, Y as SignInUserDto, de as TonightPass, P as TonightPassAPIError, V as UpdateOrganizationDto, _ as UpdateUserDto, C as UserRole, q as UserTokenType, re as auth, se as careers, ne as health, N as isBrowser, ie as organizations, ae as profiles, oe as request, w as sdk, pe as users };
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
@@ -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,G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Q,OAAQ,MAAOiB,GACbV,EAAOP,OAAO,6BAA8B,CAAEiB,GAAAA,CAAG,CAAA,CACrD,CACF,GCdO,IAAMO,GAAgBjB,IAAY,CACvCf,IAAK,MAAOrC,GACVoD,EAAOf,IAAI,sBAAuB,CAAErC,SAAAA,CAAS,CAAA,CACjD,GCFO,IAAMsE,GAAalB,IAAY,CACpCO,OAAQ,SAAYP,EAAOf,IAAI,QAAA,EAC/BA,IAAK,MAAOyB,GAAeV,EAAOf,IAAI,SAAU,CAAEyB,GAAAA,CAAG,CAAA,EACrDS,GAAI,SAAYnB,EAAOf,IAAI,WAAA,EAC3BmC,MAAO,MAAOzF,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 organization: Organization;\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 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<\"PUT\", \"/organizations/members/:id\", OrganizationMember>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", boolean>;\n","import { User } from \"../users\";\n\nexport type UserToken = {\n id: string;\n user: User;\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 = \"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"]}
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,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QAAA,EAC/BA,IAAK,MAAOyB,GAAeV,EAAOf,IAAI,SAAU,CAAEyB,GAAAA,CAAG,CAAA,EACrDS,GAAI,SAAYnB,EAAOf,IAAI,WAAA,EAC3BmC,MAAO,MAAOzF,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\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 user?: User;\n token?: UserToken;\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 user?: User;\n identifier?: string;\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 getAll: async () => client.get(\"/health\"),\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.16",
3
+ "version": "0.0.18",
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.6",
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;
@@ -0,0 +1,9 @@
1
+ import { IsEnum, IsNotEmpty } from "class-validator";
2
+
3
+ import { OrganizationMemberRole } from "../../../types";
4
+
5
+ export class UpdateOrganizationMemberDto {
6
+ @IsEnum(OrganizationMemberRole)
7
+ @IsNotEmpty()
8
+ role: OrganizationMemberRole;
9
+ }
@@ -6,4 +6,8 @@ export type AuthEndpoints =
6
6
  | Endpoint<"POST", "/auth/sign-up", User, CreateUserDto>
7
7
  | Endpoint<"POST", "/auth/sign-in", User, SignInUserDto>
8
8
  | Endpoint<"POST", "/auth/sign-out", null, null>
9
- | Endpoint<"POST", "/auth/refresh-token", null, null>;
9
+ | Endpoint<"POST", "/auth/refresh-token", null, null>
10
+ | Endpoint<"GET", "/oauth2/google", void>
11
+ | Endpoint<"GET", "/oauth2/google/callback", void>
12
+ | Endpoint<"GET", "/oauth2/twitter", void>
13
+ | Endpoint<"GET", "/oauth2/twitter/callback", void>;
@@ -13,5 +13,6 @@ export type Health<Key extends string> = {
13
13
  };
14
14
 
15
15
  export type HealthEndpoints =
16
+ | Endpoint<"GET", "/health", [Health<"app">, Health<"database">]>
16
17
  | Endpoint<"GET", "/health/database", Health<"database">>
17
18
  | Endpoint<"GET", "/health/http", Health<"app">>;
@@ -1,5 +1,10 @@
1
- import { Location, Profile, ProfileMetadata } from "..";
2
- import { CreateOrganizationDto, UpdateOrganizationDto } from "../../dtos";
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,12 +48,13 @@ export enum OrganizationSocialType {
43
48
  }
44
49
 
45
50
  export type OrganizationMember = {
46
- user: User;
47
51
  organization: Organization;
48
52
  role: OrganizationMemberRole;
49
53
  status: OrganizationMemberStatus;
50
54
  updatedAt: Date;
51
55
  createdAt: Date;
56
+ user?: User;
57
+ token?: UserToken;
52
58
  };
53
59
 
54
60
  export enum OrganizationMemberStatus {
@@ -71,5 +77,22 @@ export type OrganizationEndpoints =
71
77
  | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto>
72
78
  | Endpoint<"DELETE", "/organizations/:id", boolean>
73
79
  | Endpoint<"GET", "/organizations/members", OrganizationMember[]>
74
- | Endpoint<"PUT", "/organizations/members/:id", OrganizationMember>
75
- | Endpoint<"DELETE", "/organizations/members/:id", boolean>;
80
+ | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[]>
81
+ | Endpoint<"GET", "/organizations/:id/members", OrganizationMember[]>
82
+ | Endpoint<
83
+ "POST",
84
+ "/organizations/:id/members",
85
+ OrganizationMember,
86
+ OrganizationMemberDto
87
+ >
88
+ | Endpoint<
89
+ "PUT",
90
+ "/organizations/:organizationId/members/:userId",
91
+ OrganizationMember,
92
+ UpdateOrganizationMemberDto
93
+ >
94
+ | Endpoint<
95
+ "DELETE",
96
+ "/organizations/:organizationId/members/:userId",
97
+ OrganizationMember[]
98
+ >;
@@ -2,11 +2,12 @@ import { User } from "../users";
2
2
 
3
3
  export type UserToken = {
4
4
  id: string;
5
- user: User;
6
5
  type: UserTokenType;
7
6
  value: string;
8
7
  createdAt: Date;
9
8
  expiresAt: Date;
9
+ user?: User;
10
+ identifier?: string;
10
11
  };
11
12
 
12
13
  export enum UserTokenType {
package/src/sdk/health.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { sdk } from "./builder";
2
2
 
3
3
  export const health = sdk((client) => ({
4
+ getAll: async () => client.get("/health"),
4
5
  database: async () => client.get("/health/database"),
5
6
  http: async () => client.get("/health/http"),
6
7
  }));