@spaceinvoices/js-sdk 13.9.0 → 13.10.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.
@@ -782,8 +782,12 @@ export type updateExpenseResponse = (updateExpenseResponseSuccess | updateExpens
782
782
  export declare const getUpdateExpenseUrl: (id: string) => string;
783
783
  export declare const updateExpense: (id: string, updateExpenseBody: UpdateExpenseBody, options?: RequestInit) => Promise<updateExpenseResponse>;
784
784
  /**
785
- * Only draft expenses can be deleted; posted expenses must be voided instead. The request fails with 409 while automatic recognition of the draft's document is queued or processing.
786
- * @summary Delete draft expense
785
+ * Deletes an expense together with all of its attachments, including the source file of an OCR recognition. Draft expenses can always be deleted. Posted expenses (including voided ones) can be deleted only when they were entered manually (`creation_source=standard`) or created by OCR (`creation_source=ocr`) and did not come from a received e-invoice; expenses created through `/expenses/custom`, legacy-migrated expenses and expenses from received e-invoices can only be voided (422).
786
+
787
+ An expense with payments cannot be deleted (422): delete the payments first, or void the expense. While automatic recognition of the expense's document is still queued or processing, or has finished but its usage is not yet recorded, the request fails with 409 (try again shortly).
788
+
789
+ Deleting does not change usage: the expense still counts toward the document count of the billing period it was created in, and OCR pages that were scanned stay counted (their usage is kept in the metered usage ledger). Submitting the same document again creates a new expense and a new recognition that is counted again. Stock movements and accounting-recognition entries of the expense are removed.
790
+ * @summary Delete expense
787
791
  */
788
792
  export type deleteExpenseResponse204 = {
789
793
  data: void;
@@ -809,6 +813,10 @@ export type deleteExpenseResponse409 = {
809
813
  data: IdempotencyError;
810
814
  status: 409;
811
815
  };
816
+ export type deleteExpenseResponse422 = {
817
+ data: Error;
818
+ status: 422;
819
+ };
812
820
  export type deleteExpenseResponse500 = {
813
821
  data: Error;
814
822
  status: 500;
@@ -820,7 +828,7 @@ export type deleteExpenseResponse503 = {
820
828
  export type deleteExpenseResponseSuccess = (deleteExpenseResponse204) & {
821
829
  headers: Headers;
822
830
  };
823
- export type deleteExpenseResponseError = (deleteExpenseResponse400 | deleteExpenseResponse401 | deleteExpenseResponse403 | deleteExpenseResponse404 | deleteExpenseResponse409 | deleteExpenseResponse500 | deleteExpenseResponse503) & {
831
+ export type deleteExpenseResponseError = (deleteExpenseResponse400 | deleteExpenseResponse401 | deleteExpenseResponse403 | deleteExpenseResponse404 | deleteExpenseResponse409 | deleteExpenseResponse422 | deleteExpenseResponse500 | deleteExpenseResponse503) & {
824
832
  headers: Headers;
825
833
  };
826
834
  export type deleteExpenseResponse = (deleteExpenseResponseSuccess | deleteExpenseResponseError);
@@ -782,8 +782,12 @@ export type updateExpenseResponse = (updateExpenseResponseSuccess | updateExpens
782
782
  export declare const getUpdateExpenseUrl: (id: string) => string;
783
783
  export declare const updateExpense: (id: string, updateExpenseBody: UpdateExpenseBody, options?: RequestInit) => Promise<updateExpenseResponse>;
784
784
  /**
785
- * Only draft expenses can be deleted; posted expenses must be voided instead. The request fails with 409 while automatic recognition of the draft's document is queued or processing.
786
- * @summary Delete draft expense
785
+ * Deletes an expense together with all of its attachments, including the source file of an OCR recognition. Draft expenses can always be deleted. Posted expenses (including voided ones) can be deleted only when they were entered manually (`creation_source=standard`) or created by OCR (`creation_source=ocr`) and did not come from a received e-invoice; expenses created through `/expenses/custom`, legacy-migrated expenses and expenses from received e-invoices can only be voided (422).
786
+
787
+ An expense with payments cannot be deleted (422): delete the payments first, or void the expense. While automatic recognition of the expense's document is still queued or processing, or has finished but its usage is not yet recorded, the request fails with 409 (try again shortly).
788
+
789
+ Deleting does not change usage: the expense still counts toward the document count of the billing period it was created in, and OCR pages that were scanned stay counted (their usage is kept in the metered usage ledger). Submitting the same document again creates a new expense and a new recognition that is counted again. Stock movements and accounting-recognition entries of the expense are removed.
790
+ * @summary Delete expense
787
791
  */
788
792
  export type deleteExpenseResponse204 = {
789
793
  data: void;
@@ -809,6 +813,10 @@ export type deleteExpenseResponse409 = {
809
813
  data: IdempotencyError;
810
814
  status: 409;
811
815
  };
816
+ export type deleteExpenseResponse422 = {
817
+ data: Error;
818
+ status: 422;
819
+ };
812
820
  export type deleteExpenseResponse500 = {
813
821
  data: Error;
814
822
  status: 500;
@@ -820,7 +828,7 @@ export type deleteExpenseResponse503 = {
820
828
  export type deleteExpenseResponseSuccess = (deleteExpenseResponse204) & {
821
829
  headers: Headers;
822
830
  };
823
- export type deleteExpenseResponseError = (deleteExpenseResponse400 | deleteExpenseResponse401 | deleteExpenseResponse403 | deleteExpenseResponse404 | deleteExpenseResponse409 | deleteExpenseResponse500 | deleteExpenseResponse503) & {
831
+ export type deleteExpenseResponseError = (deleteExpenseResponse400 | deleteExpenseResponse401 | deleteExpenseResponse403 | deleteExpenseResponse404 | deleteExpenseResponse409 | deleteExpenseResponse422 | deleteExpenseResponse500 | deleteExpenseResponse503) & {
824
832
  headers: Headers;
825
833
  };
826
834
  export type deleteExpenseResponse = (deleteExpenseResponseSuccess | deleteExpenseResponseError);
@@ -2293,8 +2293,12 @@ export declare const UpdateExpenseResponse: zod.ZodObject<{
2293
2293
  has_attachment: zod.ZodBoolean;
2294
2294
  }, zod.z.core.$strip>;
2295
2295
  /**
2296
- * Only draft expenses can be deleted; posted expenses must be voided instead. The request fails with 409 while automatic recognition of the draft's document is queued or processing.
2297
- * @summary Delete draft expense
2296
+ * Deletes an expense together with all of its attachments, including the source file of an OCR recognition. Draft expenses can always be deleted. Posted expenses (including voided ones) can be deleted only when they were entered manually (`creation_source=standard`) or created by OCR (`creation_source=ocr`) and did not come from a received e-invoice; expenses created through `/expenses/custom`, legacy-migrated expenses and expenses from received e-invoices can only be voided (422).
2297
+
2298
+ An expense with payments cannot be deleted (422): delete the payments first, or void the expense. While automatic recognition of the expense's document is still queued or processing, or has finished but its usage is not yet recorded, the request fails with 409 (try again shortly).
2299
+
2300
+ Deleting does not change usage: the expense still counts toward the document count of the billing period it was created in, and OCR pages that were scanned stay counted (their usage is kept in the metered usage ledger). Submitting the same document again creates a new expense and a new recognition that is counted again. Stock movements and accounting-recognition entries of the expense are removed.
2301
+ * @summary Delete expense
2298
2302
  */
2299
2303
  export declare const deleteExpensePathIdRegExp: RegExp;
2300
2304
  export declare const DeleteExpenseParams: zod.ZodObject<{
@@ -2293,8 +2293,12 @@ export declare const UpdateExpenseResponse: zod.ZodObject<{
2293
2293
  has_attachment: zod.ZodBoolean;
2294
2294
  }, zod.z.core.$strip>;
2295
2295
  /**
2296
- * Only draft expenses can be deleted; posted expenses must be voided instead. The request fails with 409 while automatic recognition of the draft's document is queued or processing.
2297
- * @summary Delete draft expense
2296
+ * Deletes an expense together with all of its attachments, including the source file of an OCR recognition. Draft expenses can always be deleted. Posted expenses (including voided ones) can be deleted only when they were entered manually (`creation_source=standard`) or created by OCR (`creation_source=ocr`) and did not come from a received e-invoice; expenses created through `/expenses/custom`, legacy-migrated expenses and expenses from received e-invoices can only be voided (422).
2297
+
2298
+ An expense with payments cannot be deleted (422): delete the payments first, or void the expense. While automatic recognition of the expense's document is still queued or processing, or has finished but its usage is not yet recorded, the request fails with 409 (try again shortly).
2299
+
2300
+ Deleting does not change usage: the expense still counts toward the document count of the billing period it was created in, and OCR pages that were scanned stay counted (their usage is kept in the metered usage ledger). Submitting the same document again creates a new expense and a new recognition that is counted again. Stock movements and accounting-recognition entries of the expense are removed.
2301
+ * @summary Delete expense
2298
2302
  */
2299
2303
  export declare const deleteExpensePathIdRegExp: RegExp;
2300
2304
  export declare const DeleteExpenseParams: zod.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaceinvoices/js-sdk",
3
- "version": "13.9.0",
3
+ "version": "13.10.0",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Space Invoices API",
5
5
  "author": "Space Invoices <support@spaceinvoices.com>",
6
6
  "license": "MIT",