box-node-sdk 10.4.0 → 10.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/lib/bundle.js +771 -16
- package/lib/bundle.js.map +1 -1
- package/lib/client.d.ts +10 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +16 -0
- package/lib/client.js.map +1 -1
- package/lib/managers/archives.d.ts +4 -0
- package/lib/managers/archives.d.ts.map +1 -1
- package/lib/managers/archives.js +4 -0
- package/lib/managers/archives.js.map +1 -1
- package/lib/managers/hubDocument.d.ts +133 -0
- package/lib/managers/hubDocument.d.ts.map +1 -0
- package/lib/managers/hubDocument.js +162 -0
- package/lib/managers/hubDocument.js.map +1 -0
- package/lib/managers/hubItems.d.ts +7 -0
- package/lib/managers/hubItems.d.ts.map +1 -1
- package/lib/managers/hubItems.js +1 -0
- package/lib/managers/hubItems.js.map +1 -1
- package/lib/managers/index.d.ts +1 -0
- package/lib/managers/index.d.ts.map +1 -1
- package/lib/managers/index.js +1 -0
- package/lib/managers/index.js.map +1 -1
- package/lib/managers/search.d.ts +1 -1
- package/lib/managers/search.d.ts.map +1 -1
- package/lib/managers/search.js +1 -1
- package/lib/managers/search.js.map +1 -1
- package/lib/managers/trashedItems.d.ts +2 -0
- package/lib/managers/trashedItems.d.ts.map +1 -1
- package/lib/managers/trashedItems.js +2 -0
- package/lib/managers/trashedItems.js.map +1 -1
- package/lib/networking/boxNetworkClient.d.ts.map +1 -1
- package/lib/networking/boxNetworkClient.js +61 -6
- package/lib/networking/boxNetworkClient.js.map +1 -1
- package/lib/networking/network.d.ts +10 -1
- package/lib/networking/network.d.ts.map +1 -1
- package/lib/networking/network.js +29 -0
- package/lib/networking/network.js.map +1 -1
- package/lib/networking/timeoutConfig.d.ts +4 -0
- package/lib/networking/timeoutConfig.d.ts.map +1 -0
- package/lib/networking/timeoutConfig.js +3 -0
- package/lib/networking/timeoutConfig.js.map +1 -0
- package/lib/networking/version.d.ts +1 -1
- package/lib/networking/version.js +1 -1
- package/lib/schemas/aiAgentBasicTextToolBase.d.ts +1 -1
- package/lib/schemas/aiAgentBasicTextToolBase.d.ts.map +1 -1
- package/lib/schemas/aiAgentSpreadsheetTool.d.ts +1 -1
- package/lib/schemas/aiAgentSpreadsheetTool.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructured.d.ts +3 -0
- package/lib/schemas/aiExtractStructured.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructured.js +9 -0
- package/lib/schemas/aiExtractStructured.js.map +1 -1
- package/lib/schemas/aiExtractStructuredResponse.d.ts +5 -0
- package/lib/schemas/aiExtractStructuredResponse.d.ts.map +1 -1
- package/lib/schemas/aiExtractStructuredResponse.js +24 -0
- package/lib/schemas/aiExtractStructuredResponse.js.map +1 -1
- package/lib/schemas/index.d.ts +9 -9
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +9 -9
- package/lib/schemas/index.js.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignedItem.d.ts +13 -5
- package/lib/schemas/legalHoldPolicyAssignedItem.d.ts.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignedItem.js +47 -24
- package/lib/schemas/legalHoldPolicyAssignedItem.js.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignment.d.ts.map +1 -1
- package/lib/schemas/legalHoldPolicyAssignment.js.map +1 -1
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.d.ts +17 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.js +87 -0
- package/lib/schemas/v2025R0/hubDividerBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts +10 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js +60 -0
- package/lib/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts +13 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.js +36 -0
- package/lib/schemas/v2025R0/hubDocumentBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts +45 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.js +162 -0
- package/lib/schemas/v2025R0/hubDocumentBlocksV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.d.ts +19 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.js +68 -0
- package/lib/schemas/v2025R0/hubDocumentPageV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts +45 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.js +162 -0
- package/lib/schemas/v2025R0/hubDocumentPagesV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.d.ts +17 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.js +87 -0
- package/lib/schemas/v2025R0/hubItemListBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.js +8 -0
- package/lib/schemas/v2025R0/hubItemOperationResultV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.js +12 -1
- package/lib/schemas/v2025R0/hubItemOperationV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubParagraphTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts +20 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts.map +1 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js +105 -0
- package/lib/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js.map +1 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts +3 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.js +11 -0
- package/lib/schemas/v2025R0/hubUpdateRequestV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/hubV2025R0.d.ts +1 -0
- package/lib/schemas/v2025R0/hubV2025R0.d.ts.map +1 -1
- package/lib/schemas/v2025R0/hubV2025R0.js +14 -0
- package/lib/schemas/v2025R0/hubV2025R0.js.map +1 -1
- package/lib/schemas/v2025R0/index.d.ts +10 -0
- package/lib/schemas/v2025R0/index.d.ts.map +1 -1
- package/lib/schemas/v2025R0/index.js +10 -0
- package/lib/schemas/v2025R0/index.js.map +1 -1
- package/lib-esm/client.d.ts +10 -1
- package/lib-esm/client.js +17 -0
- package/lib-esm/client.js.map +1 -1
- package/lib-esm/managers/archives.d.ts +4 -0
- package/lib-esm/managers/archives.js +4 -0
- package/lib-esm/managers/archives.js.map +1 -1
- package/lib-esm/managers/hubDocument.d.ts +132 -0
- package/lib-esm/managers/hubDocument.js +154 -0
- package/lib-esm/managers/hubDocument.js.map +1 -0
- package/lib-esm/managers/hubItems.d.ts +7 -0
- package/lib-esm/managers/hubItems.js +1 -0
- package/lib-esm/managers/hubItems.js.map +1 -1
- package/lib-esm/managers/index.d.ts +1 -0
- package/lib-esm/managers/index.js +1 -0
- package/lib-esm/managers/index.js.map +1 -1
- package/lib-esm/managers/search.d.ts +1 -1
- package/lib-esm/managers/search.js +1 -1
- package/lib-esm/managers/search.js.map +1 -1
- package/lib-esm/managers/trashedItems.d.ts +2 -0
- package/lib-esm/managers/trashedItems.js +2 -0
- package/lib-esm/managers/trashedItems.js.map +1 -1
- package/lib-esm/networking/boxNetworkClient.js +67 -6
- package/lib-esm/networking/boxNetworkClient.js.map +1 -1
- package/lib-esm/networking/network.d.ts +10 -1
- package/lib-esm/networking/network.js +30 -0
- package/lib-esm/networking/network.js.map +1 -1
- package/lib-esm/networking/timeoutConfig.d.ts +3 -0
- package/lib-esm/networking/timeoutConfig.js +2 -0
- package/lib-esm/networking/timeoutConfig.js.map +1 -0
- package/lib-esm/networking/version.d.ts +1 -1
- package/lib-esm/networking/version.js +1 -1
- package/lib-esm/schemas/aiAgentBasicTextToolBase.d.ts +1 -1
- package/lib-esm/schemas/aiAgentSpreadsheetTool.d.ts +1 -1
- package/lib-esm/schemas/aiExtractStructured.d.ts +3 -0
- package/lib-esm/schemas/aiExtractStructured.js +9 -0
- package/lib-esm/schemas/aiExtractStructured.js.map +1 -1
- package/lib-esm/schemas/aiExtractStructuredResponse.d.ts +5 -0
- package/lib-esm/schemas/aiExtractStructuredResponse.js +24 -0
- package/lib-esm/schemas/aiExtractStructuredResponse.js.map +1 -1
- package/lib-esm/schemas/index.d.ts +9 -9
- package/lib-esm/schemas/index.js +9 -9
- package/lib-esm/schemas/index.js.map +1 -1
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.d.ts +13 -5
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.js +44 -23
- package/lib-esm/schemas/legalHoldPolicyAssignedItem.js.map +1 -1
- package/lib-esm/schemas/legalHoldPolicyAssignment.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.d.ts +16 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.js +85 -0
- package/lib-esm/schemas/v2025R0/hubDividerBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.d.ts +9 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js +56 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockEntryV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.d.ts +12 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.js +32 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.d.ts +44 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.js +164 -0
- package/lib-esm/schemas/v2025R0/hubDocumentBlocksV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.d.ts +18 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.js +64 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPageV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.d.ts +44 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.js +164 -0
- package/lib-esm/schemas/v2025R0/hubDocumentPagesV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.d.ts +16 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.js +85 -0
- package/lib-esm/schemas/v2025R0/hubItemListBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.js +8 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationResultV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.js +12 -1
- package/lib-esm/schemas/v2025R0/hubItemOperationV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubParagraphTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.d.ts +19 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js +106 -0
- package/lib-esm/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.js.map +1 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.d.ts +3 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.js +11 -0
- package/lib-esm/schemas/v2025R0/hubUpdateRequestV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/hubV2025R0.d.ts +1 -0
- package/lib-esm/schemas/v2025R0/hubV2025R0.js +15 -0
- package/lib-esm/schemas/v2025R0/hubV2025R0.js.map +1 -1
- package/lib-esm/schemas/v2025R0/index.d.ts +10 -0
- package/lib-esm/schemas/v2025R0/index.js +10 -0
- package/lib-esm/schemas/v2025R0/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +20 -0
- package/src/managers/archives.ts +4 -0
- package/src/managers/hubDocument.ts +330 -0
- package/src/managers/hubItems.ts +8 -0
- package/src/managers/index.ts +1 -0
- package/src/managers/search.ts +2 -2
- package/src/managers/trashedItems.ts +2 -0
- package/src/networking/boxNetworkClient.ts +82 -13
- package/src/networking/network.ts +33 -0
- package/src/networking/timeoutConfig.ts +3 -0
- package/src/networking/version.ts +1 -1
- package/src/schemas/aiAgentBasicTextToolBase.ts +1 -1
- package/src/schemas/aiAgentSpreadsheetTool.ts +1 -1
- package/src/schemas/aiExtractStructured.ts +16 -0
- package/src/schemas/aiExtractStructuredResponse.ts +44 -0
- package/src/schemas/index.ts +9 -9
- package/src/schemas/legalHoldPolicyAssignedItem.ts +69 -27
- package/src/schemas/legalHoldPolicyAssignment.ts +0 -9
- package/src/schemas/v2025R0/hubCalloutBoxTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubDividerBlockV2025R0.ts +108 -0
- package/src/schemas/v2025R0/hubDocumentBlockEntryV2025R0.ts +76 -0
- package/src/schemas/v2025R0/hubDocumentBlockV2025R0.ts +51 -0
- package/src/schemas/v2025R0/hubDocumentBlocksV2025R0.ts +238 -0
- package/src/schemas/v2025R0/hubDocumentPageV2025R0.ts +92 -0
- package/src/schemas/v2025R0/hubDocumentPagesV2025R0.ts +218 -0
- package/src/schemas/v2025R0/hubItemListBlockV2025R0.ts +108 -0
- package/src/schemas/v2025R0/hubItemOperationResultV2025R0.ts +13 -0
- package/src/schemas/v2025R0/hubItemOperationV2025R0.ts +17 -1
- package/src/schemas/v2025R0/hubParagraphTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubSectionTitleTextBlockV2025R0.ts +133 -0
- package/src/schemas/v2025R0/hubUpdateRequestV2025R0.ts +18 -0
- package/src/schemas/v2025R0/hubV2025R0.ts +19 -0
- package/src/schemas/v2025R0/index.ts +10 -0
- package/src/test/archives.test.ts +0 -1
- package/src/test/client.test.ts +17 -0
- package/src/test/hubDocument.test.ts +91 -0
package/src/managers/archives.ts
CHANGED
|
@@ -405,6 +405,10 @@ export class ArchivesManager {
|
|
|
405
405
|
* Permanently deletes an archive.
|
|
406
406
|
*
|
|
407
407
|
* To learn more about the archive APIs, see the [Archive API Guide](https://developer.box.com/guides/archives).
|
|
408
|
+
*
|
|
409
|
+
* <Danger>
|
|
410
|
+
* This endpoint is currently unavailable. Please contact support for assistance.
|
|
411
|
+
* </Danger>
|
|
408
412
|
* @param {string} archiveId The ID of the archive.
|
|
409
413
|
Example: "982312"
|
|
410
414
|
* @param {DeleteArchiveByIdV2025R0OptionalsInput} optionalsInput
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { serializeHubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
2
|
+
import { deserializeHubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
3
|
+
import { serializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0';
|
|
4
|
+
import { deserializeClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0';
|
|
5
|
+
import { serializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0';
|
|
6
|
+
import { deserializeBoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0';
|
|
7
|
+
import { serializeHubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
8
|
+
import { deserializeHubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
9
|
+
import { ResponseFormat } from '../networking/fetchOptions';
|
|
10
|
+
import { HubDocumentPagesV2025R0 } from '../schemas/v2025R0/hubDocumentPagesV2025R0';
|
|
11
|
+
import { ClientErrorV2025R0 } from '../schemas/v2025R0/clientErrorV2025R0';
|
|
12
|
+
import { BoxVersionHeaderV2025R0 } from '../parameters/v2025R0/boxVersionHeaderV2025R0';
|
|
13
|
+
import { HubDocumentBlocksV2025R0 } from '../schemas/v2025R0/hubDocumentBlocksV2025R0';
|
|
14
|
+
import { BoxSdkError } from '../box/errors';
|
|
15
|
+
import { Authentication } from '../networking/auth';
|
|
16
|
+
import { NetworkSession } from '../networking/network';
|
|
17
|
+
import { FetchOptions } from '../networking/fetchOptions';
|
|
18
|
+
import { FetchResponse } from '../networking/fetchResponse';
|
|
19
|
+
import { prepareParams } from '../internal/utils';
|
|
20
|
+
import { toString } from '../internal/utils';
|
|
21
|
+
import { ByteStream } from '../internal/utils';
|
|
22
|
+
import { CancellationToken } from '../internal/utils';
|
|
23
|
+
import { sdToJson } from '../serialization/json';
|
|
24
|
+
import { SerializedData } from '../serialization/json';
|
|
25
|
+
import { sdIsEmpty } from '../serialization/json';
|
|
26
|
+
import { sdIsBoolean } from '../serialization/json';
|
|
27
|
+
import { sdIsNumber } from '../serialization/json';
|
|
28
|
+
import { sdIsString } from '../serialization/json';
|
|
29
|
+
import { sdIsList } from '../serialization/json';
|
|
30
|
+
import { sdIsMap } from '../serialization/json';
|
|
31
|
+
export class GetHubDocumentPagesV2025R0Optionals {
|
|
32
|
+
readonly headers: GetHubDocumentPagesV2025R0Headers =
|
|
33
|
+
new GetHubDocumentPagesV2025R0Headers({});
|
|
34
|
+
readonly cancellationToken?: CancellationToken = void 0;
|
|
35
|
+
constructor(
|
|
36
|
+
fields: Omit<
|
|
37
|
+
GetHubDocumentPagesV2025R0Optionals,
|
|
38
|
+
'headers' | 'cancellationToken'
|
|
39
|
+
> &
|
|
40
|
+
Partial<
|
|
41
|
+
Pick<
|
|
42
|
+
GetHubDocumentPagesV2025R0Optionals,
|
|
43
|
+
'headers' | 'cancellationToken'
|
|
44
|
+
>
|
|
45
|
+
>,
|
|
46
|
+
) {
|
|
47
|
+
if (fields.headers !== undefined) {
|
|
48
|
+
this.headers = fields.headers;
|
|
49
|
+
}
|
|
50
|
+
if (fields.cancellationToken !== undefined) {
|
|
51
|
+
this.cancellationToken = fields.cancellationToken;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export interface GetHubDocumentPagesV2025R0OptionalsInput {
|
|
56
|
+
readonly headers?: GetHubDocumentPagesV2025R0Headers;
|
|
57
|
+
readonly cancellationToken?: CancellationToken;
|
|
58
|
+
}
|
|
59
|
+
export class GetHubDocumentBlocksV2025R0Optionals {
|
|
60
|
+
readonly headers: GetHubDocumentBlocksV2025R0Headers =
|
|
61
|
+
new GetHubDocumentBlocksV2025R0Headers({});
|
|
62
|
+
readonly cancellationToken?: CancellationToken = void 0;
|
|
63
|
+
constructor(
|
|
64
|
+
fields: Omit<
|
|
65
|
+
GetHubDocumentBlocksV2025R0Optionals,
|
|
66
|
+
'headers' | 'cancellationToken'
|
|
67
|
+
> &
|
|
68
|
+
Partial<
|
|
69
|
+
Pick<
|
|
70
|
+
GetHubDocumentBlocksV2025R0Optionals,
|
|
71
|
+
'headers' | 'cancellationToken'
|
|
72
|
+
>
|
|
73
|
+
>,
|
|
74
|
+
) {
|
|
75
|
+
if (fields.headers !== undefined) {
|
|
76
|
+
this.headers = fields.headers;
|
|
77
|
+
}
|
|
78
|
+
if (fields.cancellationToken !== undefined) {
|
|
79
|
+
this.cancellationToken = fields.cancellationToken;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export interface GetHubDocumentBlocksV2025R0OptionalsInput {
|
|
84
|
+
readonly headers?: GetHubDocumentBlocksV2025R0Headers;
|
|
85
|
+
readonly cancellationToken?: CancellationToken;
|
|
86
|
+
}
|
|
87
|
+
export interface GetHubDocumentPagesV2025R0QueryParams {
|
|
88
|
+
/**
|
|
89
|
+
* The unique identifier that represent a hub.
|
|
90
|
+
*
|
|
91
|
+
* The ID for any hub can be determined
|
|
92
|
+
* by visiting this hub in the web application
|
|
93
|
+
* and copying the ID from the URL. For example,
|
|
94
|
+
* for the URL `https://*.app.box.com/hubs/123`
|
|
95
|
+
* the `hub_id` is `123`. */
|
|
96
|
+
readonly hubId: string;
|
|
97
|
+
/**
|
|
98
|
+
* Defines the position marker at which to begin returning results. This is
|
|
99
|
+
* used when paginating using marker-based pagination. */
|
|
100
|
+
readonly marker?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The maximum number of items to return per page. */
|
|
103
|
+
readonly limit?: number;
|
|
104
|
+
}
|
|
105
|
+
export class GetHubDocumentPagesV2025R0Headers {
|
|
106
|
+
/**
|
|
107
|
+
* Version header. */
|
|
108
|
+
readonly boxVersion: BoxVersionHeaderV2025R0 =
|
|
109
|
+
'2025.0' as BoxVersionHeaderV2025R0;
|
|
110
|
+
/**
|
|
111
|
+
* Extra headers that will be included in the HTTP request. */
|
|
112
|
+
readonly extraHeaders?: {
|
|
113
|
+
readonly [key: string]: undefined | string;
|
|
114
|
+
} = {};
|
|
115
|
+
constructor(
|
|
116
|
+
fields: Omit<
|
|
117
|
+
GetHubDocumentPagesV2025R0Headers,
|
|
118
|
+
'boxVersion' | 'extraHeaders'
|
|
119
|
+
> &
|
|
120
|
+
Partial<
|
|
121
|
+
Pick<GetHubDocumentPagesV2025R0Headers, 'boxVersion' | 'extraHeaders'>
|
|
122
|
+
>,
|
|
123
|
+
) {
|
|
124
|
+
if (fields.boxVersion !== undefined) {
|
|
125
|
+
this.boxVersion = fields.boxVersion;
|
|
126
|
+
}
|
|
127
|
+
if (fields.extraHeaders !== undefined) {
|
|
128
|
+
this.extraHeaders = fields.extraHeaders;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export interface GetHubDocumentPagesV2025R0HeadersInput {
|
|
133
|
+
/**
|
|
134
|
+
* Version header. */
|
|
135
|
+
readonly boxVersion?: BoxVersionHeaderV2025R0;
|
|
136
|
+
/**
|
|
137
|
+
* Extra headers that will be included in the HTTP request. */
|
|
138
|
+
readonly extraHeaders?: {
|
|
139
|
+
readonly [key: string]: undefined | string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface GetHubDocumentBlocksV2025R0QueryParams {
|
|
143
|
+
/**
|
|
144
|
+
* The unique identifier that represent a hub.
|
|
145
|
+
*
|
|
146
|
+
* The ID for any hub can be determined
|
|
147
|
+
* by visiting this hub in the web application
|
|
148
|
+
* and copying the ID from the URL. For example,
|
|
149
|
+
* for the URL `https://*.app.box.com/hubs/123`
|
|
150
|
+
* the `hub_id` is `123`. */
|
|
151
|
+
readonly hubId: string;
|
|
152
|
+
/**
|
|
153
|
+
* The unique identifier of a page within the Box Hub. */
|
|
154
|
+
readonly pageId: string;
|
|
155
|
+
/**
|
|
156
|
+
* Defines the position marker at which to begin returning results. This is
|
|
157
|
+
* used when paginating using marker-based pagination. */
|
|
158
|
+
readonly marker?: string;
|
|
159
|
+
/**
|
|
160
|
+
* The maximum number of items to return per page. */
|
|
161
|
+
readonly limit?: number;
|
|
162
|
+
}
|
|
163
|
+
export class GetHubDocumentBlocksV2025R0Headers {
|
|
164
|
+
/**
|
|
165
|
+
* Version header. */
|
|
166
|
+
readonly boxVersion: BoxVersionHeaderV2025R0 =
|
|
167
|
+
'2025.0' as BoxVersionHeaderV2025R0;
|
|
168
|
+
/**
|
|
169
|
+
* Extra headers that will be included in the HTTP request. */
|
|
170
|
+
readonly extraHeaders?: {
|
|
171
|
+
readonly [key: string]: undefined | string;
|
|
172
|
+
} = {};
|
|
173
|
+
constructor(
|
|
174
|
+
fields: Omit<
|
|
175
|
+
GetHubDocumentBlocksV2025R0Headers,
|
|
176
|
+
'boxVersion' | 'extraHeaders'
|
|
177
|
+
> &
|
|
178
|
+
Partial<
|
|
179
|
+
Pick<GetHubDocumentBlocksV2025R0Headers, 'boxVersion' | 'extraHeaders'>
|
|
180
|
+
>,
|
|
181
|
+
) {
|
|
182
|
+
if (fields.boxVersion !== undefined) {
|
|
183
|
+
this.boxVersion = fields.boxVersion;
|
|
184
|
+
}
|
|
185
|
+
if (fields.extraHeaders !== undefined) {
|
|
186
|
+
this.extraHeaders = fields.extraHeaders;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
export interface GetHubDocumentBlocksV2025R0HeadersInput {
|
|
191
|
+
/**
|
|
192
|
+
* Version header. */
|
|
193
|
+
readonly boxVersion?: BoxVersionHeaderV2025R0;
|
|
194
|
+
/**
|
|
195
|
+
* Extra headers that will be included in the HTTP request. */
|
|
196
|
+
readonly extraHeaders?: {
|
|
197
|
+
readonly [key: string]: undefined | string;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export class HubDocumentManager {
|
|
201
|
+
readonly auth?: Authentication;
|
|
202
|
+
readonly networkSession: NetworkSession = new NetworkSession({});
|
|
203
|
+
constructor(
|
|
204
|
+
fields: Omit<
|
|
205
|
+
HubDocumentManager,
|
|
206
|
+
| 'networkSession'
|
|
207
|
+
| 'getHubDocumentPagesV2025R0'
|
|
208
|
+
| 'getHubDocumentBlocksV2025R0'
|
|
209
|
+
> &
|
|
210
|
+
Partial<Pick<HubDocumentManager, 'networkSession'>>,
|
|
211
|
+
) {
|
|
212
|
+
if (fields.auth !== undefined) {
|
|
213
|
+
this.auth = fields.auth;
|
|
214
|
+
}
|
|
215
|
+
if (fields.networkSession !== undefined) {
|
|
216
|
+
this.networkSession = fields.networkSession;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Retrieves a list of Hub Document Pages for the specified hub.
|
|
221
|
+
* Includes both root-level pages and sub pages.
|
|
222
|
+
* @param {GetHubDocumentPagesV2025R0QueryParams} queryParams Query parameters of getHubDocumentPagesV2025R0 method
|
|
223
|
+
* @param {GetHubDocumentPagesV2025R0OptionalsInput} optionalsInput
|
|
224
|
+
* @returns {Promise<HubDocumentPagesV2025R0>}
|
|
225
|
+
*/
|
|
226
|
+
async getHubDocumentPagesV2025R0(
|
|
227
|
+
queryParams: GetHubDocumentPagesV2025R0QueryParams,
|
|
228
|
+
optionalsInput: GetHubDocumentPagesV2025R0OptionalsInput = {},
|
|
229
|
+
): Promise<HubDocumentPagesV2025R0> {
|
|
230
|
+
const optionals: GetHubDocumentPagesV2025R0Optionals =
|
|
231
|
+
new GetHubDocumentPagesV2025R0Optionals({
|
|
232
|
+
headers: optionalsInput.headers,
|
|
233
|
+
cancellationToken: optionalsInput.cancellationToken,
|
|
234
|
+
});
|
|
235
|
+
const headers: any = optionals.headers;
|
|
236
|
+
const cancellationToken: any = optionals.cancellationToken;
|
|
237
|
+
const queryParamsMap: {
|
|
238
|
+
readonly [key: string]: string;
|
|
239
|
+
} = prepareParams({
|
|
240
|
+
['hub_id']: toString(queryParams.hubId) as string,
|
|
241
|
+
['marker']: toString(queryParams.marker) as string,
|
|
242
|
+
['limit']: toString(queryParams.limit) as string,
|
|
243
|
+
});
|
|
244
|
+
const headersMap: {
|
|
245
|
+
readonly [key: string]: string;
|
|
246
|
+
} = prepareParams({
|
|
247
|
+
...{ ['box-version']: toString(headers.boxVersion) as string },
|
|
248
|
+
...headers.extraHeaders,
|
|
249
|
+
});
|
|
250
|
+
const response: FetchResponse =
|
|
251
|
+
await this.networkSession.networkClient.fetch(
|
|
252
|
+
new FetchOptions({
|
|
253
|
+
url: ''.concat(
|
|
254
|
+
this.networkSession.baseUrls.baseUrl,
|
|
255
|
+
'/2.0/hub_document_pages',
|
|
256
|
+
) as string,
|
|
257
|
+
method: 'GET',
|
|
258
|
+
params: queryParamsMap,
|
|
259
|
+
headers: headersMap,
|
|
260
|
+
responseFormat: 'json' as ResponseFormat,
|
|
261
|
+
auth: this.auth,
|
|
262
|
+
networkSession: this.networkSession,
|
|
263
|
+
cancellationToken: cancellationToken,
|
|
264
|
+
}),
|
|
265
|
+
);
|
|
266
|
+
return {
|
|
267
|
+
...deserializeHubDocumentPagesV2025R0(response.data!),
|
|
268
|
+
rawData: response.data!,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items.
|
|
273
|
+
* Blocks are hierarchically organized by their `parent_id`.
|
|
274
|
+
* Blocks are sorted in order based on user specification in the user interface.
|
|
275
|
+
* The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks.
|
|
276
|
+
* @param {GetHubDocumentBlocksV2025R0QueryParams} queryParams Query parameters of getHubDocumentBlocksV2025R0 method
|
|
277
|
+
* @param {GetHubDocumentBlocksV2025R0OptionalsInput} optionalsInput
|
|
278
|
+
* @returns {Promise<HubDocumentBlocksV2025R0>}
|
|
279
|
+
*/
|
|
280
|
+
async getHubDocumentBlocksV2025R0(
|
|
281
|
+
queryParams: GetHubDocumentBlocksV2025R0QueryParams,
|
|
282
|
+
optionalsInput: GetHubDocumentBlocksV2025R0OptionalsInput = {},
|
|
283
|
+
): Promise<HubDocumentBlocksV2025R0> {
|
|
284
|
+
const optionals: GetHubDocumentBlocksV2025R0Optionals =
|
|
285
|
+
new GetHubDocumentBlocksV2025R0Optionals({
|
|
286
|
+
headers: optionalsInput.headers,
|
|
287
|
+
cancellationToken: optionalsInput.cancellationToken,
|
|
288
|
+
});
|
|
289
|
+
const headers: any = optionals.headers;
|
|
290
|
+
const cancellationToken: any = optionals.cancellationToken;
|
|
291
|
+
const queryParamsMap: {
|
|
292
|
+
readonly [key: string]: string;
|
|
293
|
+
} = prepareParams({
|
|
294
|
+
['hub_id']: toString(queryParams.hubId) as string,
|
|
295
|
+
['page_id']: toString(queryParams.pageId) as string,
|
|
296
|
+
['marker']: toString(queryParams.marker) as string,
|
|
297
|
+
['limit']: toString(queryParams.limit) as string,
|
|
298
|
+
});
|
|
299
|
+
const headersMap: {
|
|
300
|
+
readonly [key: string]: string;
|
|
301
|
+
} = prepareParams({
|
|
302
|
+
...{ ['box-version']: toString(headers.boxVersion) as string },
|
|
303
|
+
...headers.extraHeaders,
|
|
304
|
+
});
|
|
305
|
+
const response: FetchResponse =
|
|
306
|
+
await this.networkSession.networkClient.fetch(
|
|
307
|
+
new FetchOptions({
|
|
308
|
+
url: ''.concat(
|
|
309
|
+
this.networkSession.baseUrls.baseUrl,
|
|
310
|
+
'/2.0/hub_document_blocks',
|
|
311
|
+
) as string,
|
|
312
|
+
method: 'GET',
|
|
313
|
+
params: queryParamsMap,
|
|
314
|
+
headers: headersMap,
|
|
315
|
+
responseFormat: 'json' as ResponseFormat,
|
|
316
|
+
auth: this.auth,
|
|
317
|
+
networkSession: this.networkSession,
|
|
318
|
+
cancellationToken: cancellationToken,
|
|
319
|
+
}),
|
|
320
|
+
);
|
|
321
|
+
return {
|
|
322
|
+
...deserializeHubDocumentBlocksV2025R0(response.data!),
|
|
323
|
+
rawData: response.data!,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
export interface HubDocumentManagerInput {
|
|
328
|
+
readonly auth?: Authentication;
|
|
329
|
+
readonly networkSession?: NetworkSession;
|
|
330
|
+
}
|
package/src/managers/hubItems.ts
CHANGED
|
@@ -89,6 +89,13 @@ export interface GetHubItemsV2025R0QueryParams {
|
|
|
89
89
|
* for the URL `https://*.app.box.com/hubs/123`
|
|
90
90
|
* the `hub_id` is `123`. */
|
|
91
91
|
readonly hubId: string;
|
|
92
|
+
/**
|
|
93
|
+
* The unique identifier of an item list block within the Box Hub.
|
|
94
|
+
*
|
|
95
|
+
* When provided, the response will only include items that belong
|
|
96
|
+
* to the specified item list, allowing you to filter results to
|
|
97
|
+
* items on a specific page or section. */
|
|
98
|
+
readonly parentId?: string;
|
|
92
99
|
/**
|
|
93
100
|
* Defines the position marker at which to begin returning results. This is
|
|
94
101
|
* used when paginating using marker-based pagination.
|
|
@@ -203,6 +210,7 @@ export class HubItemsManager {
|
|
|
203
210
|
readonly [key: string]: string;
|
|
204
211
|
} = prepareParams({
|
|
205
212
|
['hub_id']: toString(queryParams.hubId) as string,
|
|
213
|
+
['parent_id']: toString(queryParams.parentId) as string,
|
|
206
214
|
['marker']: toString(queryParams.marker) as string,
|
|
207
215
|
['limit']: toString(queryParams.limit) as string,
|
|
208
216
|
});
|
package/src/managers/index.ts
CHANGED
|
@@ -77,6 +77,7 @@ export * from './enterpriseConfigurations';
|
|
|
77
77
|
export * from './hubs';
|
|
78
78
|
export * from './hubCollaborations';
|
|
79
79
|
export * from './hubItems';
|
|
80
|
+
export * from './hubDocument';
|
|
80
81
|
export * from './shieldLists';
|
|
81
82
|
export * from './archives';
|
|
82
83
|
export * from './externalUsers';
|
package/src/managers/search.ts
CHANGED
|
@@ -93,7 +93,7 @@ export type SearchForContentQueryParamsContentTypesField =
|
|
|
93
93
|
| 'description'
|
|
94
94
|
| 'file_content'
|
|
95
95
|
| 'comments'
|
|
96
|
-
| '
|
|
96
|
+
| 'tags'
|
|
97
97
|
| string;
|
|
98
98
|
export type SearchForContentQueryParamsTypeField =
|
|
99
99
|
| 'file'
|
|
@@ -595,7 +595,7 @@ export function deserializeSearchForContentQueryParamsContentTypesField(
|
|
|
595
595
|
if (val == 'comments') {
|
|
596
596
|
return val;
|
|
597
597
|
}
|
|
598
|
-
if (val == '
|
|
598
|
+
if (val == 'tags') {
|
|
599
599
|
return val;
|
|
600
600
|
}
|
|
601
601
|
if (sdIsString(val)) {
|
|
@@ -126,6 +126,8 @@ export class TrashedItemsManager {
|
|
|
126
126
|
*
|
|
127
127
|
* This endpoint defaults to use offset-based pagination, yet also supports
|
|
128
128
|
* marker-based pagination using the `marker` parameter.
|
|
129
|
+
*
|
|
130
|
+
* The number of entries returned may be less than `total_count`. For example, if a user deletes items from a shared folder and is later removed as a collaborator, those deleted items will no longer appear in this endpoint’s results, even though they are still included in `total_count`.
|
|
129
131
|
* @param {GetTrashedItemsQueryParams} queryParams Query parameters of getTrashedItems method
|
|
130
132
|
* @param {GetTrashedItemsHeadersInput} headersInput Headers of getTrashedItems method
|
|
131
133
|
* @param {CancellationToken} cancellationToken Token used for request cancellation.
|
|
@@ -40,6 +40,55 @@ export const shouldIncludeBoxUaHeader = (options: FetchOptions) => {
|
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
function createAbortSignalWithTimeout(
|
|
44
|
+
baseSignal: RequestInit['signal'],
|
|
45
|
+
timeoutMs: number,
|
|
46
|
+
): {
|
|
47
|
+
signal: AbortSignal;
|
|
48
|
+
clearTimeout: () => void;
|
|
49
|
+
didTimeout: () => boolean;
|
|
50
|
+
} {
|
|
51
|
+
const controller = new AbortController();
|
|
52
|
+
const upstream = baseSignal as unknown as AbortSignal | undefined;
|
|
53
|
+
let timedOut = false;
|
|
54
|
+
|
|
55
|
+
const abortFromUpstream = () => {
|
|
56
|
+
try {
|
|
57
|
+
(controller as any).abort((upstream as any)?.reason);
|
|
58
|
+
} catch {
|
|
59
|
+
controller.abort();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (upstream) {
|
|
64
|
+
if (upstream.aborted) {
|
|
65
|
+
abortFromUpstream();
|
|
66
|
+
} else {
|
|
67
|
+
upstream.addEventListener('abort', abortFromUpstream, { once: true });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const timeoutId = setTimeout(() => {
|
|
72
|
+
timedOut = true;
|
|
73
|
+
controller.abort();
|
|
74
|
+
}, timeoutMs);
|
|
75
|
+
|
|
76
|
+
// Node.js timers keep the event loop alive. If the only pending work is this
|
|
77
|
+
// watchdog timeout, we don't want it to prevent process exit (e.g. short CLI
|
|
78
|
+
// runs, tests, scripts). `unref()` detaches the timer from the event loop.
|
|
79
|
+
// It’s a no-op in environments where `unref` isn’t available.
|
|
80
|
+
(timeoutId as any)?.unref?.();
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
signal: controller.signal,
|
|
84
|
+
clearTimeout: () => {
|
|
85
|
+
clearTimeout(timeoutId);
|
|
86
|
+
if (upstream) upstream.removeEventListener('abort', abortFromUpstream);
|
|
87
|
+
},
|
|
88
|
+
didTimeout: () => timedOut,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
43
92
|
type FetchOptionsExtended = FetchOptions & {
|
|
44
93
|
attemptNumber?: number;
|
|
45
94
|
numberOfRetriesOnException?: number;
|
|
@@ -193,19 +242,33 @@ export class BoxNetworkClient implements NetworkClient {
|
|
|
193
242
|
: void 0,
|
|
194
243
|
});
|
|
195
244
|
|
|
245
|
+
const timeoutConfig = fetchOptions.networkSession?.timeoutConfig;
|
|
246
|
+
const timeoutMs = timeoutConfig?.timeoutMs;
|
|
247
|
+
|
|
248
|
+
const requestTimeout =
|
|
249
|
+
timeoutMs != null && timeoutMs > 0
|
|
250
|
+
? createAbortSignalWithTimeout(requestInit.signal, timeoutMs)
|
|
251
|
+
: undefined;
|
|
252
|
+
const requestInitWithTimeout: RequestInit = requestTimeout
|
|
253
|
+
? {
|
|
254
|
+
...requestInit,
|
|
255
|
+
signal: requestTimeout.signal as unknown as RequestInit['signal'],
|
|
256
|
+
}
|
|
257
|
+
: requestInit;
|
|
258
|
+
|
|
196
259
|
try {
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
new URLSearchParams(params).toString(),
|
|
204
|
-
),
|
|
205
|
-
{ ...requestInit, redirect: isBrowser() ? 'follow' : 'manual' },
|
|
260
|
+
const requestUrl = ''.concat(
|
|
261
|
+
fetchOptions.url,
|
|
262
|
+
Object.keys(params).length === 0 || fetchOptions.url.endsWith('?')
|
|
263
|
+
? ''
|
|
264
|
+
: '?',
|
|
265
|
+
new URLSearchParams(params).toString(),
|
|
206
266
|
);
|
|
267
|
+
const response = await nodeFetch(requestUrl, {
|
|
268
|
+
...requestInitWithTimeout,
|
|
269
|
+
redirect: isBrowser() ? 'follow' : 'manual',
|
|
270
|
+
});
|
|
207
271
|
|
|
208
|
-
const contentType = response.headers.get('content-type') ?? '';
|
|
209
272
|
const ignoreResponseBody = fetchOptions.followRedirects === false;
|
|
210
273
|
|
|
211
274
|
let data: SerializedData | undefined;
|
|
@@ -244,8 +307,14 @@ export class BoxNetworkClient implements NetworkClient {
|
|
|
244
307
|
} catch (error) {
|
|
245
308
|
isExceptionCase = true;
|
|
246
309
|
numberOfRetriesOnException++;
|
|
247
|
-
|
|
310
|
+
if (requestTimeout?.didTimeout()) {
|
|
311
|
+
caughtError = new Error(`Connection timeout after ${timeoutMs}ms`);
|
|
312
|
+
} else {
|
|
313
|
+
caughtError = error instanceof Error ? error : new Error(String(error));
|
|
314
|
+
}
|
|
248
315
|
fetchResponse = fetchResponse ?? { status: 0, headers: {} };
|
|
316
|
+
} finally {
|
|
317
|
+
requestTimeout?.clearTimeout();
|
|
249
318
|
}
|
|
250
319
|
const attemptForRetry = isExceptionCase
|
|
251
320
|
? numberOfRetriesOnException
|
|
@@ -263,7 +332,7 @@ export class BoxNetworkClient implements NetworkClient {
|
|
|
263
332
|
fetchResponse,
|
|
264
333
|
attemptForRetry,
|
|
265
334
|
);
|
|
266
|
-
await new Promise((resolve) => setTimeout(resolve, retryTimeout));
|
|
335
|
+
await new Promise((resolve) => setTimeout(resolve, retryTimeout * 1000));
|
|
267
336
|
return this.fetch({
|
|
268
337
|
...options,
|
|
269
338
|
attemptNumber: attemptNumber + 1,
|
|
@@ -325,7 +394,7 @@ export class BoxNetworkClient implements NetworkClient {
|
|
|
325
394
|
: [];
|
|
326
395
|
if (fetchResponse.status === 0) {
|
|
327
396
|
throw new BoxSdkError({
|
|
328
|
-
message: `Unexpected Error occurred`,
|
|
397
|
+
message: caughtError?.message || `Unexpected Error occurred`,
|
|
329
398
|
timestamp: `${Date.now()}`,
|
|
330
399
|
error: caughtError,
|
|
331
400
|
});
|
|
@@ -5,6 +5,7 @@ import { Agent } from '../internal/utils';
|
|
|
5
5
|
import { AgentOptions } from '../internal/utils';
|
|
6
6
|
import { createAgent } from '../internal/utils';
|
|
7
7
|
import { ProxyConfig } from './proxyConfig';
|
|
8
|
+
import { TimeoutConfig } from './timeoutConfig';
|
|
8
9
|
import { BoxNetworkClient } from './boxNetworkClient';
|
|
9
10
|
import { NetworkClient } from './networkClient';
|
|
10
11
|
import { RetryStrategy } from './retries';
|
|
@@ -22,6 +23,7 @@ export class NetworkSession {
|
|
|
22
23
|
readonly networkClient: NetworkClient = new BoxNetworkClient({});
|
|
23
24
|
readonly retryStrategy: RetryStrategy = new BoxRetryStrategy({});
|
|
24
25
|
readonly dataSanitizer: DataSanitizer = new DataSanitizer({});
|
|
26
|
+
readonly timeoutConfig?: TimeoutConfig;
|
|
25
27
|
constructor(
|
|
26
28
|
fields: Omit<
|
|
27
29
|
NetworkSession,
|
|
@@ -40,6 +42,7 @@ export class NetworkSession {
|
|
|
40
42
|
| 'withNetworkClient'
|
|
41
43
|
| 'withRetryStrategy'
|
|
42
44
|
| 'withDataSanitizer'
|
|
45
|
+
| 'withTimeoutConfig'
|
|
43
46
|
> &
|
|
44
47
|
Partial<
|
|
45
48
|
Pick<
|
|
@@ -81,6 +84,9 @@ export class NetworkSession {
|
|
|
81
84
|
if (fields.dataSanitizer !== undefined) {
|
|
82
85
|
this.dataSanitizer = fields.dataSanitizer;
|
|
83
86
|
}
|
|
87
|
+
if (fields.timeoutConfig !== undefined) {
|
|
88
|
+
this.timeoutConfig = fields.timeoutConfig;
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
/**
|
|
86
92
|
* Generate a fresh network session by duplicating the existing configuration and network parameters, while also including additional headers to be attached to every API call.
|
|
@@ -122,6 +128,7 @@ export class NetworkSession {
|
|
|
122
128
|
networkClient: this.networkClient,
|
|
123
129
|
retryStrategy: this.retryStrategy,
|
|
124
130
|
dataSanitizer: this.dataSanitizer,
|
|
131
|
+
timeoutConfig: this.timeoutConfig,
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
134
|
/**
|
|
@@ -140,6 +147,7 @@ export class NetworkSession {
|
|
|
140
147
|
networkClient: this.networkClient,
|
|
141
148
|
retryStrategy: this.retryStrategy,
|
|
142
149
|
dataSanitizer: this.dataSanitizer,
|
|
150
|
+
timeoutConfig: this.timeoutConfig,
|
|
143
151
|
});
|
|
144
152
|
}
|
|
145
153
|
/**
|
|
@@ -158,6 +166,7 @@ export class NetworkSession {
|
|
|
158
166
|
networkClient: this.networkClient,
|
|
159
167
|
retryStrategy: this.retryStrategy,
|
|
160
168
|
dataSanitizer: this.dataSanitizer,
|
|
169
|
+
timeoutConfig: this.timeoutConfig,
|
|
161
170
|
});
|
|
162
171
|
}
|
|
163
172
|
/**
|
|
@@ -176,6 +185,7 @@ export class NetworkSession {
|
|
|
176
185
|
networkClient: this.networkClient,
|
|
177
186
|
retryStrategy: this.retryStrategy,
|
|
178
187
|
dataSanitizer: this.dataSanitizer,
|
|
188
|
+
timeoutConfig: this.timeoutConfig,
|
|
179
189
|
});
|
|
180
190
|
}
|
|
181
191
|
/**
|
|
@@ -194,6 +204,7 @@ export class NetworkSession {
|
|
|
194
204
|
networkClient: networkClient,
|
|
195
205
|
retryStrategy: this.retryStrategy,
|
|
196
206
|
dataSanitizer: this.dataSanitizer,
|
|
207
|
+
timeoutConfig: this.timeoutConfig,
|
|
197
208
|
});
|
|
198
209
|
}
|
|
199
210
|
/**
|
|
@@ -212,6 +223,7 @@ export class NetworkSession {
|
|
|
212
223
|
networkClient: this.networkClient,
|
|
213
224
|
retryStrategy: retryStrategy,
|
|
214
225
|
dataSanitizer: this.dataSanitizer,
|
|
226
|
+
timeoutConfig: this.timeoutConfig,
|
|
215
227
|
});
|
|
216
228
|
}
|
|
217
229
|
/**
|
|
@@ -231,6 +243,26 @@ export class NetworkSession {
|
|
|
231
243
|
networkClient: this.networkClient,
|
|
232
244
|
retryStrategy: this.retryStrategy,
|
|
233
245
|
dataSanitizer: dataSanitizer,
|
|
246
|
+
timeoutConfig: this.timeoutConfig,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Generate a fresh network session by duplicating the existing configuration and network parameters, while also applying timeout config
|
|
251
|
+
* @param {TimeoutConfig} timeoutConfig
|
|
252
|
+
* @returns {NetworkSession}
|
|
253
|
+
*/
|
|
254
|
+
withTimeoutConfig(timeoutConfig: TimeoutConfig): NetworkSession {
|
|
255
|
+
return new NetworkSession({
|
|
256
|
+
additionalHeaders: this.additionalHeaders,
|
|
257
|
+
baseUrls: this.baseUrls,
|
|
258
|
+
interceptors: this.interceptors,
|
|
259
|
+
agent: this.agent,
|
|
260
|
+
agentOptions: this.agentOptions,
|
|
261
|
+
proxyConfig: this.proxyConfig,
|
|
262
|
+
networkClient: this.networkClient,
|
|
263
|
+
retryStrategy: this.retryStrategy,
|
|
264
|
+
dataSanitizer: this.dataSanitizer,
|
|
265
|
+
timeoutConfig: timeoutConfig,
|
|
234
266
|
});
|
|
235
267
|
}
|
|
236
268
|
}
|
|
@@ -246,4 +278,5 @@ export interface NetworkSessionInput {
|
|
|
246
278
|
readonly networkClient?: NetworkClient;
|
|
247
279
|
readonly retryStrategy?: RetryStrategy;
|
|
248
280
|
readonly dataSanitizer?: DataSanitizer;
|
|
281
|
+
readonly timeoutConfig?: TimeoutConfig;
|
|
249
282
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const sdkVersion = '10.
|
|
1
|
+
export const sdkVersion = '10.6.0';
|
|
@@ -23,7 +23,7 @@ import { sdIsList } from '../serialization/json';
|
|
|
23
23
|
import { sdIsMap } from '../serialization/json';
|
|
24
24
|
export interface AiAgentBasicTextToolBase {
|
|
25
25
|
/**
|
|
26
|
-
* The model used for the AI agent for basic text. For specific model values, see the [available models list](https://developer.box.com/guides/box-ai/
|
|
26
|
+
* The model used for the AI agent for basic text. For specific model values, see the [available models list](https://developer.box.com/guides/box-ai/ai-models). */
|
|
27
27
|
readonly model?: string;
|
|
28
28
|
/**
|
|
29
29
|
* The number of tokens for completion. */
|
|
@@ -23,7 +23,7 @@ import { sdIsList } from '../serialization/json';
|
|
|
23
23
|
import { sdIsMap } from '../serialization/json';
|
|
24
24
|
export interface AiAgentSpreadsheetTool {
|
|
25
25
|
/**
|
|
26
|
-
* The model used for the AI agent for spreadsheets. For specific model values, see the [available models list](https://developer.box.com/guides/box-ai/
|
|
26
|
+
* The model used for the AI agent for spreadsheets. For specific model values, see the [available models list](https://developer.box.com/guides/box-ai/ai-models). */
|
|
27
27
|
readonly model?: string;
|
|
28
28
|
/**
|
|
29
29
|
* The number of tokens for completion. */
|