tonightpass 0.0.0 → 0.0.2
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 +21 -17
- package/CHANGELOG.md +13 -0
- package/dist/index.d.mts +615 -0
- package/dist/index.d.ts +258 -52
- package/dist/index.js +44 -471
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +15 -6
- package/src/constants/api.ts +1 -0
- package/src/constants/index.ts +2 -0
- package/src/constants/regex.ts +20 -0
- package/src/index.ts +5 -3
- package/src/rest/client.ts +154 -0
- package/src/rest/dtos/index.ts +3 -0
- package/src/rest/dtos/users/create-user.dto.ts +16 -0
- package/src/rest/dtos/users/index.ts +3 -0
- package/src/rest/dtos/users/sign-in-user.dto.ts +4 -0
- package/src/rest/dtos/users/update-user.dto.ts +116 -0
- package/src/rest/endpoints.ts +41 -0
- package/src/rest/index.ts +5 -0
- package/src/rest/request/index.ts +1 -0
- package/src/rest/request/request.ts +30 -0
- package/src/rest/types/api/index.ts +0 -0
- package/src/rest/types/careers/index.ts +87 -0
- package/src/rest/types/event/index.ts +60 -0
- package/src/rest/types/event/ticket/index.ts +36 -0
- package/src/rest/types/health/index.ts +17 -0
- package/src/rest/types/index.ts +33 -0
- package/src/rest/types/order/index.ts +46 -0
- package/src/rest/types/organizations/index.ts +54 -0
- package/src/rest/types/profiles/index.ts +30 -0
- package/src/rest/types/token/index.ts +15 -0
- package/src/rest/types/users/index.ts +104 -0
- package/src/sdk/builder.ts +5 -0
- package/src/sdk/careers.ts +22 -0
- package/src/sdk/health.ts +6 -0
- package/src/sdk/index.ts +3 -0
- package/src/sdk/profiles.ts +6 -0
- package/src/sdk/users.ts +12 -0
- package/src/tonightpass.ts +19 -0
- package/src/utils/index.ts +1 -0
- package/tests/careers/index.ts +28 -0
- package/tests/index.ts +57 -0
- package/tsconfig.json +3 -1
- package/tsup.config.ts +5 -2
package/dist/index.js
CHANGED
|
@@ -1,472 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
OrganizationSocialType: () => OrganizationSocialType,
|
|
46
|
-
PASSWORD_REGEX: () => PASSWORD_REGEX,
|
|
47
|
-
PHONE_NUMBER_REGEX: () => PHONE_NUMBER_REGEX,
|
|
48
|
-
SLUG_REGEX: () => SLUG_REGEX,
|
|
49
|
-
SignInUserDto: () => SignInUserDto,
|
|
50
|
-
UpdateUserDto: () => UpdateUserDto,
|
|
51
|
-
UserRole: () => UserRole,
|
|
52
|
-
UserTokenType: () => UserTokenType,
|
|
53
|
-
health: () => health,
|
|
54
|
-
request: () => request,
|
|
55
|
-
requester: () => requester,
|
|
56
|
-
sdk: () => sdk,
|
|
57
|
-
users: () => users
|
|
58
|
-
});
|
|
59
|
-
module.exports = __toCommonJS(src_exports);
|
|
60
|
-
|
|
61
|
-
// src/constants/regex.ts
|
|
62
|
-
var EMAIL_REGEX = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/;
|
|
63
|
-
var PASSWORD_REGEX = /((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/;
|
|
64
|
-
var NAME_REGEX = /(^[\p{L}\d'\\.\s\\-]*$)/u;
|
|
65
|
-
var SLUG_REGEX = /^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/;
|
|
66
|
-
var BCRYPT_HASH = /\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/;
|
|
67
|
-
var PHONE_NUMBER_REGEX = /^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/;
|
|
68
|
-
var IMAGE_URL_REGEX = /(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;
|
|
69
|
-
|
|
70
|
-
// src/rest/dtos/index.ts
|
|
71
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
72
|
-
|
|
73
|
-
// src/rest/dtos/users/create-user.dto.ts
|
|
74
|
-
var CreateUserDto = class {
|
|
75
|
-
identifier;
|
|
76
|
-
password;
|
|
77
|
-
identity;
|
|
78
|
-
addresses;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// src/rest/dtos/users/sign-in-user.dto.ts
|
|
82
|
-
var SignInUserDto = class {
|
|
83
|
-
identifier;
|
|
84
|
-
password;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/rest/dtos/users/update-user.dto.ts
|
|
88
|
-
var import_class_transformer = require("class-transformer");
|
|
89
|
-
var import_class_validator = require("class-validator");
|
|
90
|
-
var UpdateUserDto = class {
|
|
91
|
-
identifier;
|
|
92
|
-
identity;
|
|
93
|
-
password;
|
|
94
|
-
};
|
|
95
|
-
__decorateClass([
|
|
96
|
-
(0, import_class_validator.IsOptional)(),
|
|
97
|
-
(0, import_class_validator.IsObject)(),
|
|
98
|
-
(0, import_class_validator.ValidateNested)(),
|
|
99
|
-
(0, import_class_transformer.Type)(() => UpdateIdentifierDto)
|
|
100
|
-
], UpdateUserDto.prototype, "identifier", 2);
|
|
101
|
-
__decorateClass([
|
|
102
|
-
(0, import_class_validator.IsOptional)(),
|
|
103
|
-
(0, import_class_validator.IsObject)(),
|
|
104
|
-
(0, import_class_validator.ValidateNested)(),
|
|
105
|
-
(0, import_class_transformer.Type)(() => UpdateIdentityDto)
|
|
106
|
-
], UpdateUserDto.prototype, "identity", 2);
|
|
107
|
-
__decorateClass([
|
|
108
|
-
(0, import_class_validator.IsOptional)(),
|
|
109
|
-
(0, import_class_validator.IsString)(),
|
|
110
|
-
(0, import_class_validator.MinLength)(6),
|
|
111
|
-
(0, import_class_validator.MaxLength)(130)
|
|
112
|
-
], UpdateUserDto.prototype, "password", 2);
|
|
113
|
-
var UpdateIdentifierDto = class {
|
|
114
|
-
email;
|
|
115
|
-
phoneNumber;
|
|
116
|
-
username;
|
|
117
|
-
};
|
|
118
|
-
__decorateClass([
|
|
119
|
-
(0, import_class_validator.IsOptional)(),
|
|
120
|
-
(0, import_class_validator.IsString)(),
|
|
121
|
-
(0, import_class_validator.IsEmail)()
|
|
122
|
-
], UpdateIdentifierDto.prototype, "email", 2);
|
|
123
|
-
__decorateClass([
|
|
124
|
-
(0, import_class_validator.IsOptional)(),
|
|
125
|
-
(0, import_class_validator.IsString)(),
|
|
126
|
-
(0, import_class_validator.IsPhoneNumber)()
|
|
127
|
-
], UpdateIdentifierDto.prototype, "phoneNumber", 2);
|
|
128
|
-
__decorateClass([
|
|
129
|
-
(0, import_class_validator.IsOptional)(),
|
|
130
|
-
(0, import_class_validator.IsString)(),
|
|
131
|
-
(0, import_class_validator.MinLength)(3)
|
|
132
|
-
], UpdateIdentifierDto.prototype, "username", 2);
|
|
133
|
-
var UpdateIdentityDto = class {
|
|
134
|
-
firstName;
|
|
135
|
-
lastName;
|
|
136
|
-
displayName;
|
|
137
|
-
description;
|
|
138
|
-
profilePictureUrl;
|
|
139
|
-
bannerUrl;
|
|
140
|
-
gender;
|
|
141
|
-
birthDate;
|
|
142
|
-
};
|
|
143
|
-
__decorateClass([
|
|
144
|
-
(0, import_class_validator.IsOptional)(),
|
|
145
|
-
(0, import_class_validator.IsString)(),
|
|
146
|
-
(0, import_class_validator.Length)(2, 50),
|
|
147
|
-
(0, import_class_validator.Matches)(NAME_REGEX, {
|
|
148
|
-
message: "First name must be composed of letters only"
|
|
149
|
-
})
|
|
150
|
-
], UpdateIdentityDto.prototype, "firstName", 2);
|
|
151
|
-
__decorateClass([
|
|
152
|
-
(0, import_class_validator.IsOptional)(),
|
|
153
|
-
(0, import_class_validator.IsString)(),
|
|
154
|
-
(0, import_class_validator.Length)(2, 50),
|
|
155
|
-
(0, import_class_validator.Matches)(NAME_REGEX, {
|
|
156
|
-
message: "Last name must be composed of letters only"
|
|
157
|
-
})
|
|
158
|
-
], UpdateIdentityDto.prototype, "lastName", 2);
|
|
159
|
-
__decorateClass([
|
|
160
|
-
(0, import_class_validator.IsOptional)(),
|
|
161
|
-
(0, import_class_validator.IsString)(),
|
|
162
|
-
(0, import_class_validator.Length)(1, 32)
|
|
163
|
-
], UpdateIdentityDto.prototype, "displayName", 2);
|
|
164
|
-
__decorateClass([
|
|
165
|
-
(0, import_class_validator.IsOptional)(),
|
|
166
|
-
(0, import_class_validator.IsString)(),
|
|
167
|
-
(0, import_class_validator.Length)(15, 500)
|
|
168
|
-
], UpdateIdentityDto.prototype, "description", 2);
|
|
169
|
-
__decorateClass([
|
|
170
|
-
(0, import_class_validator.IsOptional)(),
|
|
171
|
-
(0, import_class_validator.IsUrl)()
|
|
172
|
-
], UpdateIdentityDto.prototype, "profilePictureUrl", 2);
|
|
173
|
-
__decorateClass([
|
|
174
|
-
(0, import_class_validator.IsOptional)(),
|
|
175
|
-
(0, import_class_validator.IsUrl)()
|
|
176
|
-
], UpdateIdentityDto.prototype, "bannerUrl", 2);
|
|
177
|
-
__decorateClass([
|
|
178
|
-
(0, import_class_validator.IsOptional)()
|
|
179
|
-
], UpdateIdentityDto.prototype, "gender", 2);
|
|
180
|
-
__decorateClass([
|
|
181
|
-
(0, import_class_validator.IsOptional)(),
|
|
182
|
-
(0, import_class_validator.IsDateString)()
|
|
183
|
-
], UpdateIdentityDto.prototype, "birthDate", 2);
|
|
184
|
-
|
|
185
|
-
// ../../node_modules/redaxios/dist/redaxios.module.js
|
|
186
|
-
var redaxios_module_default = function e(t) {
|
|
187
|
-
function n(e2, t2, r2) {
|
|
188
|
-
var a, o = {};
|
|
189
|
-
if (Array.isArray(e2))
|
|
190
|
-
return e2.concat(t2);
|
|
191
|
-
for (a in e2)
|
|
192
|
-
o[r2 ? a.toLowerCase() : a] = e2[a];
|
|
193
|
-
for (a in t2) {
|
|
194
|
-
var i = r2 ? a.toLowerCase() : a, u = t2[a];
|
|
195
|
-
o[i] = i in o && "object" == typeof u ? n(o[i], u, "headers" == i) : u;
|
|
196
|
-
}
|
|
197
|
-
return o;
|
|
198
|
-
}
|
|
199
|
-
function r(e2, r2, a, o, i) {
|
|
200
|
-
var u = "string" != typeof e2 ? (r2 = e2).url : e2, c = { config: r2 }, s = n(t, r2), f = {};
|
|
201
|
-
o = o || s.data, (s.transformRequest || []).map(function(e3) {
|
|
202
|
-
o = e3(o, s.headers) || o;
|
|
203
|
-
}), s.auth && (f.authorization = s.auth), o && "object" == typeof o && "function" != typeof o.append && "function" != typeof o.text && (o = JSON.stringify(o), f["content-type"] = "application/json");
|
|
204
|
-
try {
|
|
205
|
-
f[s.xsrfHeaderName] = decodeURIComponent(document.cookie.match(RegExp("(^|; )" + s.xsrfCookieName + "=([^;]*)"))[2]);
|
|
206
|
-
} catch (e3) {
|
|
207
|
-
}
|
|
208
|
-
return s.baseURL && (u = u.replace(/^(?!.*\/\/)\/?/, s.baseURL + "/")), s.params && (u += (~u.indexOf("?") ? "&" : "?") + (s.paramsSerializer ? s.paramsSerializer(s.params) : new URLSearchParams(s.params))), (s.fetch || fetch)(u, { method: (a || s.method || "get").toUpperCase(), body: o, headers: n(s.headers, f, true), credentials: s.withCredentials ? "include" : i }).then(function(e3) {
|
|
209
|
-
for (var t2 in e3)
|
|
210
|
-
"function" != typeof e3[t2] && (c[t2] = e3[t2]);
|
|
211
|
-
return "stream" == s.responseType ? (c.data = e3.body, c) : e3[s.responseType || "text"]().then(function(e4) {
|
|
212
|
-
c.data = e4, c.data = JSON.parse(e4);
|
|
213
|
-
}).catch(Object).then(function() {
|
|
214
|
-
return (s.validateStatus ? s.validateStatus(e3.status) : e3.ok) ? c : Promise.reject(c);
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
return t = t || {}, r.request = r, r.get = function(e2, t2) {
|
|
219
|
-
return r(e2, t2, "get");
|
|
220
|
-
}, r.delete = function(e2, t2) {
|
|
221
|
-
return r(e2, t2, "delete");
|
|
222
|
-
}, r.head = function(e2, t2) {
|
|
223
|
-
return r(e2, t2, "head");
|
|
224
|
-
}, r.options = function(e2, t2) {
|
|
225
|
-
return r(e2, t2, "options");
|
|
226
|
-
}, r.post = function(e2, t2, n2) {
|
|
227
|
-
return r(e2, n2, "post", t2);
|
|
228
|
-
}, r.put = function(e2, t2, n2) {
|
|
229
|
-
return r(e2, n2, "put", t2);
|
|
230
|
-
}, r.patch = function(e2, t2, n2) {
|
|
231
|
-
return r(e2, n2, "patch", t2);
|
|
232
|
-
}, r.all = Promise.all.bind(Promise), r.spread = function(e2) {
|
|
233
|
-
return e2.apply.bind(e2, e2);
|
|
234
|
-
}, r.CancelToken = "function" == typeof AbortController ? AbortController : Object, r.defaults = t, r.create = e, r;
|
|
235
|
-
}();
|
|
236
|
-
|
|
237
|
-
// src/rest/request/request.ts
|
|
238
|
-
var instance = redaxios_module_default.create({
|
|
239
|
-
baseURL: process.env.NEXT_PUBLIC_API_URL,
|
|
240
|
-
headers: {
|
|
241
|
-
"Content-Type": "application/json",
|
|
242
|
-
Accept: "application/json"
|
|
243
|
-
},
|
|
244
|
-
responseType: "json",
|
|
245
|
-
transformRequest: [
|
|
246
|
-
function(data) {
|
|
247
|
-
return JSON.stringify(data);
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
});
|
|
251
|
-
var request = async (url, options) => {
|
|
252
|
-
const response = instance(url, { ...options }).then((response2) => response2.data).catch((error) => {
|
|
253
|
-
throw error;
|
|
254
|
-
});
|
|
255
|
-
return response;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/rest/request/requester.ts
|
|
259
|
-
var createAuthHeaders = (jwtToken) => ({
|
|
260
|
-
Authorization: `${process.env.NEXT_PUBLIC_AUTH_PREFIX || "Bearer"} ${jwtToken}`
|
|
261
|
-
});
|
|
262
|
-
var requester = (auth = true) => {
|
|
263
|
-
let baseOptions = {};
|
|
264
|
-
if (auth) {
|
|
265
|
-
createAuthHeaders;
|
|
266
|
-
baseOptions = {
|
|
267
|
-
...baseOptions,
|
|
268
|
-
withCredentials: true
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
const get = async (url, options) => request(url, { ...baseOptions, ...options, method: "GET" });
|
|
272
|
-
const post = async (url, options) => request(url, { ...baseOptions, ...options, method: "POST" });
|
|
273
|
-
const put = async (url, options) => request(url, { ...baseOptions, ...options, method: "PUT" });
|
|
274
|
-
const del = async (url, options) => request(url, { ...baseOptions, ...options, method: "DELETE" });
|
|
275
|
-
return {
|
|
276
|
-
get,
|
|
277
|
-
post,
|
|
278
|
-
put,
|
|
279
|
-
delete: del
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// src/rest/types/event/ticket/index.ts
|
|
284
|
-
var EventTicketCategory = /* @__PURE__ */ ((EventTicketCategory2) => {
|
|
285
|
-
EventTicketCategory2["ENTRY"] = "entry";
|
|
286
|
-
EventTicketCategory2["PACKAGE"] = "package";
|
|
287
|
-
EventTicketCategory2["MEAL"] = "meal";
|
|
288
|
-
EventTicketCategory2["DRINK"] = "drink";
|
|
289
|
-
EventTicketCategory2["PARKING"] = "parking";
|
|
290
|
-
EventTicketCategory2["ACCOMMODATION"] = "accommodation";
|
|
291
|
-
EventTicketCategory2["CAMPING"] = "camping";
|
|
292
|
-
EventTicketCategory2["LOCKER"] = "locker";
|
|
293
|
-
EventTicketCategory2["SHUTTLE"] = "shuttle";
|
|
294
|
-
EventTicketCategory2["OTHER"] = "other";
|
|
295
|
-
return EventTicketCategory2;
|
|
296
|
-
})(EventTicketCategory || {});
|
|
297
|
-
|
|
298
|
-
// src/rest/types/event/index.ts
|
|
299
|
-
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
300
|
-
EventType2["Clubbing"] = "clubbing";
|
|
301
|
-
EventType2["Concert"] = "concert";
|
|
302
|
-
EventType2["Afterwork"] = "afterwork";
|
|
303
|
-
EventType2["DancingLunch"] = "dancing_lunch";
|
|
304
|
-
EventType2["Diner"] = "diner";
|
|
305
|
-
EventType2["Garden"] = "garden";
|
|
306
|
-
EventType2["AfterBeach"] = "after_beach";
|
|
307
|
-
EventType2["Festival"] = "festival";
|
|
308
|
-
EventType2["Spectacle"] = "spectacle";
|
|
309
|
-
EventType2["Cruise"] = "cruise";
|
|
310
|
-
EventType2["OutsideAnimation"] = "outside_animation";
|
|
311
|
-
EventType2["Sport"] = "sport";
|
|
312
|
-
EventType2["Match"] = "match";
|
|
313
|
-
EventType2["Seminar"] = "seminar";
|
|
314
|
-
EventType2["Conference"] = "conference";
|
|
315
|
-
EventType2["WellnessDay"] = "wellness_day";
|
|
316
|
-
EventType2["Workshop"] = "workshop";
|
|
317
|
-
EventType2["TradeFair"] = "trade_fair";
|
|
318
|
-
EventType2["ConsumerShow"] = "consumer_show";
|
|
319
|
-
EventType2["Membership"] = "membership";
|
|
320
|
-
return EventType2;
|
|
321
|
-
})(EventType || {});
|
|
322
|
-
var EventStyleType = /* @__PURE__ */ ((EventStyleType2) => {
|
|
323
|
-
EventStyleType2["Music"] = "music";
|
|
324
|
-
EventStyleType2["Dress"] = "dress";
|
|
325
|
-
EventStyleType2["Sport"] = "sport";
|
|
326
|
-
EventStyleType2["Food"] = "food";
|
|
327
|
-
EventStyleType2["Art"] = "art";
|
|
328
|
-
return EventStyleType2;
|
|
329
|
-
})(EventStyleType || {});
|
|
330
|
-
|
|
331
|
-
// src/rest/types/organization/index.ts
|
|
332
|
-
var OrganizationSocialType = /* @__PURE__ */ ((OrganizationSocialType2) => {
|
|
333
|
-
OrganizationSocialType2["Facebook"] = "facebook";
|
|
334
|
-
OrganizationSocialType2["Twitter"] = "twitter";
|
|
335
|
-
OrganizationSocialType2["Instagram"] = "instagram";
|
|
336
|
-
OrganizationSocialType2["Linkedin"] = "linkedin";
|
|
337
|
-
OrganizationSocialType2["Youtube"] = "youtube";
|
|
338
|
-
OrganizationSocialType2["Website"] = "website";
|
|
339
|
-
return OrganizationSocialType2;
|
|
340
|
-
})(OrganizationSocialType || {});
|
|
341
|
-
var OrganizationMemberRole = /* @__PURE__ */ ((OrganizationMemberRole2) => {
|
|
342
|
-
OrganizationMemberRole2[OrganizationMemberRole2["EMPLOYEE"] = 0] = "EMPLOYEE";
|
|
343
|
-
OrganizationMemberRole2[OrganizationMemberRole2["MANAGER"] = 1] = "MANAGER";
|
|
344
|
-
OrganizationMemberRole2[OrganizationMemberRole2["ADMINISTRATOR"] = 2] = "ADMINISTRATOR";
|
|
345
|
-
OrganizationMemberRole2[OrganizationMemberRole2["OWNER"] = 3] = "OWNER";
|
|
346
|
-
return OrganizationMemberRole2;
|
|
347
|
-
})(OrganizationMemberRole || {});
|
|
348
|
-
|
|
349
|
-
// src/rest/types/token/index.ts
|
|
350
|
-
var UserTokenType = /* @__PURE__ */ ((UserTokenType2) => {
|
|
351
|
-
UserTokenType2["Authentication"] = "authentication";
|
|
352
|
-
UserTokenType2["OrganizationInvite"] = "organization_invite";
|
|
353
|
-
UserTokenType2["PasswordRecovery"] = "password_recovery";
|
|
354
|
-
UserTokenType2["EmailValidation"] = "email_validation";
|
|
355
|
-
UserTokenType2["PhoneValidation"] = "phone_validation";
|
|
356
|
-
return UserTokenType2;
|
|
357
|
-
})(UserTokenType || {});
|
|
358
|
-
|
|
359
|
-
// src/rest/types/user/index.ts
|
|
360
|
-
var UserRole = /* @__PURE__ */ ((UserRole2) => {
|
|
361
|
-
UserRole2[UserRole2["USER"] = 0] = "USER";
|
|
362
|
-
UserRole2[UserRole2["DEVELOPER"] = 8] = "DEVELOPER";
|
|
363
|
-
UserRole2[UserRole2["ADMINISTRATOR"] = 10] = "ADMINISTRATOR";
|
|
364
|
-
return UserRole2;
|
|
365
|
-
})(UserRole || {});
|
|
366
|
-
|
|
367
|
-
// src/rest/types/order/index.ts
|
|
368
|
-
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
369
|
-
OrderStatus2["Created"] = "created";
|
|
370
|
-
OrderStatus2["Cancelled"] = "cancelled";
|
|
371
|
-
OrderStatus2["Completed"] = "completed";
|
|
372
|
-
OrderStatus2["Pending"] = "pending";
|
|
373
|
-
OrderStatus2["Confirmed"] = "confirmed";
|
|
374
|
-
OrderStatus2["Declined"] = "declined";
|
|
375
|
-
OrderStatus2["Refunded"] = "refunded";
|
|
376
|
-
OrderStatus2["PartiallyRefunded"] = "partially_refunded";
|
|
377
|
-
OrderStatus2["Expired"] = "expired";
|
|
378
|
-
return OrderStatus2;
|
|
379
|
-
})(OrderStatus || {});
|
|
380
|
-
|
|
381
|
-
// src/rest/types/index.ts
|
|
382
|
-
var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
383
|
-
Currency2["EUR"] = "EUR";
|
|
384
|
-
Currency2["USD"] = "USD";
|
|
385
|
-
Currency2["GBP"] = "GBP";
|
|
386
|
-
return Currency2;
|
|
387
|
-
})(Currency || {});
|
|
388
|
-
var Language = /* @__PURE__ */ ((Language2) => {
|
|
389
|
-
Language2["FR"] = "fr";
|
|
390
|
-
Language2["EN"] = "en";
|
|
391
|
-
return Language2;
|
|
392
|
-
})(Language || {});
|
|
393
|
-
|
|
394
|
-
// src/rest/client.ts
|
|
395
|
-
var import_pathcat = require("pathcat");
|
|
396
|
-
|
|
397
|
-
// src/constants/api.ts
|
|
398
|
-
var DEFAULT_API_URL = "https://api.staging.tonightpass.com";
|
|
399
|
-
|
|
400
|
-
// src/rest/client.ts
|
|
401
|
-
var Client = class {
|
|
402
|
-
options;
|
|
403
|
-
url;
|
|
404
|
-
request = requester();
|
|
405
|
-
constructor(options) {
|
|
406
|
-
this.options = options;
|
|
407
|
-
this.url = (path, params) => {
|
|
408
|
-
const baseUrl = DEFAULT_API_URL || this.options.baseUrl;
|
|
409
|
-
return (0, import_pathcat.pathcat)(baseUrl, path, params);
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
async get(url, options) {
|
|
413
|
-
return this.request.get(url, options);
|
|
414
|
-
}
|
|
415
|
-
async post(url, options) {
|
|
416
|
-
return this.request.post(url, options);
|
|
417
|
-
}
|
|
418
|
-
async put(url, options) {
|
|
419
|
-
return this.request.put(url, options);
|
|
420
|
-
}
|
|
421
|
-
async delete(url, options) {
|
|
422
|
-
return this.request.delete(url, options);
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
// src/sdk/builder.ts
|
|
427
|
-
function sdk(builder) {
|
|
428
|
-
return builder;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// src/sdk/health.ts
|
|
432
|
-
var health = sdk((client) => ({
|
|
433
|
-
http: async () => client.get("/health/http")
|
|
434
|
-
}));
|
|
435
|
-
|
|
436
|
-
// src/sdk/users.ts
|
|
437
|
-
var users = sdk((client) => ({
|
|
438
|
-
me: {
|
|
439
|
-
get: async () => client.get("/users/me"),
|
|
440
|
-
update: async (data) => client.put("/users/me", { data })
|
|
441
|
-
}
|
|
442
|
-
}));
|
|
443
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
444
|
-
0 && (module.exports = {
|
|
445
|
-
BCRYPT_HASH,
|
|
446
|
-
Client,
|
|
447
|
-
CreateUserDto,
|
|
448
|
-
Currency,
|
|
449
|
-
EMAIL_REGEX,
|
|
450
|
-
EventStyleType,
|
|
451
|
-
EventTicketCategory,
|
|
452
|
-
EventType,
|
|
453
|
-
IMAGE_URL_REGEX,
|
|
454
|
-
Language,
|
|
455
|
-
NAME_REGEX,
|
|
456
|
-
OrderStatus,
|
|
457
|
-
OrganizationMemberRole,
|
|
458
|
-
OrganizationSocialType,
|
|
459
|
-
PASSWORD_REGEX,
|
|
460
|
-
PHONE_NUMBER_REGEX,
|
|
461
|
-
SLUG_REGEX,
|
|
462
|
-
SignInUserDto,
|
|
463
|
-
UpdateUserDto,
|
|
464
|
-
UserRole,
|
|
465
|
-
UserTokenType,
|
|
466
|
-
health,
|
|
467
|
-
request,
|
|
468
|
-
requester,
|
|
469
|
-
sdk,
|
|
470
|
-
users
|
|
471
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('reflect-metadata');
|
|
4
|
+
var classTransformer = require('class-transformer');
|
|
5
|
+
var classValidator = require('class-validator');
|
|
6
|
+
var z = require('redaxios');
|
|
7
|
+
var pathcat = require('pathcat');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var z__default = /*#__PURE__*/_interopDefault(z);
|
|
12
|
+
|
|
13
|
+
var $=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var a=(r,e,s,t)=>{for(var n=t>1?void 0:t?j(e,s):e,i=r.length-1,d;i>=0;i--)(d=r[i])&&(n=(t?d(e,s,n):d(n))||n);return t&&n&&$(e,s,n),n};var R="https://api.tonightpass.com";var oe=/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/,ie=/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,E=/(^[\p{L}\d'\\.\s\\-]*$)/u,ae=/^[a-z\d]+(?:(\.|-|_)[a-z\d]+)*$/,pe=/\$2[abxy]?\$\d{1,2}\$[A-Za-z\d\\./]{53}/,de=/^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$/,me=/(((http:\/\/www)|(http:\/\/)|(www))[-a-zA-Z0-9@:%_\\+.~#?&//=]+)\.(jpg|jpeg|gif|png|bmp|tiff|tga|svg)/i;var I=class{identifier;password;identity;addresses};var U=class{identifier;password};var h=class{identifier;identity;password};a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>f)],h.prototype,"identifier",2),a([classValidator.IsOptional(),classValidator.IsObject(),classValidator.ValidateNested(),classTransformer.Type(()=>m)],h.prototype,"identity",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(6),classValidator.MaxLength(130)],h.prototype,"password",2);var f=class{email;phoneNumber;username};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsEmail()],f.prototype,"email",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.IsPhoneNumber()],f.prototype,"phoneNumber",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.MinLength(3)],f.prototype,"username",2);var m=class{firstName;lastName;displayName;description;profilePictureUrl;bannerUrl;gender;birthDate};a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(E,{message:"First name must be composed of letters only"})],m.prototype,"firstName",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(2,50),classValidator.Matches(E,{message:"Last name must be composed of letters only"})],m.prototype,"lastName",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(1,32)],m.prototype,"displayName",2),a([classValidator.IsOptional(),classValidator.IsString(),classValidator.Length(15,500)],m.prototype,"description",2),a([classValidator.IsOptional(),classValidator.IsUrl()],m.prototype,"profilePictureUrl",2),a([classValidator.IsOptional(),classValidator.IsUrl()],m.prototype,"bannerUrl",2),a([classValidator.IsOptional()],m.prototype,"gender",2),a([classValidator.IsOptional(),classValidator.IsDateString()],m.prototype,"birthDate",2);var k=typeof window<"u";var H=z__default.default.create({headers:{"Content-Type":"application/json",Accept:"application/json",...!k&&{"User-Agent":"tonightpass-api-client"}},responseType:"json",transformRequest:[function(r){return JSON.stringify(r)}]}),G=async(r,e)=>H(r,{...e}).then(t=>t).catch(t=>{throw t});var V=(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))(V||{});var B=(o=>(o.Clubbing="clubbing",o.Concert="concert",o.Afterwork="afterwork",o.DancingLunch="dancing_lunch",o.Diner="diner",o.Garden="garden",o.AfterBeach="after_beach",o.Festival="festival",o.Spectacle="spectacle",o.Cruise="cruise",o.OutsideAnimation="outside_animation",o.Sport="sport",o.Match="match",o.Seminar="seminar",o.Conference="conference",o.WellnessDay="wellness_day",o.Workshop="workshop",o.TradeFair="trade_fair",o.ConsumerShow="consumer_show",o.Membership="membership",o))(B||{}),X=(i=>(i.Music="music",i.Dress="dress",i.Sport="sport",i.Food="food",i.Art="art",i))(X||{});var W=(d=>(d.Facebook="facebook",d.Twitter="twitter",d.Instagram="instagram",d.Linkedin="linkedin",d.Youtube="youtube",d.Website="website",d))(W||{}),K=(n=>(n[n.EMPLOYEE=0]="EMPLOYEE",n[n.MANAGER=1]="MANAGER",n[n.ADMINISTRATOR=2]="ADMINISTRATOR",n[n.OWNER=3]="OWNER",n))(K||{});var Y=(i=>(i.Authentication="authentication",i.OrganizationInvite="organization_invite",i.PasswordRecovery="password_recovery",i.EmailValidation="email_validation",i.PhoneValidation="phone_validation",i))(Y||{});var Z=(t=>(t[t.USER=0]="USER",t[t.DEVELOPER=8]="DEVELOPER",t[t.ADMINISTRATOR=10]="ADMINISTRATOR",t))(Z||{});var J=(u=>(u.Created="created",u.Cancelled="cancelled",u.Completed="completed",u.Pending="pending",u.Confirmed="confirmed",u.Declined="declined",u.Refunded="refunded",u.PartiallyRefunded="partially_refunded",u.Expired="expired",u))(J||{});var ee=(t=>(t.EUR="EUR",t.USD="USD",t.GBP="GBP",t))(ee||{}),te=(s=>(s.FR="fr",s.EN="en",s))(te||{});var b=class extends Error{constructor(s,t){super(t.message);this.response=s;this.data=t;this.status=s.status;}status},x=class{options;url;constructor(e){this.options=e,this.url=(s,t)=>{let n=this.options.baseURL||R;return pathcat.pathcat(n,s,t)};}setOptions(e){this.options=e;}async get(e,s,t){return this.requester("GET",e,void 0,s,t)}async post(e,s,t,n){return this.requester("POST",e,s,t,n)}async put(e,s,t,n){return this.requester("PUT",e,s,t,n)}async patch(e,s,t,n){return this.requester("PATCH",e,s,t,n)}async delete(e,s,t){return this.requester("DELETE",e,void 0,s,t)}async requester(e,s,t,n={},i={}){let d=this.url(s,n);if(t!==void 0&&e==="GET")throw new Error("Cannot send a GET request with a body");let A=await G(d,{method:e,data:t,...i}),P=A.data;if(!P.success)throw new b(A,P);return P.data}};function y(r){return r}var _=r=>({database:async()=>r.get("/health/database"),http:async()=>r.get("/health/http")});var T=r=>({getAll:async()=>r.get("/users"),get:async e=>r.get("/users",{id:e}),me:async()=>r.get("/users/me"),check:async e=>r.get("/check/:identifier",{identifier:e}),update:async(e,s)=>r.put("/users/:id",s,{id:e})});var M=r=>({categories:{getAll:async e=>r.get("/careers/categories",e)},employmentTypes:{getAll:async e=>r.get("/careers/employmentTypes",e)},jobs:{getAll:async e=>r.get("/careers/jobs",e),get:async e=>r.get("/careers/jobs/:id",{id:e})},offices:{getAll:async e=>r.get("/careers/offices",e)}});var q=class{client;careers;health;users;constructor(e){this.client=new x(e),this.careers=M(this.client),this.health=_(this.client),this.users=T(this.client);}};
|
|
14
|
+
|
|
15
|
+
exports.BCRYPT_HASH = pe;
|
|
16
|
+
exports.Client = x;
|
|
17
|
+
exports.CreateUserDto = I;
|
|
18
|
+
exports.Currency = ee;
|
|
19
|
+
exports.DEFAULT_API_URL = R;
|
|
20
|
+
exports.EMAIL_REGEX = oe;
|
|
21
|
+
exports.EventStyleType = X;
|
|
22
|
+
exports.EventTicketCategory = V;
|
|
23
|
+
exports.EventType = B;
|
|
24
|
+
exports.IMAGE_URL_REGEX = me;
|
|
25
|
+
exports.Language = te;
|
|
26
|
+
exports.NAME_REGEX = E;
|
|
27
|
+
exports.OrderStatus = J;
|
|
28
|
+
exports.OrganizationMemberRole = K;
|
|
29
|
+
exports.OrganizationSocialType = W;
|
|
30
|
+
exports.PASSWORD_REGEX = ie;
|
|
31
|
+
exports.PHONE_NUMBER_REGEX = de;
|
|
32
|
+
exports.SLUG_REGEX = ae;
|
|
33
|
+
exports.SignInUserDto = U;
|
|
34
|
+
exports.TonightPass = q;
|
|
35
|
+
exports.TonightPassAPIError = b;
|
|
36
|
+
exports.UpdateUserDto = h;
|
|
37
|
+
exports.UserRole = Z;
|
|
38
|
+
exports.UserTokenType = Y;
|
|
39
|
+
exports.health = _;
|
|
40
|
+
exports.isBrowser = k;
|
|
41
|
+
exports.request = G;
|
|
42
|
+
exports.sdk = y;
|
|
43
|
+
exports.users = T;
|
|
44
|
+
//# sourceMappingURL=out.js.map
|
|
472
45
|
//# sourceMappingURL=index.js.map
|