tonightpass 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +37 -2
- package/dist/index.d.ts +37 -2
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/rest/types/organizations/index.ts +11 -1
- package/src/sdk/auth.ts +24 -0
- package/src/sdk/organizations.ts +26 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> tonightpass@0.0.
|
|
2
|
+
> tonightpass@0.0.24 build /home/runner/work/tonightpass/tonightpass/packages/node
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
[34mCLI[39m Target: esnext
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m11.19 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m34.56 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 422ms
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m12.94 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m34.56 KB[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 422ms
|
|
18
18
|
[34mDTS[39m Build start
|
|
19
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 4041ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m26.77 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m26.77 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# tonightpass
|
|
2
2
|
|
|
3
|
+
## 0.0.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6da4940`](https://github.com/tonightpass/tonightpass/commit/6da4940b7272bfbf2d4e1d9c309f7dfdd5542ddc) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add organization billing dashboard
|
|
8
|
+
|
|
9
|
+
## 0.0.23
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`994066c`](https://github.com/tonightpass/tonightpass/commit/994066c83c282d9645894366557bcaa276b23904) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Add oauth2 and organization billing to sdk
|
|
14
|
+
|
|
3
15
|
## 0.0.22
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as pathcat from 'pathcat';
|
|
2
2
|
import { ParamValue, Query } from 'pathcat';
|
|
3
3
|
export * from 'pathcat';
|
|
4
|
+
import * as stripe from 'stripe';
|
|
5
|
+
import stripe__default from 'stripe';
|
|
4
6
|
import { Options, Response } from 'redaxios';
|
|
5
7
|
|
|
6
8
|
declare const DEFAULT_API_URL = "https://api.tonightpass.com";
|
|
@@ -228,6 +230,7 @@ type Organization = {
|
|
|
228
230
|
type OrganizationBilling = {
|
|
229
231
|
account: string;
|
|
230
232
|
};
|
|
233
|
+
type OrganizationBillingAccount = stripe__default.Account;
|
|
231
234
|
type OrganizationIdentity = Profile & {
|
|
232
235
|
socialLinks: OrganizationSocialLink[];
|
|
233
236
|
metadata: ProfileMetadata & {
|
|
@@ -268,7 +271,7 @@ declare enum OrganizationMemberRole {
|
|
|
268
271
|
Admin = "admin",
|
|
269
272
|
Owner = "owner"
|
|
270
273
|
}
|
|
271
|
-
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:slug", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:slug", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:slug", boolean, null> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:slug/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationSlug/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationSlug/members/:userId", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/billing/link", void>;
|
|
274
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:slug", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:slug", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:slug", boolean, null> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:slug/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationSlug/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationSlug/members/:userId", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/billing/account", OrganizationBillingAccount> | Endpoint<"GET", "/organizations/:slug/billing/link", void> | Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>;
|
|
272
275
|
|
|
273
276
|
type Event = {
|
|
274
277
|
title: string;
|
|
@@ -583,9 +586,15 @@ declare class Client {
|
|
|
583
586
|
}> | Extract<Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]>, {
|
|
584
587
|
path: Path;
|
|
585
588
|
method: "GET";
|
|
589
|
+
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/account", stripe.Stripe.Account>, {
|
|
590
|
+
path: Path;
|
|
591
|
+
method: "GET";
|
|
586
592
|
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/link", void>, {
|
|
587
593
|
path: Path;
|
|
588
594
|
method: "GET";
|
|
595
|
+
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>, {
|
|
596
|
+
path: Path;
|
|
597
|
+
method: "GET";
|
|
589
598
|
}> | Extract<ProfileEndpoints, {
|
|
590
599
|
path: Path;
|
|
591
600
|
method: "GET";
|
|
@@ -679,6 +688,14 @@ declare const auth: (client: Client) => {
|
|
|
679
688
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
680
689
|
signOut: () => Promise<null>;
|
|
681
690
|
refreshToken: () => Promise<null>;
|
|
691
|
+
oauth2: {
|
|
692
|
+
google: {
|
|
693
|
+
connect: (params?: Record<string, ParamValue>) => void;
|
|
694
|
+
};
|
|
695
|
+
twitter: {
|
|
696
|
+
connect: (params?: Record<string, ParamValue>) => void;
|
|
697
|
+
};
|
|
698
|
+
};
|
|
682
699
|
};
|
|
683
700
|
|
|
684
701
|
declare const careers: (client: Client) => {
|
|
@@ -715,6 +732,11 @@ declare const organizations: (client: Client) => {
|
|
|
715
732
|
getAll: () => Promise<OrganizationMember[]>;
|
|
716
733
|
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
717
734
|
};
|
|
735
|
+
billing: {
|
|
736
|
+
account: (slug: string) => Promise<stripe.Stripe.Account>;
|
|
737
|
+
link: (slug: string) => void;
|
|
738
|
+
dashboard: (slug: string) => void;
|
|
739
|
+
};
|
|
718
740
|
};
|
|
719
741
|
|
|
720
742
|
declare const profiles: (client: Client) => {
|
|
@@ -740,6 +762,14 @@ declare class TonightPass {
|
|
|
740
762
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
741
763
|
signOut: () => Promise<null>;
|
|
742
764
|
refreshToken: () => Promise<null>;
|
|
765
|
+
oauth2: {
|
|
766
|
+
google: {
|
|
767
|
+
connect: (params?: Record<string, pathcat.ParamValue> | undefined) => void;
|
|
768
|
+
};
|
|
769
|
+
twitter: {
|
|
770
|
+
connect: (params?: Record<string, pathcat.ParamValue> | undefined) => void;
|
|
771
|
+
};
|
|
772
|
+
};
|
|
743
773
|
};
|
|
744
774
|
readonly careers: {
|
|
745
775
|
categories: {
|
|
@@ -771,6 +801,11 @@ declare class TonightPass {
|
|
|
771
801
|
getAll: () => Promise<OrganizationMember[]>;
|
|
772
802
|
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
773
803
|
};
|
|
804
|
+
billing: {
|
|
805
|
+
account: (slug: string) => Promise<stripe.Stripe.Account>;
|
|
806
|
+
link: (slug: string) => void;
|
|
807
|
+
dashboard: (slug: string) => void;
|
|
808
|
+
};
|
|
774
809
|
};
|
|
775
810
|
readonly profiles: {
|
|
776
811
|
get: (username: string) => Promise<UserIdentity | OrganizationIdentity>;
|
|
@@ -791,4 +826,4 @@ declare class TonightPass {
|
|
|
791
826
|
|
|
792
827
|
declare const isBrowser: boolean;
|
|
793
828
|
|
|
794
|
-
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 OrganizationBilling, 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 };
|
|
829
|
+
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 OrganizationBilling, type OrganizationBillingAccount, 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
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as pathcat from 'pathcat';
|
|
2
2
|
import { ParamValue, Query } from 'pathcat';
|
|
3
3
|
export * from 'pathcat';
|
|
4
|
+
import * as stripe from 'stripe';
|
|
5
|
+
import stripe__default from 'stripe';
|
|
4
6
|
import { Options, Response } from 'redaxios';
|
|
5
7
|
|
|
6
8
|
declare const DEFAULT_API_URL = "https://api.tonightpass.com";
|
|
@@ -228,6 +230,7 @@ type Organization = {
|
|
|
228
230
|
type OrganizationBilling = {
|
|
229
231
|
account: string;
|
|
230
232
|
};
|
|
233
|
+
type OrganizationBillingAccount = stripe__default.Account;
|
|
231
234
|
type OrganizationIdentity = Profile & {
|
|
232
235
|
socialLinks: OrganizationSocialLink[];
|
|
233
236
|
metadata: ProfileMetadata & {
|
|
@@ -268,7 +271,7 @@ declare enum OrganizationMemberRole {
|
|
|
268
271
|
Admin = "admin",
|
|
269
272
|
Owner = "owner"
|
|
270
273
|
}
|
|
271
|
-
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:slug", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:slug", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:slug", boolean, null> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:slug/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationSlug/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationSlug/members/:userId", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/billing/link", void>;
|
|
274
|
+
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:slug", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:slug", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:slug", boolean, null> | Endpoint<"GET", "/organizations/members", OrganizationMember[]> | Endpoint<"DELETE", "/organizations/members/:id", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]> | Endpoint<"POST", "/organizations/:slug/members", OrganizationMember, OrganizationMemberDto> | Endpoint<"PUT", "/organizations/:organizationSlug/members/:userId", OrganizationMember, UpdateOrganizationMemberDto> | Endpoint<"DELETE", "/organizations/:organizationSlug/members/:userId", OrganizationMember[], null> | Endpoint<"GET", "/organizations/:slug/billing/account", OrganizationBillingAccount> | Endpoint<"GET", "/organizations/:slug/billing/link", void> | Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>;
|
|
272
275
|
|
|
273
276
|
type Event = {
|
|
274
277
|
title: string;
|
|
@@ -583,9 +586,15 @@ declare class Client {
|
|
|
583
586
|
}> | Extract<Endpoint<"GET", "/organizations/:slug/members", OrganizationMember[]>, {
|
|
584
587
|
path: Path;
|
|
585
588
|
method: "GET";
|
|
589
|
+
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/account", stripe.Stripe.Account>, {
|
|
590
|
+
path: Path;
|
|
591
|
+
method: "GET";
|
|
586
592
|
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/link", void>, {
|
|
587
593
|
path: Path;
|
|
588
594
|
method: "GET";
|
|
595
|
+
}> | Extract<Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>, {
|
|
596
|
+
path: Path;
|
|
597
|
+
method: "GET";
|
|
589
598
|
}> | Extract<ProfileEndpoints, {
|
|
590
599
|
path: Path;
|
|
591
600
|
method: "GET";
|
|
@@ -679,6 +688,14 @@ declare const auth: (client: Client) => {
|
|
|
679
688
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
680
689
|
signOut: () => Promise<null>;
|
|
681
690
|
refreshToken: () => Promise<null>;
|
|
691
|
+
oauth2: {
|
|
692
|
+
google: {
|
|
693
|
+
connect: (params?: Record<string, ParamValue>) => void;
|
|
694
|
+
};
|
|
695
|
+
twitter: {
|
|
696
|
+
connect: (params?: Record<string, ParamValue>) => void;
|
|
697
|
+
};
|
|
698
|
+
};
|
|
682
699
|
};
|
|
683
700
|
|
|
684
701
|
declare const careers: (client: Client) => {
|
|
@@ -715,6 +732,11 @@ declare const organizations: (client: Client) => {
|
|
|
715
732
|
getAll: () => Promise<OrganizationMember[]>;
|
|
716
733
|
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
717
734
|
};
|
|
735
|
+
billing: {
|
|
736
|
+
account: (slug: string) => Promise<stripe.Stripe.Account>;
|
|
737
|
+
link: (slug: string) => void;
|
|
738
|
+
dashboard: (slug: string) => void;
|
|
739
|
+
};
|
|
718
740
|
};
|
|
719
741
|
|
|
720
742
|
declare const profiles: (client: Client) => {
|
|
@@ -740,6 +762,14 @@ declare class TonightPass {
|
|
|
740
762
|
signUp: (data: CreateUserDto) => Promise<User>;
|
|
741
763
|
signOut: () => Promise<null>;
|
|
742
764
|
refreshToken: () => Promise<null>;
|
|
765
|
+
oauth2: {
|
|
766
|
+
google: {
|
|
767
|
+
connect: (params?: Record<string, pathcat.ParamValue> | undefined) => void;
|
|
768
|
+
};
|
|
769
|
+
twitter: {
|
|
770
|
+
connect: (params?: Record<string, pathcat.ParamValue> | undefined) => void;
|
|
771
|
+
};
|
|
772
|
+
};
|
|
743
773
|
};
|
|
744
774
|
readonly careers: {
|
|
745
775
|
categories: {
|
|
@@ -771,6 +801,11 @@ declare class TonightPass {
|
|
|
771
801
|
getAll: () => Promise<OrganizationMember[]>;
|
|
772
802
|
delete: (id: string) => Promise<OrganizationMember[]>;
|
|
773
803
|
};
|
|
804
|
+
billing: {
|
|
805
|
+
account: (slug: string) => Promise<stripe.Stripe.Account>;
|
|
806
|
+
link: (slug: string) => void;
|
|
807
|
+
dashboard: (slug: string) => void;
|
|
808
|
+
};
|
|
774
809
|
};
|
|
775
810
|
readonly profiles: {
|
|
776
811
|
get: (username: string) => Promise<UserIdentity | OrganizationIdentity>;
|
|
@@ -791,4 +826,4 @@ declare class TonightPass {
|
|
|
791
826
|
|
|
792
827
|
declare const isBrowser: boolean;
|
|
793
828
|
|
|
794
|
-
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 OrganizationBilling, 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 };
|
|
829
|
+
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 OrganizationBilling, type OrganizationBillingAccount, 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,34 +10,34 @@ 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 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,n){return this.requester("DELETE",t,o,r,n)}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/:slug",{slug:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:slug",o,{slug:t}),delete:async t=>e.delete("/organizations/:slug",null,{slug:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",null,{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);}};
|
|
13
|
+
var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var S="https://api.tonightpass.com";var Ae=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,_e=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,N=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,ve=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,je=/^\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 l(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(l,"_ts_decorate");function f(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(f,"_ts_metadata");var y=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};l([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,128),f("design:type",String)],y.prototype,"slug",void 0);l([classValidator.IsObject(),f("design:type",typeof g>"u"?Object:g)],y.prototype,"identity",void 0);l([classValidator.IsArray(),f("design:type",Array)],y.prototype,"members",void 0);l([classValidator.IsOptional(),classValidator.IsObject(),f("design:type",typeof Location>"u"?Object:Location)],y.prototype,"location",void 0);var g=class{static{s(this,"CreateOrganizationIdentityDto");}displayName;description;avatarUrl;bannerUrl;socialLinks};l([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(1,32),f("design:type",String)],g.prototype,"displayName",void 0);l([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(16,1024),f("design:type",String)],g.prototype,"description",void 0);l([classValidator.IsUrl({protocols:["http","https"]}),f("design:type",String)],g.prototype,"avatarUrl",void 0);l([classValidator.IsOptional(),classValidator.IsUrl({protocols:["http","https"]}),f("design:type",String)],g.prototype,"bannerUrl",void 0);l([classValidator.IsOptional(),classValidator.IsArray(),f("design:type",Array)],g.prototype,"socialLinks",void 0);var R=class{static{s(this,"OrganizationMemberDto");}user;role};l([classValidator.IsString(),classValidator.IsNotEmpty(),f("design:type",String)],R.prototype,"user",void 0);l([classValidator.IsEnum(exports.OrganizationMemberRole),classValidator.IsNotEmpty(),f("design:type",typeof exports.OrganizationMemberRole>"u"?Object:exports.OrganizationMemberRole)],R.prototype,"role",void 0);var V=class extends y{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(()=>w),p("design:type",typeof w>"u"?Object:w)],_.prototype,"identifier",void 0);a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>m),p("design:type",typeof m>"u"?Object:m)],_.prototype,"identity",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130),p("design:type",String)],_.prototype,"password",void 0);var w=class{static{s(this,"UpdateIdentifierDto");}email;phoneNumber;username};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail(),p("design:type",String)],w.prototype,"email",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber(),p("design:type",String)],w.prototype,"phoneNumber",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3),p("design:type",String)],w.prototype,"username",void 0);var m=class{static{s(this,"UpdateIdentityDto");}firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(N,{message:"First name must be composed of letters only"}),p("design:type",String)],m.prototype,"firstName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(N,{message:"Last name must be composed of letters only"}),p("design:type",String)],m.prototype,"lastName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32),p("design:type",String)],m.prototype,"displayName",void 0);a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500),p("design:type",String)],m.prototype,"description",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],m.prototype,"avatarUrl",void 0);a([classValidator.IsOptional(),classValidator.IsUrl(),p("design:type",Object)],m.prototype,"bannerUrl",void 0);a([classValidator.IsOptional(),p("design:type",String)],m.prototype,"gender",void 0);a([classValidator.IsOptional(),classValidator.IsDateString(),p("design:type",typeof Date>"u"?Object:Date)],m.prototype,"birthDate",void 0);var h=typeof window<"u";var ye=he__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!h&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:h}),oe=s(async(e,t)=>ye(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var G=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;}},L=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||S;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,n){return this.requester("DELETE",t,o,r,n)}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}),D=u.data;if(!D.success)throw new G(u,D);return D.data}};function A(e){return e}s(A,"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),oauth2:{google:{connect:t=>{if(h)window.location.href=e.url("/oauth2/google",t||{});else throw new Error("Google OAuth2 is only available in the browser")}},twitter:{connect:t=>{if(h)window.location.href=e.url("/oauth2/twitter",t||{});else throw new Error("Twitter OAuth2 is only available in the browser")}}}});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/:slug",{slug:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:slug",o,{slug:t}),delete:async t=>e.delete("/organizations/:slug",null,{slug:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",null,{id:t})},billing:{account:async t=>e.get("/organizations/:slug/billing/account",{slug:t}),link:t=>{if(h)window.location.href=e.url("/organizations/:slug/billing/link",{slug:t});else throw new Error("Billing link is only available in the browser")},dashboard:t=>{if(h)window.location.href=e.url("/organizations/:slug/billing/dashboard",{slug:t});else throw new Error("Billing dashboard is only available in the browser")}}});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 L(t),this.auth=re(this.client),this.careers=se(this.client),this.health=ne(this.client),this.organizations=ie(this.client),this.profiles=ae(this.client),this.users=pe(this.client);}};
|
|
14
14
|
|
|
15
|
-
exports.BCRYPT_HASH =
|
|
16
|
-
exports.Client =
|
|
17
|
-
exports.CreateOrganizationDto =
|
|
15
|
+
exports.BCRYPT_HASH = ve;
|
|
16
|
+
exports.Client = L;
|
|
17
|
+
exports.CreateOrganizationDto = y;
|
|
18
18
|
exports.CreateOrganizationIdentityDto = g;
|
|
19
19
|
exports.CreateUserDto = Z;
|
|
20
|
-
exports.DEFAULT_API_URL =
|
|
21
|
-
exports.EMAIL_REGEX =
|
|
20
|
+
exports.DEFAULT_API_URL = S;
|
|
21
|
+
exports.EMAIL_REGEX = Ae;
|
|
22
22
|
exports.IMAGE_URL_REGEX = Ue;
|
|
23
|
-
exports.NAME_REGEX =
|
|
24
|
-
exports.OrganizationMemberDto =
|
|
25
|
-
exports.PASSWORD_REGEX =
|
|
26
|
-
exports.PHONE_NUMBER_REGEX =
|
|
23
|
+
exports.NAME_REGEX = N;
|
|
24
|
+
exports.OrganizationMemberDto = R;
|
|
25
|
+
exports.PASSWORD_REGEX = _e;
|
|
26
|
+
exports.PHONE_NUMBER_REGEX = je;
|
|
27
27
|
exports.SLUG_REGEX = Re;
|
|
28
28
|
exports.SignInUserDto = Y;
|
|
29
29
|
exports.TonightPass = de;
|
|
30
|
-
exports.TonightPassAPIError =
|
|
30
|
+
exports.TonightPassAPIError = G;
|
|
31
31
|
exports.UpdateOrganizationDto = V;
|
|
32
32
|
exports.UpdateUserDto = _;
|
|
33
33
|
exports.auth = re;
|
|
34
34
|
exports.careers = se;
|
|
35
35
|
exports.health = ne;
|
|
36
|
-
exports.isBrowser =
|
|
36
|
+
exports.isBrowser = h;
|
|
37
37
|
exports.organizations = ie;
|
|
38
38
|
exports.profiles = ae;
|
|
39
39
|
exports.request = oe;
|
|
40
|
-
exports.sdk =
|
|
40
|
+
exports.sdk = A;
|
|
41
41
|
exports.users = pe;
|
|
42
42
|
//# sourceMappingURL=out.js.map
|
|
43
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YA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fO,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\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 billing: OrganizationBilling;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationBilling = {\n account: string;\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/:slug\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:slug\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:slug\", boolean, null>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[], null>\n | Endpoint<\"GET\", \"/organizations/:slug/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:slug/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember[],\n null\n >\n | Endpoint<\"GET\", \"/organizations/:slug/billing/link\", void>;\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 body: Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, body, 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 (slug: string) => client.get(\"/organizations/:slug\", { slug }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (slug: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:slug\", data, { slug }),\n delete: async (slug: string) =>\n client.delete(\"/organizations/:slug\", null, { slug }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", null, { 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","oauth2","google","connect","href","twitter","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","billing","account","link","dashboard","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,kBCJAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAmBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,yEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC9DAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC4BAC,EAAAA,yDAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCmBAC,EAAAA,uCAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAOAC,EAAAA,uBAAAA,IAAAA,EAAAA,CAAAA,EAAAA,6dPbL,IAAMC,EAAN,KAAMA,OAAAA,CAAAA,EAAAA,8BAIXC,KAGAC,SAGAC,QAIAC,QACF,KAdGnB,EAAAA,EACAC,EAAAA,EACAE,EAAO,EAAG,GAAA,2BAHAY,EAAAA,UAAAA,OAAAA,MAAAA,KAMVhB,EAAAA,yBACSqB,EAAA,IAAA,OAAAA,CAAA,GAPCL,EAAAA,U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GAAa3B,IAAY,CACpCY,OAAQ,SAAYZ,EAAOf,IAAI,QAAA,EAC/BA,IAAK,MAAO8B,GAAef,EAAOf,IAAI,SAAU,CAAE8B,GAAAA,CAAG,CAAA,EACrDa,GAAI,SAAY5B,EAAOf,IAAI,WAAA,EAC3B4C,MAAO,MAAOlG,EAAoBmG,IAChC9B,EAAOf,IAAI,2BAA4B,CAAEtD,WAAAA,EAAYmG,YAAAA,CAAY,CAAA,EACnET,OAAQ,MAAON,EAAYpD,IACzBqC,EAAOT,IAAI,aAAc5B,EAAM,CAAEoD,GAAAA,CAAG,CAAA,CACxC,GCRO,IAAMgB,GAAN,KAAMA,CAHb,MAGaA,CAAAA,EAAAA,oBACK/B,OAEAD,KACAW,QACAO,OACAG,cACAM,SACAC,MAEhBhD,YAAYT,EAAwB,CAClC,KAAK8B,OAAS,IAAIpB,EAAOV,CAAAA,EAEzB,KAAK6B,KAAOA,GAAK,KAAKC,MAAM,EAC5B,KAAKU,QAAUA,GAAQ,KAAKV,MAAM,EAClC,KAAKiB,OAASA,GAAO,KAAKjB,MAAM,EAChC,KAAKoB,cAAgBA,GAAc,KAAKpB,MAAM,EAC9C,KAAK0B,SAAWA,GAAS,KAAK1B,MAAM,EACpC,KAAK2B,MAAQA,GAAM,KAAK3B,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 type Stripe from \"stripe\";\n\nimport { 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 billing: OrganizationBilling;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationBilling = {\n account: string;\n};\n\nexport type OrganizationBillingAccount = Stripe.Account;\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/:slug\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:slug\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:slug\", boolean, null>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[], null>\n | Endpoint<\"GET\", \"/organizations/:slug/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:slug/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember[],\n null\n >\n | Endpoint<\n \"GET\",\n \"/organizations/:slug/billing/account\",\n OrganizationBillingAccount\n >\n | Endpoint<\"GET\", \"/organizations/:slug/billing/link\", void>\n | Endpoint<\"GET\", \"/organizations/:slug/billing/dashboard\", void>;\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 body: Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, body, 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 { ParamValue } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\nimport { isBrowser } from \"../utils\";\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 oauth2: {\n google: {\n connect: (params?: Record<string, ParamValue>) => {\n if (isBrowser) {\n window.location.href = client.url(\"/oauth2/google\", params || {});\n } else {\n throw new Error(\"Google OAuth2 is only available in the browser\");\n }\n },\n },\n twitter: {\n connect: (params?: Record<string, ParamValue>) => {\n if (isBrowser) {\n window.location.href = client.url(\"/oauth2/twitter\", params || {});\n } else {\n throw new Error(\"Twitter OAuth2 is only available in the browser\");\n }\n },\n },\n },\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\";\nimport { isBrowser } from \"../utils\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (slug: string) => client.get(\"/organizations/:slug\", { slug }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (slug: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:slug\", data, { slug }),\n delete: async (slug: string) =>\n client.delete(\"/organizations/:slug\", null, { slug }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", null, { id }),\n },\n billing: {\n account: async (slug: string) =>\n client.get(\"/organizations/:slug/billing/account\", { slug }),\n link: (slug: string) => {\n if (isBrowser) {\n window.location.href = client.url(\"/organizations/:slug/billing/link\", {\n slug,\n });\n } else {\n throw new Error(\"Billing link is only available in the browser\");\n }\n },\n dashboard: (slug: string) => {\n if (isBrowser) {\n window.location.href = client.url(\n \"/organizations/:slug/billing/dashboard\",\n {\n slug,\n },\n );\n } else {\n throw new Error(\"Billing dashboard is only available in the browser\");\n }\n },\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 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,n){return this.requester("DELETE",t,o,r,n)}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/:slug",{slug:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:slug",o,{slug:t}),delete:async t=>e.delete("/organizations/:slug",null,{slug:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",null,{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);}};
|
|
7
|
+
var ce=Object.defineProperty;var s=(e,t)=>ce(e,"name",{value:t,configurable:!0});var S="https://api.tonightpass.com";var Ae=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,_e=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,N=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,ve=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,je=/^\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 k;(function(e){e.Music="music",e.Dress="dress",e.Sport="sport",e.Food="food",e.Art="art";})(k||(k={}));var E;(function(e){e.Facebook="facebook",e.Twitter="twitter",e.Instagram="instagram",e.Linkedin="linkedin",e.Youtube="youtube",e.Website="website";})(E||(E={}));var B;(function(e){e.Pending="pending",e.Accepted="accepted",e.Rejected="rejected";})(B||(B={}));var b;(function(e){e.Member="member",e.Manager="manager",e.Admin="admin",e.Owner="owner";})(b||(b={}));var M;(function(e){e.Authentication="authentication",e.OrganizationInvite="organization_invite",e.PasswordRecovery="password_recovery",e.EmailValidation="email_validation",e.PhoneValidation="phone_validation";})(M||(M={}));var q;(function(e){e.User="user",e.Developer="developer",e.Admin="admin";})(q||(q={}));var F;(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";})(F||(F={}));var $;(function(e){e.EUR="EUR",e.USD="USD",e.GBP="GBP";})($||($={}));var X;(function(e){e.FR="fr",e.EN="en";})(X||(X={}));function l(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(l,"_ts_decorate");function f(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}s(f,"_ts_metadata");var y=class{static{s(this,"CreateOrganizationDto");}slug;identity;members;location};l([IsOptional(),IsString(),Length(1,128),f("design:type",String)],y.prototype,"slug",void 0);l([IsObject(),f("design:type",typeof g>"u"?Object:g)],y.prototype,"identity",void 0);l([IsArray(),f("design:type",Array)],y.prototype,"members",void 0);l([IsOptional(),IsObject(),f("design:type",typeof Location>"u"?Object:Location)],y.prototype,"location",void 0);var g=class{static{s(this,"CreateOrganizationIdentityDto");}displayName;description;avatarUrl;bannerUrl;socialLinks};l([IsString(),IsNotEmpty(),Length(1,32),f("design:type",String)],g.prototype,"displayName",void 0);l([IsString(),IsNotEmpty(),Length(16,1024),f("design:type",String)],g.prototype,"description",void 0);l([IsUrl({protocols:["http","https"]}),f("design:type",String)],g.prototype,"avatarUrl",void 0);l([IsOptional(),IsUrl({protocols:["http","https"]}),f("design:type",String)],g.prototype,"bannerUrl",void 0);l([IsOptional(),IsArray(),f("design:type",Array)],g.prototype,"socialLinks",void 0);var R=class{static{s(this,"OrganizationMemberDto");}user;role};l([IsString(),IsNotEmpty(),f("design:type",String)],R.prototype,"user",void 0);l([IsEnum(b),IsNotEmpty(),f("design:type",typeof b>"u"?Object:b)],R.prototype,"role",void 0);var V=class extends y{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(()=>w),p("design:type",typeof w>"u"?Object:w)],_.prototype,"identifier",void 0);a([IsOptional(),IsObject(),ValidateNested(),Type(()=>m),p("design:type",typeof m>"u"?Object:m)],_.prototype,"identity",void 0);a([IsOptional(),IsString(),MinLength(6),MaxLength(130),p("design:type",String)],_.prototype,"password",void 0);var w=class{static{s(this,"UpdateIdentifierDto");}email;phoneNumber;username};a([IsOptional(),IsString(),IsEmail(),p("design:type",String)],w.prototype,"email",void 0);a([IsOptional(),IsString(),IsPhoneNumber(),p("design:type",String)],w.prototype,"phoneNumber",void 0);a([IsOptional(),IsString(),MinLength(3),p("design:type",String)],w.prototype,"username",void 0);var m=class{static{s(this,"UpdateIdentityDto");}firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};a([IsOptional(),IsString(),Length(2,50),Matches(N,{message:"First name must be composed of letters only"}),p("design:type",String)],m.prototype,"firstName",void 0);a([IsOptional(),IsString(),Length(2,50),Matches(N,{message:"Last name must be composed of letters only"}),p("design:type",String)],m.prototype,"lastName",void 0);a([IsOptional(),IsString(),Length(1,32),p("design:type",String)],m.prototype,"displayName",void 0);a([IsOptional(),IsString(),Length(15,500),p("design:type",String)],m.prototype,"description",void 0);a([IsOptional(),IsUrl(),p("design:type",Object)],m.prototype,"avatarUrl",void 0);a([IsOptional(),IsUrl(),p("design:type",Object)],m.prototype,"bannerUrl",void 0);a([IsOptional(),p("design:type",String)],m.prototype,"gender",void 0);a([IsOptional(),IsDateString(),p("design:type",typeof Date>"u"?Object:Date)],m.prototype,"birthDate",void 0);var h=typeof window<"u";var ye=he.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!h&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(e){return JSON.stringify(e)}],withCredentials:h}),oe=s(async(e,t)=>ye(e,{...t}).then(r=>r).catch(r=>{throw r.data}),"request");var G=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;}},L=class{static{s(this,"Client");}options;url;constructor(t){this.options=t,this.url=(o,r)=>{let n=this.options.baseURL||S;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,n){return this.requester("DELETE",t,o,r,n)}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}),D=u.data;if(!D.success)throw new G(u,D);return D.data}};function A(e){return e}s(A,"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),oauth2:{google:{connect:t=>{if(h)window.location.href=e.url("/oauth2/google",t||{});else throw new Error("Google OAuth2 is only available in the browser")}},twitter:{connect:t=>{if(h)window.location.href=e.url("/oauth2/twitter",t||{});else throw new Error("Twitter OAuth2 is only available in the browser")}}}});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/:slug",{slug:t}),create:async t=>e.post("/organizations",t),update:async(t,o)=>e.put("/organizations/:slug",o,{slug:t}),delete:async t=>e.delete("/organizations/:slug",null,{slug:t}),members:{getAll:async()=>e.get("/organizations/members"),delete:async t=>e.delete("/organizations/members/:id",null,{id:t})},billing:{account:async t=>e.get("/organizations/:slug/billing/account",{slug:t}),link:t=>{if(h)window.location.href=e.url("/organizations/:slug/billing/link",{slug:t});else throw new Error("Billing link is only available in the browser")},dashboard:t=>{if(h)window.location.href=e.url("/organizations/:slug/billing/dashboard",{slug:t});else throw new Error("Billing dashboard is only available in the browser")}}});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 L(t),this.auth=re(this.client),this.careers=se(this.client),this.health=ne(this.client),this.organizations=ie(this.client),this.profiles=ae(this.client),this.users=pe(this.client);}};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { ve as BCRYPT_HASH, L as Client, y as CreateOrganizationDto, g as CreateOrganizationIdentityDto, Z as CreateUserDto, $ as Currency, S as DEFAULT_API_URL, Ae as EMAIL_REGEX, k as EventStyleType, z as EventTicketCategory, O as EventType, Ue as IMAGE_URL_REGEX, X as Language, N as NAME_REGEX, F as OrderStatus, R as OrganizationMemberDto, b as OrganizationMemberRole, B as OrganizationMemberStatus, E as OrganizationSocialType, _e as PASSWORD_REGEX, je as PHONE_NUMBER_REGEX, Re as SLUG_REGEX, Y as SignInUserDto, de as TonightPass, G as TonightPassAPIError, V as UpdateOrganizationDto, _ as UpdateUserDto, q as UserRole, M as UserTokenType, re as auth, se as careers, ne as health, h as isBrowser, ie as organizations, ae as profiles, oe as request, A as sdk, pe as users };
|
|
10
10
|
//# sourceMappingURL=out.js.map
|
|
11
11
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants/api.ts","../src/constants/regex.ts","../src/rest/dtos/index.ts","../src/rest/dtos/organizations/create-organization.dto.ts","../src/rest/types/event/ticket/index.ts","../src/rest/types/event/index.ts","../src/rest/types/organizations/index.ts","../src/rest/types/token/index.ts","../src/rest/types/users/index.ts","../src/rest/types/order/index.ts","../src/rest/types/index.ts","../src/rest/dtos/organizations/update-organization.dto.ts","../src/rest/dtos/users/create-user.dto.ts","../src/rest/dtos/users/sign-in-user.dto.ts","../src/rest/dtos/users/update-user.dto.ts","../src/rest/request/request.ts","../src/utils/index.ts","../src/rest/client.ts","../src/sdk/builder.ts","../src/sdk/auth.ts","../src/sdk/careers.ts","../src/sdk/health.ts","../src/sdk/organizations.ts","../src/sdk/profiles.ts","../src/sdk/users.ts","../src/tonightpass.ts"],"names":["DEFAULT_API_URL","EMAIL_REGEX","PASSWORD_REGEX","NAME_REGEX","SLUG_REGEX","BCRYPT_HASH","PHONE_NUMBER_REGEX","IMAGE_URL_REGEX","IsArray","IsEnum","IsNotEmpty","IsObject","IsOptional","IsString","IsUrl","Length","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberStatus","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","CreateOrganizationDto","slug","identity","members","location","CreateOrganizationIdentityDto","displayName","description","avatarUrl","bannerUrl","socialLinks","protocols","OrganizationMemberDto","user","role","UpdateOrganizationDto","CreateUserDto","identifier","password","addresses","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","email","phoneNumber","username","firstName","lastName","gender","birthDate","message","axios","isBrowser","window","instance","create","headers","Accept","responseType","transformRequest","data","JSON","stringify","withCredentials","request","__name","url","options","then","response","catch","error","pathcat","TonightPassAPIError","Error","status","constructor","Client","path","params","baseURL","setOptions","get","query","requester","undefined","post","body","put","patch","delete","method","result","success","sdk","builder","auth","client","signIn","signUp","signOut","refreshToken","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","profiles","users","me","check","suggestions","TonightPass"],"mappings":"iFAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACEC,WAAAA,EACAC,UAAAA,GACAC,cAAAA,EACAC,YAAAA,EACAC,cAAAA,EACAC,YAAAA,EACAC,SAAAA,EACAC,UAAAA,MACK,kCCeKC,EAAAA,mMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCAAC,EAAAA,2dAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBA6BAC,EAAAA,6EAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCRAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAmBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,yEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC1DAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC4BAC,EAAAA,yDAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCmBAC,EAAAA,uCAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAOAC,EAAAA,uBAAAA,IAAAA,EAAAA,CAAAA,EAAAA,6dPbL,IAAMC,EAAN,KAAMA,OAAAA,CAAAA,EAAAA,8BAIXC,KAGAC,SAGAC,QAIAC,QACF,KAdGnB,EAAAA,EACAC,EAAAA,EACAE,EAAO,EAAG,GAAA,2BAHAY,EAAAA,UAAAA,OAAAA,MAAAA,KAMVhB,EAAAA,yBACSqB,EAAA,IAAA,OAAAA,CAAA,GAPCL,EAAAA,UAAAA,WAAAA,MAAAA,KASVnB,EAAAA,0BATUmB,EAAAA,UAAAA,UAAAA,MAAAA,KAYVf,EAAAA,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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 billing: OrganizationBilling;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationBilling = {\n account: string;\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/:slug\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:slug\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:slug\", boolean, null>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[], null>\n | Endpoint<\"GET\", \"/organizations/:slug/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:slug/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember[],\n null\n >\n | Endpoint<\"GET\", \"/organizations/:slug/billing/link\", void>;\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 body: Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, body, 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 (slug: string) => client.get(\"/organizations/:slug\", { slug }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (slug: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:slug\", data, { slug }),\n delete: async (slug: string) =>\n client.delete(\"/organizations/:slug\", null, { slug }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", null, { 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","oauth2","google","connect","href","twitter","careers","categories","getAll","employmentTypes","jobs","id","offices","health","database","http","organizations","update","billing","account","link","dashboard","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,kBCJAC,EAAAA,mIAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAmBAC,EAAAA,mEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAMAC,EAAAA,yEAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC9DAC,EAAAA,iMAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBC4BAC,EAAAA,yDAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCpCAC,EAAAA,4NAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBCmBAC,EAAAA,uCAAAA,IAAAA,EAAAA,CAAAA,EAAAA,kBAOAC,EAAAA,uBAAAA,IAAAA,EAAAA,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FC,OAAOtC,SAAS0F,KAAOR,EAAO/B,IAC5B,yCACA,CACEtD,KAAAA,CACF,CAAA,MAGF,OAAM,IAAI8D,MAAM,oDAAA,CAEpB,CACF,CACF,GCzCO,IAAMiD,GAAgB1B,IAAY,CACvCf,IAAK,MAAOrC,GACVoD,EAAOf,IAAI,sBAAuB,CAAErC,SAAAA,CAAS,CAAA,CACjD,GCFO,IAAM+E,GAAa3B,IAAY,CACpCY,OAAQ,SAAYZ,EAAOf,IAAI,QAAA,EAC/BA,IAAK,MAAO8B,GAAef,EAAOf,IAAI,SAAU,CAAE8B,GAAAA,CAAG,CAAA,EACrDa,GAAI,SAAY5B,EAAOf,IAAI,WAAA,EAC3B4C,MAAO,MAAOlG,EAAoBmG,IAChC9B,EAAOf,IAAI,2BAA4B,CAAEtD,WAAAA,EAAYmG,YAAAA,CAAY,CAAA,EACnET,OAAQ,MAAON,EAAYpD,IACzBqC,EAAOT,IAAI,aAAc5B,EAAM,CAAEoD,GAAAA,CAAG,CAAA,CACxC,GCRO,IAAMgB,GAAN,KAAMA,CAHb,MAGaA,CAAAA,EAAAA,oBACK/B,OAEAD,KACAW,QACAO,OACAG,cACAM,SACAC,MAEhBhD,YAAYT,EAAwB,CAClC,KAAK8B,OAAS,IAAIpB,EAAOV,CAAAA,EAEzB,KAAK6B,KAAOA,GAAK,KAAKC,MAAM,EAC5B,KAAKU,QAAUA,GAAQ,KAAKV,MAAM,EAClC,KAAKiB,OAASA,GAAO,KAAKjB,MAAM,EAChC,KAAKoB,cAAgBA,GAAc,KAAKpB,MAAM,EAC9C,KAAK0B,SAAWA,GAAS,KAAK1B,MAAM,EACpC,KAAK2B,MAAQA,GAAM,KAAK3B,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 type Stripe from \"stripe\";\n\nimport { 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 billing: OrganizationBilling;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationBilling = {\n account: string;\n};\n\nexport type OrganizationBillingAccount = Stripe.Account;\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/:slug\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:slug\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:slug\", boolean, null>\n | Endpoint<\"GET\", \"/organizations/members\", OrganizationMember[]>\n | Endpoint<\"DELETE\", \"/organizations/members/:id\", OrganizationMember[], null>\n | Endpoint<\"GET\", \"/organizations/:slug/members\", OrganizationMember[]>\n | Endpoint<\n \"POST\",\n \"/organizations/:slug/members\",\n OrganizationMember,\n OrganizationMemberDto\n >\n | Endpoint<\n \"PUT\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember,\n UpdateOrganizationMemberDto\n >\n | Endpoint<\n \"DELETE\",\n \"/organizations/:organizationSlug/members/:userId\",\n OrganizationMember[],\n null\n >\n | Endpoint<\n \"GET\",\n \"/organizations/:slug/billing/account\",\n OrganizationBillingAccount\n >\n | Endpoint<\"GET\", \"/organizations/:slug/billing/link\", void>\n | Endpoint<\"GET\", \"/organizations/:slug/billing/dashboard\", void>;\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 body: Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, body, 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 { ParamValue } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\nimport { isBrowser } from \"../utils\";\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 oauth2: {\n google: {\n connect: (params?: Record<string, ParamValue>) => {\n if (isBrowser) {\n window.location.href = client.url(\"/oauth2/google\", params || {});\n } else {\n throw new Error(\"Google OAuth2 is only available in the browser\");\n }\n },\n },\n twitter: {\n connect: (params?: Record<string, ParamValue>) => {\n if (isBrowser) {\n window.location.href = client.url(\"/oauth2/twitter\", params || {});\n } else {\n throw new Error(\"Twitter OAuth2 is only available in the browser\");\n }\n },\n },\n },\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\";\nimport { isBrowser } from \"../utils\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (slug: string) => client.get(\"/organizations/:slug\", { slug }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (slug: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:slug\", data, { slug }),\n delete: async (slug: string) =>\n client.delete(\"/organizations/:slug\", null, { slug }),\n members: {\n getAll: async () => client.get(\"/organizations/members\"),\n delete: async (id: string) =>\n client.delete(\"/organizations/members/:id\", null, { id }),\n },\n billing: {\n account: async (slug: string) =>\n client.get(\"/organizations/:slug/billing/account\", { slug }),\n link: (slug: string) => {\n if (isBrowser) {\n window.location.href = client.url(\"/organizations/:slug/billing/link\", {\n slug,\n });\n } else {\n throw new Error(\"Billing link is only available in the browser\");\n }\n },\n dashboard: (slug: string) => {\n if (isBrowser) {\n window.location.href = client.url(\n \"/organizations/:slug/billing/dashboard\",\n {\n slug,\n },\n );\n } else {\n throw new Error(\"Billing dashboard is only available in the browser\");\n }\n },\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tonightpass",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "@tonightpass sdk and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"class-validator": "^0.14.0",
|
|
19
19
|
"pathcat": "^1.2.2",
|
|
20
20
|
"redaxios": "^0.5.1",
|
|
21
|
-
"reflect-metadata": "^0.2.1"
|
|
21
|
+
"reflect-metadata": "^0.2.1",
|
|
22
|
+
"stripe": "^15.3.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@anatine/esbuild-decorators": "^0.2.19",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
|
|
1
3
|
import { Location, Profile, ProfileMetadata, UserToken } from "..";
|
|
2
4
|
import {
|
|
3
5
|
CreateOrganizationDto,
|
|
@@ -28,6 +30,8 @@ export type OrganizationBilling = {
|
|
|
28
30
|
account: string;
|
|
29
31
|
};
|
|
30
32
|
|
|
33
|
+
export type OrganizationBillingAccount = Stripe.Account;
|
|
34
|
+
|
|
31
35
|
export type OrganizationIdentity = Profile & {
|
|
32
36
|
socialLinks: OrganizationSocialLink[];
|
|
33
37
|
|
|
@@ -102,4 +106,10 @@ export type OrganizationEndpoints =
|
|
|
102
106
|
OrganizationMember[],
|
|
103
107
|
null
|
|
104
108
|
>
|
|
105
|
-
| Endpoint<
|
|
109
|
+
| Endpoint<
|
|
110
|
+
"GET",
|
|
111
|
+
"/organizations/:slug/billing/account",
|
|
112
|
+
OrganizationBillingAccount
|
|
113
|
+
>
|
|
114
|
+
| Endpoint<"GET", "/organizations/:slug/billing/link", void>
|
|
115
|
+
| Endpoint<"GET", "/organizations/:slug/billing/dashboard", void>;
|
package/src/sdk/auth.ts
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
|
+
import { ParamValue } from "pathcat";
|
|
2
|
+
|
|
1
3
|
import { sdk } from "./builder";
|
|
2
4
|
import { CreateUserDto, SignInUserDto } from "../rest";
|
|
5
|
+
import { isBrowser } from "../utils";
|
|
3
6
|
|
|
4
7
|
export const auth = sdk((client) => ({
|
|
5
8
|
signIn: async (data: SignInUserDto) => client.post("/auth/sign-in", data),
|
|
6
9
|
signUp: async (data: CreateUserDto) => client.post("/auth/sign-up", data),
|
|
7
10
|
signOut: async () => client.post("/auth/sign-out", null),
|
|
8
11
|
refreshToken: async () => client.post("/auth/refresh-token", null),
|
|
12
|
+
|
|
13
|
+
oauth2: {
|
|
14
|
+
google: {
|
|
15
|
+
connect: (params?: Record<string, ParamValue>) => {
|
|
16
|
+
if (isBrowser) {
|
|
17
|
+
window.location.href = client.url("/oauth2/google", params || {});
|
|
18
|
+
} else {
|
|
19
|
+
throw new Error("Google OAuth2 is only available in the browser");
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
twitter: {
|
|
24
|
+
connect: (params?: Record<string, ParamValue>) => {
|
|
25
|
+
if (isBrowser) {
|
|
26
|
+
window.location.href = client.url("/oauth2/twitter", params || {});
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error("Twitter OAuth2 is only available in the browser");
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
9
33
|
}));
|
package/src/sdk/organizations.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sdk } from "./builder";
|
|
2
2
|
import { CreateOrganizationDto, UpdateOrganizationDto } from "../rest";
|
|
3
|
+
import { isBrowser } from "../utils";
|
|
3
4
|
|
|
4
5
|
export const organizations = sdk((client) => ({
|
|
5
6
|
getAll: async () => client.get("/organizations"),
|
|
@@ -15,4 +16,29 @@ export const organizations = sdk((client) => ({
|
|
|
15
16
|
delete: async (id: string) =>
|
|
16
17
|
client.delete("/organizations/members/:id", null, { id }),
|
|
17
18
|
},
|
|
19
|
+
billing: {
|
|
20
|
+
account: async (slug: string) =>
|
|
21
|
+
client.get("/organizations/:slug/billing/account", { slug }),
|
|
22
|
+
link: (slug: string) => {
|
|
23
|
+
if (isBrowser) {
|
|
24
|
+
window.location.href = client.url("/organizations/:slug/billing/link", {
|
|
25
|
+
slug,
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error("Billing link is only available in the browser");
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
dashboard: (slug: string) => {
|
|
32
|
+
if (isBrowser) {
|
|
33
|
+
window.location.href = client.url(
|
|
34
|
+
"/organizations/:slug/billing/dashboard",
|
|
35
|
+
{
|
|
36
|
+
slug,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
} else {
|
|
40
|
+
throw new Error("Billing dashboard is only available in the browser");
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
},
|
|
18
44
|
}));
|