@timbrix/cli 1.3.0 → 1.4.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/commands/customers/create.d.ts.map +1 -1
- package/dist/commands/customers/create.js +2 -2
- package/dist/commands/customers/delete.js +1 -1
- package/dist/commands/invoices/create.d.ts +1 -1
- package/dist/commands/invoices/create.d.ts.map +1 -1
- package/dist/commands/invoices/create.js +5 -5
- package/dist/commands/invoices/list.d.ts.map +1 -1
- package/dist/commands/invoices/list.js +2 -2
- package/dist/commands/products/create.d.ts.map +1 -1
- package/dist/commands/products/create.js +2 -2
- package/dist/commands/products/delete.js +1 -1
- package/dist/commands/products/get.js +1 -1
- package/dist/commands/products/import.js +1 -1
- package/dist/commands/products/list.d.ts.map +1 -1
- package/dist/commands/products/list.js +2 -2
- package/dist/commands/products/update.js +1 -1
- package/oclif.manifest.json +4 -5
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/customers/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,OAAgB,WAAW,SAA0B;IAErD,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;;;;;;;;;;;;;;MAsDpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/customers/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,OAAgB,WAAW,SAA0B;IAErD,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;;;;;;;;;;;;;;MAsDpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkKlC"}
|
|
@@ -154,7 +154,7 @@ export default class CustomersCreate extends Command {
|
|
|
154
154
|
default: "MEX",
|
|
155
155
|
}));
|
|
156
156
|
const spinner = ora("Creating customer...").start();
|
|
157
|
-
const customer = await client.customers.create(
|
|
157
|
+
const customer = await client.customers.create({
|
|
158
158
|
legalName,
|
|
159
159
|
taxId,
|
|
160
160
|
taxSystem,
|
|
@@ -170,7 +170,7 @@ export default class CustomersCreate extends Command {
|
|
|
170
170
|
addressZip,
|
|
171
171
|
addressState,
|
|
172
172
|
addressCountry,
|
|
173
|
-
});
|
|
173
|
+
}, flags.org);
|
|
174
174
|
spinner.succeed(chalk.green("✓ Customer created successfully!"));
|
|
175
175
|
this.log(chalk.gray("\nCustomer Details:"));
|
|
176
176
|
this.log(` ${chalk.bold("ID:")} ${customer.id}`);
|
|
@@ -41,7 +41,7 @@ export default class CustomersDelete extends Command {
|
|
|
41
41
|
}
|
|
42
42
|
const spinner = ora("Deleting customer...").start();
|
|
43
43
|
try {
|
|
44
|
-
await client.customers.delete(flags.
|
|
44
|
+
await client.customers.delete(flags.id, flags.org);
|
|
45
45
|
spinner.succeed(chalk.green("✓ Customer deleted successfully!"));
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -3,7 +3,7 @@ export default class InvoicesCreate extends Command {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
-
org: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
org: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
"api-key": import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/invoices/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/invoices/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAgB,WAAW,SAImD;IAE9E,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;;MAoBpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8ClC"}
|
|
@@ -7,16 +7,16 @@ import { getErrorMessage } from "../../utils/error.js";
|
|
|
7
7
|
export default class InvoicesCreate extends Command {
|
|
8
8
|
static description = "Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC. " +
|
|
9
9
|
"This command authenticates with --api-key instead of the `timbrix login` " +
|
|
10
|
-
"session
|
|
10
|
+
"session. --org is optional — omit it to resolve the organization from " +
|
|
11
|
+
"the API key itself, or pass it to match the key's organization explicitly.";
|
|
11
12
|
static examples = [
|
|
12
|
-
"<%= config.bin %> <%= command.id %> --
|
|
13
|
+
"<%= config.bin %> <%= command.id %> --api-key sk_live_... --file invoice.json",
|
|
13
14
|
"<%= config.bin %> <%= command.id %> --org org-id --api-key sk_live_... --file invoice.json --output invoice.xml",
|
|
14
15
|
];
|
|
15
16
|
static flags = {
|
|
16
17
|
org: Flags.string({
|
|
17
18
|
char: "o",
|
|
18
|
-
description: "Organization ID (must match the API key's organization)",
|
|
19
|
-
required: true,
|
|
19
|
+
description: "Organization ID (must match the API key's organization). Optional — if omitted, the organization is resolved from the API key itself.",
|
|
20
20
|
}),
|
|
21
21
|
"api-key": Flags.string({
|
|
22
22
|
description: "Timbrix API key (needs the write:invoices scope)",
|
|
@@ -44,7 +44,7 @@ export default class InvoicesCreate extends Command {
|
|
|
44
44
|
}
|
|
45
45
|
const spinner = ora("Stamping invoice...").start();
|
|
46
46
|
try {
|
|
47
|
-
const invoice = await client.invoices.create(flags.org
|
|
47
|
+
const invoice = await client.invoices.create(payload, flags.org);
|
|
48
48
|
spinner.succeed(chalk.green("✓ Invoice stamped successfully!"));
|
|
49
49
|
this.log(chalk.gray("\nInvoice Details:"));
|
|
50
50
|
this.log(` ${chalk.bold("ID:")} ${invoice.id}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/invoices/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,OAAgB,WAAW,SACmC;IAE9D,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;MAcpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/invoices/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,OAAgB,WAAW,SACmC;IAE9D,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;MAcpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+DlC"}
|
|
@@ -30,10 +30,10 @@ export default class InvoicesList extends Command {
|
|
|
30
30
|
const client = createClient();
|
|
31
31
|
const spinner = ora("Fetching invoices...").start();
|
|
32
32
|
try {
|
|
33
|
-
const result = await client.invoices.list(
|
|
33
|
+
const result = await client.invoices.list({
|
|
34
34
|
page: flags.page,
|
|
35
35
|
limit: flags.limit,
|
|
36
|
-
});
|
|
36
|
+
}, flags.org);
|
|
37
37
|
spinner.stop();
|
|
38
38
|
if (result.data.length === 0) {
|
|
39
39
|
this.log(chalk.yellow("No invoices found"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/products/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;;;;;;MAiCpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/products/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAO5C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,QAAQ,WAGvB;IAED,OAAgB,KAAK;;;;;;;;;MAiCpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2FlC"}
|
|
@@ -84,7 +84,7 @@ export default class ProductsCreate extends Command {
|
|
|
84
84
|
default: "Elemento",
|
|
85
85
|
}));
|
|
86
86
|
const spinner = ora("Creating product...").start();
|
|
87
|
-
const product = await client.products.create(
|
|
87
|
+
const product = await client.products.create({
|
|
88
88
|
description,
|
|
89
89
|
productKey: productKey,
|
|
90
90
|
price: parseFloat(priceRaw),
|
|
@@ -93,7 +93,7 @@ export default class ProductsCreate extends Command {
|
|
|
93
93
|
unitKey,
|
|
94
94
|
unitName,
|
|
95
95
|
taxes: [{ type: "IVA", rate: 0.16 }],
|
|
96
|
-
});
|
|
96
|
+
}, flags.org);
|
|
97
97
|
spinner.succeed(chalk.green("✓ Product created successfully!"));
|
|
98
98
|
this.log(chalk.gray("\nProduct Details:"));
|
|
99
99
|
this.log(` ${chalk.bold("ID:")} ${product.id}`);
|
|
@@ -41,7 +41,7 @@ export default class ProductsDelete extends Command {
|
|
|
41
41
|
}
|
|
42
42
|
const spinner = ora("Deleting product...").start();
|
|
43
43
|
try {
|
|
44
|
-
await client.products.delete(flags.
|
|
44
|
+
await client.products.delete(flags.id, flags.org);
|
|
45
45
|
spinner.succeed(chalk.green("✓ Product deleted successfully!"));
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
@@ -24,7 +24,7 @@ export default class ProductsGet extends Command {
|
|
|
24
24
|
const client = createClient();
|
|
25
25
|
const spinner = ora("Fetching product...").start();
|
|
26
26
|
try {
|
|
27
|
-
const product = await client.products.get(flags.
|
|
27
|
+
const product = await client.products.get(flags.id, flags.org);
|
|
28
28
|
spinner.stop();
|
|
29
29
|
this.log(chalk.bold("\nProduct Details:"));
|
|
30
30
|
this.log(` ${chalk.bold("ID:")} ${product.id}`);
|
|
@@ -37,7 +37,7 @@ export default class ProductsImport extends Command {
|
|
|
37
37
|
const buffer = readFileSync(flags.file);
|
|
38
38
|
const filename = basename(flags.file);
|
|
39
39
|
const blob = new Blob([buffer], { type: "text/csv" });
|
|
40
|
-
const result = await client.products.importCsv(
|
|
40
|
+
const result = await client.products.importCsv(blob, filename, flags.org);
|
|
41
41
|
spinner.succeed(chalk.green("✓ Import finished"));
|
|
42
42
|
this.log(chalk.gray("\nImport Summary:"));
|
|
43
43
|
this.log(` ${chalk.bold("Total rows:")} ${result.totalRows}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/products/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,OAAgB,WAAW,SAAmD;IAE9E,OAAgB,QAAQ,WAIvB;IAED,OAAgB,KAAK;;;;;MAkBpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/products/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,OAAgB,WAAW,SAAmD;IAE9E,OAAgB,QAAQ,WAIvB;IAED,OAAgB,KAAK;;;;;MAkBpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsDlC"}
|
|
@@ -35,11 +35,11 @@ export default class ProductsList extends Command {
|
|
|
35
35
|
const client = createClient();
|
|
36
36
|
const spinner = ora("Fetching products...").start();
|
|
37
37
|
try {
|
|
38
|
-
const products = await client.products.list(
|
|
38
|
+
const products = await client.products.list({
|
|
39
39
|
description: flags.description,
|
|
40
40
|
sku: flags.sku,
|
|
41
41
|
productKey: flags["product-key"],
|
|
42
|
-
});
|
|
42
|
+
}, flags.org);
|
|
43
43
|
spinner.stop();
|
|
44
44
|
if (products.length === 0) {
|
|
45
45
|
this.log(chalk.yellow("No products found"));
|
|
@@ -69,7 +69,7 @@ export default class ProductsUpdate extends Command {
|
|
|
69
69
|
}
|
|
70
70
|
const spinner = ora("Updating product...").start();
|
|
71
71
|
try {
|
|
72
|
-
const product = await client.products.update(flags.
|
|
72
|
+
const product = await client.products.update(flags.id, updates, flags.org);
|
|
73
73
|
spinner.succeed(chalk.green("✓ Product updated successfully!"));
|
|
74
74
|
this.log(chalk.gray("\nUpdated Product:"));
|
|
75
75
|
this.log(` ${chalk.bold("ID:")} ${product.id}`);
|
package/oclif.manifest.json
CHANGED
|
@@ -492,17 +492,16 @@
|
|
|
492
492
|
"invoices:create": {
|
|
493
493
|
"aliases": [],
|
|
494
494
|
"args": {},
|
|
495
|
-
"description": "Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC. This command authenticates with --api-key instead of the `timbrix login` session — the key
|
|
495
|
+
"description": "Create and stamp (timbrar) a CFDI 4.0 invoice via the configured PAC. This command authenticates with --api-key instead of the `timbrix login` session. --org is optional — omit it to resolve the organization from the API key itself, or pass it to match the key's organization explicitly.",
|
|
496
496
|
"examples": [
|
|
497
|
-
"<%= config.bin %> <%= command.id %> --
|
|
497
|
+
"<%= config.bin %> <%= command.id %> --api-key sk_live_... --file invoice.json",
|
|
498
498
|
"<%= config.bin %> <%= command.id %> --org org-id --api-key sk_live_... --file invoice.json --output invoice.xml"
|
|
499
499
|
],
|
|
500
500
|
"flags": {
|
|
501
501
|
"org": {
|
|
502
502
|
"char": "o",
|
|
503
|
-
"description": "Organization ID (must match the API key's organization)",
|
|
503
|
+
"description": "Organization ID (must match the API key's organization). Optional — if omitted, the organization is resolved from the API key itself.",
|
|
504
504
|
"name": "org",
|
|
505
|
-
"required": true,
|
|
506
505
|
"hasDynamicHelp": false,
|
|
507
506
|
"multiple": false,
|
|
508
507
|
"type": "option"
|
|
@@ -1691,5 +1690,5 @@
|
|
|
1691
1690
|
]
|
|
1692
1691
|
}
|
|
1693
1692
|
},
|
|
1694
|
-
"version": "1.
|
|
1693
|
+
"version": "1.4.0"
|
|
1695
1694
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timbrix/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "CLI tool for Timbrix API",
|
|
5
5
|
"author": "Ivan Sotelo",
|
|
6
6
|
"bin": {
|
|
@@ -26,28 +26,28 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org/"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inquirer/prompts": "^8.
|
|
30
|
-
"@oclif/core": "^4.
|
|
29
|
+
"@inquirer/prompts": "^8.6.0",
|
|
30
|
+
"@oclif/core": "^4.14.0",
|
|
31
31
|
"@oclif/plugin-help": "^6.2.58",
|
|
32
|
-
"@oclif/plugin-plugins": "^5.
|
|
32
|
+
"@oclif/plugin-plugins": "^5.5.1",
|
|
33
33
|
"chalk": "^6.0.0",
|
|
34
34
|
"cli-table3": "^0.6.5",
|
|
35
35
|
"conf": "^15.1.0",
|
|
36
36
|
"ky": "^2.0.2",
|
|
37
37
|
"ora": "^9.4.1",
|
|
38
38
|
"update-notifier": "^7.3.1",
|
|
39
|
-
"@timbrix/sdk": "
|
|
39
|
+
"@timbrix/sdk": "2.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^26.2.0",
|
|
43
43
|
"@types/update-notifier": "^6.0.8",
|
|
44
|
-
"eslint": "^10.
|
|
44
|
+
"eslint": "^10.9.0",
|
|
45
45
|
"oclif": "^4.23.30",
|
|
46
46
|
"shx": "^0.4.0",
|
|
47
47
|
"tsx": "^4.23.12",
|
|
48
48
|
"typescript": "^6.0.3",
|
|
49
|
-
"@repo/
|
|
50
|
-
"@repo/
|
|
49
|
+
"@repo/eslint-config": "0.1.1",
|
|
50
|
+
"@repo/typescript-config": "0.1.0"
|
|
51
51
|
},
|
|
52
52
|
"oclif": {
|
|
53
53
|
"bin": "timbrix",
|