@sorokchat-messanger/contracts 2.0.0 → 2.0.1

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.
Files changed (46) hide show
  1. package/dist/authorization/authorized.schema.d.ts +6 -0
  2. package/dist/authorization/authorized.schema.d.ts.map +1 -0
  3. package/dist/authorization/authorized.schema.js +8 -0
  4. package/dist/authorization/authorized.schema.js.map +1 -0
  5. package/dist/authorization/controller.d.ts +10 -0
  6. package/dist/authorization/controller.d.ts.map +1 -0
  7. package/dist/authorization/controller.js +9 -0
  8. package/dist/authorization/controller.js.map +1 -0
  9. package/dist/authorization/index.d.ts +2 -0
  10. package/dist/authorization/index.d.ts.map +1 -1
  11. package/dist/authorization/index.js +2 -0
  12. package/dist/authorization/index.js.map +1 -1
  13. package/dist/authorization/login.schema.d.ts +2 -2
  14. package/dist/authorization/messages.code.d.ts +5 -4
  15. package/dist/authorization/messages.code.d.ts.map +1 -1
  16. package/dist/authorization/messages.code.js +5 -4
  17. package/dist/authorization/messages.code.js.map +1 -1
  18. package/dist/authorization/register.schema.d.ts +2 -2
  19. package/dist/authorization/register.schema.d.ts.map +1 -1
  20. package/dist/authorization/register.schema.js +5 -4
  21. package/dist/authorization/register.schema.js.map +1 -1
  22. package/dist/common/common.codes.d.ts +2 -0
  23. package/dist/common/common.codes.d.ts.map +1 -0
  24. package/dist/common/common.codes.js +2 -0
  25. package/dist/common/common.codes.js.map +1 -0
  26. package/dist/common/index.d.ts +2 -0
  27. package/dist/common/index.d.ts.map +1 -0
  28. package/dist/common/index.js +2 -0
  29. package/dist/common/index.js.map +1 -0
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/users/index.d.ts +3 -0
  35. package/dist/users/index.d.ts.map +1 -0
  36. package/dist/users/index.js +3 -0
  37. package/dist/users/index.js.map +1 -0
  38. package/dist/users/messages.code.d.ts +35 -0
  39. package/dist/users/messages.code.d.ts.map +1 -0
  40. package/dist/users/messages.code.js +35 -0
  41. package/dist/users/messages.code.js.map +1 -0
  42. package/dist/users/new-user.schema.d.ts +8 -0
  43. package/dist/users/new-user.schema.d.ts.map +1 -0
  44. package/dist/users/new-user.schema.js +17 -0
  45. package/dist/users/new-user.schema.js.map +1 -0
  46. package/package.json +4 -2
@@ -0,0 +1,6 @@
1
+ import z from "zod";
2
+ export declare const AuthorizedSchema: z.ZodObject<{
3
+ accessToken: z.ZodNonOptional<z.ZodString>;
4
+ }, z.core.$strip>;
5
+ export type AuthorizedPayload = z.infer<typeof AuthorizedSchema>;
6
+ //# sourceMappingURL=authorized.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorized.schema.d.ts","sourceRoot":"","sources":["../../src/authorization/authorized.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,gBAAgB;;iBAK3B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import z from "zod";
2
+ export const AuthorizedSchema = z.object({
3
+ accessToken: z
4
+ .string()
5
+ .regex(/^Bearer [A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+$/)
6
+ .nonoptional(),
7
+ });
8
+ //# sourceMappingURL=authorized.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorized.schema.js","sourceRoot":"","sources":["../../src/authorization/authorized.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,KAAK,CAAC,4DAA4D,CAAC;SACnE,WAAW,EAAE;CACjB,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const AuthorizationController: {
2
+ readonly CONTROLLER: "authorization";
3
+ readonly REGISTER: "register";
4
+ readonly LOGIN: "login";
5
+ readonly LOGOUT: "logout";
6
+ readonly REFRESH_TOKENS: "refresh_tokens";
7
+ readonly PROFILE: "profile";
8
+ };
9
+ export type AuthorizationController = typeof AuthorizationController;
10
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/authorization/controller.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;aAClC,UAAU,EAAE,eAAe;aAC3B,QAAQ,EAAE,UAAU;aACpB,KAAK,EAAE,OAAO;aACd,MAAM,EAAE,QAAQ;aAChB,cAAc,EAAE,gBAAgB;aAChC,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,OAAO,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const AuthorizationController = {
2
+ CONTROLLER: "authorization",
3
+ REGISTER: "register",
4
+ LOGIN: "login",
5
+ LOGOUT: "logout",
6
+ REFRESH_TOKENS: "refresh_tokens",
7
+ PROFILE: "profile",
8
+ };
9
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../src/authorization/controller.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU,EAAE,eAAe;IAC3B,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,cAAc,EAAE,gBAAgB;IAChC,OAAO,EAAE,SAAS;CACV,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from "./register.schema.js";
2
2
  export * from "./messages.code.js";
