@veruna/api-contracts 1.0.1 → 1.0.3

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HTTP Methods enum
3
+ */
4
+ export declare enum HttpMethod {
5
+ GET = "GET",
6
+ POST = "POST",
7
+ PUT = "PUT",
8
+ PATCH = "PATCH",
9
+ DELETE = "DELETE"
10
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpMethod = void 0;
4
+ /**
5
+ * HTTP Methods enum
6
+ */
7
+ var HttpMethod;
8
+ (function (HttpMethod) {
9
+ HttpMethod["GET"] = "GET";
10
+ HttpMethod["POST"] = "POST";
11
+ HttpMethod["PUT"] = "PUT";
12
+ HttpMethod["PATCH"] = "PATCH";
13
+ HttpMethod["DELETE"] = "DELETE";
14
+ })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
@@ -0,0 +1,3 @@
1
+ export * from './signup.command';
2
+ export * from './login.command';
3
+ export * from './logout.command';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./signup.command"), exports);
18
+ __exportStar(require("./login.command"), exports);
19
+ __exportStar(require("./logout.command"), exports);
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthLoginCommand {
4
+ const Request: z.ZodObject<{
5
+ email: z.ZodString;
6
+ password: z.ZodString;
7
+ }, z.core.$strip>;
8
+ const Response: z.ZodUnion<readonly [z.ZodObject<{
9
+ user: z.ZodObject<{
10
+ uuid: z.ZodString;
11
+ email: z.ZodString;
12
+ name: z.ZodString;
13
+ role: z.ZodString;
14
+ marketingConsent: z.ZodBoolean;
15
+ createdAt: z.ZodString;
16
+ }, z.core.$strip>;
17
+ accessToken: z.ZodString;
18
+ session: z.ZodObject<{
19
+ uuid: z.ZodString;
20
+ deviceName: z.ZodString;
21
+ ip: z.ZodString;
22
+ isCurrent: z.ZodBoolean;
23
+ createdAt: z.ZodString;
24
+ lastUsedAt: z.ZodString;
25
+ }, z.core.$strip>;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ code: z.ZodString;
28
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
29
+ }, z.core.$strip>]>;
30
+ const URL: "/api/v1/auth/login";
31
+ const METHOD = HttpMethod.POST;
32
+ type RequestType = z.infer<typeof Request>;
33
+ type ResponseType = z.infer<typeof Response>;
34
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthLoginCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_schemas_1 = require("../auth.schemas");
6
+ const auth_paths_1 = require("../auth.paths");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ const users_schemas_1 = require("../../users/users.schemas");
9
+ var AuthLoginCommand;
10
+ (function (AuthLoginCommand) {
11
+ AuthLoginCommand.Request = auth_schemas_1.LoginRequestSchema;
12
+ AuthLoginCommand.Response = zod_1.z.union([auth_schemas_1.AuthResponseSchema, users_schemas_1.ErrorResponseSchema]);
13
+ AuthLoginCommand.URL = auth_paths_1.AUTH_API_PATHS.LOGIN;
14
+ AuthLoginCommand.METHOD = http_method_1.HttpMethod.POST;
15
+ })(AuthLoginCommand || (exports.AuthLoginCommand = AuthLoginCommand = {}));
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthLogoutCommand {
4
+ const Request: z.ZodObject<{}, z.core.$strip>;
5
+ const Response: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
+ code: z.ZodString;
7
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
+ }, z.core.$strip>]>;
9
+ const URL: "/api/v1/auth/logout";
10
+ const METHOD = HttpMethod.POST;
11
+ type RequestType = z.infer<typeof Request>;
12
+ type ResponseType = z.infer<typeof Response>;
13
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthLogoutCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_paths_1 = require("../auth.paths");
6
+ const http_method_1 = require("../../../shared/http-method");
7
+ const users_schemas_1 = require("../../users/users.schemas");
8
+ var AuthLogoutCommand;
9
+ (function (AuthLogoutCommand) {
10
+ AuthLogoutCommand.Request = zod_1.z.object({}); // No request body
11
+ AuthLogoutCommand.Response = zod_1.z.union([users_schemas_1.EmptyResponseSchema, users_schemas_1.ErrorResponseSchema]);
12
+ AuthLogoutCommand.URL = auth_paths_1.AUTH_API_PATHS.LOGOUT;
13
+ AuthLogoutCommand.METHOD = http_method_1.HttpMethod.POST;
14
+ })(AuthLogoutCommand || (exports.AuthLogoutCommand = AuthLogoutCommand = {}));
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace AuthSignupCommand {
4
+ const Request: z.ZodObject<{
5
+ email: z.ZodString;
6
+ password: z.ZodString;
7
+ name: z.ZodString;
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
+ }, z.core.$strip>;
17
+ const Response: z.ZodUnion<readonly [z.ZodObject<{
18
+ user: z.ZodObject<{
19
+ uuid: z.ZodString;
20
+ email: z.ZodString;
21
+ name: z.ZodString;
22
+ role: z.ZodString;
23
+ marketingConsent: z.ZodBoolean;
24
+ createdAt: z.ZodString;
25
+ }, z.core.$strip>;
26
+ accessToken: z.ZodString;
27
+ session: z.ZodObject<{
28
+ uuid: z.ZodString;
29
+ deviceName: z.ZodString;
30
+ ip: z.ZodString;
31
+ isCurrent: z.ZodBoolean;
32
+ createdAt: z.ZodString;
33
+ lastUsedAt: z.ZodString;
34
+ }, z.core.$strip>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ code: z.ZodString;
37
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
38
+ }, z.core.$strip>]>;
39
+ const URL: "/api/v1/auth/signup";
40
+ const METHOD = HttpMethod.POST;
41
+ type RequestType = z.infer<typeof Request>;
42
+ type ResponseType = z.infer<typeof Response>;
43
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthSignupCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const auth_schemas_1 = require("../auth.schemas");
6
+ const auth_paths_1 = require("../auth.paths");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ const users_schemas_1 = require("../../users/users.schemas");
9
+ var AuthSignupCommand;
10
+ (function (AuthSignupCommand) {
11
+ AuthSignupCommand.Request = auth_schemas_1.SignUpRequestSchema;
12
+ AuthSignupCommand.Response = zod_1.z.union([auth_schemas_1.AuthResponseSchema, users_schemas_1.ErrorResponseSchema]);
13
+ AuthSignupCommand.URL = auth_paths_1.AUTH_API_PATHS.SIGNUP;
14
+ AuthSignupCommand.METHOD = http_method_1.HttpMethod.POST;
15
+ })(AuthSignupCommand || (exports.AuthSignupCommand = AuthSignupCommand = {}));
@@ -2,3 +2,4 @@ export * from './auth.schemas';
2
2
  export * from './auth.types';
3
3
  export * from './auth.paths';
4
4
  export * from './auth.errors';
5
+ export * from './commands';
@@ -18,3 +18,4 @@ __exportStar(require("./auth.schemas"), exports);
18
18
  __exportStar(require("./auth.types"), exports);
19
19
  __exportStar(require("./auth.paths"), exports);
20
20
  __exportStar(require("./auth.errors"), exports);
21
+ __exportStar(require("./commands"), exports);
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace UserChangePasswordCommand {
4
+ const Request: z.ZodObject<{
5
+ oldPassword: z.ZodString;
6
+ newPassword: z.ZodString;
7
+ logoutFromAllDevices: z.ZodDefault<z.ZodBoolean>;
8
+ }, z.core.$strip>;
9
+ const Response: 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
+ const URL: "/api/v1/users/me/password";
14
+ const METHOD = HttpMethod.PUT;
15
+ type RequestType = z.infer<typeof Request>;
16
+ type ResponseType = z.infer<typeof Response>;
17
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserChangePasswordCommand = void 0;
4
+ const users_schemas_1 = require("../users.schemas");
5
+ const users_paths_1 = require("../users.paths");
6
+ const http_method_1 = require("../../../shared/http-method");
7
+ var UserChangePasswordCommand;
8
+ (function (UserChangePasswordCommand) {
9
+ UserChangePasswordCommand.Request = users_schemas_1.ChangePasswordRequestSchema;
10
+ UserChangePasswordCommand.Response = users_schemas_1.ChangePasswordResponseSchema;
11
+ UserChangePasswordCommand.URL = users_paths_1.USERS_API_PATHS.ME_PASSWORD;
12
+ UserChangePasswordCommand.METHOD = http_method_1.HttpMethod.PUT;
13
+ })(UserChangePasswordCommand || (exports.UserChangePasswordCommand = UserChangePasswordCommand = {}));
@@ -0,0 +1,2 @@
1
+ export * from './update-profile.command';
2
+ export * from './change-password.command';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./update-profile.command"), exports);
18
+ __exportStar(require("./change-password.command"), exports);
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace UserUpdateProfileCommand {
4
+ const Request: z.ZodObject<{
5
+ name: z.ZodString;
6
+ }, z.core.$strip>;
7
+ const Response: z.ZodUnion<readonly [z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
8
+ code: z.ZodString;
9
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
10
+ }, z.core.$strip>]>;
11
+ const URL: "/api/v1/users/me";
12
+ const METHOD = HttpMethod.PATCH;
13
+ type RequestType = z.infer<typeof Request>;
14
+ type ResponseType = z.infer<typeof Response>;
15
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserUpdateProfileCommand = void 0;
4
+ const users_schemas_1 = require("../users.schemas");
5
+ const users_paths_1 = require("../users.paths");
6
+ const http_method_1 = require("../../../shared/http-method");
7
+ var UserUpdateProfileCommand;
8
+ (function (UserUpdateProfileCommand) {
9
+ UserUpdateProfileCommand.Request = users_schemas_1.UpdateProfileRequestSchema;
10
+ UserUpdateProfileCommand.Response = users_schemas_1.UpdateProfileResponseSchema;
11
+ UserUpdateProfileCommand.URL = users_paths_1.USERS_API_PATHS.ME;
12
+ UserUpdateProfileCommand.METHOD = http_method_1.HttpMethod.PATCH;
13
+ })(UserUpdateProfileCommand || (exports.UserUpdateProfileCommand = UserUpdateProfileCommand = {}));
@@ -1,3 +1,5 @@
1
1
  export * from './users.schemas';
2
2
  export * from './users.types';
3
3
  export * from './users.paths';
4
+ export * from './commands';
5
+ export * from './queries';
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./users.schemas"), exports);
18
18
  __exportStar(require("./users.types"), exports);
19
19
  __exportStar(require("./users.paths"), exports);
20
+ __exportStar(require("./commands"), exports);
21
+ __exportStar(require("./queries"), exports);
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { HttpMethod } from '../../../shared/http-method';
3
+ export declare namespace UserGetCurrentUserQuery {
4
+ const Request: z.ZodObject<{}, z.core.$strip>;
5
+ const Response: z.ZodUnion<readonly [z.ZodObject<{
6
+ uuid: z.ZodString;
7
+ email: z.ZodString;
8
+ name: z.ZodString;
9
+ role: z.ZodString;
10
+ marketingConsent: z.ZodBoolean;
11
+ createdAt: z.ZodString;
12
+ }, z.core.$strip>, z.ZodObject<{
13
+ code: z.ZodString;
14
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
15
+ }, z.core.$strip>]>;
16
+ const URL: "/api/v1/users/me";
17
+ const METHOD = HttpMethod.GET;
18
+ type RequestType = z.infer<typeof Request>;
19
+ type ResponseType = z.infer<typeof Response>;
20
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserGetCurrentUserQuery = void 0;
4
+ const zod_1 = require("zod");
5
+ const users_schemas_1 = require("../users.schemas");
6
+ const users_paths_1 = require("../users.paths");
7
+ const http_method_1 = require("../../../shared/http-method");
8
+ var UserGetCurrentUserQuery;
9
+ (function (UserGetCurrentUserQuery) {
10
+ UserGetCurrentUserQuery.Request = zod_1.z.object({}); // No request body for GET
11
+ UserGetCurrentUserQuery.Response = users_schemas_1.GetCurrentUserResponseSchema;
12
+ UserGetCurrentUserQuery.URL = users_paths_1.USERS_API_PATHS.ME;
13
+ UserGetCurrentUserQuery.METHOD = http_method_1.HttpMethod.GET;
14
+ })(UserGetCurrentUserQuery || (exports.UserGetCurrentUserQuery = UserGetCurrentUserQuery = {}));
@@ -0,0 +1 @@
1
+ export * from './get-current-user.query';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-current-user.query"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veruna/api-contracts",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",