Skip to content

Commit

Permalink
feat: remove commented types
Browse files Browse the repository at this point in the history
  • Loading branch information
David Osorio committed Jul 3, 2024
1 parent 2938ca5 commit 8a9cd4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/cfdi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Pdf from './pdf.js';
import Addenda from './addenda.js';
import File from './file.js';
import Service from './service.js';
import { Payload } from './types.js';
import { PdfPayload } from './types.js';

export default class Cfdi extends File {

Expand Down Expand Up @@ -34,7 +34,7 @@ export default class Cfdi extends File {
this.addendaReplaceValues = replaceValues
}

async toPdf(payload: Payload = {}) {
async toPdf(payload: PdfPayload = {}) {
if (this.pdf) {
return this.pdf;
}
Expand Down
74 changes: 2 additions & 72 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,3 @@
// export default class Redoc {
// apiKey: string;
// service: Service;
// constructor(apiKey?: string);
// get cfdi(): Cfdi;
// get addenda(): Addenda;
// }

// export class Cfdi extends File {
// pdf: Pdf | null;
// addenda: Addenda | null;
// constructor();
// setAddenda(addenda: Addenda, replaceValues?: object): void;
// toPdf(payload?: CfdisConvertPayload): Promise<Pdf>;
// }
// export class Addenda extends File {
// constructor();
// getFileContent(replaceValues?: object): Promise<string>;
// }

// export class File {
// filePath: string | null;
// fileBuffer: Buffer | null;
// fileContent: string | null;
// constructor();
// fromFile(filePath: string): this;
// fromString(fileContent: string): this;
// getFile(): Promise<{ content: string | Buffer; type: 'string' | 'buffer' }>;
// }

// export class Pdf {
// buffer: Buffer;
// transactionId: string;
// totalPages: number;
// totalTime: number;
// metadata: CfdisMetadata;
// constructor({ buffer, transactionId, totalPages, totalTime, metadata }: PdfConstructorParams);
// toBuffer(): Buffer;
// getTransactionId(): string;
// getTotalPages(): number;
// getTotalTimeMs(): number;
// getMetadata(): string;
// }

// export interface CfdisConvertPayload {
// style_pdf?: string;
// style_email?: string;
// }

// export class Service {
// apiKey: string;
// apiUrl: string;
// constructor(apiKey?: string);
// static getInstance(apiKey?: string): Service;
// cfdisConvert({ file, payload }: { file: { type: 'string' | 'buffer'; content: string | Buffer }; payload?: CfdisConvertPayload }): Promise<{ buffer: Buffer; metadata: CfdisMetadata; transactionId: string; totalPages: number; totalTime: number; }>;
// }

///// NEW

/* Redoc */
export interface RedocConstructorParams {
apiKey: string;
Expand All @@ -82,7 +23,7 @@ export interface ServiceConstructorParams {

export interface ServiceConvertCfdiParams {
file: FileComputed;
payload?: Payload;
payload?: PdfPayload;
}


Expand All @@ -101,17 +42,6 @@ export interface ServicePutAssetParams extends ServiceAssetsBasic{
export interface ServiceDeleteAssetParams extends ServiceAssetsBasic { }













/* File */
export interface FileComputed {
content: string | Buffer;
Expand All @@ -120,7 +50,7 @@ export interface FileComputed {

/* Cfdi */

export interface Payload {
export interface PdfPayload {
style_pdf?: string;
format?: string;
addenda?: string;
Expand Down

0 comments on commit 8a9cd4c

Please sign in to comment.