@laserfiche/lf-repository-api-client-v2 1.5.0 → 1.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/index.d.ts CHANGED
@@ -1676,6 +1676,15 @@ export interface IEntriesClient {
1676
1676
  /**
1677
1677
  * - Starts an asynchronous export operation to export an entry.
1678
1678
  - If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.
1679
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
1680
+ than started and failed later. Text is extracted asynchronously after an import, so a
1681
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
1682
+ it reports true. A document with no pages at all is not rejected here.
1683
+ - The download link the completed task carries in result.uri is **single-use**. The first
1684
+ GET returns the file; any later GET of the same link answers 404, and that 404 carries no
1685
+ problem details because it comes from the download service rather than from this API.
1686
+ Save the content on the first download, and start a new export if a download has to be
1687
+ retried.
1679
1688
  - Required OAuth scope: repository.Read
1680
1689
  * @param args.repositoryId The requested repository ID.
1681
1690
  * @param args.entryId The ID of entry to export.
@@ -1779,7 +1788,7 @@ export interface IEntriesClient {
1779
1788
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
1780
1789
  * @param args.file (optional) Optional. The file to import. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it is stored as the electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file creates an empty document with no electronic document and no pages.
1781
1790
  * @param args.request (optional)
1782
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
1791
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
1783
1792
  * @returns Document was created successfully. Returns created entry.
1784
1793
  */
1785
1794
  importEntry(args: {
@@ -1794,12 +1803,20 @@ export interface IEntriesClient {
1794
1803
  /**
1795
1804
  * - Export an entry.
1796
1805
  - The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.
1806
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
1807
+ than started and failed later. Text is extracted asynchronously after an import, so a
1808
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
1809
+ it reports true. A document with no pages at all is not rejected here.
1810
+ - The returned download link is **single-use**. The first GET returns the file; any later
1811
+ GET of the same link answers 404, and that 404 carries no problem details because it
1812
+ comes from the download service rather than from this API. Save the content on the first
1813
+ download, and start a new export if a download has to be retried.
1797
1814
  - Required OAuth scope: repository.Read
1798
1815
  * @param args.repositoryId The requested repository ID.
1799
1816
  * @param args.entryId The ID of entry to export.
1800
1817
  * @param args.request The request body.
1801
1818
  * @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc or AlternateEdoc.
1802
- * @returns Export was successful. Returned a link to download the exported entry.
1819
+ * @returns Export was successful. Returned a single-use link to download the exported entry. A second download of the same link returns 404.
1803
1820
  */
1804
1821
  exportEntry(args: {
1805
1822
  repositoryId: string;
@@ -2038,7 +2055,7 @@ export interface IEntriesClient {
2038
2055
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
2039
2056
  * @param args.file (optional) Optional. The electronic document or image file to apply to the existing document. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it replaces the existing electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file is rejected with 400; use DELETE /Document/Edoc to remove the electronic document.
2040
2057
  * @param args.request (optional)
2041
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
2058
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
2042
2059
  * @returns Successfully updated the document. Returned the updated entry.
2043
2060
  */
2044
2061
  updateDocument(args: {
@@ -2103,14 +2120,14 @@ export interface IEntriesClient {
2103
2120
  - The number of pages created is max(imageFiles.Count, textPages.Count). If one array is shorter, pages beyond its length are created without that part.
2104
2121
  - If neither imageFiles nor textPages is provided, one empty page is created.
2105
2122
  - If pageNumber is omitted, pages are appended to the end. If provided, pages are inserted at that 1-based position; existing pages shift down.
2106
- - generateText triggers OCR when imageFiles are provided. When generateText is true and imageFiles are present, textPages is ignored because OCR-generated text would overwrite any provided text.
2123
+ - generateText requests text extraction from the document's electronic document part; it does not OCR the image pages being written. When generateText is true and imageFiles are present, textPages is ignored because generated text would overwrite any provided text.
2107
2124
  - Required OAuth scope: repository.Write
2108
2125
  * @param args.repositoryId The requested repository ID.
2109
2126
  * @param args.entryId The requested document ID.
2110
2127
  * @param args.pageNumber (optional) Optional 1-based page number. If omitted, pages are appended to the end. If provided, pages are inserted at that position.
2111
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) for image pages. Default is false.
2128
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are written. This does not OCR the image pages being written. Default is false.
2112
2129
  * @param args.request (optional)
2113
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
2130
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
2114
2131
  * @returns Successfully created pages in the specified document. Returned the updated entry.
2115
2132
  */
2116
2133
  createPages(args: {
@@ -2128,9 +2145,9 @@ export interface IEntriesClient {
2128
2145
  - Required OAuth scope: repository.Write
2129
2146
  * @param args.repositoryId The requested repository ID.
2130
2147
  * @param args.entryId The requested document ID.
2131
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after creating pages. Default is false.
2148
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are created. This does not OCR the image pages being written. Default is false.
2132
2149
  * @param args.request (optional)
2133
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
2150
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
2134
2151
  * @returns Successfully replaced all pages in the specified document. Returned the updated entry.
2135
2152
  */
2136
2153
  replacePages(args: {
@@ -2172,7 +2189,7 @@ export interface IEntriesClient {
2172
2189
  * @param args.repositoryId The requested repository ID.
2173
2190
  * @param args.entryId The requested document ID.
2174
2191
  * @param args.pageNumber The 1-based page number.
2175
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after writing. Default is false.
2192
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after writing. This does not OCR the page image being written. Default is false.
2176
2193
  * @param args.imageFile (optional) Optional. The image file to upload to replace the page's image content. See https://doc.laserfiche.com/ for supported image file formats. At least one of imageFile or request (with text) must be provided.
2177
2194
  * @param args.request (optional)
2178
2195
  * @returns Successfully wrote the image content of the specified page. Returned the updated entry.
@@ -2427,17 +2444,26 @@ export interface IEntriesClient {
2427
2444
  select?: string | null | undefined;
2428
2445
  }): Promise<PageWordLocationsResponse>;
2429
2446
  /**
2430
- * - Triggers server-side text generation for the specified document.
2431
- - For documents with image pages, this performs OCR to generate searchable text.
2432
- - For documents with an electronic document part (e.g., PDF), this extracts embedded text.
2447
+ * - Queues a request for the repository's text provider to extract text from the document's electronic document part (e.g., a PDF or Office file).
2448
+ - By default this does not OCR image pages. A document whose pages are images and that has no electronic document part is unchanged by a call with ocrImagePages left at false; text for those pages is otherwise produced by the repository's automatic OCR when a page image is written, not by this endpoint.
2449
+ - Set ocrImagePages to true to also queue an OCR job for the document's image pages. Only pages that have an image and no text are included: a page that already has text is left alone, because OCR replaces a page's text and would discard text that was written through the API or edited by a user. To re-OCR such a page, clear its text first with WritePage, then call this endpoint with ocrImagePages set to true.
2450
+ - When ocrImagePages is true, returns 423 if another user holds a lock on the document and 400 if another user has it checked out; OCR writes its results back under an exclusive lock, so a document that is held cannot be processed. Neither status occurs when ocrImagePages is false.
2451
+ - When ocrImagePages is true, at most 511 pages can be queued in one request. A document with more than 511 image pages that have no text returns 400; that is the number of pages the OCR pipeline accepts in a single job.
2452
+ - When ocrImagePages is true, the optional ocrLanguageOverride names the language for that OCR job, taking precedence over the document's own language and the repository's configured default; omit it and those apply in that order, falling back to en. It is not stored on the document, so it changes this request only. Supplying it with ocrImagePages false returns 400, and so does a language that is not a usable code -- including one inherited from the document or the repository, because a job queued with an unusable language is accepted and then produces no text with nothing reported back.
2453
+ - The repository's automatic OCR setting does not apply to this endpoint. That setting governs only the OCR the repository performs on its own when a page image is written; a request made here is explicit, and its OCR is queued whether that setting is on or off.
2454
+ - A success response means the request was queued for processing, not that text now exists. Extraction and OCR run asynchronously, and the returned entry reflects the document as of the response. Poll hasText on ListPageInfos to observe OCR results; a large document may stay queued for some time.
2433
2455
  - Required OAuth scope: repository.Write
2434
2456
  * @param args.repositoryId The requested repository ID.
2435
2457
  * @param args.entryId The requested document ID.
2436
- * @returns Successfully triggered text generation for the document. Returned the updated entry.
2458
+ * @param args.ocrImagePages (optional) Set to true to also queue OCR for the document's image pages that have no text. Defaults to false.
2459
+ * @param args.ocrLanguageOverride (optional) Optional. The language the OCR engine should use for this request, as an RFC 4646 code such as en. If omitted, the language is the document's own, then the repository's configured default, then en. Supplying it takes precedence over all three, for this request only: the document's stored language is unchanged, so the repository's automatic OCR keeps using it. A value that is not a usable language code is rejected with 400 rather than queued, whether supplied here or inherited. Only valid when ocrImagePages is true.
2460
+ * @returns Successfully queued the text generation request for the document. Returned the entry. Text is produced asynchronously, so it may not be present in this response.
2437
2461
  */
2438
2462
  generateText(args: {
2439
2463
  repositoryId: string;
2440
2464
  entryId: number;
2465
+ ocrImagePages?: boolean | undefined;
2466
+ ocrLanguageOverride?: string | null | undefined;
2441
2467
  }): Promise<Entry>;
2442
2468
  /**
2443
2469
  * - Returns dynamic field logic values with the current values of the fields in the template.
@@ -2806,6 +2832,15 @@ export declare class EntriesClient implements IEntriesClient {
2806
2832
  /**
2807
2833
  * - Starts an asynchronous export operation to export an entry.
2808
2834
  - If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.
2835
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
2836
+ than started and failed later. Text is extracted asynchronously after an import, so a
2837
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
2838
+ it reports true. A document with no pages at all is not rejected here.
2839
+ - The download link the completed task carries in result.uri is **single-use**. The first
2840
+ GET returns the file; any later GET of the same link answers 404, and that 404 carries no
2841
+ problem details because it comes from the download service rather than from this API.
2842
+ Save the content on the first download, and start a new export if a download has to be
2843
+ retried.
2809
2844
  - Required OAuth scope: repository.Read
2810
2845
  * @param args.repositoryId The requested repository ID.
2811
2846
  * @param args.entryId The ID of entry to export.
@@ -2914,7 +2949,7 @@ export declare class EntriesClient implements IEntriesClient {
2914
2949
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
2915
2950
  * @param args.file (optional) Optional. The file to import. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it is stored as the electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file creates an empty document with no electronic document and no pages.
2916
2951
  * @param args.request (optional)
2917
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
2952
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
2918
2953
  * @returns Document was created successfully. Returns created entry.
2919
2954
  */
2920
2955
  importEntry(args: {
@@ -2930,12 +2965,20 @@ export declare class EntriesClient implements IEntriesClient {
2930
2965
  /**
2931
2966
  * - Export an entry.
2932
2967
  - The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.
2968
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
2969
+ than started and failed later. Text is extracted asynchronously after an import, so a
2970
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
2971
+ it reports true. A document with no pages at all is not rejected here.
2972
+ - The returned download link is **single-use**. The first GET returns the file; any later
2973
+ GET of the same link answers 404, and that 404 carries no problem details because it
2974
+ comes from the download service rather than from this API. Save the content on the first
2975
+ download, and start a new export if a download has to be retried.
2933
2976
  - Required OAuth scope: repository.Read
2934
2977
  * @param args.repositoryId The requested repository ID.
2935
2978
  * @param args.entryId The ID of entry to export.
2936
2979
  * @param args.request The request body.
2937
2980
  * @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc or AlternateEdoc.
2938
- * @returns Export was successful. Returned a link to download the exported entry.
2981
+ * @returns Export was successful. Returned a single-use link to download the exported entry. A second download of the same link returns 404.
2939
2982
  */
2940
2983
  exportEntry(args: {
2941
2984
  repositoryId: string;
@@ -3185,7 +3228,7 @@ export declare class EntriesClient implements IEntriesClient {
3185
3228
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
3186
3229
  * @param args.file (optional) Optional. The electronic document or image file to apply to the existing document. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it replaces the existing electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file is rejected with 400; use DELETE /Document/Edoc to remove the electronic document.
3187
3230
  * @param args.request (optional)
3188
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
3231
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
3189
3232
  * @returns Successfully updated the document. Returned the updated entry.
3190
3233
  */
3191
3234
  updateDocument(args: {
@@ -3254,14 +3297,14 @@ export declare class EntriesClient implements IEntriesClient {
3254
3297
  - The number of pages created is max(imageFiles.Count, textPages.Count). If one array is shorter, pages beyond its length are created without that part.
3255
3298
  - If neither imageFiles nor textPages is provided, one empty page is created.
3256
3299
  - If pageNumber is omitted, pages are appended to the end. If provided, pages are inserted at that 1-based position; existing pages shift down.
3257
- - generateText triggers OCR when imageFiles are provided. When generateText is true and imageFiles are present, textPages is ignored because OCR-generated text would overwrite any provided text.
3300
+ - generateText requests text extraction from the document's electronic document part; it does not OCR the image pages being written. When generateText is true and imageFiles are present, textPages is ignored because generated text would overwrite any provided text.
3258
3301
  - Required OAuth scope: repository.Write
3259
3302
  * @param args.repositoryId The requested repository ID.
3260
3303
  * @param args.entryId The requested document ID.
3261
3304
  * @param args.pageNumber (optional) Optional 1-based page number. If omitted, pages are appended to the end. If provided, pages are inserted at that position.
3262
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) for image pages. Default is false.
3305
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are written. This does not OCR the image pages being written. Default is false.
3263
3306
  * @param args.request (optional)
3264
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
3307
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
3265
3308
  * @returns Successfully created pages in the specified document. Returned the updated entry.
3266
3309
  */
3267
3310
  createPages(args: {
@@ -3280,9 +3323,9 @@ export declare class EntriesClient implements IEntriesClient {
3280
3323
  - Required OAuth scope: repository.Write
3281
3324
  * @param args.repositoryId The requested repository ID.
3282
3325
  * @param args.entryId The requested document ID.
3283
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after creating pages. Default is false.
3326
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are created. This does not OCR the image pages being written. Default is false.
3284
3327
  * @param args.request (optional)
3285
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
3328
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
3286
3329
  * @returns Successfully replaced all pages in the specified document. Returned the updated entry.
3287
3330
  */
3288
3331
  replacePages(args: {
@@ -3326,7 +3369,7 @@ export declare class EntriesClient implements IEntriesClient {
3326
3369
  * @param args.repositoryId The requested repository ID.
3327
3370
  * @param args.entryId The requested document ID.
3328
3371
  * @param args.pageNumber The 1-based page number.
3329
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after writing. Default is false.
3372
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after writing. This does not OCR the page image being written. Default is false.
3330
3373
  * @param args.imageFile (optional) Optional. The image file to upload to replace the page's image content. See https://doc.laserfiche.com/ for supported image file formats. At least one of imageFile or request (with text) must be provided.
3331
3374
  * @param args.request (optional)
3332
3375
  * @returns Successfully wrote the image content of the specified page. Returned the updated entry.
@@ -3594,17 +3637,26 @@ export declare class EntriesClient implements IEntriesClient {
3594
3637
  }): Promise<PageWordLocationsResponse>;
3595
3638
  protected processListPageWordLocations(response: Response): Promise<PageWordLocationsResponse>;
3596
3639
  /**
3597
- * - Triggers server-side text generation for the specified document.
3598
- - For documents with image pages, this performs OCR to generate searchable text.
3599
- - For documents with an electronic document part (e.g., PDF), this extracts embedded text.
3640
+ * - Queues a request for the repository's text provider to extract text from the document's electronic document part (e.g., a PDF or Office file).
3641
+ - By default this does not OCR image pages. A document whose pages are images and that has no electronic document part is unchanged by a call with ocrImagePages left at false; text for those pages is otherwise produced by the repository's automatic OCR when a page image is written, not by this endpoint.
3642
+ - Set ocrImagePages to true to also queue an OCR job for the document's image pages. Only pages that have an image and no text are included: a page that already has text is left alone, because OCR replaces a page's text and would discard text that was written through the API or edited by a user. To re-OCR such a page, clear its text first with WritePage, then call this endpoint with ocrImagePages set to true.
3643
+ - When ocrImagePages is true, returns 423 if another user holds a lock on the document and 400 if another user has it checked out; OCR writes its results back under an exclusive lock, so a document that is held cannot be processed. Neither status occurs when ocrImagePages is false.
3644
+ - When ocrImagePages is true, at most 511 pages can be queued in one request. A document with more than 511 image pages that have no text returns 400; that is the number of pages the OCR pipeline accepts in a single job.
3645
+ - When ocrImagePages is true, the optional ocrLanguageOverride names the language for that OCR job, taking precedence over the document's own language and the repository's configured default; omit it and those apply in that order, falling back to en. It is not stored on the document, so it changes this request only. Supplying it with ocrImagePages false returns 400, and so does a language that is not a usable code -- including one inherited from the document or the repository, because a job queued with an unusable language is accepted and then produces no text with nothing reported back.
3646
+ - The repository's automatic OCR setting does not apply to this endpoint. That setting governs only the OCR the repository performs on its own when a page image is written; a request made here is explicit, and its OCR is queued whether that setting is on or off.
3647
+ - A success response means the request was queued for processing, not that text now exists. Extraction and OCR run asynchronously, and the returned entry reflects the document as of the response. Poll hasText on ListPageInfos to observe OCR results; a large document may stay queued for some time.
3600
3648
  - Required OAuth scope: repository.Write
3601
3649
  * @param args.repositoryId The requested repository ID.
3602
3650
  * @param args.entryId The requested document ID.
3603
- * @returns Successfully triggered text generation for the document. Returned the updated entry.
3651
+ * @param args.ocrImagePages (optional) Set to true to also queue OCR for the document's image pages that have no text. Defaults to false.
3652
+ * @param args.ocrLanguageOverride (optional) Optional. The language the OCR engine should use for this request, as an RFC 4646 code such as en. If omitted, the language is the document's own, then the repository's configured default, then en. Supplying it takes precedence over all three, for this request only: the document's stored language is unchanged, so the repository's automatic OCR keeps using it. A value that is not a usable language code is rejected with 400 rather than queued, whether supplied here or inherited. Only valid when ocrImagePages is true.
3653
+ * @returns Successfully queued the text generation request for the document. Returned the entry. Text is produced asynchronously, so it may not be present in this response.
3604
3654
  */
3605
3655
  generateText(args: {
3606
3656
  repositoryId: string;
3607
3657
  entryId: number;
3658
+ ocrImagePages?: boolean | undefined;
3659
+ ocrLanguageOverride?: string | null | undefined;
3608
3660
  }): Promise<Entry>;
3609
3661
  protected processGenerateText(response: Response): Promise<Entry>;
3610
3662
  /**
@@ -8262,7 +8314,9 @@ For any other file type (PDF, Word, Excel, etc.), the file is always imported as
8262
8314
  metadata?: ImportEntryRequestMetadata | undefined;
8263
8315
  /** The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. */
8264
8316
  volumeName?: string | undefined;
8265
- /** Whether to generate searchable text (OCR) for image pages added via `imageFiles`. Default: true.
8317
+ /** Whether to request text extraction from the document's electronic document part after the image pages in
8318
+ `imageFiles` are added. This does not OCR those image pages — image pages are OCR'd by the repository's
8319
+ automatic OCR when the page image is written, regardless of this setting. Default: true.
8266
8320
  Does not affect pages generated from `file` — use `pdfOptions.generateText` for those. */
8267
8321
  generateImagePagesText?: boolean;
8268
8322
  /** An optional folder path, relative to the entry given in the route, that the document is imported into.
@@ -8291,7 +8345,9 @@ For any other file type (PDF, Word, Excel, etc.), the file is always imported as
8291
8345
  metadata?: ImportEntryRequestMetadata | undefined;
8292
8346
  /** The name of the volume to use. Will use the default parent entry volume if not specified. This is ignored in Laserfiche Cloud. */
8293
8347
  volumeName?: string | undefined;
8294
- /** Whether to generate searchable text (OCR) for image pages added via `imageFiles`. Default: true.
8348
+ /** Whether to request text extraction from the document's electronic document part after the image pages in
8349
+ `imageFiles` are added. This does not OCR those image pages — image pages are OCR'd by the repository's
8350
+ automatic OCR when the page image is written, regardless of this setting. Default: true.
8295
8351
  Does not affect pages generated from `file` — use `pdfOptions.generateText` for those. */
8296
8352
  generateImagePagesText?: boolean;
8297
8353
  /** An optional folder path, relative to the entry given in the route, that the document is imported into.
@@ -8759,7 +8815,9 @@ For any other file type (PDF, Word, Excel, etc.), the file is always imported as
8759
8815
  metadata?: ImportEntryRequestMetadata | undefined;
8760
8816
  /** The options applied when importing a PDF. */
8761
8817
  pdfOptions?: ImportEntryRequestPdfOptions | undefined;
8762
- /** Whether to generate searchable text (OCR) for image pages added via `imageFiles`. Default: true.
8818
+ /** Whether to request text extraction from the document's electronic document part after the image pages in
8819
+ `imageFiles` are added. This does not OCR those image pages — image pages are OCR'd by the repository's
8820
+ automatic OCR when the page image is written, regardless of this setting. Default: true.
8763
8821
  Does not affect pages generated from `file` — use `pdfOptions.generateText` for those. */
8764
8822
  generateImagePagesText?: boolean;
8765
8823
  constructor(data?: IUpdateDocumentRequest);
@@ -8777,7 +8835,9 @@ For any other file type (PDF, Word, Excel, etc.), the file is always imported as
8777
8835
  metadata?: ImportEntryRequestMetadata | undefined;
8778
8836
  /** The options applied when importing a PDF. */
8779
8837
  pdfOptions?: ImportEntryRequestPdfOptions | undefined;
8780
- /** Whether to generate searchable text (OCR) for image pages added via `imageFiles`. Default: true.
8838
+ /** Whether to request text extraction from the document's electronic document part after the image pages in
8839
+ `imageFiles` are added. This does not OCR those image pages — image pages are OCR'd by the repository's
8840
+ automatic OCR when the page image is written, regardless of this setting. Default: true.
8781
8841
  Does not affect pages generated from `file` — use `pdfOptions.generateText` for those. */
8782
8842
  generateImagePagesText?: boolean;
8783
8843
  }
@@ -10322,7 +10382,10 @@ export declare enum TaskStatus {
10322
10382
  export declare class TaskResult implements ITaskResult {
10323
10383
  /** The ID of the entry which is affected (e.g. created or modified) by the execution of the associated task. */
10324
10384
  entryId?: number;
10325
- /** The URI which can be used (via api call) to access the result(s) of the associated task. */
10385
+ /** The URI which can be used (via api call) to access the result(s) of the associated task.
10386
+ For an export task this is a download link for the exported file and it is single-use: the
10387
+ first GET returns the file and any later GET of the same link answers 404. For every other
10388
+ task type it is an ordinary API route and may be called as often as needed. */
10326
10389
  uri?: string | undefined;
10327
10390
  constructor(data?: ITaskResult);
10328
10391
  init(_data?: any): void;
@@ -10333,7 +10396,10 @@ export declare class TaskResult implements ITaskResult {
10333
10396
  export interface ITaskResult {
10334
10397
  /** The ID of the entry which is affected (e.g. created or modified) by the execution of the associated task. */
10335
10398
  entryId?: number;
10336
- /** The URI which can be used (via api call) to access the result(s) of the associated task. */
10399
+ /** The URI which can be used (via api call) to access the result(s) of the associated task.
10400
+ For an export task this is a download link for the exported file and it is single-use: the
10401
+ first GET returns the file and any later GET of the same link answers 404. For every other
10402
+ task type it is an ordinary API route and may be called as often as needed. */
10337
10403
  uri?: string | undefined;
10338
10404
  }
10339
10405
  /** Response containing a collection of CancelTaskResult. */
package/dist/index.js CHANGED
@@ -5524,6 +5524,15 @@ export class EntriesClient {
5524
5524
  /**
5525
5525
  * - Starts an asynchronous export operation to export an entry.
5526
5526
  - If successful, it returns a taskId which can be used to check the status of the export operation or download the export result, otherwise, it returns an error.
5527
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
5528
+ than started and failed later. Text is extracted asynchronously after an import, so a
5529
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
5530
+ it reports true. A document with no pages at all is not rejected here.
5531
+ - The download link the completed task carries in result.uri is **single-use**. The first
5532
+ GET returns the file; any later GET of the same link answers 404, and that 404 carries no
5533
+ problem details because it comes from the download service rather than from this API.
5534
+ Save the content on the first download, and start a new export if a download has to be
5535
+ retried.
5527
5536
  - Required OAuth scope: repository.Read
5528
5537
  * @param args.repositoryId The requested repository ID.
5529
5538
  * @param args.entryId The ID of entry to export.
@@ -6123,7 +6132,7 @@ export class EntriesClient {
6123
6132
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
6124
6133
  * @param args.file (optional) Optional. The file to import. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it is stored as the electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file creates an empty document with no electronic document and no pages.
6125
6134
  * @param args.request (optional)
6126
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
6135
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
6127
6136
  * @returns Document was created successfully. Returns created entry.
6128
6137
  */
6129
6138
  importEntry(args) {
@@ -6243,12 +6252,20 @@ export class EntriesClient {
6243
6252
  /**
6244
6253
  * - Export an entry.
6245
6254
  - The export may time out if it takes longer than 60 seconds. This value is subject to change at anytime. Use the long operation asynchronous export if you run into this restriction.
6255
+ - When part=Text, a document whose pages carry no text stream is rejected with 400 rather
6256
+ than started and failed later. Text is extracted asynchronously after an import, so a
6257
+ document may briefly have pages but no text; poll hasText on ListPageInfos and retry once
6258
+ it reports true. A document with no pages at all is not rejected here.
6259
+ - The returned download link is **single-use**. The first GET returns the file; any later
6260
+ GET of the same link answers 404, and that 404 carries no problem details because it
6261
+ comes from the download service rather than from this API. Save the content on the first
6262
+ download, and start a new export if a download has to be retried.
6246
6263
  - Required OAuth scope: repository.Read
6247
6264
  * @param args.repositoryId The requested repository ID.
6248
6265
  * @param args.entryId The ID of entry to export.
6249
6266
  * @param args.request The request body.
6250
6267
  * @param args.pageRange (optional) A comma-separated range of pages to include. Ex: 1,3,4 or 1-3,5-7,9. This value is ignored when exporting as Edoc or AlternateEdoc.
6251
- * @returns Export was successful. Returned a link to download the exported entry.
6268
+ * @returns Export was successful. Returned a single-use link to download the exported entry. A second download of the same link returns 404.
6252
6269
  */
6253
6270
  exportEntry(args) {
6254
6271
  let { repositoryId, entryId, request, pageRange } = args;
@@ -7612,7 +7629,7 @@ export class EntriesClient {
7612
7629
  * @param args.culture (optional) An optional query parameter used to indicate the locale that should be used. The value should be a standard language tag. This may be used when setting field values with tokens.
7613
7630
  * @param args.file (optional) Optional. The electronic document or image file to apply to the existing document. If the file extension is not in {txt, tif, tiff, bmp, pcx, jpg, jpeg, gif, png}, or if importAsElectronicDocument=true, it replaces the existing electronic document. Otherwise (image extension with importAsElectronicDocument=false), it is imported as image pages. A zero-byte file is rejected with 400; use DELETE /Document/Edoc to remove the electronic document.
7614
7631
  * @param args.request (optional)
7615
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
7632
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
7616
7633
  * @returns Successfully updated the document. Returned the updated entry.
7617
7634
  */
7618
7635
  updateDocument(args) {
@@ -8078,14 +8095,14 @@ export class EntriesClient {
8078
8095
  - The number of pages created is max(imageFiles.Count, textPages.Count). If one array is shorter, pages beyond its length are created without that part.
8079
8096
  - If neither imageFiles nor textPages is provided, one empty page is created.
8080
8097
  - If pageNumber is omitted, pages are appended to the end. If provided, pages are inserted at that 1-based position; existing pages shift down.
8081
- - generateText triggers OCR when imageFiles are provided. When generateText is true and imageFiles are present, textPages is ignored because OCR-generated text would overwrite any provided text.
8098
+ - generateText requests text extraction from the document's electronic document part; it does not OCR the image pages being written. When generateText is true and imageFiles are present, textPages is ignored because generated text would overwrite any provided text.
8082
8099
  - Required OAuth scope: repository.Write
8083
8100
  * @param args.repositoryId The requested repository ID.
8084
8101
  * @param args.entryId The requested document ID.
8085
8102
  * @param args.pageNumber (optional) Optional 1-based page number. If omitted, pages are appended to the end. If provided, pages are inserted at that position.
8086
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) for image pages. Default is false.
8103
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are written. This does not OCR the image pages being written. Default is false.
8087
8104
  * @param args.request (optional)
8088
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
8105
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
8089
8106
  * @returns Successfully created pages in the specified document. Returned the updated entry.
8090
8107
  */
8091
8108
  createPages(args) {
@@ -8205,9 +8222,9 @@ export class EntriesClient {
8205
8222
  - Required OAuth scope: repository.Write
8206
8223
  * @param args.repositoryId The requested repository ID.
8207
8224
  * @param args.entryId The requested document ID.
8208
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after creating pages. Default is false.
8225
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after the pages are created. This does not OCR the image pages being written. Default is false.
8209
8226
  * @param args.request (optional)
8210
- * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending. Set generateImagePagesText=false in the request body to skip OCR for these pages (default: true).
8227
+ * @param args.imageFiles (optional) Optional. Up to 10 image files (100 MB aggregate) that are appended as image pages. Use PUT /Document/Pages to replace existing pages instead of appending.
8211
8228
  * @returns Successfully replaced all pages in the specified document. Returned the updated entry.
8212
8229
  */
8213
8230
  replacePages(args) {
@@ -8445,7 +8462,7 @@ export class EntriesClient {
8445
8462
  * @param args.repositoryId The requested repository ID.
8446
8463
  * @param args.entryId The requested document ID.
8447
8464
  * @param args.pageNumber The 1-based page number.
8448
- * @param args.generateText (optional) If true, triggers server-side text generation (OCR) after writing. Default is false.
8465
+ * @param args.generateText (optional) If true, requests text extraction from the document's electronic document part after writing. This does not OCR the page image being written. Default is false.
8449
8466
  * @param args.imageFile (optional) Optional. The image file to upload to replace the page's image content. See https://doc.laserfiche.com/ for supported image file formats. At least one of imageFile or request (with text) must be provided.
8450
8467
  * @param args.request (optional)
8451
8468
  * @returns Successfully wrote the image content of the specified page. Returned the updated entry.
@@ -9971,23 +9988,36 @@ export class EntriesClient {
9971
9988
  return Promise.resolve(null);
9972
9989
  }
9973
9990
  /**
9974
- * - Triggers server-side text generation for the specified document.
9975
- - For documents with image pages, this performs OCR to generate searchable text.
9976
- - For documents with an electronic document part (e.g., PDF), this extracts embedded text.
9991
+ * - Queues a request for the repository's text provider to extract text from the document's electronic document part (e.g., a PDF or Office file).
9992
+ - By default this does not OCR image pages. A document whose pages are images and that has no electronic document part is unchanged by a call with ocrImagePages left at false; text for those pages is otherwise produced by the repository's automatic OCR when a page image is written, not by this endpoint.
9993
+ - Set ocrImagePages to true to also queue an OCR job for the document's image pages. Only pages that have an image and no text are included: a page that already has text is left alone, because OCR replaces a page's text and would discard text that was written through the API or edited by a user. To re-OCR such a page, clear its text first with WritePage, then call this endpoint with ocrImagePages set to true.
9994
+ - When ocrImagePages is true, returns 423 if another user holds a lock on the document and 400 if another user has it checked out; OCR writes its results back under an exclusive lock, so a document that is held cannot be processed. Neither status occurs when ocrImagePages is false.
9995
+ - When ocrImagePages is true, at most 511 pages can be queued in one request. A document with more than 511 image pages that have no text returns 400; that is the number of pages the OCR pipeline accepts in a single job.
9996
+ - When ocrImagePages is true, the optional ocrLanguageOverride names the language for that OCR job, taking precedence over the document's own language and the repository's configured default; omit it and those apply in that order, falling back to en. It is not stored on the document, so it changes this request only. Supplying it with ocrImagePages false returns 400, and so does a language that is not a usable code -- including one inherited from the document or the repository, because a job queued with an unusable language is accepted and then produces no text with nothing reported back.
9997
+ - The repository's automatic OCR setting does not apply to this endpoint. That setting governs only the OCR the repository performs on its own when a page image is written; a request made here is explicit, and its OCR is queued whether that setting is on or off.
9998
+ - A success response means the request was queued for processing, not that text now exists. Extraction and OCR run asynchronously, and the returned entry reflects the document as of the response. Poll hasText on ListPageInfos to observe OCR results; a large document may stay queued for some time.
9977
9999
  - Required OAuth scope: repository.Write
9978
10000
  * @param args.repositoryId The requested repository ID.
9979
10001
  * @param args.entryId The requested document ID.
9980
- * @returns Successfully triggered text generation for the document. Returned the updated entry.
10002
+ * @param args.ocrImagePages (optional) Set to true to also queue OCR for the document's image pages that have no text. Defaults to false.
10003
+ * @param args.ocrLanguageOverride (optional) Optional. The language the OCR engine should use for this request, as an RFC 4646 code such as en. If omitted, the language is the document's own, then the repository's configured default, then en. Supplying it takes precedence over all three, for this request only: the document's stored language is unchanged, so the repository's automatic OCR keeps using it. A value that is not a usable language code is rejected with 400 rather than queued, whether supplied here or inherited. Only valid when ocrImagePages is true.
10004
+ * @returns Successfully queued the text generation request for the document. Returned the entry. Text is produced asynchronously, so it may not be present in this response.
9981
10005
  */
9982
10006
  generateText(args) {
9983
- let { repositoryId, entryId } = args;
9984
- let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/GenerateText";
10007
+ let { repositoryId, entryId, ocrImagePages, ocrLanguageOverride } = args;
10008
+ let url_ = this.baseUrl + "/v2/Repositories/{repositoryId}/Entries/{entryId}/Document/GenerateText?";
9985
10009
  if (repositoryId === undefined || repositoryId === null)
9986
10010
  throw new Error("The parameter 'repositoryId' must be defined.");
9987
10011
  url_ = url_.replace("{repositoryId}", encodeURIComponent("" + repositoryId));
9988
10012
  if (entryId === undefined || entryId === null)
9989
10013
  throw new Error("The parameter 'entryId' must be defined.");
9990
10014
  url_ = url_.replace("{entryId}", encodeURIComponent("" + entryId));
10015
+ if (ocrImagePages === null)
10016
+ throw new Error("The parameter 'ocrImagePages' cannot be null.");
10017
+ else if (ocrImagePages !== undefined)
10018
+ url_ += "ocrImagePages=" + encodeURIComponent("" + ocrImagePages) + "&";
10019
+ if (ocrLanguageOverride !== undefined && ocrLanguageOverride !== null)
10020
+ url_ += "ocrLanguageOverride=" + encodeURIComponent("" + ocrLanguageOverride) + "&";
9991
10021
  url_ = url_.replace(/[?&]$/, "");
9992
10022
  let options_ = {
9993
10023
  method: "POST",
@@ -10046,6 +10076,14 @@ export class EntriesClient {
10046
10076
  return throwException("Entry with requested ID was not found.", status, _responseText, _headers, result404);
10047
10077
  });
10048
10078
  }
10079
+ else if (status === 423) {
10080
+ return response.text().then((_responseText) => {
10081
+ let result423 = null;
10082
+ let resultData423 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
10083
+ result423 = ProblemDetails.fromJS(resultData423);
10084
+ return throwException("The document is locked by another user. OCR writes its results back under an exclusive lock, so a locked document cannot be processed.", status, _responseText, _headers, result423);
10085
+ });
10086
+ }
10049
10087
  else if (status === 429) {
10050
10088
  return response.text().then((_responseText) => {
10051
10089
  let result429 = null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@laserfiche/lf-repository-api-client-v2",
3
3
  "type": "module",
4
- "version": "1.5.0",
4
+ "version": "1.6.0",
5
5
  "description": "The TypeScript Laserfiche Repository API Client library for accessing the v2 Laserfiche Repository APIs.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -30,11 +30,11 @@
30
30
  "ts-node": "^10.4.0",
31
31
  "tslib": "^2.6.3",
32
32
  "typescript": "^4.5.5",
33
- "vitest": "^4.1.6"
33
+ "vitest": "^4.1.11"
34
34
  },
35
35
  "dependencies": {
36
- "@laserfiche/lf-api-client-core": "^1.1.22",
37
- "@laserfiche/lf-js-utils": "^4.0.16"
36
+ "@laserfiche/lf-api-client-core": "^1.1.23",
37
+ "@laserfiche/lf-js-utils": "^4.0.17"
38
38
  },
39
39
  "scripts": {
40
40
  "test": "npm run test:all",