@nomalism-com/types 0.49.13 → 0.49.14

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.
@@ -24,11 +24,16 @@ export interface IIdentifyAndTranslateResponse {
24
24
  language: string;
25
25
  translation: string | null;
26
26
  }
27
+ export type IOllamaChatMessage = {
28
+ content?: string;
29
+ };
27
30
  export interface IOllamaChatResponse {
28
- message?: {
29
- content?: string;
30
- };
31
+ message?: IOllamaChatMessage;
31
32
  }
33
+ export type IIdentifyAndTranslateOutput = {
34
+ language?: string;
35
+ translation?: string;
36
+ };
32
37
  export interface IRepository {
33
38
  prompt: (data: IPromptRequest, response: IPromptResponse) => IPromptAbortController;
34
39
  translate(data: ITranslateRequest): Promise<string>;
@@ -3,6 +3,9 @@ import * as IShared from "../../../shared/interface";
3
3
  export type Entity = AllowedDevice;
4
4
  export declare const Route = "allowed_device";
5
5
  export type ICreateRequest = Pick<Entity, "key">;
6
+ export interface IFindByKeyRequest {
7
+ key: string;
8
+ }
6
9
  export declare const apkTypeEnum: {
7
10
  sms: "sms";
8
11
  ticket: "ticket";
@@ -3,6 +3,9 @@ import * as IShared from "../../../shared/interface";
3
3
  export type Entity = SmsTemplate;
4
4
  export declare const Route = "sms_template";
5
5
  export type SmsTemplateVariables = Record<string, string | number | boolean>;
6
+ export interface IFindByKeyRequest {
7
+ key: string;
8
+ }
6
9
  export interface ICreateRequest {
7
10
  key: string;
8
11
  name: string;
@@ -12,6 +12,14 @@ export type IFindResponse = Omit<IFindDetailedResponse, "">;
12
12
  export interface IFindPaginatedRequest extends IFindRequest, IShared.IPaginationRequest {
13
13
  }
14
14
  export type IFindWithPaginationResponse = IShared.IPaginationResponse<Omit<IFindDetailedResponse, "type_of_location">>;
15
+ export type IGeolocationCreate = {
16
+ lat: number;
17
+ lon: number;
18
+ };
19
+ export type IGeolocationUpdate = {
20
+ lat?: number;
21
+ lon?: number;
22
+ };
15
23
  export interface ICreateRequest {
16
24
  name: string;
17
25
  street: string;
@@ -20,10 +28,7 @@ export interface ICreateRequest {
20
28
  locality: string;
21
29
  postal_code: string;
22
30
  type_of_location_id: string;
23
- geolocation?: {
24
- lat: number;
25
- lon: number;
26
- };
31
+ geolocation?: IGeolocationCreate;
27
32
  default_billing?: boolean;
28
33
  default_delivery?: boolean;
29
34
  }
@@ -35,10 +40,7 @@ export interface IUpdateRequest {
35
40
  country_name?: string;
36
41
  postal_code?: string;
37
42
  type_of_location_id?: string;
38
- geolocation?: {
39
- lat?: number;
40
- lon?: number;
41
- };
43
+ geolocation?: IGeolocationUpdate;
42
44
  default_billing?: boolean;
43
45
  default_delivery?: boolean;
44
46
  }
@@ -60,8 +60,6 @@ export interface ICreateRequest {
60
60
  compositions?: string;
61
61
  attributes?: string;
62
62
  youtube_url?: string | null;
63
- created_by?: string;
64
- updated_by?: string;
65
63
  }
66
64
  export interface IUpdateRequest {
67
65
  designation?: string;
@@ -157,8 +155,10 @@ export interface IPrintLabelBulkQueryRequest {
157
155
  token: string;
158
156
  ids: string;
159
157
  }
160
- export interface IFindByReferenceRequest {
158
+ export interface IReferenceRequest {
161
159
  reference: string;
160
+ }
161
+ export interface IFindByReferenceRequest extends IReferenceRequest {
162
162
  allowProviderWildcard?: boolean;
163
163
  id_provider?: number;
164
164
  available?: boolean;
@@ -211,13 +211,11 @@ export interface IFindDataForMobileResponse {
211
211
  export interface IFindStockForMobileResponse {
212
212
  virtual: Pick<IProductVirtuals, "price_sale" | "available" | "ordered_quantity" | "prison" | "reserved" | "total" | "inativa">;
213
213
  }
214
- export type IFindForMobileRequest = {
215
- reference: string;
214
+ export type IFindForMobileRequest = (IReferenceRequest & {
216
215
  id?: never;
217
- } | {
216
+ }) | (IShared.IFindByIdRequest & {
218
217
  reference?: never;
219
- id: string;
220
- };
218
+ });
221
219
  export interface IProductLocation {
222
220
  location_id: string;
223
221
  product_ids: string[];
@@ -134,16 +134,12 @@ export interface ICreateFromHeaderRequest {
134
134
  store_operator_id?: string | null;
135
135
  copy_from_document?: string | null;
136
136
  owner_ref_document?: string | null;
137
- /**
138
- * Nota opcional a inserir nas linhas selecionadas (from_lines) aquando da
139
- * criação do documento. Usada, por exemplo, na transição "Criar Devolução"
140
- * (EM -> DF), onde o utilizador introduz uma nota do tipo "Devolucao".
141
- */
142
- document_line_note?: {
143
- note: string;
144
- type: IDocumentLineNote.IDocumentLineNoteType;
145
- };
137
+ document_line_note?: ICreateFromHeaderDocumentLineNote;
146
138
  }
139
+ export type ICreateFromHeaderDocumentLineNote = {
140
+ note: string;
141
+ type: IDocumentLineNote.IDocumentLineNoteType;
142
+ };
147
143
  export interface IUpdateRequest {
148
144
  external_id?: string | null;
149
145
  external_pdf_link?: string | null;
@@ -12,10 +12,12 @@ export type IDocumentLineVirtuals = DocumentLineVirtuals;
12
12
  export type IDocumentLineBaseVirtuals = DocumentLineBaseVirtuals;
13
13
  export type IPromotions = Pick<ProductPromotionVirtuals, "exclusive_to_location_id" | "exclusive_to_client_id" | "discount">;
14
14
  export type IDataKeys = "AvisoCliente" | "Quantidade Encomendada Originalmente" | "Linha criada na EM" | "Opcao EM" | "Levantar DF" | "Enviar Email NCF" | "Fechar DF" | "Documento pago" | "Pagamento" | "Recibo do documento";
15
- export interface IDataPayload {
15
+ export interface IDataPayloadBase {
16
16
  value: unknown;
17
17
  updated_at: Date;
18
18
  updated_by: string;
19
+ }
20
+ export interface IDataPayload extends IDataPayloadBase {
19
21
  history?: IDataPayload[];
20
22
  }
21
23
  export type IData = {
@@ -31,11 +31,12 @@ export interface ISendEmailDocumentRequest {
31
31
  template: IShared.IUserSendEmailDocumentTemplate;
32
32
  start_document_header_id: string;
33
33
  attachments: IAttachment[];
34
- user: {
35
- name: string;
36
- email: string;
37
- };
34
+ user: ISendEmailDocumentUser;
38
35
  }
36
+ export type ISendEmailDocumentUser = {
37
+ name: string;
38
+ email: string;
39
+ };
39
40
  export interface IRepository {
40
41
  findById(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
41
42
  findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdItemWithVersions[]>;
@@ -144,19 +144,21 @@ export interface IDuplicatedGroupPersona {
144
144
  main: boolean;
145
145
  contact: boolean;
146
146
  }
147
+ export type IDuplicatedGroupMergeError = {
148
+ client_id: string;
149
+ message: string;
150
+ };
151
+ export type IDuplicatedGroupData = {
152
+ documents?: Record<string, IDuplicatedGroupDocument[]>;
153
+ personas?: Record<string, IDuplicatedGroupPersona[]>;
154
+ merge_error?: IDuplicatedGroupMergeError | null;
155
+ };
147
156
  export interface IDuplicatedGroupResponse {
148
157
  id: string;
149
158
  status: "pending" | "resolved" | "merged";
150
159
  confidence_score: number;
151
160
  target_client_id: string | null;
152
- data?: {
153
- documents?: Record<string, IDuplicatedGroupDocument[]>;
154
- personas?: Record<string, IDuplicatedGroupPersona[]>;
155
- merge_error?: {
156
- client_id: string;
157
- message: string;
158
- } | null;
159
- };
161
+ data?: IDuplicatedGroupData;
160
162
  members: IDuplicatedGroupMember[];
161
163
  }
162
164
  export interface IResolveDuplicatedGroupRequest {
@@ -10,20 +10,22 @@ export declare const IErrorTypeEnum: {
10
10
  };
11
11
  export type IErrorType = (typeof IErrorTypeEnum)[keyof typeof IErrorTypeEnum];
12
12
  export declare const errorTypes: string[];
13
+ export type IErrorDetail = {
14
+ name: string;
15
+ message: string;
16
+ stack?: string;
17
+ };
18
+ export type IErrorRequestContext = {
19
+ url: string;
20
+ body?: unknown;
21
+ query?: unknown;
22
+ params?: unknown;
23
+ };
13
24
  export interface ICreateRequest {
14
25
  service: string;
15
26
  type: IErrorType;
16
- error: {
17
- name: string;
18
- message: string;
19
- stack?: string;
20
- };
21
- request?: {
22
- url: string;
23
- body?: unknown;
24
- query?: unknown;
25
- params?: unknown;
26
- };
27
+ error: IErrorDetail;
28
+ request?: IErrorRequestContext;
27
29
  }
28
30
  export interface IController {
29
31
  create(data: ICreateRequest): Promise<void>;
@@ -181,6 +181,21 @@ export declare enum IBrokerTopic {
181
181
  googlesheet_encomenda_log = "googlesheet_encomenda_log",
182
182
  log_google_api_request = "log_google_api_request"
183
183
  }
184
+ export type IBrokerPasswordEmailUser = {
185
+ name: string | null;
186
+ email: string;
187
+ };
188
+ export type IBrokerDocumentEmailUser = {
189
+ name: string;
190
+ email: string;
191
+ };
192
+ export type IBrokerProviderOrderAttachment = Pick<File, "title" | "multimedia_id">;
193
+ export type IBrokerWarningDocumentLine = {
194
+ designation: string;
195
+ quantity: string;
196
+ state: string;
197
+ };
198
+ export type IBrokerChatMessageRecipient = Pick<Persona, "email" | "name" | "telephone">;
184
199
  export type IBrokerTopicPayload = {
185
200
  [IBrokerTopic.google_sheet_import]: {
186
201
  google_sheet_import_id: string;
@@ -190,18 +205,12 @@ export type IBrokerTopicPayload = {
190
205
  };
191
206
  [IBrokerTopic.user_send_email_password]: {
192
207
  token: string;
193
- user: {
194
- name: string | null;
195
- email: string;
196
- };
208
+ user: IBrokerPasswordEmailUser;
197
209
  };
198
210
  [IBrokerTopic.user_send_email_document]: {
199
211
  template: IUserSendEmailDocumentTemplate;
200
212
  user_type: IDocumentTypeUserType;
201
- user: {
202
- name: string;
203
- email: string;
204
- };
213
+ user: IBrokerDocumentEmailUser;
205
214
  owner_id: string;
206
215
  document_header_id: string;
207
216
  start_document_name: string;
@@ -230,7 +239,7 @@ export type IBrokerTopicPayload = {
230
239
  pf_number: string;
231
240
  provider_name: string;
232
241
  provider_email: string;
233
- attachments: Pick<File, "title" | "multimedia_id">[];
242
+ attachments: IBrokerProviderOrderAttachment[];
234
243
  };
235
244
  [IBrokerTopic.undo_provider_order_schedule_email]: {
236
245
  provider_id: string;
@@ -258,11 +267,7 @@ export type IBrokerTopicPayload = {
258
267
  warning: IWarningType;
259
268
  document_header_id: string;
260
269
  document_number: number;
261
- document_lines: {
262
- designation: string;
263
- quantity: string;
264
- state: string;
265
- }[];
270
+ document_lines: IBrokerWarningDocumentLine[];
266
271
  };
267
272
  [IBrokerTopic.espera_devolver_catalogo_email]: {
268
273
  owner_id: string;
@@ -277,7 +282,7 @@ export type IBrokerTopicPayload = {
277
282
  warningErrors: string[];
278
283
  };
279
284
  [IBrokerTopic.dispatch_chat_message]: {
280
- to: [Pick<Persona, "email" | "name" | "telephone">];
285
+ to: [IBrokerChatMessageRecipient];
281
286
  reply_url: string;
282
287
  owner_id: string;
283
288
  document_header_id: string | null;
@@ -416,19 +421,4 @@ export interface IBrokerMessage<T extends IBrokerTopic = IBrokerTopic> {
416
421
  topic: T;
417
422
  payload: IBrokerTopicPayload[T];
418
423
  }
419
- export type Nullable<T> = {
420
- [K in keyof T]: T[K] | null;
421
- };
422
- export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
423
- export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
424
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
425
- }[Keys];
426
- export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
427
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
428
- }[Keys];
429
- type Impossible<K extends PropertyKey> = {
430
- [P in K]: never;
431
- };
432
- export type NoExtraProperties<T, U extends T = T> = U & Impossible<Exclude<keyof U, keyof T>>;
433
- export type ExactPromise<T> = Promise<NoExtraProperties<T>>;
434
424
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nomalism-com/types",
3
3
  "description": "A nomalism package with all necessary types and validations for developing APIs",
4
- "version": "0.49.13",
4
+ "version": "0.49.14",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "devDependencies": {
29
29
  "@eslint/js": "^10.0.1",
30
30
  "@swc/core": "^1.16.2",
31
- "@types/node": "^26.5.1",
31
+ "@types/node": "^26.6.0",
32
32
  "@typescript-eslint/eslint-plugin": "^8.62.0",
33
33
  "@typescript-eslint/parser": "^8.62.0",
34
34
  "eslint": "^10.10.0",