3
3
  export * from "./login.schema.js";
4
+ export * from "./controller.js";
5
+ export * from "./authorized.schema.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from "./register.schema.js";
2
2
  export * from "./messages.code.js";
3
3
  export * from "./login.schema.js";
4
+ export * from "./controller.js";
5
+ export * from "./authorized.schema.js";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type z from "zod";
2
2
  export declare const LoginSchema: z.ZodObject<{
3
- login: z.ZodNonOptional<z.ZodString>;
4
- password: z.ZodNonOptional<z.ZodString>;
3
+ login: z.ZodNonOptional<z.ZodNonOptional<z.ZodString>>;
4
+ password: z.ZodNonOptional<z.ZodNonOptional<z.ZodString>>;
5
5
  }, z.core.$strip>;
6
6
  export type LoginPayload = z.infer<typeof LoginSchema>;
7
7
  //# sourceMappingURL=login.schema.d.ts.map
@@ -1,7 +1,8 @@
1
+ export declare const AUTHORIZATION_CODE: string;
1
2
  export declare const AuthorizationMessageCodes: {
2
- readonly BAD_CREDENTIALS: "errors.authorization.bad-credentials";
3
- readonly UNAUTHORIZED: "errors.authorization.unauthorized";
4
- readonly ACCESS_DENIED: "errors.authorization.access-denied";
3
+ readonly BAD_CREDENTIALS: `${string}.bad-credentials`;
4
+ readonly UNAUTHORIZED: `${string}.unauthorized`;
5
+ readonly ACCESS_DENIED: `${string}.access-denied`;
5
6
  };
6
- export type AuthorizationMessageCodes = (typeof AuthorizationMessageCodes)[keyof typeof AuthorizationMessageCodes];
7
+ export type AuthorizationMessageCodes = typeof AuthorizationMessageCodes;
7
8
  //# sourceMappingURL=messages.code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.code.d.ts","sourceRoot":"","sources":["../../src/authorization/messages.code.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB;aACpC,eAAe;aACf,YAAY;aACZ,aAAa;CACL,CAAC;AAEX,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"messages.code.d.ts","sourceRoot":"","sources":["../../src/authorization/messages.code.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,EAAE,MAAuC,CAAC;AAEzE,eAAO,MAAM,yBAAyB;aACpC,eAAe;aACf,YAAY;aACZ,aAAa;CACL,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC"}
@@ -1,7 +1,8 @@
1
- const base = "errors.authorization";
1
+ import { ERRORS_CODE } from "../common/index.js";
2
+ export const AUTHORIZATION_CODE = `${ERRORS_CODE}.authorization`;
2
3
  export const AuthorizationMessageCodes = {
3
- BAD_CREDENTIALS: `${base}.bad-credentials`,
4
- UNAUTHORIZED: `${base}.unauthorized`,
5
- ACCESS_DENIED: `${base}.access-denied`,
4
+ BAD_CREDENTIALS: `${AUTHORIZATION_CODE}.bad-credentials`,
5
+ UNAUTHORIZED: `${AUTHORIZATION_CODE}.unauthorized`,
6
+ ACCESS_DENIED: `${AUTHORIZATION_CODE}.access-denied`,
6
7
  };
