@pimia/sdk 0.5.0 → 0.6.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/client.d.ts CHANGED
@@ -146,6 +146,11 @@ export declare class PimiaClient {
146
146
  meta: {
147
147
  invoice_total_count: number;
148
148
  };
149
+ } | {
150
+ data: components["schemas"]["InvoiceSummaryResource"][];
151
+ meta: {
152
+ invoice_total_count: number;
153
+ };
149
154
  }>;
150
155
  get: (id: number | string, options?: ReadOptions) => Promise<{
151
156
  data: components["schemas"]["InvoiceResource"] & Record<string, never>;
@@ -155,175 +160,177 @@ export declare class PimiaClient {
155
160
  * `200` de `invoices.store` está vacío ahí (ver {@link ResourceEnvelope}).
156
161
  */
157
162
  create: (body: InvoicesRequest, options?: WriteOptions) => Promise<ResourceEnvelope<{
158
- id: string;
163
+ id: number;
159
164
  invoice_date: string;
160
- due_date: string;
161
- invoice_number: string;
165
+ due_date: string | null;
166
+ invoice_number: string | null;
162
167
  reference_number: string;
163
168
  status: string;
164
169
  paid_status: string;
165
170
  tax_per_item: string;
166
171
  tax_included: string;
167
172
  discount_per_item: string;
168
- notes: string;
169
- discount_type: string;
170
- discount: string;
171
- discount_val: string;
172
- sub_total: string;
173
- total: string;
173
+ notes: string | null;
174
+ discount_type: string | null;
175
+ discount: number;
176
+ discount_val: number;
177
+ sub_total: number;
178
+ total: number;
174
179
  effective_total: string;
175
- tax: string;
180
+ tax: number;
176
181
  due_amount: string;
177
182
  effective_due_amount: string;
178
183
  sent: string;
179
184
  viewed: string;
180
- unique_hash: string;
181
- template_name: string;
185
+ sent_at: string;
186
+ viewed_at: string;
187
+ unique_hash: string | null;
188
+ template_name: string | null;
182
189
  invoice_series_id: string;
183
- customer_id: string;
190
+ customer_id: number | null;
184
191
  external_ref: string | null;
185
192
  payment_method_id: string;
186
193
  recurring_invoice_id: string;
187
- sequence_number: string;
188
- exchange_rate: string;
189
- base_discount_val: string;
190
- base_sub_total: string;
191
- base_total: string;
192
- creator_id: string;
193
- base_tax: string;
194
- base_due_amount: string;
194
+ sequence_number: number | null;
195
+ exchange_rate: number | null;
196
+ base_discount_val: string | null;
197
+ base_sub_total: string | null;
198
+ base_total: string | null;
199
+ creator_id: number | null;
200
+ base_tax: string | null;
201
+ base_due_amount: string | null;
195
202
  effective_base_total: string;
196
203
  effective_base_due_amount: string;
197
204
  credited_total: string;
198
205
  credited_base_total: string;
199
- currency_id: string;
206
+ currency_id: number | null;
200
207
  formatted_created_at: string;
201
208
  invoice_pdf_url: string;
202
209
  formatted_invoice_date: string;
203
210
  formatted_due_date: string;
204
211
  allow_edit: string;
205
212
  payment_module_enabled: string;
206
- sales_tax_type: string;
207
- sales_tax_address_type: string;
208
213
  overdue: string;
209
214
  effective_paid_status: string;
210
215
  effective_overdue: string;
211
216
  aeat_status: string;
212
- qr_data: string;
213
- hash: string;
214
- aeat_csv: string;
215
- is_credit_note: string | boolean;
216
- rectified_invoice_id: string;
217
+ qr_data: string | null;
218
+ hash: string | null;
219
+ aeat_csv: string | null;
220
+ is_credit_note: boolean;
221
+ rectified_invoice_id: number | null;
217
222
  rectified_invoice_number?: string | null;
218
223
  rectified_invoice?: {
219
- id: string;
220
- invoice_number: string;
224
+ id: number;
225
+ invoice_number: string | null;
221
226
  tax_per_item: string;
222
227
  tax_included: string;
223
- sub_total: string;
224
- discount_val: string;
225
- tax: string;
226
- total: string;
228
+ sub_total: number;
229
+ discount_val: number;
230
+ tax: number;
231
+ total: number;
227
232
  items: components["schemas"]["InvoiceItemResource"][];
228
233
  taxes: components["schemas"]["TaxResource"][];
229
234
  };
230
- credit_notes_count: number;
235
+ credit_notes_count: string | number;
231
236
  items?: components["schemas"]["InvoiceItemResource"][];
232
237
  payments?: components["schemas"]["PaymentResource"][];
233
- customer?: components["schemas"]["CustomerResource"];
238
+ email_logs?: components["schemas"]["EmailLogResource"][];
239
+ customer?: components["schemas"]["CustomerResource"] | null;
234
240
  invoice_series?: components["schemas"]["InvoiceSeriesResource"];
235
241
  payment_method?: components["schemas"]["PaymentMethodResource"];
236
- creator?: components["schemas"]["UserResource"];
242
+ creator?: components["schemas"]["UserResource"] | null;
237
243
  taxes: components["schemas"]["TaxResource"][];
238
244
  fields?: components["schemas"]["CustomFieldValueResource"][];
239
- company?: components["schemas"]["CompanyResource"];
240
- currency?: components["schemas"]["CurrencyResource"];
245
+ company?: components["schemas"]["CompanyResource"] | null;
246
+ currency?: components["schemas"]["CurrencyResource"] | null;
241
247
  }>>;
242
248
  /** Mismo caso que `create`: el `200` de `invoices.update` no está tipado en el spec. */
243
249
  update: (id: number | string, body: InvoicesRequest, options?: WriteOptions) => Promise<ResourceEnvelope<{
244
- id: string;
250
+ id: number;
245
251
  invoice_date: string;
246
- due_date: string;
247
- invoice_number: string;
252
+ due_date: string | null;
253
+ invoice_number: string | null;
248
254
  reference_number: string;
249
255
  status: string;
250
256
  paid_status: string;
251
257
  tax_per_item: string;
252
258
  tax_included: string;
253
259
  discount_per_item: string;
254
- notes: string;
255
- discount_type: string;
256
- discount: string;
257
- discount_val: string;
258
- sub_total: string;
259
- total: string;
260
+ notes: string | null;
261
+ discount_type: string | null;
262
+ discount: number;
263
+ discount_val: number;
264
+ sub_total: number;
265
+ total: number;
260
266
  effective_total: string;
261
- tax: string;
267
+ tax: number;
262
268
  due_amount: string;
263
269
  effective_due_amount: string;
264
270
  sent: string;
265
271
  viewed: string;
266
- unique_hash: string;
267
- template_name: string;
272
+ sent_at: string;
273
+ viewed_at: string;
274
+ unique_hash: string | null;
275
+ template_name: string | null;
268
276
  invoice_series_id: string;
269
- customer_id: string;
277
+ customer_id: number | null;
270
278
  external_ref: string | null;
271
279
  payment_method_id: string;
272
280
  recurring_invoice_id: string;
273
- sequence_number: string;
274
- exchange_rate: string;
275
- base_discount_val: string;
276
- base_sub_total: string;
277
- base_total: string;
278
- creator_id: string;
279
- base_tax: string;
280
- base_due_amount: string;
281
+ sequence_number: number | null;
282
+ exchange_rate: number | null;
283
+ base_discount_val: string | null;
284
+ base_sub_total: string | null;
285
+ base_total: string | null;
286
+ creator_id: number | null;
287
+ base_tax: string | null;
288
+ base_due_amount: string | null;
281
289
  effective_base_total: string;
282
290
  effective_base_due_amount: string;
283
291
  credited_total: string;
284
292
  credited_base_total: string;
285
- currency_id: string;
293
+ currency_id: number | null;
286
294
  formatted_created_at: string;
287
295
  invoice_pdf_url: string;
288
296
  formatted_invoice_date: string;
289
297
  formatted_due_date: string;
290
298
  allow_edit: string;
291
299
  payment_module_enabled: string;
292
- sales_tax_type: string;
293
- sales_tax_address_type: string;
294
300
  overdue: string;
295
301
  effective_paid_status: string;
296
302
  effective_overdue: string;
297
303
  aeat_status: string;
298
- qr_data: string;
299
- hash: string;
300
- aeat_csv: string;
301
- is_credit_note: string | boolean;
302
- rectified_invoice_id: string;
304
+ qr_data: string | null;
305
+ hash: string | null;
306
+ aeat_csv: string | null;
307
+ is_credit_note: boolean;
308
+ rectified_invoice_id: number | null;
303
309
  rectified_invoice_number?: string | null;
304
310
  rectified_invoice?: {
305
- id: string;
306
- invoice_number: string;
311
+ id: number;
312
+ invoice_number: string | null;
307
313
  tax_per_item: string;
308
314
  tax_included: string;
309
- sub_total: string;
310
- discount_val: string;
311
- tax: string;
312
- total: string;
315
+ sub_total: number;
316
+ discount_val: number;
317
+ tax: number;
318
+ total: number;
313
319
  items: components["schemas"]["InvoiceItemResource"][];
314
320
  taxes: components["schemas"]["TaxResource"][];
315
321
  };
316
- credit_notes_count: number;
322
+ credit_notes_count: string | number;
317
323
  items?: components["schemas"]["InvoiceItemResource"][];
318
324
  payments?: components["schemas"]["PaymentResource"][];
319
- customer?: components["schemas"]["CustomerResource"];
325
+ email_logs?: components["schemas"]["EmailLogResource"][];
326
+ customer?: components["schemas"]["CustomerResource"] | null;
320
327
  invoice_series?: components["schemas"]["InvoiceSeriesResource"];
321
328
  payment_method?: components["schemas"]["PaymentMethodResource"];
322
- creator?: components["schemas"]["UserResource"];
329
+ creator?: components["schemas"]["UserResource"] | null;
323
330
  taxes: components["schemas"]["TaxResource"][];
324
331
  fields?: components["schemas"]["CustomFieldValueResource"][];
325
- company?: components["schemas"]["CompanyResource"];
326
- currency?: components["schemas"]["CurrencyResource"];
332
+ company?: components["schemas"]["CompanyResource"] | null;
333
+ currency?: components["schemas"]["CurrencyResource"] | null;
327
334
  }>>;
328
335
  };
329
336
  get customers(): {
@@ -332,6 +339,11 @@ export declare class PimiaClient {
332
339
  meta: {
333
340
  customer_total_count: number;
334
341
  };
342
+ } | {
343
+ data: components["schemas"]["CustomerSummaryResource"][];
344
+ meta: {
345
+ customer_total_count: number;
346
+ };
335
347
  }>;
336
348
  get: (id: number | string, options?: ReadOptions) => Promise<{
337
349
  data: components["schemas"]["CustomerResource"];
@@ -341,40 +353,36 @@ export declare class PimiaClient {
341
353
  }>;
342
354
  /** El `200` de `customers.update` no está tipado en el spec. */
343
355
  update: (id: number | string, body: CustomerRequest, options?: WriteOptions) => Promise<ResourceEnvelope<{
344
- id: string;
356
+ id: number;
345
357
  name: string;
346
- email: string;
347
- phone: string;
348
- contact_name: string;
349
- company_name: string;
350
- website: string;
351
- enable_portal: string;
358
+ email: string | null;
359
+ phone: string | null;
360
+ contact_name: string | null;
361
+ website: string | null;
362
+ enable_portal: boolean;
352
363
  password_added: boolean;
353
- currency_id: string;
364
+ currency_id: number | null;
354
365
  payment_method_id: string;
355
- company_id: string;
356
- facebook_id: string;
357
- google_id: string;
358
- github_id: string;
359
- created_at: string;
366
+ company_id: number | null;
367
+ created_at: string | null;
360
368
  formatted_created_at: string;
361
- updated_at: string;
369
+ updated_at: string | null;
362
370
  avatar: string;
363
371
  due_amount: string;
364
372
  base_due_amount: string;
365
- prefix: string;
373
+ prefix: string | null;
366
374
  tax_id: string;
367
375
  notes: string;
368
376
  external_ref: string | null;
369
- iban: string;
370
- bic: string;
371
- sepa_mandate_id: string;
372
- sepa_mandate_date: string;
373
- billing?: components["schemas"]["AddressResource"];
374
- shipping?: components["schemas"]["AddressResource"];
377
+ iban: string | null;
378
+ bic: string | null;
379
+ sepa_mandate_id: string | null;
380
+ sepa_mandate_date: string | null;
381
+ billing?: components["schemas"]["AddressResource"] | null;
382
+ shipping?: components["schemas"]["AddressResource"] | null;
375
383
  fields?: components["schemas"]["CustomFieldValueResource"][];
376
- company?: components["schemas"]["CompanyResource"];
377
- currency?: components["schemas"]["CurrencyResource"];
384
+ company?: components["schemas"]["CompanyResource"] | null;
385
+ currency?: components["schemas"]["CurrencyResource"] | null;
378
386
  payment_method?: components["schemas"]["PaymentMethodResource"];
379
387
  }>>;
380
388
  };
@@ -384,9 +392,14 @@ export declare class PimiaClient {
384
392
  meta: {
385
393
  estimate_total_count: number;
386
394
  };
395
+ } | {
396
+ data: components["schemas"]["EstimateSummaryResource"][];
397
+ meta: {
398
+ estimate_total_count: number;
399
+ };
387
400
  }>;
388
401
  get: (id: number | string, options?: ReadOptions) => Promise<{
389
- data: components["schemas"]["EstimateResource"];
402
+ data: components["schemas"]["EstimateResource"] & Record<string, never>;
390
403
  }>;
391
404
  create: (body: EstimatesRequest, options?: WriteOptions) => Promise<{
392
405
  data: components["schemas"]["EstimateResource"];
@@ -427,89 +440,90 @@ export declare class PimiaClient {
427
440
  convertToInvoice: (id: number | string, options?: WriteOptions & {
428
441
  externalRef?: string | null;
429
442
  }) => Promise<ResourceEnvelope<{
430
- id: string;
443
+ id: number;
431
444
  invoice_date: string;
432
- due_date: string;
433
- invoice_number: string;
445
+ due_date: string | null;
446
+ invoice_number: string | null;
434
447
  reference_number: string;
435
448
  status: string;
436
449
  paid_status: string;
437
450
  tax_per_item: string;
438
451
  tax_included: string;
439
452
  discount_per_item: string;
440
- notes: string;
441
- discount_type: string;
442
- discount: string;
443
- discount_val: string;
444
- sub_total: string;
445
- total: string;
453
+ notes: string | null;
454
+ discount_type: string | null;
455
+ discount: number;
456
+ discount_val: number;
457
+ sub_total: number;
458
+ total: number;
446
459
  effective_total: string;
447
- tax: string;
460
+ tax: number;
448
461
  due_amount: string;
449
462
  effective_due_amount: string;
450
463
  sent: string;
451
464
  viewed: string;
452
- unique_hash: string;
453
- template_name: string;
465
+ sent_at: string;
466
+ viewed_at: string;
467
+ unique_hash: string | null;
468
+ template_name: string | null;
454
469
  invoice_series_id: string;
455
- customer_id: string;
470
+ customer_id: number | null;
456
471
  external_ref: string | null;
457
472
  payment_method_id: string;
458
473
  recurring_invoice_id: string;
459
- sequence_number: string;
460
- exchange_rate: string;
461
- base_discount_val: string;
462
- base_sub_total: string;
463
- base_total: string;
464
- creator_id: string;
465
- base_tax: string;
466
- base_due_amount: string;
474
+ sequence_number: number | null;
475
+ exchange_rate: number | null;
476
+ base_discount_val: string | null;
477
+ base_sub_total: string | null;
478
+ base_total: string | null;
479
+ creator_id: number | null;
480
+ base_tax: string | null;
481
+ base_due_amount: string | null;
467
482
  effective_base_total: string;
468
483
  effective_base_due_amount: string;
469
484
  credited_total: string;
470
485
  credited_base_total: string;
471
- currency_id: string;
486
+ currency_id: number | null;
472
487
  formatted_created_at: string;
473
488
  invoice_pdf_url: string;
474
489
  formatted_invoice_date: string;
475
490
  formatted_due_date: string;
476
491
  allow_edit: string;
477
492
  payment_module_enabled: string;
478
- sales_tax_type: string;
479
- sales_tax_address_type: string;
480
493
  overdue: string;
481
494
  effective_paid_status: string;
482
495
  effective_overdue: string;
483
496
  aeat_status: string;
484
- qr_data: string;
485
- hash: string;
486
- aeat_csv: string;
487
- is_credit_note: string | boolean;
488
- rectified_invoice_id: string;
497
+ qr_data: string | null;
498
+ hash: string | null;
499
+ aeat_csv: string | null;
500
+ is_credit_note: boolean;
501
+ rectified_invoice_id: number | null;
489
502
  rectified_invoice_number?: string | null;
490
503
  rectified_invoice?: {
491
- id: string;
492
- invoice_number: string;
504
+ id: number;
505
+ invoice_number: string | null;
493
506
  tax_per_item: string;
494
507
  tax_included: string;
495
- sub_total: string;
496
- discount_val: string;
497
- tax: string;
498
- total: string;
508
+ sub_total: number;
509
+ discount_val: number;
510
+ tax: number;
511
+ total: number;
499
512
  items: components["schemas"]["InvoiceItemResource"][];
500
513
  taxes: components["schemas"]["TaxResource"][];
501
514
  };
502
- credit_notes_count: number;
515
+ credit_notes_count: string | number;
503
516
  items?: components["schemas"]["InvoiceItemResource"][];
504
517
  payments?: components["schemas"]["PaymentResource"][];
505
- customer?: components["schemas"]["CustomerResource"];
518
+ email_logs?: components["schemas"]["EmailLogResource"][];
519
+ customer?: components["schemas"]["CustomerResource"] | null;
506
520
  invoice_series?: components["schemas"]["InvoiceSeriesResource"];
507
521
  payment_method?: components["schemas"]["PaymentMethodResource"];
508
- creator?: components["schemas"]["UserResource"];
522
+ creator?: components["schemas"]["UserResource"] | null;
509
523
  taxes: components["schemas"]["TaxResource"][];
510
524
  fields?: components["schemas"]["CustomFieldValueResource"][];
511
- company?: components["schemas"]["CompanyResource"];
512
- currency?: components["schemas"]["CurrencyResource"];
525
+ company?: components["schemas"]["CompanyResource"] | null;
526
+ currency?: components["schemas"]["CurrencyResource"] | null;
513
527
  }>>;
514
528
  };
515
529
  get<T = unknown>(path: string, query?: RequestOptions['query'], options?: ReadOptions): Promise<T>;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,16 @@ export declare const SCOPES: {
35
35
  readonly agendaRead: "agenda:read";
36
36
  readonly agendaWrite: "agenda:write";
37
37
  readonly reportsRead: "reports:read";
38
+ /** Leer la configuración de la empresa (impuestos, preferencias, series). */
39
+ readonly settingsRead: "settings:read";
40
+ /** Ver la tienda de módulos y qué tiene contratado el tenant. */
41
+ readonly storeRead: "store:read";
42
+ /** Leer la gestión de personal: empleados, ausencias, fichajes, calendarios. */
43
+ readonly hrRead: "hr:read";
44
+ /** Gestionar el personal: altas, ausencias, correcciones de fichaje, horarios. */
45
+ readonly hrWrite: "hr:write";
46
+ /** Gestionar los avisos (webhooks) que recibe tu app. */
47
+ readonly webhooksWrite: "webhooks:write";
38
48
  /**
39
49
  * Proponer cambios que el dueño del tenant aprueba antes de aplicarse.
40
50
  * `approvalsSubmit` es un alias del mismo permiso, aceptado por el
package/dist/index.js CHANGED
@@ -31,6 +31,16 @@ export const SCOPES = {
31
31
  agendaRead: 'agenda:read',
32
32
  agendaWrite: 'agenda:write',
33
33
  reportsRead: 'reports:read',
34
+ /** Leer la configuración de la empresa (impuestos, preferencias, series). */
35
+ settingsRead: 'settings:read',
36
+ /** Ver la tienda de módulos y qué tiene contratado el tenant. */
37
+ storeRead: 'store:read',
38
+ /** Leer la gestión de personal: empleados, ausencias, fichajes, calendarios. */
39
+ hrRead: 'hr:read',
40
+ /** Gestionar el personal: altas, ausencias, correcciones de fichaje, horarios. */
41
+ hrWrite: 'hr:write',
42
+ /** Gestionar los avisos (webhooks) que recibe tu app. */
43
+ webhooksWrite: 'webhooks:write',
34
44
  /**
35
45
  * Proponer cambios que el dueño del tenant aprueba antes de aplicarse.
36
46
  * `approvalsSubmit` es un alias del mismo permiso, aceptado por el
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pimia/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Cliente TypeScript de la API de Pimia para apps de partner: OAuth con PKCE, rotación de refresh persistida, reintentos de rate limit y tipos generados del OpenAPI.",
5
5
  "license": "MIT",
6
6
  "author": "Pimia (https://pimia.es)",