tonightpass 0.0.9 → 0.0.11
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 +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +37 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/rest/dtos/organizations/create-organization.dto.ts +24 -5
- package/src/rest/types/organizations/index.ts +12 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> tonightpass@0.0.
|
|
2
|
+
> tonightpass@0.0.11 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
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
16
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
17
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.js [22m[32m9.30 KB[39m
|
|
13
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m29.79 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 274ms
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.08 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m29.79 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 274ms
|
|
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 2534ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m22.03 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m22.03 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# tonightpass
|
|
2
2
|
|
|
3
|
+
## 0.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e05e50e`](https://github.com/tonightpass/tonightpass/commit/e05e50eb071f55b46686f14f25ba01c1402cf84b) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Fix optional fields in CreateOrganizationDto
|
|
8
|
+
|
|
9
|
+
## 0.0.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#218](https://github.com/tonightpass/tonightpass/pull/218) [`d4d27fb`](https://github.com/tonightpass/tonightpass/commit/d4d27fb683212d88bf4c4650ce33ab376c23f445) Thanks [@AntoineKM](https://github.com/AntoineKM)! - Fix Organization types and dtos
|
|
14
|
+
|
|
3
15
|
## 0.0.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -243,13 +243,20 @@ declare enum OrganizationSocialType {
|
|
|
243
243
|
type OrganizationMember = {
|
|
244
244
|
user: User;
|
|
245
245
|
role: OrganizationMemberRole;
|
|
246
|
+
status: OrganizationMemberStatus;
|
|
247
|
+
updatedAt: Date;
|
|
246
248
|
createdAt: Date;
|
|
247
249
|
};
|
|
250
|
+
declare enum OrganizationMemberStatus {
|
|
251
|
+
PENDING = "pending",
|
|
252
|
+
ACCEPTED = "accepted",
|
|
253
|
+
REJECTED = "rejected"
|
|
254
|
+
}
|
|
248
255
|
declare enum OrganizationMemberRole {
|
|
249
|
-
|
|
250
|
-
MANAGER =
|
|
251
|
-
ADMINISTRATOR =
|
|
252
|
-
OWNER =
|
|
256
|
+
MEMBER = "member",
|
|
257
|
+
MANAGER = "manager",
|
|
258
|
+
ADMINISTRATOR = "admin",
|
|
259
|
+
OWNER = "owner"
|
|
253
260
|
}
|
|
254
261
|
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean>;
|
|
255
262
|
|
|
@@ -412,9 +419,9 @@ declare enum Language {
|
|
|
412
419
|
}
|
|
413
420
|
|
|
414
421
|
declare class CreateOrganizationDto {
|
|
415
|
-
slug
|
|
422
|
+
slug?: string;
|
|
416
423
|
identity: CreateOrganizationIdentityDto;
|
|
417
|
-
members:
|
|
424
|
+
members: OrganizationMemberDto[];
|
|
418
425
|
location?: Location;
|
|
419
426
|
}
|
|
420
427
|
declare class CreateOrganizationIdentityDto {
|
|
@@ -422,7 +429,11 @@ declare class CreateOrganizationIdentityDto {
|
|
|
422
429
|
description: string;
|
|
423
430
|
avatarUrl?: string;
|
|
424
431
|
bannerUrl?: string;
|
|
425
|
-
socialLinks
|
|
432
|
+
socialLinks?: OrganizationSocialLink[];
|
|
433
|
+
}
|
|
434
|
+
declare class OrganizationMemberDto {
|
|
435
|
+
user: string;
|
|
436
|
+
role: OrganizationMemberRole;
|
|
426
437
|
}
|
|
427
438
|
|
|
428
439
|
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
@@ -719,4 +730,4 @@ declare class TonightPass {
|
|
|
719
730
|
|
|
720
731
|
declare const isBrowser: boolean;
|
|
721
732
|
|
|
722
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, 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 };
|
|
733
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.d.ts
CHANGED
|
@@ -243,13 +243,20 @@ declare enum OrganizationSocialType {
|
|
|
243
243
|
type OrganizationMember = {
|
|
244
244
|
user: User;
|
|
245
245
|
role: OrganizationMemberRole;
|
|
246
|
+
status: OrganizationMemberStatus;
|
|
247
|
+
updatedAt: Date;
|
|
246
248
|
createdAt: Date;
|
|
247
249
|
};
|
|
250
|
+
declare enum OrganizationMemberStatus {
|
|
251
|
+
PENDING = "pending",
|
|
252
|
+
ACCEPTED = "accepted",
|
|
253
|
+
REJECTED = "rejected"
|
|
254
|
+
}
|
|
248
255
|
declare enum OrganizationMemberRole {
|
|
249
|
-
|
|
250
|
-
MANAGER =
|
|
251
|
-
ADMINISTRATOR =
|
|
252
|
-
OWNER =
|
|
256
|
+
MEMBER = "member",
|
|
257
|
+
MANAGER = "manager",
|
|
258
|
+
ADMINISTRATOR = "admin",
|
|
259
|
+
OWNER = "owner"
|
|
253
260
|
}
|
|
254
261
|
type OrganizationEndpoints = Endpoint<"GET", "/organizations", Organization[]> | Endpoint<"GET", "/organizations/:id", Organization> | Endpoint<"POST", "/organizations", Organization, CreateOrganizationDto> | Endpoint<"PUT", "/organizations/:id", Organization, UpdateOrganizationDto> | Endpoint<"DELETE", "/organizations/:id", boolean>;
|
|
255
262
|
|
|
@@ -412,9 +419,9 @@ declare enum Language {
|
|
|
412
419
|
}
|
|
413
420
|
|
|
414
421
|
declare class CreateOrganizationDto {
|
|
415
|
-
slug
|
|
422
|
+
slug?: string;
|
|
416
423
|
identity: CreateOrganizationIdentityDto;
|
|
417
|
-
members:
|
|
424
|
+
members: OrganizationMemberDto[];
|
|
418
425
|
location?: Location;
|
|
419
426
|
}
|
|
420
427
|
declare class CreateOrganizationIdentityDto {
|
|
@@ -422,7 +429,11 @@ declare class CreateOrganizationIdentityDto {
|
|
|
422
429
|
description: string;
|
|
423
430
|
avatarUrl?: string;
|
|
424
431
|
bannerUrl?: string;
|
|
425
|
-
socialLinks
|
|
432
|
+
socialLinks?: OrganizationSocialLink[];
|
|
433
|
+
}
|
|
434
|
+
declare class OrganizationMemberDto {
|
|
435
|
+
user: string;
|
|
436
|
+
role: OrganizationMemberRole;
|
|
426
437
|
}
|
|
427
438
|
|
|
428
439
|
declare class UpdateOrganizationDto extends CreateOrganizationDto {
|
|
@@ -719,4 +730,4 @@ declare class TonightPass {
|
|
|
719
730
|
|
|
720
731
|
declare const isBrowser: boolean;
|
|
721
732
|
|
|
722
|
-
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, 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 };
|
|
733
|
+
export { type APIRequestOptions, type APIResponse, type AuthEndpoints, BCRYPT_HASH, type CareersCategory, type CareersEmploymentType, type CareersEndpoints, type CareersJob, type CareersOffice, Client, type ClientOptions, CreateOrganizationDto, CreateUserDto, Currency, DEFAULT_API_URL, EMAIL_REGEX, type Endpoint, type Endpoints, type ErroredAPIResponse, type Event, type EventStyle, EventStyleType, type EventTicket, EventTicketCategory, type EventTicketType, EventType, type Health, type HealthEndpoints, IMAGE_URL_REGEX, Language, type Location, NAME_REGEX, type Order, type OrderItem, OrderStatus, type Organization, type OrganizationEndpoints, type OrganizationIdentity, type OrganizationMember, OrganizationMemberRole, OrganizationMemberStatus, type OrganizationSocialLink, OrganizationSocialType, PASSWORD_REGEX, PHONE_NUMBER_REGEX, type PathsFor, type Profile, type ProfileEndpoints, type ProfileMetadata, type PromoCode, SLUG_REGEX, SignInUserDto, type SuccessfulAPIResponse, TonightPass, TonightPassAPIError, UpdateOrganizationDto, UpdateUserDto, type User, type UserConnection, type UserConnectionClient, type UserConnectionDevice, type UserConnectionOS, type UserEndpoints, type UserIdentifier, type UserIdentity, type UserIdentityGender, type UserPreferences, UserRole, type UserToken, UserTokenType, auth, careers, health, isBrowser, organizations, profiles, request, sdk, users };
|
package/dist/index.js
CHANGED
|
@@ -3,49 +3,50 @@
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
4
|
var classValidator = require('class-validator');
|
|
5
5
|
var classTransformer = require('class-transformer');
|
|
6
|
-
var
|
|
6
|
+
var he = require('redaxios');
|
|
7
7
|
var pathcat = require('pathcat');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var he__default = /*#__PURE__*/_interopDefault(he);
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var J=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var s=(t,e,o,r)=>{for(var n=r>1?void 0:r?ee(e,o):e,a=t.length-1,m;a>=0;a--)(m=t[a])&&(n=(r?m(e,o,n):m(n))||n);return r&&n&&J(e,o,n),n};var N="https://api.tonightpass.com";var be=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,O=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,Ue=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Ie=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Oe=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var te=(c=>(c.ENTRY="entry",c.PACKAGE="package",c.MEAL="meal",c.DRINK="drink",c.PARKING="parking",c.ACCOMMODATION="accommodation",c.CAMPING="camping",c.LOCKER="locker",c.SHUTTLE="shuttle",c.OTHER="other",c))(te||{});var re=(i=>(i.Clubbing="clubbing",i.Concert="concert",i.Afterwork="afterwork",i.DancingLunch="dancing_lunch",i.Diner="diner",i.Garden="garden",i.AfterBeach="after_beach",i.Festival="festival",i.Spectacle="spectacle",i.Cruise="cruise",i.OutsideAnimation="outside_animation",i.Sport="sport",i.Match="match",i.Seminar="seminar",i.Conference="conference",i.WellnessDay="wellness_day",i.Workshop="workshop",i.TradeFair="trade_fair",i.ConsumerShow="consumer_show",i.Membership="membership",i))(re||{}),oe=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(oe||{});var se=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(se||{}),ne=(r=>(r.PENDING="pending",r.ACCEPTED="accepted",r.REJECTED="rejected",r))(ne||{}),L=(n=>(n.MEMBER="member",n.MANAGER="manager",n.ADMINISTRATOR="admin",n.OWNER="owner",n))(L||{});var ie=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(ie||{});var ae=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(ae||{});var pe=(l=>(l.Created="created",l.Cancelled="cancelled",l.Completed="completed",l.Pending="pending",l.Confirmed="confirmed",l.Declined="declined",l.Refunded="refunded",l.PartiallyRefunded="partially_refunded",l.Expired="expired",l))(pe||{});var me=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(me||{}),de=(o=>(o.FR="fr",o.EN="en",o))(de||{});var u=class{slug;identity;members;location};s([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,128)],u.prototype,"slug",2),s([classValidator.IsObject()],u.prototype,"identity",2),s([classValidator.IsArray()],u.prototype,"members",2),s([classValidator.IsOptional(),classValidator.IsObject()],u.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};s([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(1,32)],f.prototype,"displayName",2),s([classValidator.IsString(),classValidator.IsNotEmpty(),classValidator.Length(16,1024)],f.prototype,"description",2),s([classValidator.IsUrl({protocols:["http","https"]})],f.prototype,"avatarUrl",2),s([classValidator.IsOptional(),classValidator.IsUrl({protocols:["http","https"]})],f.prototype,"bannerUrl",2),s([classValidator.IsOptional(),classValidator.IsArray()],f.prototype,"socialLinks",2);var P=class{user;role};s([classValidator.IsString(),classValidator.IsNotEmpty()],P.prototype,"user",2),s([classValidator.IsEnum(L),classValidator.IsNotEmpty()],P.prototype,"role",2);var _=class extends u{};var M=class{identifier;password;identity;addresses};var q=class{identifier;password};var E=class{identifier;identity;password};s([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>h)],E.prototype,"identifier",2),s([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>d)],E.prototype,"identity",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130)],E.prototype,"password",2);var h=class{email;phoneNumber;username};s([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail()],h.prototype,"email",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber()],h.prototype,"phoneNumber",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3)],h.prototype,"username",2);var d=class{firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};s([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(O,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(O,{message:"Last name must be composed of letters only"})],d.prototype,"lastName",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32)],d.prototype,"displayName",2),s([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500)],d.prototype,"description",2),s([classValidator.IsOptional(),classValidator.IsUrl()],d.prototype,"avatarUrl",2),s([classValidator.IsOptional(),classValidator.IsUrl()],d.prototype,"bannerUrl",2),s([classValidator.IsOptional()],d.prototype,"gender",2),s([classValidator.IsOptional(),classValidator.IsDateString()],d.prototype,"birthDate",2);var C=typeof window<"u";var xe=he__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!C&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:C}),B=async(t,e)=>xe(t,{...e}).then(r=>r).catch(r=>{throw r.data});var w=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},U=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let n=this.options.baseURL||N;return pathcat.pathcat(n,o,r)};}setOptions(e){this.options=e;}async get(e,o,r){return this.requester("GET",e,void 0,o,r)}async post(e,o,r,n){return this.requester("POST",e,o,r,n)}async put(e,o,r,n){return this.requester("PUT",e,o,r,n)}async patch(e,o,r,n){return this.requester("PATCH",e,o,r,n)}async delete(e,o,r){return this.requester("DELETE",e,void 0,o,r)}async requester(e,o,r,n={},a={}){let m=this.url(o,n);if(r!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let k=await B(m,{method:e,data:r,...a}),I=k.data;if(!I.success)throw new w(k,I);return I.data}};function x(t){return t}var V=t=>({signIn:async e=>t.post("/auth/sign-in",e),signUp:async e=>t.post("/auth/sign-up",e),signOut:async()=>t.post("/auth/sign-out",null),refreshToken:async()=>t.post("/auth/refresh-token",null)});var $=t=>({categories:{getAll:async e=>t.get("/careers/categories",e)},employmentTypes:{getAll:async e=>t.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>t.get("/careers/jobs",e),get:async e=>t.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>t.get("/careers/offices",e)}});var X=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var W=t=>({getAll:async()=>t.get("/organizations"),get:async e=>t.get("/organizations/:id",{id:e}),create:async e=>t.post("/organizations",e),update:async(e,o)=>t.put("/organizations/:id",o,{id:e}),delete:async e=>t.delete("/organizations/:id",{id:e})});var K=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var Y=t=>({getAll:async()=>t.get("/users"),get:async e=>t.get("/users",{id:e}),me:async()=>t.get("/users/me"),check:async(e,o)=>t.get("/users/check/:identifier",{identifier:e,suggestions:o}),update:async(e,o)=>t.put("/users/:id",o,{id:e})});var Z=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new U(e),this.auth=V(this.client),this.careers=$(this.client),this.health=X(this.client),this.organizations=W(this.client),this.profiles=K(this.client),this.users=Y(this.client);}};
|
|
14
14
|
|
|
15
|
-
exports.BCRYPT_HASH =
|
|
16
|
-
exports.Client =
|
|
17
|
-
exports.CreateOrganizationDto =
|
|
18
|
-
exports.CreateUserDto =
|
|
19
|
-
exports.Currency =
|
|
20
|
-
exports.DEFAULT_API_URL =
|
|
21
|
-
exports.EMAIL_REGEX =
|
|
22
|
-
exports.EventStyleType =
|
|
23
|
-
exports.EventTicketCategory =
|
|
24
|
-
exports.EventType =
|
|
25
|
-
exports.IMAGE_URL_REGEX =
|
|
26
|
-
exports.Language =
|
|
27
|
-
exports.NAME_REGEX =
|
|
28
|
-
exports.OrderStatus =
|
|
29
|
-
exports.OrganizationMemberRole =
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
15
|
+
exports.BCRYPT_HASH = Ue;
|
|
16
|
+
exports.Client = U;
|
|
17
|
+
exports.CreateOrganizationDto = u;
|
|
18
|
+
exports.CreateUserDto = M;
|
|
19
|
+
exports.Currency = me;
|
|
20
|
+
exports.DEFAULT_API_URL = N;
|
|
21
|
+
exports.EMAIL_REGEX = be;
|
|
22
|
+
exports.EventStyleType = oe;
|
|
23
|
+
exports.EventTicketCategory = te;
|
|
24
|
+
exports.EventType = re;
|
|
25
|
+
exports.IMAGE_URL_REGEX = Oe;
|
|
26
|
+
exports.Language = de;
|
|
27
|
+
exports.NAME_REGEX = O;
|
|
28
|
+
exports.OrderStatus = pe;
|
|
29
|
+
exports.OrganizationMemberRole = L;
|
|
30
|
+
exports.OrganizationMemberStatus = ne;
|
|
31
|
+
exports.OrganizationSocialType = se;
|
|
32
|
+
exports.PASSWORD_REGEX = Ae;
|
|
33
|
+
exports.PHONE_NUMBER_REGEX = Ie;
|
|
34
|
+
exports.SLUG_REGEX = Re;
|
|
35
|
+
exports.SignInUserDto = q;
|
|
36
|
+
exports.TonightPass = Z;
|
|
37
|
+
exports.TonightPassAPIError = w;
|
|
38
|
+
exports.UpdateOrganizationDto = _;
|
|
38
39
|
exports.UpdateUserDto = E;
|
|
39
|
-
exports.UserRole =
|
|
40
|
-
exports.UserTokenType =
|
|
41
|
-
exports.auth =
|
|
42
|
-
exports.careers =
|
|
43
|
-
exports.health =
|
|
44
|
-
exports.isBrowser =
|
|
45
|
-
exports.organizations =
|
|
46
|
-
exports.profiles =
|
|
47
|
-
exports.request =
|
|
40
|
+
exports.UserRole = ae;
|
|
41
|
+
exports.UserTokenType = ie;
|
|
42
|
+
exports.auth = V;
|
|
43
|
+
exports.careers = $;
|
|
44
|
+
exports.health = X;
|
|
45
|
+
exports.isBrowser = C;
|
|
46
|
+
exports.organizations = W;
|
|
47
|
+
exports.profiles = K;
|
|
48
|
+
exports.request = B;
|
|
48
49
|
exports.sdk = x;
|
|
49
|
-
exports.users =
|
|
50
|
+
exports.users = Y;
|
|
50
51
|
//# sourceMappingURL=out.js.map
|
|
51
52
|
//# 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/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/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/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","IsNotEmpty","IsObject","IsString","IsUrl","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","users","identifier","suggestions","TonightPass"],"mappings":"wMAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACE,WAAAC,EACA,cAAAC,EACA,YAAAC,EACA,YAAAC,EACA,SAAAC,MACK,kBAQA,IAAMC,EAAN,KAA4B,CAGjC,KAGA,SAGA,QAGA,QACF,EAVEC,EAAA,CAFCH,EAAS,EACTF,EAAW,GAFDI,EAGX,oBAGAC,EAAA,CADCJ,EAAS,GALCG,EAMX,wBAGAC,EAAA,CADCN,EAAQ,GAREK,EASX,uBAGAC,EAAA,CADCJ,EAAS,GAXCG,EAYX,wBAGF,IAAME,EAAN,KAAoC,CAGlC,YAIA,YAKA,UAKA,UAGA,WACF,EAlBED,EAAA,CAFCH,EAAS,EACTF,EAAW,GAFRM,EAGJ,2BAIAD,EAAA,CAFCH,EAAS,EACTF,EAAW,GANRM,EAOJ,2BAKAD,EAAA,CAHCF,EAAM,CACL,UAAW,CAAC,OAAQ,OAAO,CAC7B,CAAC,GAXGG,EAYJ,yBAKAD,EAAA,CAHCF,EAAM,CACL,UAAW,CAAC,OAAQ,OAAO,CAC7B,CAAC,GAhBG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AAG,CAAC,EAC/C,OAAQ,MAAOA,GAAeF,EAAO,OAAO,qBAAsB,CAAE,GAAAE,CAAG,CAAC,CAC1E,GCTO,IAAMG,EAAgBL,IAAY,CACvC,IAAK,MAAOM,GACVN,EAAO,IAAI,sBAAuB,CAAE,SAAAM,CAAS,CAAC,CAClD,GCFO,IAAMC,EAAaP,IAAY,CACpC,OAAQ,SAAYA,EAAO,IAAI,QAAQ,EACvC,IAAK,MAAOE,GAAeF,EAAO,IAAI,SAAU,CAAE,GAAAE,CAAG,CAAC,EACtD,GAAI,SAAYF,EAAO,IAAI,WAAW,EACtC,MAAO,MAAOQ,EAAoBC,IAChCT,EAAO,IAAI,2BAA4B,CAAE,WAAAQ,EAAY,YAAAC,CAAY,CAAC,EACpE,OAAQ,MAAOP,EAAY/B,IACzB6B,EAAO,IAAI,aAAc7B,EAAM,CAAE,GAAA+B,CAAG,CAAC,CACzC,GCRO,IAAMQ,EAAN,KAAkB,CACP,OAEA,KACA,QACA,OACA,cACA,SACA,MAEhB,YAAYpC,EAAwB,CAClC,KAAK,OAAS,IAAIe,EAAOf,CAAO,EAEhC,KAAK,KAAOyB,EAAK,KAAK,MAAM,EAC5B,KAAK,QAAUE,EAAQ,KAAK,MAAM,EAClC,KAAK,OAASE,EAAO,KAAK,MAAM,EAChC,KAAK,cAAgBC,EAAc,KAAK,MAAM,EAC9C,KAAK,SAAWC,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQE,EAAM,KAAK,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 IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMember,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @IsNotEmpty()\n slug: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMember[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsArray()\n socialLinks: OrganizationSocialLink[];\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 { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\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","__decorateClass","CreateOrganizationIdentityDto","OrganizationMemberDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","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L,IAAY,CACvC,IAAK,MAAOM,GACVN,EAAO,IAAI,sBAAuB,CAAE,SAAAM,CAAS,CAAC,CAClD,GCFO,IAAMC,EAAaP,IAAY,CACpC,OAAQ,SAAYA,EAAO,IAAI,QAAQ,EACvC,IAAK,MAAOE,GAAeF,EAAO,IAAI,SAAU,CAAE,GAAAE,CAAG,CAAC,EACtD,GAAI,SAAYF,EAAO,IAAI,WAAW,EACtC,MAAO,MAAOQ,EAAoBC,IAChCT,EAAO,IAAI,2BAA4B,CAAE,WAAAQ,EAAY,YAAAC,CAAY,CAAC,EACpE,OAAQ,MAAOP,EAAYrB,IACzBmB,EAAO,IAAI,aAAcnB,EAAM,CAAE,GAAAqB,CAAG,CAAC,CACzC,GCRO,IAAMQ,EAAN,KAAkB,CACP,OAEA,KACA,QACA,OACA,cACA,SACA,MAEhB,YAAY1B,EAAwB,CAClC,KAAK,OAAS,IAAIK,EAAOL,CAAO,EAEhC,KAAK,KAAOe,EAAK,KAAK,MAAM,EAC5B,KAAK,QAAUE,EAAQ,KAAK,MAAM,EAClC,KAAK,OAASE,EAAO,KAAK,MAAM,EAChC,KAAK,cAAgBC,EAAc,KAAK,MAAM,EAC9C,KAAK,SAAWC,EAAS,KAAK,MAAM,EACpC,KAAK,MAAQE,EAAM,KAAK,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 Location,\n OrganizationMemberRole,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\n","import { sdk } from \"./builder\";\n\nexport const profiles = sdk((client) => ({\n get: async (username: string) =>\n client.get(\"/profiles/:username\", { username }),\n}));\n","import { sdk } from \"./builder\";\nimport { UpdateUserDto } from \"../rest\";\n\nexport const users = sdk((client) => ({\n getAll: async () => client.get(\"/users\"),\n get: async (id: string) => client.get(\"/users\", { id }),\n me: async () => client.get(\"/users/me\"),\n check: async (identifier: string, suggestions?: boolean) =>\n client.get(\"/users/check/:identifier\", { identifier, suggestions }),\n update: async (id: string, data: UpdateUserDto) =>\n client.put(\"/users/:id\", data, { id }),\n}));\n","import { Client, ClientOptions } from \"./rest\";\nimport { auth, careers, health, organizations, profiles, users } from \"./sdk\";\n\nexport class TonightPass {\n public readonly client: Client;\n\n public readonly auth;\n public readonly careers;\n public readonly health;\n public readonly organizations;\n public readonly profiles;\n public readonly users;\n\n constructor(options: ClientOptions) {\n this.client = new Client(options);\n\n this.auth = auth(this.client);\n this.careers = careers(this.client);\n this.health = health(this.client);\n this.organizations = organizations(this.client);\n this.profiles = profiles(this.client);\n this.users = users(this.client);\n }\n}\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { IsString,
|
|
2
|
+
import { IsOptional, IsString, Length, IsObject, IsArray, IsNotEmpty, IsUrl, IsEnum, ValidateNested, MinLength, MaxLength, IsEmail, IsPhoneNumber, Matches, IsDateString } from 'class-validator';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
|
-
import
|
|
4
|
+
import he from 'redaxios';
|
|
5
5
|
import { pathcat } from 'pathcat';
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var J=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var s=(t,e,o,r)=>{for(var n=r>1?void 0:r?ee(e,o):e,a=t.length-1,m;a>=0;a--)(m=t[a])&&(n=(r?m(e,o,n):m(n))||n);return r&&n&&J(e,o,n),n};var N="https://api.tonightpass.com";var be=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,Ae=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,O=/(^[\p{L}\d'\\.\s\\-]*$)/u,Re=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,Ue=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,Ie=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,Oe=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var te=(c=>(c.ENTRY="entry",c.PACKAGE="package",c.MEAL="meal",c.DRINK="drink",c.PARKING="parking",c.ACCOMMODATION="accommodation",c.CAMPING="camping",c.LOCKER="locker",c.SHUTTLE="shuttle",c.OTHER="other",c))(te||{});var re=(i=>(i.Clubbing="clubbing",i.Concert="concert",i.Afterwork="afterwork",i.DancingLunch="dancing_lunch",i.Diner="diner",i.Garden="garden",i.AfterBeach="after_beach",i.Festival="festival",i.Spectacle="spectacle",i.Cruise="cruise",i.OutsideAnimation="outside_animation",i.Sport="sport",i.Match="match",i.Seminar="seminar",i.Conference="conference",i.WellnessDay="wellness_day",i.Workshop="workshop",i.TradeFair="trade_fair",i.ConsumerShow="consumer_show",i.Membership="membership",i))(re||{}),oe=(a=>(a.Music="music",a.Dress="dress",a.Sport="sport",a.Food="food",a.Art="art",a))(oe||{});var se=(m=>(m.Facebook="facebook",m.Twitter="twitter",m.Instagram="instagram",m.Linkedin="linkedin",m.Youtube="youtube",m.Website="website",m))(se||{}),ne=(r=>(r.PENDING="pending",r.ACCEPTED="accepted",r.REJECTED="rejected",r))(ne||{}),L=(n=>(n.MEMBER="member",n.MANAGER="manager",n.ADMINISTRATOR="admin",n.OWNER="owner",n))(L||{});var ie=(a=>(a.Authentication="authentication",a.OrganizationInvite="organization_invite",a.PasswordRecovery="password_recovery",a.EmailValidation="email_validation",a.PhoneValidation="phone_validation",a))(ie||{});var ae=(r=>(r[r.USER=0]="USER",r[r.DEVELOPER=8]="DEVELOPER",r[r.ADMINISTRATOR=10]="ADMINISTRATOR",r))(ae||{});var pe=(l=>(l.Created="created",l.Cancelled="cancelled",l.Completed="completed",l.Pending="pending",l.Confirmed="confirmed",l.Declined="declined",l.Refunded="refunded",l.PartiallyRefunded="partially_refunded",l.Expired="expired",l))(pe||{});var me=(r=>(r.EUR="EUR",r.USD="USD",r.GBP="GBP",r))(me||{}),de=(o=>(o.FR="fr",o.EN="en",o))(de||{});var u=class{slug;identity;members;location};s([IsOptional(),IsString(),Length(1,128)],u.prototype,"slug",2),s([IsObject()],u.prototype,"identity",2),s([IsArray()],u.prototype,"members",2),s([IsOptional(),IsObject()],u.prototype,"location",2);var f=class{displayName;description;avatarUrl;bannerUrl;socialLinks};s([IsString(),IsNotEmpty(),Length(1,32)],f.prototype,"displayName",2),s([IsString(),IsNotEmpty(),Length(16,1024)],f.prototype,"description",2),s([IsUrl({protocols:["http","https"]})],f.prototype,"avatarUrl",2),s([IsOptional(),IsUrl({protocols:["http","https"]})],f.prototype,"bannerUrl",2),s([IsOptional(),IsArray()],f.prototype,"socialLinks",2);var P=class{user;role};s([IsString(),IsNotEmpty()],P.prototype,"user",2),s([IsEnum(L),IsNotEmpty()],P.prototype,"role",2);var _=class extends u{};var M=class{identifier;password;identity;addresses};var q=class{identifier;password};var E=class{identifier;identity;password};s([IsOptional(),IsObject(),ValidateNested(),Type(()=>h)],E.prototype,"identifier",2),s([IsOptional(),IsObject(),ValidateNested(),Type(()=>d)],E.prototype,"identity",2),s([IsOptional(),IsString(),MinLength(6),MaxLength(130)],E.prototype,"password",2);var h=class{email;phoneNumber;username};s([IsOptional(),IsString(),IsEmail()],h.prototype,"email",2),s([IsOptional(),IsString(),IsPhoneNumber()],h.prototype,"phoneNumber",2),s([IsOptional(),IsString(),MinLength(3)],h.prototype,"username",2);var d=class{firstName;lastName;displayName;description;avatarUrl;bannerUrl;gender;birthDate};s([IsOptional(),IsString(),Length(2,50),Matches(O,{message:"First name must be composed of letters only"})],d.prototype,"firstName",2),s([IsOptional(),IsString(),Length(2,50),Matches(O,{message:"Last name must be composed of letters only"})],d.prototype,"lastName",2),s([IsOptional(),IsString(),Length(1,32)],d.prototype,"displayName",2),s([IsOptional(),IsString(),Length(15,500)],d.prototype,"description",2),s([IsOptional(),IsUrl()],d.prototype,"avatarUrl",2),s([IsOptional(),IsUrl()],d.prototype,"bannerUrl",2),s([IsOptional()],d.prototype,"gender",2),s([IsOptional(),IsDateString()],d.prototype,"birthDate",2);var C=typeof window<"u";var xe=he.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!C&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(t){return JSON.stringify(t)}],withCredentials:C}),B=async(t,e)=>xe(t,{...e}).then(r=>r).catch(r=>{throw r.data});var w=class extends Error{constructor(o,r){super(r.message);this.response=o;this.data=r;this.status=o.status;}status},U=class{options;url;constructor(e){this.options=e,this.url=(o,r)=>{let n=this.options.baseURL||N;return pathcat(n,o,r)};}setOptions(e){this.options=e;}async get(e,o,r){return this.requester("GET",e,void 0,o,r)}async post(e,o,r,n){return this.requester("POST",e,o,r,n)}async put(e,o,r,n){return this.requester("PUT",e,o,r,n)}async patch(e,o,r,n){return this.requester("PATCH",e,o,r,n)}async delete(e,o,r){return this.requester("DELETE",e,void 0,o,r)}async requester(e,o,r,n={},a={}){let m=this.url(o,n);if(r!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let k=await B(m,{method:e,data:r,...a}),I=k.data;if(!I.success)throw new w(k,I);return I.data}};function x(t){return t}var V=t=>({signIn:async e=>t.post("/auth/sign-in",e),signUp:async e=>t.post("/auth/sign-up",e),signOut:async()=>t.post("/auth/sign-out",null),refreshToken:async()=>t.post("/auth/refresh-token",null)});var $=t=>({categories:{getAll:async e=>t.get("/careers/categories",e)},employmentTypes:{getAll:async e=>t.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>t.get("/careers/jobs",e),get:async e=>t.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>t.get("/careers/offices",e)}});var X=t=>({database:async()=>t.get("/health/database"),http:async()=>t.get("/health/http")});var W=t=>({getAll:async()=>t.get("/organizations"),get:async e=>t.get("/organizations/:id",{id:e}),create:async e=>t.post("/organizations",e),update:async(e,o)=>t.put("/organizations/:id",o,{id:e}),delete:async e=>t.delete("/organizations/:id",{id:e})});var K=t=>({get:async e=>t.get("/profiles/:username",{username:e})});var Y=t=>({getAll:async()=>t.get("/users"),get:async e=>t.get("/users",{id:e}),me:async()=>t.get("/users/me"),check:async(e,o)=>t.get("/users/check/:identifier",{identifier:e,suggestions:o}),update:async(e,o)=>t.put("/users/:id",o,{id:e})});var Z=class{client;auth;careers;health;organizations;profiles;users;constructor(e){this.client=new U(e),this.auth=V(this.client),this.careers=$(this.client),this.health=X(this.client),this.organizations=W(this.client),this.profiles=K(this.client),this.users=Y(this.client);}};
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { Ue as BCRYPT_HASH, U as Client, u as CreateOrganizationDto, M as CreateUserDto, me as Currency, N as DEFAULT_API_URL, be as EMAIL_REGEX, oe as EventStyleType, te as EventTicketCategory, re as EventType, Oe as IMAGE_URL_REGEX, de as Language, O as NAME_REGEX, pe as OrderStatus, L as OrganizationMemberRole, ne as OrganizationMemberStatus, se as OrganizationSocialType, Ae as PASSWORD_REGEX, Ie as PHONE_NUMBER_REGEX, Re as SLUG_REGEX, q as SignInUserDto, Z as TonightPass, w as TonightPassAPIError, _ as UpdateOrganizationDto, E as UpdateUserDto, ae as UserRole, ie as UserTokenType, V as auth, $ as careers, X as health, C as isBrowser, W as organizations, K as profiles, B as request, x as sdk, Y 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/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/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/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","IsNotEmpty","IsObject","IsString","IsUrl","CreateOrganizationDto","__decorateClass","CreateOrganizationIdentityDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsOptional","IsPhoneNumber","Length","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","EventTicketCategory","EventType","EventStyleType","OrganizationSocialType","OrganizationMemberRole","UserTokenType","UserRole","OrderStatus","Currency","Language","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","users","identifier","suggestions","TonightPass"],"mappings":"wMAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACE,WAAAC,EACA,cAAAC,EACA,YAAAC,EACA,YAAAC,EACA,SAAAC,MACK,kBAQA,IAAMC,EAAN,KAA4B,CAGjC,KAGA,SAGA,QAGA,QACF,EAVEC,EAAA,CAFCH,EAAS,EACTF,EAAW,GAFDI,EAGX,oBAGAC,EAAA,CADCJ,EAAS,GALCG,EAMX,wBAGAC,EAAA,CADCN,EAAQ,GAREK,EASX,uBAGAC,EAAA,C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AM,EACpC,KAAK,MAAQE,EAAM,KAAK,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 IsNotEmpty,\n IsObject,\n IsString,\n IsUrl,\n} from \"class-validator\";\n\nimport {\n Location,\n OrganizationMember,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsString()\n @IsNotEmpty()\n slug: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMember[];\n\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsArray()\n socialLinks: OrganizationSocialLink[];\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 { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberRole {\n EMPLOYEE = 0,\n MANAGER = 1,\n ADMINISTRATOR = 2,\n OWNER = 3,\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\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","__decorateClass","CreateOrganizationIdentityDto","OrganizationMemberDto","UpdateOrganizationDto","CreateUserDto","SignInUserDto","Type","IsDateString","IsEmail","IsPhoneNumber","Matches","MaxLength","MinLength","ValidateNested","UpdateUserDto","UpdateIdentifierDto","UpdateIdentityDto","axios","isBrowser","instance","data","request","url","options","response","error","pathcat","TonightPassAPIError","Client","path","params","baseURL","query","body","method","result","sdk","builder","auth","client","careers","id","health","organizations","profiles","username","users","identifier","suggestions","TonightPass"],"mappings":"0MAAO,IAAMA,EAAkB,8BCAxB,IAAMC,GAAc,2CAGdC,GACX,yDAGWC,EAAa,2BAGbC,GAAa,kCAGbC,GAAc,0CAEdC,GACX,6FAEWC,GACX,yGCnBF,MAAO,mBCAP,OACE,WAAAC,EACA,UAAAC,GACA,cAAAC,EACA,YAAAC,EACA,cAAAC,EACA,YAAAC,EACA,SAAAC,EACA,UAAAC,MACK,kBCeA,IAAKC,QACVA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,cAAgB,gBAChBA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,QAAA,ICAL,IAAKC,QACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,UAAY,YACZA,EAAA,aAAe,gBACfA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,WAAa,cACbA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,OAAS,SACTA,EAAA,iBAAmB,oBACnBA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,QAAU,UACVA,EAAA,WAAa,aACbA,EAAA,YAAc,eACdA,EAAA,SAAW,WACXA,EAAA,UAAY,aACZA,EAAA,aAAe,gBACfA,EAAA,WAA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X = /^[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 Location,\n OrganizationMemberRole,\n OrganizationSocialLink,\n} from \"../../types\";\n\nexport class CreateOrganizationDto {\n @IsOptional()\n @IsString()\n @Length(1, 128)\n slug?: string;\n\n @IsObject()\n identity: CreateOrganizationIdentityDto;\n\n @IsArray()\n members: OrganizationMemberDto[];\n\n @IsOptional()\n @IsObject()\n location?: Location;\n}\n\nclass CreateOrganizationIdentityDto {\n @IsString()\n @IsNotEmpty()\n @Length(1, 32)\n displayName: string;\n\n @IsString()\n @IsNotEmpty()\n @Length(16, 1024)\n description: string;\n\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n avatarUrl?: string;\n\n @IsOptional()\n @IsUrl({\n protocols: [\"http\", \"https\"],\n })\n bannerUrl?: string;\n\n @IsOptional()\n @IsArray()\n socialLinks?: OrganizationSocialLink[];\n}\n\nclass OrganizationMemberDto {\n @IsString()\n @IsNotEmpty()\n user: string;\n\n @IsEnum(OrganizationMemberRole)\n @IsNotEmpty()\n role: OrganizationMemberRole;\n}\n","import { Currency } from \"../..\";\n\nexport type EventTicket = {\n id: string;\n name: string;\n description?: string;\n price: number;\n displayPrice: number;\n quantity: number;\n type: EventTicketType;\n category: EventTicketCategory;\n currency: Currency;\n vatRate: number;\n externalId?: string;\n isVisible: boolean;\n isFeesIncluded: boolean;\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type EventTicketType = \"e-ticket\" | \"other\";\n\nexport enum EventTicketCategory {\n ENTRY = \"entry\",\n PACKAGE = \"package\",\n MEAL = \"meal\",\n DRINK = \"drink\",\n PARKING = \"parking\",\n ACCOMMODATION = \"accommodation\",\n CAMPING = \"camping\",\n LOCKER = \"locker\",\n SHUTTLE = \"shuttle\",\n OTHER = \"other\",\n}\n","import { EventTicket } from \"./ticket\";\nimport { Location } from \"..\";\nimport { Organization } from \"../organizations\";\n\nexport * from \"./ticket\";\n\nexport type Event = {\n title: string;\n description: string;\n slug: string;\n organization: Organization;\n type: EventType;\n public: boolean;\n flyers: string[];\n trailers: string[];\n location: Location;\n tickets: EventTicket[];\n styles: EventStyle[];\n startAt: Date;\n endAt: Date;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum EventType {\n Clubbing = \"clubbing\",\n Concert = \"concert\",\n Afterwork = \"afterwork\",\n DancingLunch = \"dancing_lunch\",\n Diner = \"diner\",\n Garden = \"garden\",\n AfterBeach = \"after_beach\",\n Festival = \"festival\",\n Spectacle = \"spectacle\",\n Cruise = \"cruise\",\n OutsideAnimation = \"outside_animation\",\n Sport = \"sport\",\n Match = \"match\",\n Seminar = \"seminar\",\n Conference = \"conference\",\n WellnessDay = \"wellness_day\",\n Workshop = \"workshop\",\n TradeFair = \"trade_fair\",\n ConsumerShow = \"consumer_show\",\n Membership = \"membership\",\n}\n\nexport type EventStyle = {\n type: EventStyleType;\n emoji: string;\n name: string;\n};\n\nexport enum EventStyleType {\n Music = \"music\",\n Dress = \"dress\",\n Sport = \"sport\",\n Food = \"food\",\n Art = \"art\",\n}\n","import { Location, Profile, ProfileMetadata } from \"..\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\nimport { Event } from \"../event\";\nimport { EventTicket } from \"../event/ticket\";\nimport { User } from \"../users\";\n\nexport type Organization = {\n id: string;\n slug: string;\n identity: OrganizationIdentity;\n members: OrganizationMember[];\n location?: Location;\n events: Event[];\n savedTickets: EventTicket[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type OrganizationIdentity = Profile & {\n socialLinks: OrganizationSocialLink[];\n\n metadata: ProfileMetadata & {\n eventsCount: number;\n viewsCount: number;\n membersCount: number;\n };\n};\n\nexport type OrganizationSocialLink = {\n type: OrganizationSocialType;\n url: string;\n};\n\nexport enum OrganizationSocialType {\n Facebook = \"facebook\",\n Twitter = \"twitter\",\n Instagram = \"instagram\",\n Linkedin = \"linkedin\",\n Youtube = \"youtube\",\n Website = \"website\",\n}\n\nexport type OrganizationMember = {\n user: User;\n role: OrganizationMemberRole;\n status: OrganizationMemberStatus;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport enum OrganizationMemberStatus {\n PENDING = \"pending\",\n ACCEPTED = \"accepted\",\n REJECTED = \"rejected\",\n}\n\nexport enum OrganizationMemberRole {\n MEMBER = \"member\",\n MANAGER = \"manager\",\n ADMINISTRATOR = \"admin\",\n OWNER = \"owner\",\n}\n\nexport type OrganizationEndpoints =\n | Endpoint<\"GET\", \"/organizations\", Organization[]>\n | Endpoint<\"GET\", \"/organizations/:id\", Organization>\n | Endpoint<\"POST\", \"/organizations\", Organization, CreateOrganizationDto>\n | Endpoint<\"PUT\", \"/organizations/:id\", Organization, UpdateOrganizationDto>\n | Endpoint<\"DELETE\", \"/organizations/:id\", boolean>;\n","export type UserToken = {\n id: string;\n type: UserTokenType;\n value: string;\n createdAt: Date;\n expiresAt: Date;\n};\n\nexport enum UserTokenType {\n Authentication = \"authentication\",\n OrganizationInvite = \"organization_invite\",\n PasswordRecovery = \"password_recovery\",\n EmailValidation = \"email_validation\",\n PhoneValidation = \"phone_validation\",\n}\n","import { Currency, Language, Location, Profile, ProfileMetadata } from \"..\";\nimport { UpdateUserDto } from \"../../dtos\";\nimport { Endpoint } from \"../../endpoints\";\n\nexport type User = {\n id: string;\n identifier: UserIdentifier;\n password: string;\n identity: UserIdentity;\n role: UserRole;\n addresses: Location[];\n preferences: UserPreferences;\n connections: UserConnection[];\n verified: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserIdentifier = {\n email?: string;\n phoneNumber?: string;\n username: string;\n\n [key: string]: string | undefined;\n};\n\nexport type UserIdentity = Profile & {\n firstName: string;\n lastName: string;\n fullName: string;\n gender: UserIdentityGender;\n birthDate: Date;\n\n metadata: ProfileMetadata & {\n followingCount: number;\n hasPassPlus: boolean;\n idValid: boolean;\n };\n};\n\nexport enum UserRole {\n USER = 0,\n DEVELOPER = 8,\n ADMINISTRATOR = 10,\n}\n\nexport type UserIdentityGender =\n | \"male\"\n | \"female\"\n | \"non-binary\"\n | \"gender-fluid\"\n | \"neutral\"\n | \"other\"\n | string;\n\nexport type UserPreferences = {\n language: Language;\n currency: Currency;\n notifications: {\n email: {\n newsletter: boolean;\n message: boolean;\n };\n push: {\n message: boolean;\n };\n };\n};\n\nexport type UserConnection = {\n ip: string;\n os: UserConnectionOS;\n device: UserConnectionDevice;\n client: UserConnectionClient;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type UserConnectionOS = {\n name: string;\n version: string;\n};\n\nexport type UserConnectionDevice = {\n type: string;\n brand: string;\n};\n\nexport type UserConnectionClient = {\n name: string;\n version: string;\n};\n\nexport type UserEndpoints =\n | Endpoint<\"GET\", \"/users\", User[]>\n | Endpoint<\"GET\", \"/users/:id\", User, { id: string }>\n | Endpoint<\"GET\", \"/users/me\", User>\n | Endpoint<\n \"GET\",\n \"/users/check/:identifier\",\n {\n exists: boolean;\n identifier: UserIdentifier;\n suggestions?: string[];\n },\n { identifier: boolean; suggestions?: boolean }\n >\n | Endpoint<\"PUT\", \"/users/:id\", User, UpdateUserDto>;\n","import { Currency } from \"..\";\nimport { Event, EventTicket } from \"../event\";\nimport { User } from \"../users\";\n\nexport enum OrderStatus {\n Created = \"created\",\n Cancelled = \"cancelled\",\n Completed = \"completed\",\n Pending = \"pending\",\n Confirmed = \"confirmed\",\n Declined = \"declined\",\n Refunded = \"refunded\",\n PartiallyRefunded = \"partially_refunded\",\n Expired = \"expired\",\n}\n\nexport type OrderItem = {\n id: string;\n ticket: EventTicket;\n isUsed: boolean;\n updatedAt: Date;\n createdAt: Date;\n};\n\nexport type Order = {\n id: string;\n owner: User;\n members: User[];\n status: OrderStatus;\n event: Event;\n items: OrderItem[];\n promoCode?: PromoCode;\n total: number;\n currency: Currency;\n createdAt: Date;\n};\n\nexport type PromoCode = {\n id: string;\n code: string;\n used: number;\n discount: number;\n isActive: boolean;\n expirationAt: Date;\n createdAt: Date;\n};\n","export * from \"./auth\";\nexport * from \"./careers\";\nexport * from \"./event\";\nexport * from \"./health\";\nexport * from \"./organizations\";\nexport * from \"./token\";\nexport * from \"./users\";\nexport * from \"./order\";\nexport * from \"./profiles\";\n\nexport type Location = {\n name?: string;\n address: string;\n zipCode: string;\n city: string;\n country: string;\n geometry?: {\n latitude: number;\n longitude: number;\n };\n};\n\n// Currency\nexport enum Currency {\n EUR = \"EUR\",\n USD = \"USD\",\n GBP = \"GBP\",\n}\n\n// I18n\nexport enum Language {\n FR = \"fr\",\n EN = \"en\",\n}\n","import { CreateOrganizationDto } from \"./create-organization.dto\";\n\nexport class UpdateOrganizationDto extends CreateOrganizationDto {}\n","import { Location, UserIdentifier, UserIdentityGender } from \"../../types\";\n\nexport class CreateUserDto {\n identifier: UserIdentifier;\n password: string;\n identity: CreateUserIdentituDto;\n addresses: Location[];\n}\n\nclass CreateUserIdentituDto {\n firstName: string;\n lastName: string;\n gender: UserIdentityGender;\n avatarUrl?: string;\n birthDate: Date;\n}\n","export class SignInUserDto {\n identifier: string;\n password: string;\n}\n","import { Type } from \"class-transformer\";\nimport {\n IsDateString,\n IsEmail,\n IsObject,\n IsOptional,\n IsPhoneNumber,\n IsString,\n IsUrl,\n Length,\n Matches,\n MaxLength,\n MinLength,\n ValidateNested,\n} from \"class-validator\";\n\nimport { NAME_REGEX } from \"../../../constants/regex\";\nimport { UserIdentifier, UserIdentity } from \"../../types\";\n\nexport class UpdateUserDto {\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentifierDto)\n identifier?: UpdateIdentifierDto;\n\n @IsOptional()\n @IsObject()\n @ValidateNested()\n @Type(() => UpdateIdentityDto)\n identity?: UpdateIdentityDto;\n\n @IsOptional()\n @IsString()\n @MinLength(6)\n @MaxLength(130)\n password?: string;\n}\n\nclass UpdateIdentifierDto\n implements\n Partial<Pick<UserIdentifier, \"email\" | \"phoneNumber\" | \"username\">>\n{\n @IsOptional()\n @IsString()\n @IsEmail()\n email?: string;\n\n @IsOptional()\n @IsString()\n @IsPhoneNumber()\n phoneNumber?: string;\n\n @IsOptional()\n @IsString()\n @MinLength(3)\n username?: string;\n}\n\nclass UpdateIdentityDto\n implements\n Partial<\n Pick<\n UserIdentity,\n | \"firstName\"\n | \"lastName\"\n | \"displayName\"\n | \"description\"\n | \"avatarUrl\"\n | \"bannerUrl\"\n | \"gender\"\n | \"birthDate\"\n >\n >\n{\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"First name must be composed of letters only\",\n })\n firstName?: string;\n\n @IsOptional()\n @IsString()\n @Length(2, 50)\n @Matches(NAME_REGEX, {\n message: \"Last name must be composed of letters only\",\n })\n lastName?: string;\n\n @IsOptional()\n @IsString()\n @Length(1, 32)\n displayName?: string;\n\n @IsOptional()\n @IsString()\n @Length(15, 500)\n description?: string;\n\n @IsOptional()\n @IsUrl()\n avatarUrl?: string | undefined;\n\n @IsOptional()\n @IsUrl()\n bannerUrl?: string | undefined;\n\n @IsOptional()\n gender?: string;\n\n @IsOptional()\n @IsDateString()\n birthDate?: Date;\n}\n","import axios, { Options, Response } from \"redaxios\";\n\nimport { isBrowser } from \"../../utils\";\nimport { APIResponse, ErroredAPIResponse } from \"../endpoints\";\n\nconst instance = axios.create({\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n ...(!isBrowser && { \"User-Agent\": \"tonightpass-api-client\" }),\n },\n responseType: \"json\",\n transformRequest: [\n function (data) {\n return JSON.stringify(data);\n },\n ],\n withCredentials: isBrowser,\n});\n\nexport interface APIRequestOptions extends Options {}\n\nexport const request = async <T>(url: string, options?: Options) => {\n const response = instance<APIResponse<T>>(url, { ...options })\n .then((response) => response)\n .catch((error: Response<ErroredAPIResponse>) => {\n throw error.data;\n });\n\n return response;\n};\n","export const isBrowser = typeof window !== \"undefined\";\n","import { ParamValue, Query, pathcat } from \"pathcat\";\nimport { Options, Response } from \"redaxios\";\n\nimport { APIResponse, Endpoints, ErroredAPIResponse } from \"./endpoints\";\nimport { APIRequestOptions, request } from \"./request\";\nimport { DEFAULT_API_URL } from \"../constants\";\n\nexport type PathsFor<M extends Options[\"method\"]> = Extract<\n Endpoints,\n { method: M }\n>[\"path\"];\n\nexport class TonightPassAPIError<T> extends Error {\n public readonly status: number;\n\n constructor(\n public readonly response: Response<APIResponse<T>>,\n public readonly data: ErroredAPIResponse,\n ) {\n super(data.message);\n\n this.status = response.status;\n }\n}\n\nexport interface ClientOptions {\n readonly baseURL: string;\n}\n\nexport class Client {\n private options;\n public readonly url;\n\n constructor(options: ClientOptions) {\n this.options = options;\n this.url = (path: string, params: Record<string, ParamValue>) => {\n const baseURL = this.options.baseURL || DEFAULT_API_URL;\n return pathcat(baseURL, path, params);\n };\n }\n\n setOptions(options: ClientOptions) {\n this.options = options;\n }\n\n async get<Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]\n >(\"GET\", path, undefined, query, options);\n }\n\n async post<Path extends Extract<Endpoints, { method: \"POST\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"POST\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"POST\" }>[\"res\"]\n >(\"POST\", path, body, query, options);\n }\n\n async put<Path extends Extract<Endpoints, { method: \"PUT\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PUT\" }>[\"res\"]\n >(\"PUT\", path, body, query, options);\n }\n\n async patch<Path extends Extract<Endpoints, { method: \"PATCH\" }>[\"path\"]>(\n path: Path,\n body: Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"body\"],\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"PATCH\" }>[\"res\"]\n >(\"PATCH\", path, body, query, options);\n }\n\n async delete<Path extends Extract<Endpoints, { method: \"DELETE\" }>[\"path\"]>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n ) {\n return this.requester<\n Extract<Endpoints, { path: Path; method: \"DELETE\" }>[\"res\"]\n >(\"DELETE\", path, undefined, query, options);\n }\n\n private async requester<T>(\n method: Options[\"method\"],\n path: string,\n body: unknown,\n query: Query<string> = {},\n options: APIRequestOptions = {},\n ) {\n const url = this.url(path, query);\n\n if (body !== undefined) {\n if (method === \"GET\") {\n throw new Error(\"Cannot send a GET request with a body\");\n }\n }\n\n const response: Response<APIResponse<T>> = await request<T>(url, {\n method,\n data: body,\n ...options,\n });\n\n const result = response.data;\n\n if (!result.success) {\n throw new TonightPassAPIError<T>(response, result);\n }\n\n return result.data;\n }\n}\n","import { Client } from \"../rest\";\n\nexport function sdk<T>(builder: (client: Client) => T) {\n return builder;\n}\n","import { sdk } from \"./builder\";\nimport { CreateUserDto, SignInUserDto } from \"../rest\";\n\nexport const auth = sdk((client) => ({\n signIn: async (data: SignInUserDto) => client.post(\"/auth/sign-in\", data),\n signUp: async (data: CreateUserDto) => client.post(\"/auth/sign-up\", data),\n signOut: async () => client.post(\"/auth/sign-out\", null),\n refreshToken: async () => client.post(\"/auth/refresh-token\", null),\n}));\n","import { Query } from \"pathcat\";\n\nimport { sdk } from \"./builder\";\n\nexport const careers = sdk((client) => ({\n categories: {\n getAll: async (query?: Query<\"/careers/categories\">) =>\n client.get(\"/careers/categories\", query),\n },\n employmentTypes: {\n getAll: async (query?: Query<\"/careers/employmentTypes\">) =>\n client.get(\"/careers/employmentTypes\", query),\n },\n jobs: {\n getAll: async (query?: Query<\"/careers/jobs\">) =>\n client.get(\"/careers/jobs\", query),\n get: async (id: number) => client.get(\"/careers/jobs/:id\", { id }),\n },\n offices: {\n getAll: async (query?: Query<\"/careers/offices\">) =>\n client.get(\"/careers/offices\", query),\n },\n}));\n","import { sdk } from \"./builder\";\n\nexport const health = sdk((client) => ({\n database: async () => client.get(\"/health/database\"),\n http: async () => client.get(\"/health/http\"),\n}));\n","import { sdk } from \"./builder\";\nimport { CreateOrganizationDto, UpdateOrganizationDto } from \"../rest\";\n\nexport const organizations = sdk((client) => ({\n getAll: async () => client.get(\"/organizations\"),\n get: async (id: string) => client.get(\"/organizations/:id\", { id }),\n create: async (data: CreateOrganizationDto) =>\n client.post(\"/organizations\", data),\n update: async (id: string, data: UpdateOrganizationDto) =>\n client.put(\"/organizations/:id\", data, { id }),\n delete: async (id: string) => client.delete(\"/organizations/:id\", { id }),\n}));\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.11",
|
|
4
4
|
"description": "@tonightpass sdk and tools.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"reflect-metadata": "^0.2.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "20.12.
|
|
24
|
+
"@types/node": "20.12.4",
|
|
25
25
|
"tsx": "^4.7.1",
|
|
26
26
|
"typescript": "^5.0.0"
|
|
27
27
|
},
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IsArray,
|
|
3
|
+
IsEnum,
|
|
3
4
|
IsNotEmpty,
|
|
4
5
|
IsObject,
|
|
6
|
+
IsOptional,
|
|
5
7
|
IsString,
|
|
6
8
|
IsUrl,
|
|
9
|
+
Length,
|
|
7
10
|
} from "class-validator";
|
|
8
11
|
|
|
9
12
|
import {
|
|
10
13
|
Location,
|
|
11
|
-
|
|
14
|
+
OrganizationMemberRole,
|
|
12
15
|
OrganizationSocialLink,
|
|
13
16
|
} from "../../types";
|
|
14
17
|
|
|
15
18
|
export class CreateOrganizationDto {
|
|
19
|
+
@IsOptional()
|
|
16
20
|
@IsString()
|
|
17
|
-
@
|
|
18
|
-
slug
|
|
21
|
+
@Length(1, 128)
|
|
22
|
+
slug?: string;
|
|
19
23
|
|
|
20
24
|
@IsObject()
|
|
21
25
|
identity: CreateOrganizationIdentityDto;
|
|
22
26
|
|
|
23
27
|
@IsArray()
|
|
24
|
-
members:
|
|
28
|
+
members: OrganizationMemberDto[];
|
|
25
29
|
|
|
30
|
+
@IsOptional()
|
|
26
31
|
@IsObject()
|
|
27
32
|
location?: Location;
|
|
28
33
|
}
|
|
@@ -30,10 +35,12 @@ export class CreateOrganizationDto {
|
|
|
30
35
|
class CreateOrganizationIdentityDto {
|
|
31
36
|
@IsString()
|
|
32
37
|
@IsNotEmpty()
|
|
38
|
+
@Length(1, 32)
|
|
33
39
|
displayName: string;
|
|
34
40
|
|
|
35
41
|
@IsString()
|
|
36
42
|
@IsNotEmpty()
|
|
43
|
+
@Length(16, 1024)
|
|
37
44
|
description: string;
|
|
38
45
|
|
|
39
46
|
@IsUrl({
|
|
@@ -41,11 +48,23 @@ class CreateOrganizationIdentityDto {
|
|
|
41
48
|
})
|
|
42
49
|
avatarUrl?: string;
|
|
43
50
|
|
|
51
|
+
@IsOptional()
|
|
44
52
|
@IsUrl({
|
|
45
53
|
protocols: ["http", "https"],
|
|
46
54
|
})
|
|
47
55
|
bannerUrl?: string;
|
|
48
56
|
|
|
57
|
+
@IsOptional()
|
|
49
58
|
@IsArray()
|
|
50
|
-
socialLinks
|
|
59
|
+
socialLinks?: OrganizationSocialLink[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
class OrganizationMemberDto {
|
|
63
|
+
@IsString()
|
|
64
|
+
@IsNotEmpty()
|
|
65
|
+
user: string;
|
|
66
|
+
|
|
67
|
+
@IsEnum(OrganizationMemberRole)
|
|
68
|
+
@IsNotEmpty()
|
|
69
|
+
role: OrganizationMemberRole;
|
|
51
70
|
}
|
|
@@ -45,14 +45,22 @@ export enum OrganizationSocialType {
|
|
|
45
45
|
export type OrganizationMember = {
|
|
46
46
|
user: User;
|
|
47
47
|
role: OrganizationMemberRole;
|
|
48
|
+
status: OrganizationMemberStatus;
|
|
49
|
+
updatedAt: Date;
|
|
48
50
|
createdAt: Date;
|
|
49
51
|
};
|
|
50
52
|
|
|
53
|
+
export enum OrganizationMemberStatus {
|
|
54
|
+
PENDING = "pending",
|
|
55
|
+
ACCEPTED = "accepted",
|
|
56
|
+
REJECTED = "rejected",
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
export enum OrganizationMemberRole {
|
|
52
|
-
|
|
53
|
-
MANAGER =
|
|
54
|
-
ADMINISTRATOR =
|
|
55
|
-
OWNER =
|
|
60
|
+
MEMBER = "member",
|
|
61
|
+
MANAGER = "manager",
|
|
62
|
+
ADMINISTRATOR = "admin",
|
|
63
|
+
OWNER = "owner",
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
export type OrganizationEndpoints =
|