7
8
  //# sourceMappingURL=messages.code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.code.js","sourceRoot":"","sources":["../../src/authorization/messages.code.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,sBAAsB,CAAC;AAEpC,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,eAAe,EAAE,GAAG,IAAI,kBAAkB;IAC1C,YAAY,EAAE,GAAG,IAAI,eAAe;IACpC,aAAa,EAAE,GAAG,IAAI,gBAAgB;CAC9B,CAAC"}
1
+ {"version":3,"file":"messages.code.js","sourceRoot":"","sources":["../../src/authorization/messages.code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,kBAAkB,GAAW,GAAG,WAAW,gBAAgB,CAAC;AAEzE,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,eAAe,EAAE,GAAG,kBAAkB,kBAAkB;IACxD,YAAY,EAAE,GAAG,kBAAkB,eAAe;IAClD,aAAa,EAAE,GAAG,kBAAkB,gBAAgB;CAC5C,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import z from "zod";
2
2
  export declare const RegisterSchema: z.ZodObject<{
3
- login: z.ZodString;
4
- password: z.ZodString;
3
+ login: z.ZodNonOptional<z.ZodString>;
4
+ password: z.ZodNonOptional<z.ZodString>;
5
5
  displayName: z.ZodOptional<z.ZodString>;
6
6
  }, z.core.$strip>;
7
7
  export type RegisterPayload = z.infer<typeof RegisterSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"register.schema.d.ts","sourceRoot":"","sources":["../../src/authorization/register.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,cAAc;;;;iBAIzB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"register.schema.d.ts","sourceRoot":"","sources":["../../src/authorization/register.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,cAAc;;;;iBAIzB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import z from "zod";
2
- export const RegisterSchema = z.object({
3
- login: z.string(),
4
- password: z.string(),
5
- displayName: z.string().optional(),
2
+ import { NewUserSchema } from "../users/index.js";
3
+ export const RegisterSchema = NewUserSchema.pick({
4
+ displayName: true,
5
+ login: true,
6
+ password: true,
6
7
  });
7
8
  //# sourceMappingURL=register.schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.schema.js","sourceRoot":"","sources":["../../src/authorization/register.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC"}
1
+ {"version":3,"file":"register.schema.js","sourceRoot":"","sources":["../../src/authorization/register.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,CAAC;IAC/C,WAAW,EAAE,IAAI;IACjB,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const ERRORS_CODE = "errors";
2
+ //# sourceMappingURL=common.codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.codes.d.ts","sourceRoot":"","sources":["../../src/common/common.codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const ERRORS_CODE = "errors";
2
+ //# sourceMappingURL=common.codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.codes.js","sourceRoot":"","sources":["../../src/common/common.codes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./common.codes.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./common.codes.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./authorization/index.js";
2
+ export * from "./users/index.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./authorization/index.js";
2
+ export * from "./users/index.js";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./new-user.schema.js";
2
+ export * from "./messages.code.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./new-user.schema.js";
2
+ export * from "./messages.code.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare const USERS_CODE = "users";
2
+ export declare const LOGIN_CODE = "users.login";
3
+ export declare const PASSWORD_CODE = "users.password";
4
+ export declare const DISPLAY_NAME_CODE = "users.display-name";
5
+ export declare const USERS_ERROR_CODE = "errors.users";
6
+ export declare const LOGIN_ERROR_CODE = "errors.users.login";
7
+ export declare const PASSWORD_ERROR_CODE = "errors.users.password";
8
+ export declare const DISPLAY_ERROR_NAME_CODE = "errors.users.display-name";
9
+ export declare const MIN_PASSWORD_LENGTH: number;
10
+ export declare const MAX_PASSWORD_LENGTH: number;
11
+ export declare const UsersCodes: {
12
+ readonly NOT_FOUND: "errors.users.not-found";
13
+ readonly ALREADY_EXISTS: "errors.users.already-exists";
14
+ readonly LOGIN: {
15
+ readonly EMPTY: "errors.users.login.empty";
16
+ readonly UNDEFINED: "errors.users.login.undefined";
17
+ };
18
+ readonly PASSWORD: {
19
+ readonly EMPTY: "errors.users.password.empty";
20
+ readonly UNDEFINED: "errors.users.password.undefined";
21
+ readonly MIN_LENGTH: {
22
+ readonly VALUE: number;
23
+ readonly MESSAGE: "errors.users.password.min-length";
24
+ };
25
+ readonly MAX_LENGTH: {
26
+ readonly VALUE: number;
27
+ readonly MESSAGE: "errors.users.password.max-length";
28
+ };
29
+ };
30
+ readonly DISPLAY_NAME: {
31
+ readonly EMPTY: "errors.users.password.empty";
32
+ };
33
+ };
34
+ export type UsersCodes = typeof UsersCodes;
35
+ //# sourceMappingURL=messages.code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.code.d.ts","sourceRoot":"","sources":["../../src/users/messages.code.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,UAAU,CAAC;AAClC,eAAO,MAAM,UAAU,gBAAwB,CAAC;AAChD,eAAO,MAAM,aAAa,mBAA2B,CAAC;AACtD,eAAO,MAAM,iBAAiB,uBAA+B,CAAC;AAE9D,eAAO,MAAM,gBAAgB,iBAAiC,CAAC;AAC/D,eAAO,MAAM,gBAAgB,uBAAiC,CAAC;AAC/D,eAAO,MAAM,mBAAmB,0BAAoC,CAAC;AACrE,eAAO,MAAM,uBAAuB,8BAAwC,CAAC;AAE7E,eAAO,MAAM,mBAAmB,EAAE,MAAU,CAAC;AAC7C,eAAO,MAAM,mBAAmB,EAAE,MAAY,CAAC;AAE/C,eAAO,MAAM,UAAU;aACrB,SAAS;aACT,cAAc;aACd,KAAK;iBACH,KAAK;iBACL,SAAS;;aAEX,QAAQ;iBACN,KAAK;iBACL,SAAS;iBACT,UAAU;qBACR,KAAK;qBACL,OAAO;;iBAET,UAAU;qBACR,KAAK;qBACL,OAAO;;;aAGX,YAAY;iBACV,KAAK;;CAEC,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { ERRORS_CODE } from "../common/index.js";
2
+ export const USERS_CODE = "users";
3
+ export const LOGIN_CODE = `${USERS_CODE}.login`;
4
+ export const PASSWORD_CODE = `${USERS_CODE}.password`;
5
+ export const DISPLAY_NAME_CODE = `${USERS_CODE}.display-name`;
6
+ export const USERS_ERROR_CODE = `${ERRORS_CODE}.${USERS_CODE}`;
7
+ export const LOGIN_ERROR_CODE = `${ERRORS_CODE}.${LOGIN_CODE}`;
8
+ export const PASSWORD_ERROR_CODE = `${ERRORS_CODE}.${PASSWORD_CODE}`;
9
+ export const DISPLAY_ERROR_NAME_CODE = `${ERRORS_CODE}.${DISPLAY_NAME_CODE}`;
10
+ export const MIN_PASSWORD_LENGTH = 8;
11
+ export const MAX_PASSWORD_LENGTH = 100;
12
+ export const UsersCodes = {
13
+ NOT_FOUND: `${USERS_ERROR_CODE}.not-found`,
14
+ ALREADY_EXISTS: `${USERS_ERROR_CODE}.already-exists`,
15
+ LOGIN: {
16
+ EMPTY: `${LOGIN_ERROR_CODE}.empty`,
17
+ UNDEFINED: `${LOGIN_ERROR_CODE}.undefined`,
18
+ },
19
+ PASSWORD: {
20
+ EMPTY: `${PASSWORD_ERROR_CODE}.empty`,
21
+ UNDEFINED: `${PASSWORD_ERROR_CODE}.undefined`,
22
+ MIN_LENGTH: {
23
+ VALUE: MIN_PASSWORD_LENGTH,
24
+ MESSAGE: `${PASSWORD_ERROR_CODE}.min-length`,
25
+ },
26
+ MAX_LENGTH: {
27
+ VALUE: MAX_PASSWORD_LENGTH,
28
+ MESSAGE: `${PASSWORD_ERROR_CODE}.max-length`,
29
+ },
30
+ },
31
+ DISPLAY_NAME: {
32
+ EMPTY: `${PASSWORD_ERROR_CODE}.empty`,
33
+ },
34
+ };
35
+ //# sourceMappingURL=messages.code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.code.js","sourceRoot":"","sources":["../../src/users/messages.code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,UAAU,QAAQ,CAAC;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,UAAU,WAAW,CAAC;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,UAAU,eAAe,CAAC;AAE9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,WAAW,IAAI,aAAa,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,WAAW,IAAI,iBAAiB,EAAE,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAW,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,mBAAmB,GAAW,GAAG,CAAC;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,GAAG,gBAAgB,YAAY;IAC1C,cAAc,EAAE,GAAG,gBAAgB,iBAAiB;IACpD,KAAK,EAAE;QACL,KAAK,EAAE,GAAG,gBAAgB,QAAQ;QAClC,SAAS,EAAE,GAAG,gBAAgB,YAAY;KAC3C;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,GAAG,mBAAmB,QAAQ;QACrC,SAAS,EAAE,GAAG,mBAAmB,YAAY;QAC7C,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,GAAG,mBAAmB,aAAa;SAC7C;QACD,UAAU,EAAE;YACV,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,GAAG,mBAAmB,aAAa;SAC7C;KACF;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,GAAG,mBAAmB,QAAQ;KACtC;CACO,CAAC"}
@@ -0,0 +1,8 @@
1
+ import z from "zod";
2
+ export declare const NewUserSchema: z.ZodObject<{
3
+ login: z.ZodNonOptional<z.ZodString>;
4
+ password: z.ZodNonOptional<z.ZodString>;
5
+ displayName: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>;
7
+ export type NewUserPayload = z.infer<typeof NewUserSchema>;
8
+ //# sourceMappingURL=new-user.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-user.schema.d.ts","sourceRoot":"","sources":["../../src/users/new-user.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,eAAO,MAAM,aAAa;;;;iBAaxB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import z from "zod";
2
+ import { UsersCodes } from "./messages.code.js";
3
+ export const NewUserSchema = z.object({
4
+ login: z
5
+ .string()
6
+ .nonempty({ message: UsersCodes.LOGIN.EMPTY })
7
+ .nonoptional({ message: UsersCodes.LOGIN.UNDEFINED }),
8
+ password: z
9
+ .string()
10
+ .nonempty({ message: UsersCodes.PASSWORD.EMPTY })
11
+ .nonoptional(UsersCodes.PASSWORD.UNDEFINED),
12
+ displayName: z
13
+ .string()
14
+ .nonempty({ message: UsersCodes.DISPLAY_NAME.EMPTY })
15
+ .optional(),
16
+ });
17
+ //# sourceMappingURL=new-user.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-user.schema.js","sourceRoot":"","sources":["../../src/users/new-user.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SAC7C,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;IACvD,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;SAChD,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;IAC7C,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;SACpD,QAAQ,EAAE;CACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sorokchat-messanger/contracts",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Contracts for frontend and backend of sorokchat messanger",
5
5
  "keywords": [
6
6
  "sorokchat",
@@ -24,7 +24,9 @@
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
- "files": ["dist"],
27
+ "files": [
28
+ "dist"
29
+ ],
28
30
  "scripts": {
29
31
  "build": "tsc"
30
32
  },