mintly-lib 2.17.0-preview → 2.18.1-preview

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.
@@ -1,6 +1,14 @@
1
1
  import { HttpBaseClient } from '../core/client/http-base-client';
2
+ import type { ResponseDto } from '../core/data/request/response';
3
+ import type { Headers } from '../core/data/request/headers';
2
4
  import type { Person } from '../core/data/person/person-entity';
5
+ import type { PersonAvatarResult } from '../core/data/person/person-avatar';
3
6
  export declare class PersonClient extends HttpBaseClient<Person> {
4
7
  constructor();
8
+ /**
9
+ * Foto de perfil pelo nome de usuário (e-mail). Só devolve a de quem é do mesmo
10
+ * restaurante do token; `avatar: null` quando não há foto (ou o usuário não é visível).
11
+ */
12
+ getAvatarByUsername(username: string, headers: Headers): Promise<ResponseDto<PersonAvatarResult>>;
5
13
  }
6
14
  //# sourceMappingURL=person-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"person-client.d.ts","sourceRoot":"","sources":["../../src/clients/person-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,qBAAa,YAAa,SAAQ,cAAc,CAAC,MAAM,CAAC;;CAIvD"}
1
+ {"version":3,"file":"person-client.d.ts","sourceRoot":"","sources":["../../src/clients/person-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,qBAAa,YAAa,SAAQ,cAAc,CAAC,MAAM,CAAC;;IAKtD;;;OAGG;IACG,mBAAmB,CAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;CAOzG"}
@@ -1,11 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PersonClient = void 0;
4
+ const request_config_1 = require("../core/client/request-config");
4
5
  const http_base_client_1 = require("../core/client/http-base-client");
5
6
  class PersonClient extends http_base_client_1.HttpBaseClient {
6
7
  constructor() {
7
8
  super('people');
8
9
  }
10
+ /**
11
+ * Foto de perfil pelo nome de usuário (e-mail). Só devolve a de quem é do mesmo
12
+ * restaurante do token; `avatar: null` quando não há foto (ou o usuário não é visível).
13
+ */
14
+ async getAvatarByUsername(username, headers) {
15
+ const response = await this.connection.get(`/avatar/${encodeURIComponent(username)}`, (0, request_config_1.withHeaders)(headers));
16
+ return response.data;
17
+ }
9
18
  }
10
19
  exports.PersonClient = PersonClient;
11
20
  //# sourceMappingURL=person-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"person-client.js","sourceRoot":"","sources":["../../src/clients/person-client.ts"],"names":[],"mappings":";;;AAAA,sEAAgE;AAGhE,MAAa,YAAa,SAAQ,iCAAsB;IACtD;QACE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjB,CAAC;CACF;AAJD,oCAIC"}
1
+ {"version":3,"file":"person-client.js","sourceRoot":"","sources":["../../src/clients/person-client.ts"],"names":[],"mappings":";;;AAAA,kEAA2D;AAC3D,sEAAgE;AAMhE,MAAa,YAAa,SAAQ,iCAAsB;IACtD;QACE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,mBAAmB,CAAE,QAAgB,EAAE,OAAgB;QAC3D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CACxC,WAAW,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EACzC,IAAA,4BAAW,EAAC,OAAO,CAAC,CACrB,CAAA;QACD,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF;AAhBD,oCAgBC"}
@@ -1,11 +1,19 @@
1
1
  import type { User } from '../user/user-entity';
2
2
  import type { Restaurant } from '../restaurant/restaurant-entity';
3
+ import type { PersonRef } from '../person/person-ref-schema';
3
4
  export interface AuthTokens {
4
5
  accessToken: string;
5
6
  refreshToken: string | null;
6
7
  }
7
- /** Visão pública do usuário — nunca expõe passwordHash. */
8
- export type AuthUser = Omit<User, 'passwordHash'>;
8
+ /**
9
+ * Visão pública do usuário — nunca expõe passwordHash. O `person` ganha a foto de perfil
10
+ * (data URL), lida do documento em `people` (o ref em `users` não a carrega, p/ não inchar).
11
+ */
12
+ export type AuthUser = Omit<User, 'passwordHash' | 'person'> & {
13
+ person: PersonRef & {
14
+ avatar?: string;
15
+ };
16
+ };
9
17
  export interface SignupResult extends AuthTokens {
10
18
  user: AuthUser;
11
19
  restaurant: Restaurant;
@@ -1 +1 @@
1
- {"version":3,"file":"auth-response.d.ts","sourceRoot":"","sources":["../../../../src/core/data/auth/auth-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAEjE,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,2DAA2D;AAC3D,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAA;AAEjD,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAA;AAEtC,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;CAChB"}
1
+ {"version":3,"file":"auth-response.d.ts","sourceRoot":"","sources":["../../../../src/core/data/auth/auth-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE5D,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,CAAC,GAAG;IAC7D,MAAM,EAAE,SAAS,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACxC,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAA;AAEtC,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -9,6 +9,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
9
9
  person: import("@ascendance-hub/sapphire-core").ObjectField<Omit<{
10
10
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
11
11
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
12
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
12
13
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
13
14
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
14
15
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -28,6 +29,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
28
29
  }, "audit">, import("@ascendance-hub/sapphire-core").ObjectOutput<Omit<{
29
30
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
30
31
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
32
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
31
33
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
32
34
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
33
35
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -47,6 +49,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
47
49
  }, "audit">>, import("@ascendance-hub/sapphire-core").ObjectInput<Omit<{
48
50
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
49
51
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
52
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
50
53
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
51
54
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
52
55
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -72,6 +75,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
72
75
  person: import("@ascendance-hub/sapphire-core").ObjectField<Omit<{
73
76
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
74
77
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
78
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
75
79
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
76
80
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
77
81
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -91,6 +95,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
91
95
  }, "audit">, import("@ascendance-hub/sapphire-core").ObjectOutput<Omit<{
92
96
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
93
97
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
98
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
94
99
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
95
100
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
96
101
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -110,6 +115,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
110
115
  }, "audit">>, import("@ascendance-hub/sapphire-core").ObjectInput<Omit<{
111
116
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
112
117
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
118
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
113
119
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
114
120
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
115
121
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -135,6 +141,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
135
141
  person: import("@ascendance-hub/sapphire-core").ObjectField<Omit<{
136
142
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
137
143
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
144
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
138
145
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
139
146
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
140
147
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -154,6 +161,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
154
161
  }, "audit">, import("@ascendance-hub/sapphire-core").ObjectOutput<Omit<{
155
162
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
156
163
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
164
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
157
165
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
158
166
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
159
167
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -173,6 +181,7 @@ export declare const signupRequestSchema: import("@ascendance-hub/sapphire-core"
173
181
  }, "audit">>, import("@ascendance-hub/sapphire-core").ObjectInput<Omit<{
174
182
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
175
183
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
184
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
176
185
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
177
186
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
178
187
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -1 +1 @@
1
- {"version":3,"file":"signup-schema.d.ts","sourceRoot":"","sources":["../../../../src/core/data/auth/signup-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAM1D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
1
+ {"version":3,"file":"signup-schema.d.ts","sourceRoot":"","sources":["../../../../src/core/data/auth/signup-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAM1D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -2,4 +2,6 @@ export { Person } from './person-entity';
2
2
  export { personSchema } from './person-schema';
3
3
  export { personRefSchema } from './person-ref-schema';
4
4
  export type { PersonRef } from './person-ref-schema';
5
+ export { avatarSchema, AVATAR_MAX_BYTES, AVATAR_MAX_DATA_URL_LENGTH, AVATAR_MIME_TYPES } from './person-avatar';
6
+ export type { PersonAvatarResult } from './person-avatar';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.personRefSchema = exports.personSchema = void 0;
3
+ exports.AVATAR_MIME_TYPES = exports.AVATAR_MAX_DATA_URL_LENGTH = exports.AVATAR_MAX_BYTES = exports.avatarSchema = exports.personRefSchema = exports.personSchema = void 0;
4
4
  var person_schema_1 = require("./person-schema");
5
5
  Object.defineProperty(exports, "personSchema", { enumerable: true, get: function () { return person_schema_1.personSchema; } });
6
6
  var person_ref_schema_1 = require("./person-ref-schema");
7
7
  Object.defineProperty(exports, "personRefSchema", { enumerable: true, get: function () { return person_ref_schema_1.personRefSchema; } });
8
+ var person_avatar_1 = require("./person-avatar");
9
+ Object.defineProperty(exports, "avatarSchema", { enumerable: true, get: function () { return person_avatar_1.avatarSchema; } });
10
+ Object.defineProperty(exports, "AVATAR_MAX_BYTES", { enumerable: true, get: function () { return person_avatar_1.AVATAR_MAX_BYTES; } });
11
+ Object.defineProperty(exports, "AVATAR_MAX_DATA_URL_LENGTH", { enumerable: true, get: function () { return person_avatar_1.AVATAR_MAX_DATA_URL_LENGTH; } });
12
+ Object.defineProperty(exports, "AVATAR_MIME_TYPES", { enumerable: true, get: function () { return person_avatar_1.AVATAR_MIME_TYPES; } });
8
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AACrB,yDAAqD;AAA5C,oHAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/data/person/index.ts"],"names":[],"mappings":";;;AACA,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AACrB,yDAAqD;AAA5C,oHAAA,eAAe,OAAA;AAExB,iDAA+G;AAAtG,6GAAA,YAAY,OAAA;AAAE,iHAAA,gBAAgB,OAAA;AAAE,2HAAA,0BAA0B,OAAA;AAAE,kHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,19 @@
1
+ /** Tamanho máximo da imagem de perfil (bytes, já decodificada): 1 MB. */
2
+ export declare const AVATAR_MAX_BYTES: number;
3
+ export declare const AVATAR_MIME_TYPES: readonly ["image/jpeg", "image/png", "image/webp"];
4
+ /**
5
+ * Teto do data URL em caracteres: base64 infla ~4/3 sobre os bytes da imagem, mais o
6
+ * prefixo `data:<mime>;base64,` (≤ 23). Folga de 1 KB p/ arredondamento do padding.
7
+ */
8
+ export declare const AVATAR_MAX_DATA_URL_LENGTH: number;
9
+ /**
10
+ * Foto de perfil guardada no próprio documento do `Person` (Mongo) como data URL
11
+ * (`data:image/png;base64,...`) — dispensa bucket/serviço externo, e o limite de 1 MB
12
+ * deixa o documento muito abaixo dos 16 MB do Mongo.
13
+ */
14
+ export declare const avatarSchema: import("@ascendance-hub/sapphire-core").StringField<string, string>;
15
+ /** Resposta de `GET /people/avatar/:username`. `avatar` é `null` quando a pessoa não tem foto. */
16
+ export interface PersonAvatarResult {
17
+ avatar: string | null;
18
+ }
19
+ //# sourceMappingURL=person-avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-avatar.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-avatar.ts"],"names":[],"mappings":"AAIA,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,QAAc,CAAA;AAE3C,eAAO,MAAM,iBAAiB,oDAAqD,CAAA;AAEnF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,QAA+C,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,YAAY,qEAKtB,CAAA;AAEH,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.avatarSchema = exports.AVATAR_MAX_DATA_URL_LENGTH = exports.AVATAR_MIME_TYPES = exports.AVATAR_MAX_BYTES = void 0;
4
+ const sapphire_core_1 = require("@ascendance-hub/sapphire-core");
5
+ const s = new sapphire_core_1.Sapphire();
6
+ /** Tamanho máximo da imagem de perfil (bytes, já decodificada): 1 MB. */
7
+ exports.AVATAR_MAX_BYTES = 1024 * 1024;
8
+ exports.AVATAR_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp'];
9
+ /**
10
+ * Teto do data URL em caracteres: base64 infla ~4/3 sobre os bytes da imagem, mais o
11
+ * prefixo `data:<mime>;base64,` (≤ 23). Folga de 1 KB p/ arredondamento do padding.
12
+ */
13
+ exports.AVATAR_MAX_DATA_URL_LENGTH = Math.ceil((exports.AVATAR_MAX_BYTES * 4) / 3) + 1024;
14
+ /**
15
+ * Foto de perfil guardada no próprio documento do `Person` (Mongo) como data URL
16
+ * (`data:image/png;base64,...`) — dispensa bucket/serviço externo, e o limite de 1 MB
17
+ * deixa o documento muito abaixo dos 16 MB do Mongo.
18
+ */
19
+ exports.avatarSchema = s.string()
20
+ .max(exports.AVATAR_MAX_DATA_URL_LENGTH, { message: 'A foto de perfil deve ter no máximo 1 MB.' })
21
+ .regex(/^data:image\/(jpeg|png|webp);base64,[A-Za-z0-9+/]+={0,2}$/, { message: 'A foto de perfil deve ser uma imagem JPG, PNG ou WebP.' });
22
+ //# sourceMappingURL=person-avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-avatar.js","sourceRoot":"","sources":["../../../../src/core/data/person/person-avatar.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AAExD,MAAM,CAAC,GAAG,IAAI,wBAAQ,EAAE,CAAA;AAExB,yEAAyE;AAC5D,QAAA,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9B,QAAA,iBAAiB,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAU,CAAA;AAEnF;;;GAGG;AACU,QAAA,0BAA0B,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,wBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA;AAEtF;;;;GAIG;AACU,QAAA,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE;KACnC,GAAG,CAAC,kCAA0B,EAAE,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;KACzF,KAAK,CACJ,2DAA2D,EAC3D,EAAE,OAAO,EAAE,wDAAwD,EAAE,CACtE,CAAA"}
@@ -1,6 +1,7 @@
1
1
  export declare const personSchema: import("@ascendance-hub/sapphire-core").ObjectField<{
2
2
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
3
3
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
4
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
4
5
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
5
6
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
6
7
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -20,6 +21,7 @@ export declare const personSchema: import("@ascendance-hub/sapphire-core").Objec
20
21
  }, import("@ascendance-hub/sapphire-core").ObjectOutput<{
21
22
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
22
23
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
24
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
23
25
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
24
26
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
25
27
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -39,6 +41,7 @@ export declare const personSchema: import("@ascendance-hub/sapphire-core").Objec
39
41
  }>, import("@ascendance-hub/sapphire-core").ObjectInput<{
40
42
  name: import("@ascendance-hub/sapphire-core").StringField<string, string>;
41
43
  phone: import("@ascendance-hub/sapphire-core").StringField<string, string>;
44
+ avatar: import("@ascendance-hub/sapphire-core").StringField<string | undefined, string | undefined>;
42
45
  audit: import("@ascendance-hub/sapphire-core").ObjectField<{
43
46
  createdAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
44
47
  updatedAt: import("@ascendance-hub/sapphire-core").DateField<Date, Date>;
@@ -1 +1 @@
1
- {"version":3,"file":"person-schema.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIvB,CAAA"}
1
+ {"version":3,"file":"person-schema.d.ts","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKvB,CAAA"}
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.personSchema = void 0;
4
4
  const sapphire_core_1 = require("@ascendance-hub/sapphire-core");
5
5
  const audit_1 = require("../common/audit");
6
+ const person_avatar_1 = require("./person-avatar");
6
7
  const s = new sapphire_core_1.Sapphire();
7
8
  exports.personSchema = s.object({
8
9
  name: s.string(),
9
10
  phone: s.string(),
11
+ avatar: person_avatar_1.avatarSchema.optional(),
10
12
  audit: audit_1.auditSchema,
11
13
  });
12
14
  //# sourceMappingURL=person-schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"person-schema.js","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AACxD,2CAA6C;AAE7C,MAAM,CAAC,GAAG,IAAI,wBAAQ,EAAE,CAAA;AAEX,QAAA,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,mBAAW;CACnB,CAAC,CAAA"}
1
+ {"version":3,"file":"person-schema.js","sourceRoot":"","sources":["../../../../src/core/data/person/person-schema.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AACxD,2CAA6C;AAC7C,mDAA8C;AAE9C,MAAM,CAAC,GAAG,IAAI,wBAAQ,EAAE,CAAA;AAEX,QAAA,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,4BAAY,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,mBAAW;CACnB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mintly-lib",
3
- "version": "2.17.0-preview",
3
+ "version": "2.18.1-preview",
4
4
  "description": "Mintly Library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@types/http-status-codes": "^1.2.0",
50
50
  "@types/jest": "^30.0.0",
51
- "@types/node": "^20.11.5",
51
+ "@types/node": "^24.19.2",
52
52
  "@typescript-eslint/eslint-plugin": "6.4.0",
53
53
  "dotenv": "^16.4.5",
54
54
  "eslint": "8.0.1",