@pairus/product-data 1.1.0 → 1.2.0

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/dist/index.d.mts CHANGED
@@ -258,12 +258,167 @@ interface TaxPredictionResponse {
258
258
  dados_tributarios?: TaxPredictionData;
259
259
  resultados?: TaxPredictionItemResult[];
260
260
  }
261
+ interface FiscalSanitizeItemInput {
262
+ ncm: string;
263
+ cest?: string;
264
+ descricao?: string;
265
+ gtin?: string;
266
+ }
267
+ interface FiscalSanitizeItemResult {
268
+ ncm: string;
269
+ ncm_valido: boolean;
270
+ descricao_ncm?: string;
271
+ cest_informado?: string;
272
+ cest_sugerido?: string;
273
+ sujeito_st: boolean;
274
+ aliquotas_sugeridas?: Record<string, any>;
275
+ avisos?: string[];
276
+ }
277
+ interface FiscalSanitizeResponse {
278
+ status: string;
279
+ provider: string;
280
+ timestamp?: string;
281
+ total_itens: number;
282
+ itens: Array<Record<string, any>>;
283
+ }
261
284
 
262
285
  declare class FiscalResource extends BaseResource {
263
286
  /**
264
287
  * Executa a predição fiscal completa da Reforma Tributária (IBS/CBS/IS) e NF-e.
265
288
  */
266
289
  predict(params: TaxPredictionParams): Promise<TaxPredictionResponse>;
290
+ /**
291
+ * Audita e higieniza uma lista de produtos em lote perante as tabelas fiscais vigentes.
292
+ */
293
+ sanitize(itens: Array<Record<string, any>>): Promise<any>;
294
+ }
295
+
296
+ interface EnderecoNFSeInput {
297
+ logradouro: string;
298
+ numero: string;
299
+ complemento?: string;
300
+ bairro: string;
301
+ codigo_municipio_ibge: string;
302
+ uf: string;
303
+ cep: string;
304
+ }
305
+ interface PrestadorNFSeInput {
306
+ cnpj: string;
307
+ inscricao_municipal: string;
308
+ razao_social: string;
309
+ nome_fantasia?: string;
310
+ optante_simples_nacional?: boolean;
311
+ regime_especial_tributacao?: string;
312
+ endereco?: EnderecoNFSeInput;
313
+ }
314
+ interface TomadorNFSeInput {
315
+ cpf_cnpj: string;
316
+ razao_social: string;
317
+ inscricao_municipal?: string;
318
+ email?: string;
319
+ telefone?: string;
320
+ endereco?: EnderecoNFSeInput;
321
+ }
322
+ interface RetencoesFederaisInput {
323
+ pis_retido?: boolean;
324
+ aliquota_pis?: number;
325
+ valor_pis?: number;
326
+ cofins_retido?: boolean;
327
+ aliquota_cofins?: number;
328
+ valor_cofins?: number;
329
+ csll_retida?: boolean;
330
+ aliquota_csll?: number;
331
+ valor_csll?: number;
332
+ irrf_retido?: boolean;
333
+ aliquota_irrf?: number;
334
+ valor_irrf?: number;
335
+ inss_retido?: boolean;
336
+ aliquota_inss?: number;
337
+ valor_inss?: number;
338
+ }
339
+ interface ServicoNFSeInput {
340
+ item_lista_servico: string;
341
+ discriminacao: string;
342
+ municipio_prestacao_ibge: string;
343
+ valor_servicos: number;
344
+ codigo_cnae?: string;
345
+ codigo_tributacao_municipio?: string;
346
+ valor_deducoes?: number;
347
+ valor_desconto_incondicionado?: number;
348
+ valor_desconto_condicionado?: number;
349
+ iss_retido?: boolean;
350
+ aliquota_iss?: number;
351
+ exigibilidade_iss?: string;
352
+ retencoes_federais?: RetencoesFederaisInput;
353
+ }
354
+ interface NFSeEmissaoInput {
355
+ prestador: PrestadorNFSeInput | Record<string, any>;
356
+ tomador: TomadorNFSeInput | Record<string, any>;
357
+ servico: ServicoNFSeInput | Record<string, any>;
358
+ serie_dps?: string;
359
+ numero_dps?: number;
360
+ modo?: 'direto' | 'assistido' | 'simulacao';
361
+ politica_rejeicao?: 'autocura_silenciosa' | 'autocura_assistida' | 'nenhuma';
362
+ ambiente?: 'producao' | 'homologacao';
363
+ informacoes_complementares?: string;
364
+ webhook_url?: string;
365
+ }
366
+ interface NFSeEmissaoResponse {
367
+ sucesso: boolean;
368
+ status: 'autorizada' | 'rejeitada' | 'cancelada' | 'simulada';
369
+ numero_nfse?: string;
370
+ codigo_verificacao?: string;
371
+ chave_acesso_nacional?: string;
372
+ data_emissao?: string;
373
+ link_visualizacao?: string;
374
+ danfse_pdf_base64?: string;
375
+ xml_nfse?: string;
376
+ valor_servicos: number;
377
+ valor_iss: number;
378
+ valor_iss_retido: number;
379
+ total_retencoes_federais: number;
380
+ valor_liquido: number;
381
+ erros?: string[];
382
+ alertas?: string[];
383
+ trilha_auditoria?: Record<string, any>[];
384
+ creditos_cobrados: number;
385
+ tempo_processamento_ms: number;
386
+ }
387
+ interface CancelamentoNFSeInput {
388
+ numero_nfse: string;
389
+ cnpj_prestador: string;
390
+ inscricao_municipal: string;
391
+ codigo_municipio_ibge: string;
392
+ justificativa: string;
393
+ motivo_codigo?: string;
394
+ codigo_verificacao?: string;
395
+ chave_acesso_nacional?: string;
396
+ }
397
+ interface CancelamentoNFSeResponse {
398
+ sucesso: boolean;
399
+ numero_nfse: string;
400
+ data_cancelamento?: string;
401
+ mensagem: string;
402
+ erros?: string[];
403
+ }
404
+
405
+ declare class NFSeResource extends BaseResource {
406
+ /**
407
+ * Emite uma Nota Fiscal de Serviços Eletrônica (NFS-e) perante o SND ou prefeitura.
408
+ */
409
+ emitir(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
410
+ /**
411
+ * Simula o cálculo de NFS-e com retenções e apuração tributária (custo ZERO de créditos).
412
+ */
413
+ simular(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
414
+ /**
415
+ * Homologa o cancelamento oficial de uma NFS-e perante o SND ou prefeitura.
416
+ */
417
+ cancelar(payload: CancelamentoNFSeInput): Promise<CancelamentoNFSeResponse>;
418
+ /**
419
+ * Consulta os dados, status e DANFSE de uma NFS-e pelo número ou chave de 50 dígitos.
420
+ */
421
+ consultar(chaveOuNumero: string): Promise<Record<string, any>>;
267
422
  }
268
423
 
269
424
  interface ProductDetails {
@@ -287,13 +442,60 @@ interface ProductResponse {
287
442
  produto?: ProductDetails;
288
443
  raw_data?: Record<string, any>;
289
444
  }
445
+ interface ProductSearchResultItem {
446
+ gtin: string;
447
+ xProd: string;
448
+ marca?: string;
449
+ categoria?: string;
450
+ score?: number;
451
+ ncm?: string;
452
+ cest?: string;
453
+ imagem_url?: string;
454
+ }
455
+ interface ProductSearchResponse {
456
+ status: string;
457
+ provider: string;
458
+ total_encontrados: number;
459
+ termo_buscado: string;
460
+ produtos: ProductSearchResultItem[];
461
+ }
462
+ interface ProductEnrichedDetails {
463
+ gtin: string;
464
+ xProd: string;
465
+ descricao_completa?: string;
466
+ ficha_tecnica?: Record<string, any>;
467
+ palavras_chave?: string[];
468
+ ncm?: string;
469
+ cest?: string;
470
+ marca?: string;
471
+ categoria?: string;
472
+ imagem_url?: string;
473
+ peso_bruto?: number;
474
+ peso_liquido?: number;
475
+ dados_tributarios_sugeridos?: Record<string, any>;
476
+ }
290
477
 
291
478
  declare class ProductsResource extends BaseResource {
292
479
  /**
293
- * Consulta um produto por código de barras GTIN/EAN.
480
+ * Consulta dados oficiais de um produto por código de barras GTIN/EAN (V1).
294
481
  * @param gtin Código numérico de 8 a 14 dígitos.
295
482
  */
296
483
  get(gtin: string): Promise<ProductDetails>;
484
+ /**
485
+ * Consulta dados enriquecidos por IA, com SEO e ficha técnica estruturada (V2).
486
+ * @param gtin Código numérico do produto.
487
+ */
488
+ getEnriched(gtin: string): Promise<ProductEnrichedDetails>;
489
+ /**
490
+ * Executa busca semântica por intenção/linguagem natural (V2).
491
+ * @param query Termo livre de busca (ex: 'refrigerante zero lata').
492
+ */
493
+ search(query: string): Promise<ProductSearchResponse>;
494
+ /**
495
+ * Reconhece código de barras por visão computacional a partir de foto JPEG (OCR V2).
496
+ * @param file Blob, Buffer ou FormData com a imagem JPEG.
497
+ */
498
+ scan(file: Blob | Buffer | FormData): Promise<ProductEnrichedDetails>;
297
499
  }
298
500
 
299
501
  interface WebhookEvent<T = Record<string, any>> {
@@ -324,6 +526,7 @@ declare class PairusProductData {
324
526
  readonly products: ProductsResource;
325
527
  readonly fiscal: FiscalResource;
326
528
  readonly emissao: EmissaoResource;
529
+ readonly nfse: NFSeResource;
327
530
  constructor(options?: PairusClientOptions);
328
531
  }
329
532
 
@@ -354,4 +557,4 @@ declare class NetworkError extends PairusError {
354
557
  constructor(message: string);
355
558
  }
356
559
 
357
- export { AuthenticationError, type CancelamentoInput, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EventoNFeResponse, FiscalResource, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type ProductDetails, type ProductResponse, ProductsResource, RateLimitError, type SelectiveTaxData, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type WebhookEvent, Webhooks };
560
+ export { AuthenticationError, type CancelamentoInput, type CancelamentoNFSeInput, type CancelamentoNFSeResponse, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EnderecoNFSeInput, type EventoNFeResponse, FiscalResource, type FiscalSanitizeItemInput, type FiscalSanitizeItemResult, type FiscalSanitizeResponse, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, type NFSeEmissaoInput, type NFSeEmissaoResponse, NFSeResource, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type PrestadorNFSeInput, type ProductDetails, type ProductEnrichedDetails, type ProductResponse, type ProductSearchResponse, type ProductSearchResultItem, ProductsResource, RateLimitError, type RetencoesFederaisInput, type SelectiveTaxData, type ServicoNFSeInput, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type TomadorNFSeInput, type WebhookEvent, Webhooks };
package/dist/index.d.ts CHANGED
@@ -258,12 +258,167 @@ interface TaxPredictionResponse {
258
258
  dados_tributarios?: TaxPredictionData;
259
259
  resultados?: TaxPredictionItemResult[];
260
260
  }
261
+ interface FiscalSanitizeItemInput {
262
+ ncm: string;
263
+ cest?: string;
264
+ descricao?: string;
265
+ gtin?: string;
266
+ }
267
+ interface FiscalSanitizeItemResult {
268
+ ncm: string;
269
+ ncm_valido: boolean;
270
+ descricao_ncm?: string;
271
+ cest_informado?: string;
272
+ cest_sugerido?: string;
273
+ sujeito_st: boolean;
274
+ aliquotas_sugeridas?: Record<string, any>;
275
+ avisos?: string[];
276
+ }
277
+ interface FiscalSanitizeResponse {
278
+ status: string;
279
+ provider: string;
280
+ timestamp?: string;
281
+ total_itens: number;
282
+ itens: Array<Record<string, any>>;
283
+ }
261
284
 
262
285
  declare class FiscalResource extends BaseResource {
263
286
  /**
264
287
  * Executa a predição fiscal completa da Reforma Tributária (IBS/CBS/IS) e NF-e.
265
288
  */
266
289
  predict(params: TaxPredictionParams): Promise<TaxPredictionResponse>;
290
+ /**
291
+ * Audita e higieniza uma lista de produtos em lote perante as tabelas fiscais vigentes.
292
+ */
293
+ sanitize(itens: Array<Record<string, any>>): Promise<any>;
294
+ }
295
+
296
+ interface EnderecoNFSeInput {
297
+ logradouro: string;
298
+ numero: string;
299
+ complemento?: string;
300
+ bairro: string;
301
+ codigo_municipio_ibge: string;
302
+ uf: string;
303
+ cep: string;
304
+ }
305
+ interface PrestadorNFSeInput {
306
+ cnpj: string;
307
+ inscricao_municipal: string;
308
+ razao_social: string;
309
+ nome_fantasia?: string;
310
+ optante_simples_nacional?: boolean;
311
+ regime_especial_tributacao?: string;
312
+ endereco?: EnderecoNFSeInput;
313
+ }
314
+ interface TomadorNFSeInput {
315
+ cpf_cnpj: string;
316
+ razao_social: string;
317
+ inscricao_municipal?: string;
318
+ email?: string;
319
+ telefone?: string;
320
+ endereco?: EnderecoNFSeInput;
321
+ }
322
+ interface RetencoesFederaisInput {
323
+ pis_retido?: boolean;
324
+ aliquota_pis?: number;
325
+ valor_pis?: number;
326
+ cofins_retido?: boolean;
327
+ aliquota_cofins?: number;
328
+ valor_cofins?: number;
329
+ csll_retida?: boolean;
330
+ aliquota_csll?: number;
331
+ valor_csll?: number;
332
+ irrf_retido?: boolean;
333
+ aliquota_irrf?: number;
334
+ valor_irrf?: number;
335
+ inss_retido?: boolean;
336
+ aliquota_inss?: number;
337
+ valor_inss?: number;
338
+ }
339
+ interface ServicoNFSeInput {
340
+ item_lista_servico: string;
341
+ discriminacao: string;
342
+ municipio_prestacao_ibge: string;
343
+ valor_servicos: number;
344
+ codigo_cnae?: string;
345
+ codigo_tributacao_municipio?: string;
346
+ valor_deducoes?: number;
347
+ valor_desconto_incondicionado?: number;
348
+ valor_desconto_condicionado?: number;
349
+ iss_retido?: boolean;
350
+ aliquota_iss?: number;
351
+ exigibilidade_iss?: string;
352
+ retencoes_federais?: RetencoesFederaisInput;
353
+ }
354
+ interface NFSeEmissaoInput {
355
+ prestador: PrestadorNFSeInput | Record<string, any>;
356
+ tomador: TomadorNFSeInput | Record<string, any>;
357
+ servico: ServicoNFSeInput | Record<string, any>;
358
+ serie_dps?: string;
359
+ numero_dps?: number;
360
+ modo?: 'direto' | 'assistido' | 'simulacao';
361
+ politica_rejeicao?: 'autocura_silenciosa' | 'autocura_assistida' | 'nenhuma';
362
+ ambiente?: 'producao' | 'homologacao';
363
+ informacoes_complementares?: string;
364
+ webhook_url?: string;
365
+ }
366
+ interface NFSeEmissaoResponse {
367
+ sucesso: boolean;
368
+ status: 'autorizada' | 'rejeitada' | 'cancelada' | 'simulada';
369
+ numero_nfse?: string;
370
+ codigo_verificacao?: string;
371
+ chave_acesso_nacional?: string;
372
+ data_emissao?: string;
373
+ link_visualizacao?: string;
374
+ danfse_pdf_base64?: string;
375
+ xml_nfse?: string;
376
+ valor_servicos: number;
377
+ valor_iss: number;
378
+ valor_iss_retido: number;
379
+ total_retencoes_federais: number;
380
+ valor_liquido: number;
381
+ erros?: string[];
382
+ alertas?: string[];
383
+ trilha_auditoria?: Record<string, any>[];
384
+ creditos_cobrados: number;
385
+ tempo_processamento_ms: number;
386
+ }
387
+ interface CancelamentoNFSeInput {
388
+ numero_nfse: string;
389
+ cnpj_prestador: string;
390
+ inscricao_municipal: string;
391
+ codigo_municipio_ibge: string;
392
+ justificativa: string;
393
+ motivo_codigo?: string;
394
+ codigo_verificacao?: string;
395
+ chave_acesso_nacional?: string;
396
+ }
397
+ interface CancelamentoNFSeResponse {
398
+ sucesso: boolean;
399
+ numero_nfse: string;
400
+ data_cancelamento?: string;
401
+ mensagem: string;
402
+ erros?: string[];
403
+ }
404
+
405
+ declare class NFSeResource extends BaseResource {
406
+ /**
407
+ * Emite uma Nota Fiscal de Serviços Eletrônica (NFS-e) perante o SND ou prefeitura.
408
+ */
409
+ emitir(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
410
+ /**
411
+ * Simula o cálculo de NFS-e com retenções e apuração tributária (custo ZERO de créditos).
412
+ */
413
+ simular(payload: NFSeEmissaoInput | Record<string, any>): Promise<NFSeEmissaoResponse>;
414
+ /**
415
+ * Homologa o cancelamento oficial de uma NFS-e perante o SND ou prefeitura.
416
+ */
417
+ cancelar(payload: CancelamentoNFSeInput): Promise<CancelamentoNFSeResponse>;
418
+ /**
419
+ * Consulta os dados, status e DANFSE de uma NFS-e pelo número ou chave de 50 dígitos.
420
+ */
421
+ consultar(chaveOuNumero: string): Promise<Record<string, any>>;
267
422
  }
268
423
 
269
424
  interface ProductDetails {
@@ -287,13 +442,60 @@ interface ProductResponse {
287
442
  produto?: ProductDetails;
288
443
  raw_data?: Record<string, any>;
289
444
  }
445
+ interface ProductSearchResultItem {
446
+ gtin: string;
447
+ xProd: string;
448
+ marca?: string;
449
+ categoria?: string;
450
+ score?: number;
451
+ ncm?: string;
452
+ cest?: string;
453
+ imagem_url?: string;
454
+ }
455
+ interface ProductSearchResponse {
456
+ status: string;
457
+ provider: string;
458
+ total_encontrados: number;
459
+ termo_buscado: string;
460
+ produtos: ProductSearchResultItem[];
461
+ }
462
+ interface ProductEnrichedDetails {
463
+ gtin: string;
464
+ xProd: string;
465
+ descricao_completa?: string;
466
+ ficha_tecnica?: Record<string, any>;
467
+ palavras_chave?: string[];
468
+ ncm?: string;
469
+ cest?: string;
470
+ marca?: string;
471
+ categoria?: string;
472
+ imagem_url?: string;
473
+ peso_bruto?: number;
474
+ peso_liquido?: number;
475
+ dados_tributarios_sugeridos?: Record<string, any>;
476
+ }
290
477
 
291
478
  declare class ProductsResource extends BaseResource {
292
479
  /**
293
- * Consulta um produto por código de barras GTIN/EAN.
480
+ * Consulta dados oficiais de um produto por código de barras GTIN/EAN (V1).
294
481
  * @param gtin Código numérico de 8 a 14 dígitos.
295
482
  */
296
483
  get(gtin: string): Promise<ProductDetails>;
484
+ /**
485
+ * Consulta dados enriquecidos por IA, com SEO e ficha técnica estruturada (V2).
486
+ * @param gtin Código numérico do produto.
487
+ */
488
+ getEnriched(gtin: string): Promise<ProductEnrichedDetails>;
489
+ /**
490
+ * Executa busca semântica por intenção/linguagem natural (V2).
491
+ * @param query Termo livre de busca (ex: 'refrigerante zero lata').
492
+ */
493
+ search(query: string): Promise<ProductSearchResponse>;
494
+ /**
495
+ * Reconhece código de barras por visão computacional a partir de foto JPEG (OCR V2).
496
+ * @param file Blob, Buffer ou FormData com a imagem JPEG.
497
+ */
498
+ scan(file: Blob | Buffer | FormData): Promise<ProductEnrichedDetails>;
297
499
  }
298
500
 
299
501
  interface WebhookEvent<T = Record<string, any>> {
@@ -324,6 +526,7 @@ declare class PairusProductData {
324
526
  readonly products: ProductsResource;
325
527
  readonly fiscal: FiscalResource;
326
528
  readonly emissao: EmissaoResource;
529
+ readonly nfse: NFSeResource;
327
530
  constructor(options?: PairusClientOptions);
328
531
  }
329
532
 
@@ -354,4 +557,4 @@ declare class NetworkError extends PairusError {
354
557
  constructor(message: string);
355
558
  }
356
559
 
357
- export { AuthenticationError, type CancelamentoInput, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EventoNFeResponse, FiscalResource, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type ProductDetails, type ProductResponse, ProductsResource, RateLimitError, type SelectiveTaxData, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type WebhookEvent, Webhooks };
560
+ export { AuthenticationError, type CancelamentoInput, type CancelamentoNFSeInput, type CancelamentoNFSeResponse, type CartaCorrecaoInput, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS, type DetalheAutocura, type EmissaoDestinatarioInput, type EmissaoItemInput, type EmissaoNFeInput, type EmissaoNFeResponse, EmissaoResource, type EnderecoNFSeInput, type EventoNFeResponse, FiscalResource, type FiscalSanitizeItemInput, type FiscalSanitizeItemResult, type FiscalSanitizeResponse, type FuelData, type IBSCBSData, type InutilizacaoInput, InvalidSignatureError, type NFSeEmissaoInput, type NFSeEmissaoResponse, NFSeResource, NetworkError, PairusAPIError, type PairusClientOptions, PairusError, PairusProductData, type PrestadorNFSeInput, type ProductDetails, type ProductEnrichedDetails, type ProductResponse, type ProductSearchResponse, type ProductSearchResultItem, ProductsResource, RateLimitError, type RetencoesFederaisInput, type SelectiveTaxData, type ServicoNFSeInput, type TaxPredictionData, type TaxPredictionItemInput, type TaxPredictionItemResult, type TaxPredictionParams, type TaxPredictionResponse, type TomadorNFSeInput, type WebhookEvent, Webhooks };