@veruna/api-contracts 1.0.7 → 1.0.9
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/build/rest-api.d.ts +1 -1
- package/build/rest-api.js +15 -15
- package/build/v1/auth/auth.paths.d.ts +2 -2
- package/build/v1/auth/auth.paths.js +2 -2
- package/build/v1/auth/auth.types.d.ts +2 -3
- package/build/v1/auth/commands/delete-session.command.d.ts +3 -1
- package/build/v1/auth/commands/delete-session.command.js +3 -2
- package/build/v1/auth/commands/index.d.ts +1 -1
- package/build/v1/auth/commands/index.js +1 -1
- package/build/v1/auth/commands/logout-all.command.d.ts +3 -1
- package/build/v1/auth/commands/logout-all.command.js +3 -2
- package/build/v1/auth/commands/logout.command.d.ts +3 -1
- package/build/v1/auth/commands/logout.command.js +3 -2
- package/build/v1/auth/commands/{login.command.d.ts → signin.command.d.ts} +3 -3
- package/build/v1/auth/commands/signin.command.js +18 -0
- package/build/v1/auth/commands/signup.command.d.ts +0 -7
- package/build/v1/auth/routes/auth.routes.d.ts +1 -1
- package/build/v1/auth/routes/auth.routes.js +1 -1
- package/build/v1/auth/schemas/index.d.ts +1 -1
- package/build/v1/auth/schemas/index.js +1 -1
- package/build/v1/auth/schemas/{login-request.schema.d.ts → signin-request.schema.d.ts} +2 -2
- package/build/v1/auth/schemas/{login-request.schema.js → signin-request.schema.js} +3 -3
- package/build/v1/auth/schemas/signup-request.schema.d.ts +0 -17
- package/build/v1/auth/schemas/signup-request.schema.js +1 -12
- package/build/v1/unregistered-users/commands/authenticate.command.d.ts +7 -0
- package/build/v1/unregistered-users/schemas/authenticate-request.schema.d.ts +17 -0
- package/build/v1/unregistered-users/schemas/authenticate-request.schema.js +12 -1
- package/build/v1/users/commands/change-password.command.d.ts +3 -1
- package/build/v1/users/commands/change-password.command.js +7 -4
- package/build/v1/users/commands/delete-account.command.d.ts +3 -1
- package/build/v1/users/commands/delete-account.command.js +4 -2
- package/build/v1/users/commands/toggle-marketing-consent.command.d.ts +8 -1
- package/build/v1/users/commands/toggle-marketing-consent.command.js +2 -2
- package/build/v1/users/commands/update-profile.command.d.ts +8 -1
- package/build/v1/users/commands/update-profile.command.js +2 -2
- package/build/v1/users/schemas/response-unions.schema.d.ts +24 -21
- package/build/v1/users/schemas/response-unions.schema.js +6 -6
- package/package.json +2 -1
- package/build/v1/auth/commands/login.command.js +0 -18
package/build/rest-api.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const REST_API: {
|
|
|
7
7
|
readonly V1: {
|
|
8
8
|
readonly AUTH: {
|
|
9
9
|
readonly SIGNUP: "/api/v1/auth/signup";
|
|
10
|
-
readonly
|
|
10
|
+
readonly SIGNIN: "/api/v1/auth/signin";
|
|
11
11
|
readonly LOGOUT: "/api/v1/auth/logout";
|
|
12
12
|
readonly LOGOUT_ALL: "/api/v1/auth/logout-all";
|
|
13
13
|
readonly SESSIONS: "/api/v1/auth/sessions";
|
package/build/rest-api.js
CHANGED
|
@@ -7,33 +7,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.REST_API = exports.ROOT = void 0;
|
|
8
8
|
const controllers_1 = require("./v1/blog/controllers");
|
|
9
9
|
const routes_1 = require("./v1/blog/routes");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
10
|
+
const v1_1 = require("./v1");
|
|
11
|
+
const v1_2 = require("./v1");
|
|
12
|
+
const users_1 = require("./v1/users");
|
|
13
|
+
const users_2 = require("./v1/users");
|
|
14
|
+
const controllers_2 = require("./v1/unregistered-users/controllers");
|
|
15
15
|
const unreg_users_routes_1 = require("./v1/unregistered-users/routes/unreg-users.routes");
|
|
16
16
|
exports.ROOT = '/api';
|
|
17
17
|
exports.REST_API = {
|
|
18
18
|
V1: {
|
|
19
19
|
// Auth module
|
|
20
20
|
AUTH: {
|
|
21
|
-
SIGNUP: `${exports.ROOT}/${
|
|
22
|
-
|
|
23
|
-
LOGOUT: `${exports.ROOT}/${
|
|
24
|
-
LOGOUT_ALL: `${exports.ROOT}/${
|
|
25
|
-
SESSIONS: `${exports.ROOT}/${
|
|
26
|
-
SESSION_BY_ID: (id) => `${exports.ROOT}/${
|
|
21
|
+
SIGNUP: `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/${v1_2.AUTH_ROUTES.SIGNUP}`,
|
|
22
|
+
SIGNIN: `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/${v1_2.AUTH_ROUTES.SIGNIN}`,
|
|
23
|
+
LOGOUT: `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/${v1_2.AUTH_ROUTES.LOGOUT}`,
|
|
24
|
+
LOGOUT_ALL: `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/${v1_2.AUTH_ROUTES.LOGOUT_ALL}`,
|
|
25
|
+
SESSIONS: `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/${v1_2.AUTH_ROUTES.SESSIONS}`,
|
|
26
|
+
SESSION_BY_ID: (id) => `${exports.ROOT}/${v1_1.AUTH_CONTROLLER}/sessions/${id}`,
|
|
27
27
|
},
|
|
28
28
|
// Users module
|
|
29
29
|
USERS: {
|
|
30
|
-
ME: `${exports.ROOT}/${
|
|
31
|
-
ME_MARKETING_CONSENT: `${exports.ROOT}/${
|
|
32
|
-
ME_PASSWORD: `${exports.ROOT}/${
|
|
30
|
+
ME: `${exports.ROOT}/${users_1.USERS_CONTROLLER}/${users_2.USERS_ROUTES.ME}`,
|
|
31
|
+
ME_MARKETING_CONSENT: `${exports.ROOT}/${users_1.USERS_CONTROLLER}/${users_2.USERS_ROUTES.ME_MARKETING_CONSENT}`,
|
|
32
|
+
ME_PASSWORD: `${exports.ROOT}/${users_1.USERS_CONTROLLER}/${users_2.USERS_ROUTES.ME_PASSWORD}`,
|
|
33
33
|
},
|
|
34
34
|
// Unregistered Users
|
|
35
35
|
UNREG: {
|
|
36
|
-
AUTHENTICATE: `${exports.ROOT}/${
|
|
36
|
+
AUTHENTICATE: `${exports.ROOT}/${controllers_2.UNREG_USERS_CONTROLLER}/${unreg_users_routes_1.UNREG_USERS_ROUTES.AUTHENTICATE}`,
|
|
37
37
|
},
|
|
38
38
|
// Blog module
|
|
39
39
|
BLOG: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const AUTH_PATHS: {
|
|
2
2
|
readonly BASE: "v1/auth";
|
|
3
3
|
readonly SIGNUP: "signup";
|
|
4
|
-
readonly
|
|
4
|
+
readonly SIGNIN: "signin";
|
|
5
5
|
readonly LOGOUT: "logout";
|
|
6
6
|
readonly LOGOUT_ALL: "logout-all";
|
|
7
7
|
readonly SESSIONS: "sessions";
|
|
@@ -9,7 +9,7 @@ export declare const AUTH_PATHS: {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const AUTH_API_PATHS: {
|
|
11
11
|
readonly SIGNUP: "/api/v1/auth/signup";
|
|
12
|
-
readonly
|
|
12
|
+
readonly SIGNIN: "/api/v1/auth/signin";
|
|
13
13
|
readonly LOGOUT: "/api/v1/auth/logout";
|
|
14
14
|
readonly LOGOUT_ALL: "/api/v1/auth/logout-all";
|
|
15
15
|
readonly SESSIONS: "/api/v1/auth/sessions";
|
|
@@ -4,7 +4,7 @@ exports.AUTH_API_PATHS = exports.AUTH_PATHS = void 0;
|
|
|
4
4
|
exports.AUTH_PATHS = {
|
|
5
5
|
BASE: 'v1/auth',
|
|
6
6
|
SIGNUP: 'signup',
|
|
7
|
-
|
|
7
|
+
SIGNIN: 'signin',
|
|
8
8
|
LOGOUT: 'logout',
|
|
9
9
|
LOGOUT_ALL: 'logout-all',
|
|
10
10
|
SESSIONS: 'sessions',
|
|
@@ -12,7 +12,7 @@ exports.AUTH_PATHS = {
|
|
|
12
12
|
};
|
|
13
13
|
exports.AUTH_API_PATHS = {
|
|
14
14
|
SIGNUP: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SIGNUP}`,
|
|
15
|
-
|
|
15
|
+
SIGNIN: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SIGNIN}`,
|
|
16
16
|
LOGOUT: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.LOGOUT}`,
|
|
17
17
|
LOGOUT_ALL: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.LOGOUT_ALL}`,
|
|
18
18
|
SESSIONS: `/api/${exports.AUTH_PATHS.BASE}/${exports.AUTH_PATHS.SESSIONS}`,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { SignUpRequestSchema,
|
|
2
|
+
import { SignUpRequestSchema, SignInRequestSchema, SessionResponseSchema, AuthResponseSchema, SessionsListResponseSchema } from './schemas';
|
|
3
3
|
export { UserRole } from './schemas/user-role.enum';
|
|
4
4
|
export type SignUpRequest = z.infer<typeof SignUpRequestSchema>;
|
|
5
|
-
export type
|
|
5
|
+
export type SignInRequest = z.infer<typeof SignInRequestSchema>;
|
|
6
6
|
export type SessionResponse = z.infer<typeof SessionResponseSchema>;
|
|
7
7
|
export type AuthResponse = z.infer<typeof AuthResponseSchema>;
|
|
8
8
|
export type SessionsListResponse = z.infer<typeof SessionsListResponseSchema>;
|
|
9
|
-
export type Utm = z.infer<typeof UtmSchema>;
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
3
|
export declare namespace AuthDeleteSessionCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
sessionId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const PATH: "sessions/:id";
|
|
7
9
|
const URL: (id: string) => string;
|
|
8
10
|
const METHOD = HttpMethod.DELETE;
|
|
@@ -5,12 +5,13 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const auth_routes_1 = require("../routes/auth.routes");
|
|
6
6
|
const rest_api_1 = require("../../../rest-api");
|
|
7
7
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const common_schemas_1 = require("../../../shared/common-schemas");
|
|
9
8
|
var AuthDeleteSessionCommand;
|
|
10
9
|
(function (AuthDeleteSessionCommand) {
|
|
11
10
|
// Request/Response
|
|
12
11
|
AuthDeleteSessionCommand.Request = zod_1.z.object({});
|
|
13
|
-
AuthDeleteSessionCommand.Response =
|
|
12
|
+
AuthDeleteSessionCommand.Response = zod_1.z.object({
|
|
13
|
+
sessionId: zod_1.z.string().uuid(),
|
|
14
|
+
});
|
|
14
15
|
// Path/URL/Method
|
|
15
16
|
AuthDeleteSessionCommand.PATH = auth_routes_1.AUTH_ROUTES.SESSION_BY_ID;
|
|
16
17
|
AuthDeleteSessionCommand.URL = (id) => rest_api_1.REST_API.V1.AUTH.SESSION_BY_ID(id);
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./signup.command"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./signin.command"), exports);
|
|
19
19
|
__exportStar(require("./logout.command"), exports);
|
|
20
20
|
__exportStar(require("./logout-all.command"), exports);
|
|
21
21
|
__exportStar(require("./delete-session.command"), exports);
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
3
|
export declare namespace AuthLogoutAllCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
sessionIds: z.ZodArray<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const PATH: "logout-all";
|
|
7
9
|
const URL: "/api/v1/auth/logout-all";
|
|
8
10
|
const METHOD = HttpMethod.POST;
|
|
@@ -5,12 +5,13 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const auth_routes_1 = require("../routes/auth.routes");
|
|
6
6
|
const rest_api_1 = require("../../../rest-api");
|
|
7
7
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const common_schemas_1 = require("../../../shared/common-schemas");
|
|
9
8
|
var AuthLogoutAllCommand;
|
|
10
9
|
(function (AuthLogoutAllCommand) {
|
|
11
10
|
// Request/Response
|
|
12
11
|
AuthLogoutAllCommand.Request = zod_1.z.object({});
|
|
13
|
-
AuthLogoutAllCommand.Response =
|
|
12
|
+
AuthLogoutAllCommand.Response = zod_1.z.object({
|
|
13
|
+
sessionIds: zod_1.z.array(zod_1.z.string().uuid()),
|
|
14
|
+
});
|
|
14
15
|
// Path/URL/Method
|
|
15
16
|
AuthLogoutAllCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGOUT_ALL;
|
|
16
17
|
AuthLogoutAllCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGOUT_ALL;
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
3
|
export declare namespace AuthLogoutCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
sessionId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const PATH: "logout";
|
|
7
9
|
const URL: "/api/v1/auth/logout";
|
|
8
10
|
const METHOD = HttpMethod.POST;
|
|
@@ -5,12 +5,13 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const auth_routes_1 = require("../routes/auth.routes");
|
|
6
6
|
const rest_api_1 = require("../../../rest-api");
|
|
7
7
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const common_schemas_1 = require("../../../shared/common-schemas");
|
|
9
8
|
var AuthLogoutCommand;
|
|
10
9
|
(function (AuthLogoutCommand) {
|
|
11
10
|
// Request/Response
|
|
12
11
|
AuthLogoutCommand.Request = zod_1.z.object({});
|
|
13
|
-
AuthLogoutCommand.Response =
|
|
12
|
+
AuthLogoutCommand.Response = zod_1.z.object({
|
|
13
|
+
sessionId: zod_1.z.string().uuid(),
|
|
14
|
+
});
|
|
14
15
|
// Path/URL/Method
|
|
15
16
|
AuthLogoutCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGOUT;
|
|
16
17
|
AuthLogoutCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGOUT;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
|
-
export declare namespace
|
|
3
|
+
export declare namespace AuthSignInCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
5
|
email: z.ZodString;
|
|
6
6
|
password: z.ZodString;
|
|
@@ -24,8 +24,8 @@ export declare namespace AuthLoginCommand {
|
|
|
24
24
|
lastUsedAt: z.ZodString;
|
|
25
25
|
}, z.core.$strip>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
|
-
const PATH: "
|
|
28
|
-
const URL: "/api/v1/auth/
|
|
27
|
+
const PATH: "signin";
|
|
28
|
+
const URL: "/api/v1/auth/signin";
|
|
29
29
|
const METHOD = HttpMethod.POST;
|
|
30
30
|
type RequestType = z.infer<typeof Request>;
|
|
31
31
|
type ResponseType = z.infer<typeof Response>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthSignInCommand = void 0;
|
|
4
|
+
const signin_request_schema_1 = require("../schemas/signin-request.schema");
|
|
5
|
+
const auth_response_schema_1 = require("../schemas/auth-response.schema");
|
|
6
|
+
const auth_routes_1 = require("../routes/auth.routes");
|
|
7
|
+
const rest_api_1 = require("../../../rest-api");
|
|
8
|
+
const http_method_1 = require("../../../shared/http-method");
|
|
9
|
+
var AuthSignInCommand;
|
|
10
|
+
(function (AuthSignInCommand) {
|
|
11
|
+
// Request/Response
|
|
12
|
+
AuthSignInCommand.Request = signin_request_schema_1.SignInRequestSchema;
|
|
13
|
+
AuthSignInCommand.Response = auth_response_schema_1.AuthResponseSchema;
|
|
14
|
+
// Path/URL/Method
|
|
15
|
+
AuthSignInCommand.PATH = auth_routes_1.AUTH_ROUTES.SIGNIN;
|
|
16
|
+
AuthSignInCommand.URL = rest_api_1.REST_API.V1.AUTH.SIGNIN;
|
|
17
|
+
AuthSignInCommand.METHOD = http_method_1.HttpMethod.POST;
|
|
18
|
+
})(AuthSignInCommand || (exports.AuthSignInCommand = AuthSignInCommand = {}));
|
|
@@ -6,13 +6,6 @@ export declare namespace AuthSignupCommand {
|
|
|
6
6
|
password: z.ZodString;
|
|
7
7
|
name: z.ZodString;
|
|
8
8
|
marketingConsent: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
utm: z.ZodOptional<z.ZodObject<{
|
|
10
|
-
utmSource: z.ZodOptional<z.ZodString>;
|
|
11
|
-
utmMedium: z.ZodOptional<z.ZodString>;
|
|
12
|
-
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
13
|
-
utmContent: z.ZodOptional<z.ZodString>;
|
|
14
|
-
utmTerm: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
9
|
}, z.core.$strip>;
|
|
17
10
|
const Response: z.ZodObject<{
|
|
18
11
|
user: z.ZodObject<{
|
|
@@ -16,6 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./user-role.enum"), exports);
|
|
18
18
|
__exportStar(require("./signup-request.schema"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./signin-request.schema"), exports);
|
|
20
20
|
__exportStar(require("./session-response.schema"), exports);
|
|
21
21
|
__exportStar(require("./auth-response.schema"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* SignIn Request Schema
|
|
4
4
|
* Error messages are in locales (en.ts, ru.ts)
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const SignInRequestSchema: z.ZodObject<{
|
|
7
7
|
email: z.ZodString;
|
|
8
8
|
password: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SignInRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const regex_1 = require("../../../shared/regex");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* SignIn Request Schema
|
|
8
8
|
* Error messages are in locales (en.ts, ru.ts)
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.SignInRequestSchema = zod_1.z.object({
|
|
11
11
|
email: zod_1.z.string().regex(regex_1.EMAIL_REGEX),
|
|
12
12
|
password: zod_1.z.string().min(1),
|
|
13
13
|
});
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* UTM Schema
|
|
4
|
-
*/
|
|
5
|
-
export declare const UtmSchema: z.ZodObject<{
|
|
6
|
-
utmSource: z.ZodOptional<z.ZodString>;
|
|
7
|
-
utmMedium: z.ZodOptional<z.ZodString>;
|
|
8
|
-
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
9
|
-
utmContent: z.ZodOptional<z.ZodString>;
|
|
10
|
-
utmTerm: z.ZodOptional<z.ZodString>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
2
|
/**
|
|
13
3
|
* Sign Up Request Schema
|
|
14
4
|
* Error messages are in locales (en.ts, ru.ts)
|
|
@@ -18,11 +8,4 @@ export declare const SignUpRequestSchema: z.ZodObject<{
|
|
|
18
8
|
password: z.ZodString;
|
|
19
9
|
name: z.ZodString;
|
|
20
10
|
marketingConsent: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
-
utm: z.ZodOptional<z.ZodObject<{
|
|
22
|
-
utmSource: z.ZodOptional<z.ZodString>;
|
|
23
|
-
utmMedium: z.ZodOptional<z.ZodString>;
|
|
24
|
-
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
25
|
-
utmContent: z.ZodOptional<z.ZodString>;
|
|
26
|
-
utmTerm: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strip>>;
|
|
28
11
|
}, z.core.$strip>;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SignUpRequestSchema =
|
|
3
|
+
exports.SignUpRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const regex_1 = require("../../../shared/regex");
|
|
6
|
-
/**
|
|
7
|
-
* UTM Schema
|
|
8
|
-
*/
|
|
9
|
-
exports.UtmSchema = zod_1.z.object({
|
|
10
|
-
utmSource: zod_1.z.string().optional(),
|
|
11
|
-
utmMedium: zod_1.z.string().optional(),
|
|
12
|
-
utmCampaign: zod_1.z.string().optional(),
|
|
13
|
-
utmContent: zod_1.z.string().optional(),
|
|
14
|
-
utmTerm: zod_1.z.string().optional(),
|
|
15
|
-
});
|
|
16
6
|
/**
|
|
17
7
|
* Sign Up Request Schema
|
|
18
8
|
* Error messages are in locales (en.ts, ru.ts)
|
|
@@ -22,5 +12,4 @@ exports.SignUpRequestSchema = zod_1.z.object({
|
|
|
22
12
|
password: zod_1.z.string().min(8).max(128).regex(regex_1.PASSWORD_STRENGTH_REGEX),
|
|
23
13
|
name: zod_1.z.string().min(2),
|
|
24
14
|
marketingConsent: zod_1.z.boolean().default(false),
|
|
25
|
-
utm: exports.UtmSchema.optional(),
|
|
26
15
|
});
|
|
@@ -3,6 +3,13 @@ import { HttpMethod } from '../../../shared/http-method';
|
|
|
3
3
|
export declare namespace UnregAuthenticateCommand {
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
5
|
token: z.ZodOptional<z.ZodString>;
|
|
6
|
+
utm: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
utmSource: z.ZodOptional<z.ZodString>;
|
|
8
|
+
utmMedium: z.ZodOptional<z.ZodString>;
|
|
9
|
+
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
10
|
+
utmContent: z.ZodOptional<z.ZodString>;
|
|
11
|
+
utmTerm: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
6
13
|
}, z.core.$strip>;
|
|
7
14
|
const Response: z.ZodObject<{
|
|
8
15
|
token: z.ZodString;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* UTM Schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const UtmSchema: z.ZodObject<{
|
|
6
|
+
utmSource: z.ZodOptional<z.ZodString>;
|
|
7
|
+
utmMedium: z.ZodOptional<z.ZodString>;
|
|
8
|
+
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
9
|
+
utmContent: z.ZodOptional<z.ZodString>;
|
|
10
|
+
utmTerm: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
2
12
|
/**
|
|
3
13
|
* Authenticate Unregistered User Request Schema
|
|
4
14
|
*/
|
|
5
15
|
export declare const AuthenticateUnregUserRequestSchema: z.ZodObject<{
|
|
6
16
|
token: z.ZodOptional<z.ZodString>;
|
|
17
|
+
utm: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
utmSource: z.ZodOptional<z.ZodString>;
|
|
19
|
+
utmMedium: z.ZodOptional<z.ZodString>;
|
|
20
|
+
utmCampaign: z.ZodOptional<z.ZodString>;
|
|
21
|
+
utmContent: z.ZodOptional<z.ZodString>;
|
|
22
|
+
utmTerm: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
7
24
|
}, z.core.$strip>;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticateUnregUserRequestSchema = void 0;
|
|
3
|
+
exports.AuthenticateUnregUserRequestSchema = exports.UtmSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* UTM Schema
|
|
7
|
+
*/
|
|
8
|
+
exports.UtmSchema = zod_1.z.object({
|
|
9
|
+
utmSource: zod_1.z.string().optional(),
|
|
10
|
+
utmMedium: zod_1.z.string().optional(),
|
|
11
|
+
utmCampaign: zod_1.z.string().optional(),
|
|
12
|
+
utmContent: zod_1.z.string().optional(),
|
|
13
|
+
utmTerm: zod_1.z.string().optional(),
|
|
14
|
+
});
|
|
5
15
|
/**
|
|
6
16
|
* Authenticate Unregistered User Request Schema
|
|
7
17
|
*/
|
|
8
18
|
exports.AuthenticateUnregUserRequestSchema = zod_1.z.object({
|
|
9
19
|
token: zod_1.z.string().optional(),
|
|
20
|
+
utm: exports.UtmSchema.optional(),
|
|
10
21
|
});
|
|
@@ -6,7 +6,9 @@ export declare namespace UserChangePasswordCommand {
|
|
|
6
6
|
newPassword: z.ZodString;
|
|
7
7
|
logoutFromAllDevices: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
|
-
const Response: z.ZodObject<{
|
|
9
|
+
const Response: z.ZodObject<{
|
|
10
|
+
userId: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
10
12
|
const PATH: "me/password";
|
|
11
13
|
const URL: "/api/v1/users/me/password";
|
|
12
14
|
const METHOD = HttpMethod.PUT;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserChangePasswordCommand = void 0;
|
|
4
|
-
const
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../schemas");
|
|
5
6
|
const users_routes_1 = require("../routes/users.routes");
|
|
6
7
|
const rest_api_1 = require("../../../rest-api");
|
|
7
8
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const
|
|
9
|
+
const regex_1 = require("../../../shared/regex");
|
|
9
10
|
var UserChangePasswordCommand;
|
|
10
11
|
(function (UserChangePasswordCommand) {
|
|
11
|
-
UserChangePasswordCommand.Request =
|
|
12
|
-
UserChangePasswordCommand.Response =
|
|
12
|
+
UserChangePasswordCommand.Request = schemas_1.ChangePasswordRequestSchema;
|
|
13
|
+
UserChangePasswordCommand.Response = zod_1.z.object({
|
|
14
|
+
userId: zod_1.z.string().regex(regex_1.UUID_REGEX),
|
|
15
|
+
});
|
|
13
16
|
UserChangePasswordCommand.PATH = users_routes_1.USERS_ROUTES.ME_PASSWORD;
|
|
14
17
|
UserChangePasswordCommand.URL = rest_api_1.REST_API.V1.USERS.ME_PASSWORD;
|
|
15
18
|
UserChangePasswordCommand.METHOD = http_method_1.HttpMethod.PUT;
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { HttpMethod } from '../../../shared/http-method';
|
|
3
3
|
export declare namespace UserDeleteAccountCommand {
|
|
4
4
|
const Request: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
const Response: z.ZodObject<{
|
|
5
|
+
const Response: z.ZodObject<{
|
|
6
|
+
userId: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
6
8
|
const PATH: "me";
|
|
7
9
|
const URL: "/api/v1/users/me";
|
|
8
10
|
const METHOD = HttpMethod.DELETE;
|
|
@@ -5,11 +5,13 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const users_routes_1 = require("../routes/users.routes");
|
|
6
6
|
const rest_api_1 = require("../../../rest-api");
|
|
7
7
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const
|
|
8
|
+
const regex_1 = require("../../../shared/regex");
|
|
9
9
|
var UserDeleteAccountCommand;
|
|
10
10
|
(function (UserDeleteAccountCommand) {
|
|
11
11
|
UserDeleteAccountCommand.Request = zod_1.z.object({});
|
|
12
|
-
UserDeleteAccountCommand.Response =
|
|
12
|
+
UserDeleteAccountCommand.Response = zod_1.z.object({
|
|
13
|
+
userId: zod_1.z.string().regex(regex_1.UUID_REGEX),
|
|
14
|
+
});
|
|
13
15
|
UserDeleteAccountCommand.PATH = users_routes_1.USERS_ROUTES.ME;
|
|
14
16
|
UserDeleteAccountCommand.URL = rest_api_1.REST_API.V1.USERS.ME;
|
|
15
17
|
UserDeleteAccountCommand.METHOD = http_method_1.HttpMethod.DELETE;
|
|
@@ -4,7 +4,14 @@ export declare namespace UserToggleMarketingConsentCommand {
|
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
5
|
marketingConsent: z.ZodBoolean;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
-
const Response: z.ZodObject<{
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
uuid: z.ZodString;
|
|
9
|
+
email: z.ZodString;
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
role: z.ZodString;
|
|
12
|
+
marketingConsent: z.ZodBoolean;
|
|
13
|
+
createdAt: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
8
15
|
const PATH: "me/marketing-consent";
|
|
9
16
|
const URL: "/api/v1/users/me/marketing-consent";
|
|
10
17
|
const METHOD = HttpMethod.PUT;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserToggleMarketingConsentCommand = void 0;
|
|
4
4
|
const toggle_marketing_consent_request_schema_1 = require("../schemas/toggle-marketing-consent-request.schema");
|
|
5
|
+
const user_response_schema_1 = require("../schemas/user-response.schema");
|
|
5
6
|
const users_routes_1 = require("../routes/users.routes");
|
|
6
7
|
const rest_api_1 = require("../../../rest-api");
|
|
7
8
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const common_schemas_1 = require("../../../shared/common-schemas");
|
|
9
9
|
var UserToggleMarketingConsentCommand;
|
|
10
10
|
(function (UserToggleMarketingConsentCommand) {
|
|
11
11
|
UserToggleMarketingConsentCommand.Request = toggle_marketing_consent_request_schema_1.ToggleMarketingConsentRequestSchema;
|
|
12
|
-
UserToggleMarketingConsentCommand.Response =
|
|
12
|
+
UserToggleMarketingConsentCommand.Response = user_response_schema_1.UserResponseSchema;
|
|
13
13
|
UserToggleMarketingConsentCommand.PATH = users_routes_1.USERS_ROUTES.ME_MARKETING_CONSENT;
|
|
14
14
|
UserToggleMarketingConsentCommand.URL = rest_api_1.REST_API.V1.USERS.ME_MARKETING_CONSENT;
|
|
15
15
|
UserToggleMarketingConsentCommand.METHOD = http_method_1.HttpMethod.PUT;
|
|
@@ -4,7 +4,14 @@ export declare namespace UserUpdateProfileCommand {
|
|
|
4
4
|
const Request: z.ZodObject<{
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
-
const Response: z.ZodObject<{
|
|
7
|
+
const Response: z.ZodObject<{
|
|
8
|
+
uuid: z.ZodString;
|
|
9
|
+
email: z.ZodString;
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
role: z.ZodString;
|
|
12
|
+
marketingConsent: z.ZodBoolean;
|
|
13
|
+
createdAt: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
8
15
|
const PATH: "me";
|
|
9
16
|
const URL: "/api/v1/users/me";
|
|
10
17
|
const METHOD = HttpMethod.PATCH;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserUpdateProfileCommand = void 0;
|
|
4
4
|
const update_profile_request_schema_1 = require("../schemas/update-profile-request.schema");
|
|
5
|
+
const user_response_schema_1 = require("../schemas/user-response.schema");
|
|
5
6
|
const users_routes_1 = require("../routes/users.routes");
|
|
6
7
|
const rest_api_1 = require("../../../rest-api");
|
|
7
8
|
const http_method_1 = require("../../../shared/http-method");
|
|
8
|
-
const common_schemas_1 = require("../../../shared/common-schemas");
|
|
9
9
|
var UserUpdateProfileCommand;
|
|
10
10
|
(function (UserUpdateProfileCommand) {
|
|
11
11
|
UserUpdateProfileCommand.Request = update_profile_request_schema_1.UpdateProfileRequestSchema;
|
|
12
|
-
UserUpdateProfileCommand.Response =
|
|
12
|
+
UserUpdateProfileCommand.Response = user_response_schema_1.UserResponseSchema;
|
|
13
13
|
UserUpdateProfileCommand.PATH = users_routes_1.USERS_ROUTES.ME;
|
|
14
14
|
UserUpdateProfileCommand.URL = rest_api_1.REST_API.V1.USERS.ME;
|
|
15
15
|
UserUpdateProfileCommand.METHOD = http_method_1.HttpMethod.PATCH;
|
|
@@ -2,30 +2,33 @@ import { z } from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Endpoint Response Unions (for frontend type safety)
|
|
4
4
|
*/
|
|
5
|
-
export declare const UpdateProfileResponseSchema: z.
|
|
6
|
-
code: z.ZodString;
|
|
7
|
-
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
8
|
-
}, z.core.$strip>]>;
|
|
9
|
-
export declare const DeleteAccountResponseSchema: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
10
|
-
code: z.ZodString;
|
|
11
|
-
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
-
}, z.core.$strip>]>;
|
|
13
|
-
export declare const ToggleMarketingConsentResponseSchema: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
14
|
-
code: z.ZodString;
|
|
15
|
-
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
16
|
-
}, z.core.$strip>]>;
|
|
17
|
-
export declare const ChangePasswordResponseSchema: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
18
|
-
code: z.ZodString;
|
|
19
|
-
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
20
|
-
}, z.core.$strip>]>;
|
|
21
|
-
export declare const GetCurrentUserResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
5
|
+
export declare const UpdateProfileResponseSchema: z.ZodObject<{
|
|
22
6
|
uuid: z.ZodString;
|
|
23
7
|
email: z.ZodString;
|
|
24
8
|
name: z.ZodString;
|
|
25
9
|
role: z.ZodString;
|
|
26
10
|
marketingConsent: z.ZodBoolean;
|
|
27
11
|
createdAt: z.ZodString;
|
|
28
|
-
}, z.core.$strip
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, z.core.$strip
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const DeleteAccountResponseSchema: z.ZodObject<{
|
|
14
|
+
userId: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const ToggleMarketingConsentResponseSchema: z.ZodObject<{
|
|
17
|
+
uuid: z.ZodString;
|
|
18
|
+
email: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
role: z.ZodString;
|
|
21
|
+
marketingConsent: z.ZodBoolean;
|
|
22
|
+
createdAt: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const ChangePasswordResponseSchema: z.ZodObject<{
|
|
25
|
+
userId: z.ZodString;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const GetCurrentUserResponseSchema: z.ZodObject<{
|
|
28
|
+
uuid: z.ZodString;
|
|
29
|
+
email: z.ZodString;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
role: z.ZodString;
|
|
32
|
+
marketingConsent: z.ZodBoolean;
|
|
33
|
+
createdAt: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetCurrentUserResponseSchema = exports.ChangePasswordResponseSchema = exports.ToggleMarketingConsentResponseSchema = exports.DeleteAccountResponseSchema = exports.UpdateProfileResponseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const user_response_schema_1 = require("./user-response.schema");
|
|
6
|
-
const
|
|
6
|
+
const regex_1 = require("../../../shared/regex");
|
|
7
7
|
/**
|
|
8
8
|
* Endpoint Response Unions (for frontend type safety)
|
|
9
9
|
*/
|
|
10
|
-
exports.UpdateProfileResponseSchema =
|
|
11
|
-
exports.DeleteAccountResponseSchema = zod_1.z.
|
|
12
|
-
exports.ToggleMarketingConsentResponseSchema =
|
|
13
|
-
exports.ChangePasswordResponseSchema = zod_1.z.
|
|
14
|
-
exports.GetCurrentUserResponseSchema =
|
|
10
|
+
exports.UpdateProfileResponseSchema = user_response_schema_1.UserResponseSchema;
|
|
11
|
+
exports.DeleteAccountResponseSchema = zod_1.z.object({ userId: zod_1.z.string().regex(regex_1.UUID_REGEX) });
|
|
12
|
+
exports.ToggleMarketingConsentResponseSchema = user_response_schema_1.UserResponseSchema;
|
|
13
|
+
exports.ChangePasswordResponseSchema = zod_1.z.object({ userId: zod_1.z.string().regex(regex_1.UUID_REGEX) });
|
|
14
|
+
exports.GetCurrentUserResponseSchema = user_response_schema_1.UserResponseSchema;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veruna/api-contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "API contracts for Veruna project - Zod schemas, types, and paths",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepublish": "rm -rf build && tsc",
|
|
9
9
|
"build": "tsc",
|
|
10
|
+
"watch": "tsc --watch",
|
|
10
11
|
"clean": "rm -rf build node_modules"
|
|
11
12
|
},
|
|
12
13
|
"keywords": [
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthLoginCommand = void 0;
|
|
4
|
-
const login_request_schema_1 = require("../schemas/login-request.schema");
|
|
5
|
-
const auth_response_schema_1 = require("../schemas/auth-response.schema");
|
|
6
|
-
const auth_routes_1 = require("../routes/auth.routes");
|
|
7
|
-
const rest_api_1 = require("../../../rest-api");
|
|
8
|
-
const http_method_1 = require("../../../shared/http-method");
|
|
9
|
-
var AuthLoginCommand;
|
|
10
|
-
(function (AuthLoginCommand) {
|
|
11
|
-
// Request/Response
|
|
12
|
-
AuthLoginCommand.Request = login_request_schema_1.LoginRequestSchema;
|
|
13
|
-
AuthLoginCommand.Response = auth_response_schema_1.AuthResponseSchema;
|
|
14
|
-
// Path/URL/Method
|
|
15
|
-
AuthLoginCommand.PATH = auth_routes_1.AUTH_ROUTES.LOGIN;
|
|
16
|
-
AuthLoginCommand.URL = rest_api_1.REST_API.V1.AUTH.LOGIN;
|
|
17
|
-
AuthLoginCommand.METHOD = http_method_1.HttpMethod.POST;
|
|
18
|
-
})(AuthLoginCommand || (exports.AuthLoginCommand = AuthLoginCommand = {}));
|