New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

increase

Package Overview
Dependencies
Maintainers
2
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

increase - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

CHANGELOG.md

6

core.d.ts

@@ -12,3 +12,3 @@ import * as qs from 'qs';

} from './uploads.js';
type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
export declare abstract class APIClient {

@@ -26,2 +26,3 @@ baseURL: string;

httpAgent,
fetch: overridenFetch,
}: {

@@ -32,2 +33,3 @@ baseURL: string;

httpAgent: Agent | undefined;
fetch: Fetch | undefined;
});

@@ -69,2 +71,3 @@ protected authHeaders(): Headers;

): PagePromise<PageClass>;
private calculateContentLength;
buildRequest<Req extends {}>(

@@ -203,2 +206,3 @@ options: FinalRequestOptions<Req>,

httpAgent?: Agent;
signal?: AbortSignal | undefined | null;
idempotencyKey?: string;

@@ -205,0 +209,0 @@ };

@@ -124,2 +124,3 @@ 'use strict';

httpAgent,
fetch: overridenFetch,
}) {

@@ -133,3 +134,3 @@ this.baseURL = baseURL;

this.httpAgent = httpAgent;
this.fetch = fetch_1.fetch;
this.fetch = overridenFetch !== null && overridenFetch !== void 0 ? overridenFetch : fetch_1.fetch;
}

@@ -192,4 +193,15 @@ authHeaders() {

}
calculateContentLength(body) {
if (typeof body === 'string') {
if (typeof Buffer !== 'undefined') {
return Buffer.byteLength(body, 'utf8').toString();
}
const encoder = new TextEncoder();
const encoded = encoder.encode(body);
return encoded.length.toString();
}
return null;
}
buildRequest(options) {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
const { method, path, query, headers: headers = {} } = options;

@@ -200,13 +212,24 @@ const body =

: null;
const contentLength = typeof body === 'string' ? body.length.toString() : null;
const contentLength = this.calculateContentLength(body);
const url = this.buildURL(path, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
const timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : this.timeout;
const httpAgent =
(
(_b = (_a = options.httpAgent) !== null && _a !== void 0 ? _a : this.httpAgent) !== null &&
_b !== void 0
(_c = (_b = options.httpAgent) !== null && _b !== void 0 ? _b : this.httpAgent) !== null &&
_c !== void 0
) ?
_b
_c
: (0, agent_1.getDefaultAgent)(url);
const timeout = (_c = options.timeout) !== null && _c !== void 0 ? _c : this.timeout;
validatePositiveInteger('timeout', timeout);
const minAgentTimeout = timeout + 1000;
if (
(httpAgent === null || httpAgent === void 0 ? void 0 : httpAgent.options) &&
minAgentTimeout > ((_d = httpAgent.options.timeout) !== null && _d !== void 0 ? _d : 0)
) {
// Allow any given request to bump our agent active socket timeout.
// This may seem strange, but leaking active sockets should be rare and not particularly problematic,
// and without mutating agent we would need to create more of them.
// This tradeoff optimizes for performance.
httpAgent.options.timeout = minAgentTimeout;
}
if (this.idempotencyHeader && method !== 'get') {

@@ -232,2 +255,5 @@ if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();

...(httpAgent && { agent: httpAgent }),
// @ts-ignore node-fetch uses a custom AbortSignal type that is
// not compatible with standard web types
signal: (_e = options.signal) !== null && _e !== void 0 ? _e : null,
};

@@ -248,3 +274,3 @@ this.validateHeaders(reqHeaders, headers);

async request(options, retriesRemaining) {
var _a;
var _a, _b;
if (retriesRemaining === void 0) {

@@ -259,4 +285,11 @@ retriesRemaining = (_a = options.maxRetries) !== null && _a !== void 0 ? _a : this.maxRetries;

if (response instanceof Error) {
if (retriesRemaining) return this.retryRequest(options, retriesRemaining);
if (response.name === 'AbortError') throw new error_1.APIConnectionTimeoutError();
if ((_b = options.signal) === null || _b === void 0 ? void 0 : _b.aborted) {
throw new error_1.APIUserAbortError();
}
if (retriesRemaining) {
return this.retryRequest(options, retriesRemaining);
}
if (response.name === 'AbortError') {
throw new error_1.APIConnectionTimeoutError();
}
throw new error_1.APIConnectionError({ cause: response });

@@ -509,2 +542,3 @@ }

httpAgent: true,
signal: true,
idempotencyKey: true,

@@ -511,0 +545,0 @@ };

@@ -19,2 +19,6 @@ import { Headers } from './core.js';

}
export declare class APIUserAbortError extends APIError {
readonly status: undefined;
constructor({ message }?: { message?: string });
}
export declare class APIConnectionError extends APIError {

@@ -172,2 +176,15 @@ readonly status: undefined;

}
export declare class UniqueIdentifierAlreadyExistsError extends ConflictError {
detail: string | null;
resource_id: string;
status: 409;
title: string;
type: 'unique_identifier_already_exists_error';
constructor(
status: number | undefined,
error: Object | undefined,
message: string | undefined,
headers: Headers | undefined,
);
}
export declare class IdempotencyUnprocessableError extends UnprocessableEntityError {

@@ -174,0 +191,0 @@ detail: string | null;

@@ -7,2 +7,3 @@ 'use strict';

exports.IdempotencyUnprocessableError =
exports.UniqueIdentifierAlreadyExistsError =
exports.InvalidOperationError =

@@ -27,2 +28,3 @@ exports.IdempotencyConflictError =

exports.APIConnectionError =
exports.APIUserAbortError =
exports.APIError =

@@ -76,2 +78,5 @@ void 0;

}
if (type === 'unique_identifier_already_exists_error') {
return new UniqueIdentifierAlreadyExistsError(status, error, message, headers);
}
if (type === 'idempotency_unprocessable_error') {

@@ -119,2 +124,9 @@ return new IdempotencyUnprocessableError(status, error, message, headers);

exports.APIError = APIError;
class APIUserAbortError extends APIError {
constructor({ message } = {}) {
super(undefined, undefined, message || 'Request was aborted.', undefined);
this.status = undefined;
}
}
exports.APIUserAbortError = APIUserAbortError;
class APIConnectionError extends APIError {

@@ -296,2 +308,14 @@ constructor({ message, cause }) {

exports.InvalidOperationError = InvalidOperationError;
class UniqueIdentifierAlreadyExistsError extends ConflictError {
constructor(status, error, message, headers) {
const data = error;
super(status, error, (data === null || data === void 0 ? void 0 : data['title']) || message, headers);
this.detail = data === null || data === void 0 ? void 0 : data['detail'];
this.resource_id = data === null || data === void 0 ? void 0 : data['resource_id'];
this.status = data === null || data === void 0 ? void 0 : data['status'];
this.title = data === null || data === void 0 ? void 0 : data['title'];
this.type = data === null || data === void 0 ? void 0 : data['type'];
}
}
exports.UniqueIdentifierAlreadyExistsError = UniqueIdentifierAlreadyExistsError;
class IdempotencyUnprocessableError extends UnprocessableEntityError {

@@ -298,0 +322,0 @@ constructor(status, error, message, headers) {

@@ -45,2 +45,9 @@ import * as qs from 'qs';

/**
* Specify a custom `fetch` function implementation.
*
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
* defined globally.
*/
fetch?: Core.Fetch | undefined;
/**
* The maximum number of times that the client will retry a request in case of a

@@ -117,2 +124,3 @@ * temporary failure, like a network error or a 5XX error from the server.

static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
static APIUserAbortError: typeof Errors.APIUserAbortError;
static NotFoundError: typeof Errors.NotFoundError;

@@ -138,2 +146,3 @@ static ConflictError: typeof Errors.ConflictError;

static IdempotencyUnprocessableError: typeof Errors.IdempotencyUnprocessableError;
static UniqueIdentifierAlreadyExistsError: typeof Errors.UniqueIdentifierAlreadyExistsError;
}

@@ -143,2 +152,3 @@ export declare const APIError: typeof Errors.APIError,

APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError,
APIUserAbortError: typeof Errors.APIUserAbortError,
NotFoundError: typeof Errors.NotFoundError,

@@ -163,3 +173,4 @@ ConflictError: typeof Errors.ConflictError,

InsufficientPermissionsError: typeof Errors.InsufficientPermissionsError,
IdempotencyUnprocessableError: typeof Errors.IdempotencyUnprocessableError;
IdempotencyUnprocessableError: typeof Errors.IdempotencyUnprocessableError,
UniqueIdentifierAlreadyExistsError: typeof Errors.UniqueIdentifierAlreadyExistsError;
export import toFile = Uploads.toFile;

@@ -166,0 +177,0 @@ export import fileFromPath = Uploads.fileFromPath;

@@ -46,2 +46,3 @@ 'use strict';

exports.toFile =
exports.UniqueIdentifierAlreadyExistsError =
exports.IdempotencyUnprocessableError =

@@ -67,2 +68,3 @@ exports.InsufficientPermissionsError =

exports.NotFoundError =
exports.APIUserAbortError =
exports.APIConnectionTimeoutError =

@@ -100,2 +102,3 @@ exports.APIConnectionError =

maxRetries: options.maxRetries,
fetch: options.fetch,
});

@@ -164,2 +167,3 @@ this.accounts = new API.Accounts(this);

Increase.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
Increase.APIUserAbortError = Errors.APIUserAbortError;
Increase.NotFoundError = Errors.NotFoundError;

@@ -185,5 +189,7 @@ Increase.ConflictError = Errors.ConflictError;

Increase.IdempotencyUnprocessableError = Errors.IdempotencyUnprocessableError;
Increase.UniqueIdentifierAlreadyExistsError = Errors.UniqueIdentifierAlreadyExistsError;
(exports.APIError = Errors.APIError),
(exports.APIConnectionError = Errors.APIConnectionError),
(exports.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError),
(exports.APIUserAbortError = Errors.APIUserAbortError),
(exports.NotFoundError = Errors.NotFoundError),

@@ -208,3 +214,4 @@ (exports.ConflictError = Errors.ConflictError),

(exports.InsufficientPermissionsError = Errors.InsufficientPermissionsError),
(exports.IdempotencyUnprocessableError = Errors.IdempotencyUnprocessableError);
(exports.IdempotencyUnprocessableError = Errors.IdempotencyUnprocessableError),
(exports.UniqueIdentifierAlreadyExistsError = Errors.UniqueIdentifierAlreadyExistsError);
exports.toFile = Uploads.toFile;

@@ -211,0 +218,0 @@ exports.fileFromPath = Uploads.fileFromPath;

2

package.json
{
"name": "increase",
"version": "0.6.0",
"version": "0.7.0",
"description": "Client library for the Increase API",

@@ -5,0 +5,0 @@ "author": "Increase <dev-feedback@increase.com>",

@@ -122,2 +122,6 @@ import * as Core from 'increase/core';

type: 'account_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -180,2 +184,8 @@ export declare namespace AccountTransfer {

require_approval?: boolean;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -188,2 +198,6 @@ export interface AccountTransferListParams extends PageParams {

created_at?: AccountTransferListParams.CreatedAt;
/**
* Filter Account Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -190,0 +204,0 @@ export declare namespace AccountTransferListParams {

@@ -197,2 +197,6 @@ import * as Core from 'increase/core';

type: 'ach_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -235,4 +239,31 @@ export declare namespace ACHTransfer {

* The type of change that occurred.
*
* - `incorrect_account_number` - The account number was incorrect.
* - `incorrect_routing_number` - The routing number was incorrect.
* - `incorrect_routing_number_and_account_number` - Both the routing number and
* the account number were incorrect.
* - `incorrect_transaction_code` - The transaction code was incorrect.
* - `incorrect_account_number_and_transaction_code` - The account number and the
* transaction code were incorrect.
* - `incorrect_routing_number_account_number_and_transaction_code` - The routing
* number, account number, and transaction code were incorrect.
* - `incorrect_receiving_depository_financial_institution_identification` - The
* receiving depository financial institution identification was incorrect.
* - `incorrect_individual_identification_number` - The individual identification
* number was incorrect.
* - `addenda_format_error` - The addenda had an incorrect format.
* - `incorrect_standard_entry_class_code_for_outbound_international_payment` - The
* standard entry class code was incorrect for an outbound international payment.
*/
change_code: string;
change_code:
| 'incorrect_account_number'
| 'incorrect_routing_number'
| 'incorrect_routing_number_and_account_number'
| 'incorrect_transaction_code'
| 'incorrect_account_number_and_transaction_code'
| 'incorrect_routing_number_account_number_and_transaction_code'
| 'incorrect_receiving_depository_financial_institution_identification'
| 'incorrect_individual_identification_number'
| 'addenda_format_error'
| 'incorrect_standard_entry_class_code_for_outbound_international_payment';
/**

@@ -599,2 +630,8 @@ * The corrected data.

| 'internet_initiated';
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -611,2 +648,6 @@ export interface ACHTransferListParams extends PageParams {

external_account_id?: string;
/**
* Filter ACH Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -613,0 +654,0 @@ export declare namespace ACHTransferListParams {

@@ -61,4 +61,4 @@ import * as Core from 'increase/core';

/**
* The date of the transaction. If `transaction_id` is provided, this must match
* the `created_at` field on that resource.
* The date of the transaction. Optional if `transaction_id` is provided, in which
* case we use the `date` of that transaction. Required otherwise.
*/

@@ -65,0 +65,0 @@ date?: string;

@@ -50,2 +50,6 @@ import * as Core from 'increase/core';

/**
* How physical cards should be designed and shipped.
*/
physical_cards: CardProfile.PhysicalCards | null;
/**
* The status of the Card Profile.

@@ -124,2 +128,23 @@ *

}
/**
* How physical cards should be designed and shipped.
*/
interface PhysicalCards {
/**
* The identifier of the File containing the physical card's back image.
*/
back_image_file_id: string;
/**
* The identifier of the File containing the physical card's carrier image.
*/
carrier_image_file_id: string;
/**
* A phone number the user can contact to receive support for their card.
*/
contact_phone: string;
/**
* The identifier of the File containing the physical card's front image.
*/
front_image_file_id: string;
}
}

@@ -136,2 +161,6 @@ export interface CardProfileCreateParams {

digital_wallets: CardProfileCreateParams.DigitalWallets;
/**
* How physical cards should be designed and shipped.
*/
physical_cards?: CardProfileCreateParams.PhysicalCards;
}

@@ -196,2 +225,19 @@ export declare namespace CardProfileCreateParams {

}
/**
* How physical cards should be designed and shipped.
*/
interface PhysicalCards {
/**
* The identifier of the File containing the physical card's carrier image.
*/
carrier_image_file_id: string;
/**
* A phone number the user can contact to receive support for their card.
*/
contact_phone: string;
/**
* The identifier of the File containing the physical card's front image.
*/
front_image_file_id: string;
}
}

@@ -198,0 +244,0 @@ export interface CardProfileListParams extends PageParams {

@@ -191,2 +191,6 @@ import * as Core from 'increase/core';

type: 'check_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -374,2 +378,8 @@ export declare namespace CheckTransfer {

source_account_number_id?: string;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -414,2 +424,6 @@ export declare namespace CheckTransferCreateParams {

created_at?: CheckTransferListParams.CreatedAt;
/**
* Filter Check Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -416,0 +430,0 @@ export declare namespace CheckTransferListParams {

@@ -898,3 +898,3 @@ import * as Core from 'increase/core';

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -906,2 +906,6 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -923,6 +927,11 @@ /**

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/
file_id: string;
/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1073,3 +1082,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1081,2 +1090,6 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1098,6 +1111,11 @@ /**

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/
file_id: string;
/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1238,3 +1256,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1246,2 +1264,6 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1263,6 +1285,11 @@ /**

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/
file_id: string;
/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1492,3 +1519,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1500,2 +1527,6 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1517,6 +1548,11 @@ /**

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/
file_id: string;
/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1654,3 +1690,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1662,2 +1698,6 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1679,6 +1719,11 @@ /**

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/
file_id: string;
/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1685,0 +1730,0 @@ */

@@ -77,5 +77,5 @@ import * as Core from 'increase/core';

* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_artwork` - A card image to be printed on the front of a
* physical card. This must be a 2100x1340 pixel PNG with no other color but
* black.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1340 pixel PNG with no other color but black.
* - `physical_card_back` - The image to be printed on the back of a physical card.
* - `physical_card_carrier` - An image representing the entirety of the carrier

@@ -100,3 +100,4 @@ * used for a physical card. This must be a 2550x3300 pixel PNG with no other

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'

@@ -133,5 +134,4 @@ | 'document_request'

* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_artwork` - A card image to be printed on the front of a
* physical card. This must be a 2100x1340 pixel PNG with no other color but
* black.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1340 pixel PNG with no other color but black.
* - `physical_card_carrier` - An image representing the entirety of the carrier

@@ -153,3 +153,3 @@ * used for a physical card. This must be a 2550x3300 pixel PNG with no other

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_carrier'

@@ -206,3 +206,4 @@ | 'document_request'

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'

@@ -209,0 +210,0 @@ | 'document_request'

@@ -504,2 +504,7 @@ import * as Core from 'increase/core';

status: 'held' | 'complete';
/**
* A constant representing the object's type. For this resource it will always be
* `inbound_funds_hold`.
*/
type: 'inbound_funds_hold';
}

@@ -506,0 +511,0 @@ /**

@@ -141,2 +141,6 @@ import * as Core from 'increase/core';

type: 'real_time_payments_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -320,2 +324,8 @@ export declare namespace RealTimePaymentsTransfer {

require_approval?: boolean;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -333,2 +343,6 @@ export interface RealTimePaymentsTransferListParams extends PageParams {

external_account_id?: string;
/**
* Filter ACH Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -335,0 +349,0 @@ export declare namespace RealTimePaymentsTransferListParams {

@@ -1102,2 +1102,7 @@ import * as Core from 'increase/core';

status: 'held' | 'complete';
/**
* A constant representing the object's type. For this resource it will always be
* `inbound_funds_hold`.
*/
type: 'inbound_funds_hold';
}

@@ -1104,0 +1109,0 @@ /**

@@ -21,2 +21,3 @@ export {

export { DocumentCreateParams, Documents } from './documents.js';
export { InboundFundsHoldReleaseResponse, InboundFundsHolds } from './inbound-funds-holds.js';
export {

@@ -23,0 +24,0 @@ InboundRealTimePaymentsTransferSimulationResult,

@@ -10,2 +10,3 @@ 'use strict';

exports.RealTimePaymentsTransfers =
exports.InboundFundsHolds =
exports.Documents =

@@ -100,2 +101,9 @@ exports.DigitalWalletTokenRequests =

});
var inbound_funds_holds_1 = require('./inbound-funds-holds.js');
Object.defineProperty(exports, 'InboundFundsHolds', {
enumerable: true,
get: function () {
return inbound_funds_holds_1.InboundFundsHolds;
},
});
var real_time_payments_transfers_1 = require('./real-time-payments-transfers.js');

@@ -102,0 +110,0 @@ Object.defineProperty(exports, 'RealTimePaymentsTransfers', {

@@ -14,2 +14,3 @@ import { APIResource } from 'increase/resource';

import { InboundWireDrawdownRequests } from './inbound-wire-drawdown-requests.js';
import { InboundFundsHolds } from './inbound-funds-holds.js';
import { InterestPayments } from './interest-payments.js';

@@ -33,2 +34,3 @@ import { WireTransfers } from './wire-transfers.js';

inboundWireDrawdownRequests: InboundWireDrawdownRequests;
inboundFundsHolds: InboundFundsHolds;
interestPayments: InterestPayments;

@@ -63,2 +65,4 @@ wireTransfers: WireTransfers;

export import InboundWireDrawdownRequestCreateParams = API.InboundWireDrawdownRequestCreateParams;
export import InboundFundsHolds = API.InboundFundsHolds;
export import InboundFundsHoldReleaseResponse = API.InboundFundsHoldReleaseResponse;
export import InterestPayments = API.InterestPayments;

@@ -65,0 +69,0 @@ export import InterestPaymentSimulationResult = API.InterestPaymentSimulationResult;

@@ -58,2 +58,3 @@ 'use strict';

const inbound_wire_drawdown_requests_1 = require('./inbound-wire-drawdown-requests.js');
const inbound_funds_holds_1 = require('./inbound-funds-holds.js');
const interest_payments_1 = require('./interest-payments.js');

@@ -83,2 +84,3 @@ const wire_transfers_1 = require('./wire-transfers.js');

);
this.inboundFundsHolds = new inbound_funds_holds_1.InboundFundsHolds(this.client);
this.interestPayments = new interest_payments_1.InterestPayments(this.client);

@@ -106,2 +108,3 @@ this.wireTransfers = new wire_transfers_1.WireTransfers(this.client);

Simulations.InboundWireDrawdownRequests = API.InboundWireDrawdownRequests;
Simulations.InboundFundsHolds = API.InboundFundsHolds;
Simulations.InterestPayments = API.InterestPayments;

@@ -108,0 +111,0 @@ Simulations.WireTransfers = API.WireTransfers;

@@ -164,2 +164,6 @@ import * as Core from 'increase/core';

type: 'wire_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -328,2 +332,8 @@ export declare namespace WireTransfer {

routing_number?: string;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -340,2 +350,6 @@ export interface WireTransferListParams extends PageParams {

external_account_id?: string;
/**
* Filter Wire Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -342,0 +356,0 @@ export declare namespace WireTransferListParams {

@@ -6,3 +6,3 @@ /**

import { fileFromPath as _fileFromPath } from 'formdata-node/file-from-path';
import type { File, FilePropertyBag } from './formdata.node';
import type { File, FilePropertyBag } from './formdata.node.js';

@@ -9,0 +9,0 @@ export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;

@@ -8,3 +8,3 @@ /**

import type { FilePropertyBag, File } from './formdata';
import type { FilePropertyBag, File } from './formdata.js';

@@ -11,0 +11,0 @@ export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;

@@ -5,3 +5,3 @@ /**

import { FormData } from './formdata.node';
import { FormData } from './formdata.node.js';
import type { RequestOptions } from '../core';

@@ -8,0 +8,0 @@ import { Readable } from 'node:stream';

@@ -5,3 +5,3 @@ /**

import { FormData } from './formdata';
import { FormData } from './formdata.js';
import type { RequestOptions } from '../core';

@@ -8,0 +8,0 @@ import { MultipartBody } from '../uploads';

import * as qs from 'qs';
import { VERSION } from './version';
import { Stream } from './streaming';
import { APIError, APIConnectionError, APIConnectionTimeoutError } from './error';
import type { Readable } from 'increase/_shims/node-readable';
import { getDefaultAgent, type Agent } from 'increase/_shims/agent';
import { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError } from './error';
import type { Readable } from './_shims/node-readable';
import { getDefaultAgent, type Agent } from './_shims/agent';
import {

@@ -13,3 +13,3 @@ fetch,

type Response,
} from 'increase/_shims/fetch';
} from './_shims/fetch.js';
import { isMultipartBody } from './uploads';

@@ -25,3 +25,3 @@ export {

type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;

@@ -42,2 +42,3 @@ export abstract class APIClient {

httpAgent,
fetch: overridenFetch,
}: {

@@ -48,2 +49,3 @@ baseURL: string;

httpAgent: Agent | undefined;
fetch: Fetch | undefined;
}) {

@@ -55,3 +57,3 @@ this.baseURL = baseURL;

this.fetch = fetch;
this.fetch = overridenFetch ?? fetch;
}

@@ -128,2 +130,16 @@

private calculateContentLength(body: unknown): string | null {
if (typeof body === 'string') {
if (typeof Buffer !== 'undefined') {
return Buffer.byteLength(body, 'utf8').toString();
}
const encoder = new TextEncoder();
const encoded = encoder.encode(body);
return encoded.length.toString();
}
return null;
}
buildRequest<Req extends {}>(

@@ -138,8 +154,16 @@ options: FinalRequestOptions<Req>,

: null;
const contentLength = typeof body === 'string' ? body.length.toString() : null;
const contentLength = this.calculateContentLength(body);
const url = this.buildURL(path!, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
const timeout = options.timeout ?? this.timeout;
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
const timeout = options.timeout ?? this.timeout;
validatePositiveInteger('timeout', timeout);
const minAgentTimeout = timeout + 1000;
if ((httpAgent as any)?.options && minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)) {
// Allow any given request to bump our agent active socket timeout.
// This may seem strange, but leaking active sockets should be rare and not particularly problematic,
// and without mutating agent we would need to create more of them.
// This tradeoff optimizes for performance.
(httpAgent as any).options.timeout = minAgentTimeout;
}

@@ -169,2 +193,5 @@ if (this.idempotencyHeader && method !== 'get') {

...(httpAgent && { agent: httpAgent }),
// @ts-ignore node-fetch uses a custom AbortSignal type that is
// not compatible with standard web types
signal: options.signal ?? null,
};

@@ -207,4 +234,11 @@

if (response instanceof Error) {
if (retriesRemaining) return this.retryRequest(options, retriesRemaining);
if (response.name === 'AbortError') throw new APIConnectionTimeoutError();
if (options.signal?.aborted) {
throw new APIUserAbortError();
}
if (retriesRemaining) {
return this.retryRequest(options, retriesRemaining);
}
if (response.name === 'AbortError') {
throw new APIConnectionTimeoutError();
}
throw new APIConnectionError({ cause: response });

@@ -549,2 +583,3 @@ }

httpAgent?: Agent;
signal?: AbortSignal | undefined | null;
idempotencyKey?: string;

@@ -567,2 +602,3 @@ };

httpAgent: true,
signal: true,
idempotencyKey: true,

@@ -569,0 +605,0 @@ };

@@ -76,2 +76,6 @@ // File generated from our OpenAPI spec by Stainless.

if (type === 'unique_identifier_already_exists_error') {
return new UniqueIdentifierAlreadyExistsError(status, error, message, headers);
}
if (type === 'idempotency_unprocessable_error') {

@@ -129,2 +133,10 @@ return new IdempotencyUnprocessableError(status, error, message, headers);

export class APIUserAbortError extends APIError {
override readonly status: undefined = undefined;
constructor({ message }: { message?: string } = {}) {
super(undefined, undefined, message || 'Request was aborted.', undefined);
}
}
export class APIConnectionError extends APIError {

@@ -431,2 +443,30 @@ override readonly status: undefined = undefined;

export class UniqueIdentifierAlreadyExistsError extends ConflictError {
detail: string | null;
resource_id: string;
override status: 409;
title: string;
type: 'unique_identifier_already_exists_error';
constructor(
status: number | undefined,
error: Object | undefined,
message: string | undefined,
headers: Headers | undefined,
) {
const data = error as Record<string, any>;
super(status, error, data?.['title'] || message, headers);
this.detail = data?.['detail'];
this.resource_id = data?.['resource_id'];
this.status = data?.['status'];
this.title = data?.['title'];
this.type = data?.['type'];
}
}
export class IdempotencyUnprocessableError extends UnprocessableEntityError {

@@ -433,0 +473,0 @@ detail: string | null;

@@ -8,3 +8,3 @@ // File generated from our OpenAPI spec by Stainless.

import * as Errors from './error';
import type { Agent } from 'increase/_shims/agent';
import type { Agent } from './_shims/agent';
import * as Uploads from './uploads';

@@ -55,2 +55,10 @@

/**
* Specify a custom `fetch` function implementation.
*
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
* defined globally.
*/
fetch?: Core.Fetch | undefined;
/**
* The maximum number of times that the client will retry a request in case of a

@@ -104,2 +112,3 @@ * temporary failure, like a network error or a 5XX error from the server.

maxRetries: options.maxRetries,
fetch: options.fetch,
});

@@ -172,2 +181,3 @@ this.apiKey = options.apiKey;

static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
static APIUserAbortError = Errors.APIUserAbortError;
static NotFoundError = Errors.NotFoundError;

@@ -193,2 +203,3 @@ static ConflictError = Errors.ConflictError;

static IdempotencyUnprocessableError = Errors.IdempotencyUnprocessableError;
static UniqueIdentifierAlreadyExistsError = Errors.UniqueIdentifierAlreadyExistsError;
}

@@ -200,2 +211,3 @@

APIConnectionTimeoutError,
APIUserAbortError,
NotFoundError,

@@ -221,2 +233,3 @@ ConflictError,

IdempotencyUnprocessableError,
UniqueIdentifierAlreadyExistsError,
} = Errors;

@@ -223,0 +236,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class AccountNumbers extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class AccountStatements extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -163,2 +163,7 @@ export class AccountTransfers extends APIResource {

type: 'account_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -230,2 +235,9 @@

require_approval?: boolean;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -240,2 +252,7 @@

created_at?: AccountTransferListParams.CreatedAt;
/**
* Filter Account Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -242,0 +259,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Accounts extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class ACHPrenotifications extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -252,2 +252,7 @@ export class ACHTransfers extends APIResource {

type: 'ach_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -295,4 +300,31 @@

* The type of change that occurred.
*
* - `incorrect_account_number` - The account number was incorrect.
* - `incorrect_routing_number` - The routing number was incorrect.
* - `incorrect_routing_number_and_account_number` - Both the routing number and
* the account number were incorrect.
* - `incorrect_transaction_code` - The transaction code was incorrect.
* - `incorrect_account_number_and_transaction_code` - The account number and the
* transaction code were incorrect.
* - `incorrect_routing_number_account_number_and_transaction_code` - The routing
* number, account number, and transaction code were incorrect.
* - `incorrect_receiving_depository_financial_institution_identification` - The
* receiving depository financial institution identification was incorrect.
* - `incorrect_individual_identification_number` - The individual identification
* number was incorrect.
* - `addenda_format_error` - The addenda had an incorrect format.
* - `incorrect_standard_entry_class_code_for_outbound_international_payment` - The
* standard entry class code was incorrect for an outbound international payment.
*/
change_code: string;
change_code:
| 'incorrect_account_number'
| 'incorrect_routing_number'
| 'incorrect_routing_number_and_account_number'
| 'incorrect_transaction_code'
| 'incorrect_account_number_and_transaction_code'
| 'incorrect_routing_number_account_number_and_transaction_code'
| 'incorrect_receiving_depository_financial_institution_identification'
| 'incorrect_individual_identification_number'
| 'addenda_format_error'
| 'incorrect_standard_entry_class_code_for_outbound_international_payment';

@@ -685,2 +717,9 @@ /**

| 'internet_initiated';
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -700,2 +739,7 @@

external_account_id?: string;
/**
* Filter ACH Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -702,0 +746,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as API from './';
import * as Core from '../core';
import { APIResource } from '../resource';
import * as API from '.';

@@ -7,0 +7,0 @@ export class BalanceLookups extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class BookkeepingAccounts extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class BookkeepingEntries extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as API from './';
import * as Core from '../core';
import { APIResource } from '../resource';
import * as API from '.';

@@ -76,4 +76,4 @@ export class BookkeepingEntrySets extends APIResource {

/**
* The date of the transaction. If `transaction_id` is provided, this must match
* the `created_at` field on that resource.
* The date of the transaction. Optional if `transaction_id` is provided, in which
* case we use the `date` of that transaction. Required otherwise.
*/

@@ -80,0 +80,0 @@ date?: string;

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class CardDisputes extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -76,2 +76,7 @@ export class CardProfiles extends APIResource {

/**
* How physical cards should be designed and shipped.
*/
physical_cards: CardProfile.PhysicalCards | null;
/**
* The status of the Card Profile.

@@ -162,2 +167,27 @@ *

}
/**
* How physical cards should be designed and shipped.
*/
export interface PhysicalCards {
/**
* The identifier of the File containing the physical card's back image.
*/
back_image_file_id: string;
/**
* The identifier of the File containing the physical card's carrier image.
*/
carrier_image_file_id: string;
/**
* A phone number the user can contact to receive support for their card.
*/
contact_phone: string;
/**
* The identifier of the File containing the physical card's front image.
*/
front_image_file_id: string;
}
}

@@ -176,2 +206,7 @@

digital_wallets: CardProfileCreateParams.DigitalWallets;
/**
* How physical cards should be designed and shipped.
*/
physical_cards?: CardProfileCreateParams.PhysicalCards;
}

@@ -247,2 +282,22 @@

}
/**
* How physical cards should be designed and shipped.
*/
export interface PhysicalCards {
/**
* The identifier of the File containing the physical card's carrier image.
*/
carrier_image_file_id: string;
/**
* A phone number the user can contact to receive support for their card.
*/
contact_phone: string;
/**
* The identifier of the File containing the physical card's front image.
*/
front_image_file_id: string;
}
}

@@ -249,0 +304,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Cards extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class CheckDeposits extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -248,2 +248,7 @@ export class CheckTransfers extends APIResource {

type: 'check_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -464,2 +469,9 @@

source_account_number_id?: string;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -512,2 +524,7 @@

created_at?: CheckTransferListParams.CreatedAt;
/**
* Filter Check Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -514,0 +531,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as Shared from 'increase/resources/shared';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Shared from './shared';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -10,0 +10,0 @@ export class DeclinedTransactions extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class DigitalWalletTokens extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Documents extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import { isRequestOptions } from '../../core';
import { SupplementalDocuments } from './supplemental-documents';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as API from '.';
import { Page, PageParams } from '../../pagination';

@@ -1058,3 +1058,3 @@ export class Entities extends APIResource {

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1067,2 +1067,7 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1087,3 +1092,3 @@

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/

@@ -1093,2 +1098,8 @@ file_id: string;

/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1261,3 +1272,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1270,2 +1281,7 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1290,3 +1306,3 @@

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/

@@ -1296,2 +1312,8 @@ file_id: string;

/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1452,3 +1474,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1461,2 +1483,7 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1481,3 +1508,3 @@

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/

@@ -1487,2 +1514,8 @@ file_id: string;

/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1748,3 +1781,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1757,2 +1790,7 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1777,3 +1815,3 @@

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/

@@ -1783,2 +1821,8 @@ file_id: string;

/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1936,3 +1980,3 @@ */

/**
* The identifier of the File containing the driver's license.
* The identifier of the File containing the front of the driver's license.
*/

@@ -1945,2 +1989,7 @@ file_id: string;

state: string;
/**
* The identifier of the File containing the back of the driver's license.
*/
back_file_id?: string;
}

@@ -1965,3 +2014,3 @@

/**
* The identifier of the File containing the document.
* The identifier of the File containing the front of the document.
*/

@@ -1971,2 +2020,8 @@ file_id: string;

/**
* The identifier of the File containing the back of the document. Not every
* document has a reverse side.
*/
back_file_id?: string;
/**
* The document's expiration date in YYYY-MM-DD format.

@@ -1973,0 +2028,0 @@ */

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Entities from 'increase/resources/entities/index';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as Entities from './index';
import * as API from '.';
import { Page, PageParams } from '../../pagination';

@@ -9,0 +9,0 @@ export class SupplementalDocuments extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class EventSubscriptions extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Events extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Exports extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class ExternalAccounts extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { type Uploadable, multipartFormRequestOptions } from 'increase/core';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { type Uploadable, multipartFormRequestOptions } from '../core';
import { Page, PageParams } from '../pagination';

@@ -105,5 +105,5 @@ export class Files extends APIResource {

* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_artwork` - A card image to be printed on the front of a
* physical card. This must be a 2100x1340 pixel PNG with no other color but
* black.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1340 pixel PNG with no other color but black.
* - `physical_card_back` - The image to be printed on the back of a physical card.
* - `physical_card_carrier` - An image representing the entirety of the carrier

@@ -128,3 +128,4 @@ * used for a physical card. This must be a 2550x3300 pixel PNG with no other

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'

@@ -164,5 +165,4 @@ | 'document_request'

* wallet apps. This must be a 100x100 pixel PNG.
* - `physical_card_artwork` - A card image to be printed on the front of a
* physical card. This must be a 2100x1340 pixel PNG with no other color but
* black.
* - `physical_card_front` - A card image to be printed on the front of a physical
* card. This must be a 2100x1340 pixel PNG with no other color but black.
* - `physical_card_carrier` - An image representing the entirety of the carrier

@@ -184,3 +184,3 @@ * used for a physical card. This must be a 2550x3300 pixel PNG with no other

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_carrier'

@@ -245,3 +245,4 @@ | 'document_request'

| 'digital_wallet_app_icon'
| 'physical_card_artwork'
| 'physical_card_front'
| 'physical_card_back'
| 'physical_card_carrier'

@@ -248,0 +249,0 @@ | 'document_request'

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as API from './';
import * as Core from '../core';
import { APIResource } from '../resource';
import * as API from '.';

@@ -7,0 +7,0 @@ export class Groups extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class InboundACHTransferReturns extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class InboundWireDrawdownRequests extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Limits extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class OauthConnections extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as Shared from 'increase/resources/shared';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as Shared from './shared';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -582,2 +582,8 @@ export class PendingTransactions extends APIResource {

status: 'held' | 'complete';
/**
* A constant representing the object's type. For this resource it will always be
* `inbound_funds_hold`.
*/
type: 'inbound_funds_hold';
}

@@ -584,0 +590,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class Programs extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Shared from 'increase/resources/shared';
import * as API from './';
import * as Core from '../core';
import { APIResource } from '../resource';
import * as Shared from './shared';
import * as API from '.';

@@ -8,0 +8,0 @@ export class RealTimeDecisions extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -183,2 +183,7 @@ export class RealTimePaymentsTransfers extends APIResource {

type: 'real_time_payments_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -379,2 +384,9 @@

require_approval?: boolean;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -395,2 +407,7 @@

external_account_id?: string;
/**
* Filter ACH Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -397,0 +414,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -8,0 +8,0 @@ export class RoutingNumbers extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as AccountStatements_ from 'increase/resources/account-statements';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as AccountStatements_ from '../account-statements';
import * as API from '.';

@@ -8,0 +8,0 @@ export class AccountStatements extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as AccountTransfers_ from 'increase/resources/account-transfers';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as AccountTransfers_ from '../account-transfers';

@@ -7,0 +7,0 @@ export class AccountTransfers extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as CardDisputes_ from 'increase/resources/card-disputes';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as CardDisputes_ from '../card-disputes';
import * as API from '.';

@@ -8,0 +8,0 @@ export class CardDisputes extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as CardProfiles_ from 'increase/resources/card-profiles';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as CardProfiles_ from '../card-profiles';

@@ -7,0 +7,0 @@ export class CardProfiles extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Transactions from 'increase/resources/transactions';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as Transactions from '../transactions';
import * as API from '.';

@@ -8,0 +8,0 @@ export class CardRefunds extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Transactions from 'increase/resources/transactions';
import * as Shared from 'increase/resources/shared';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as Transactions from '../transactions';
import * as Shared from '../shared';
import * as API from '.';

@@ -1280,2 +1280,8 @@ export class Cards extends APIResource {

status: 'held' | 'complete';
/**
* A constant representing the object's type. For this resource it will always be
* `inbound_funds_hold`.
*/
type: 'inbound_funds_hold';
}

@@ -1282,0 +1288,0 @@

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as CheckDeposits_ from 'increase/resources/check-deposits';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as CheckDeposits_ from '../check-deposits';

@@ -7,0 +7,0 @@ export class CheckDeposits extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as CheckTransfers_ from 'increase/resources/check-transfers';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as CheckTransfers_ from '../check-transfers';

@@ -7,0 +7,0 @@ export class CheckTransfers extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as API from '.';

@@ -7,0 +7,0 @@ export class DigitalWalletTokenRequests extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Documents_ from 'increase/resources/documents';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as Documents_ from '../documents';
import * as API from '.';

@@ -8,0 +8,0 @@ export class Documents extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as InboundWireDrawdownRequests_ from 'increase/resources/inbound-wire-drawdown-requests';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as InboundWireDrawdownRequests_ from '../inbound-wire-drawdown-requests';
import * as API from '.';

@@ -8,0 +8,0 @@ export class InboundWireDrawdownRequests extends APIResource {

@@ -23,2 +23,3 @@ // File generated from our OpenAPI spec by Stainless.

export { DocumentCreateParams, Documents } from './documents';
export { InboundFundsHoldReleaseResponse, InboundFundsHolds } from './inbound-funds-holds';
export {

@@ -25,0 +26,0 @@ InboundRealTimePaymentsTransferSimulationResult,

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import * as Programs_ from 'increase/resources/programs';
import * as API from './';
import * as Core from '../../core';
import { APIResource } from '../../resource';
import * as Programs_ from '../programs';
import * as API from '.';

@@ -8,0 +8,0 @@ export class Programs extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'increase/resource';
import { APIResource } from '../../resource';
import { AccountTransfers } from './account-transfers';

@@ -16,2 +16,3 @@ import { AccountStatements } from './account-statements';

import { InboundWireDrawdownRequests } from './inbound-wire-drawdown-requests';
import { InboundFundsHolds } from './inbound-funds-holds';
import { InterestPayments } from './interest-payments';

@@ -21,3 +22,3 @@ import { WireTransfers } from './wire-transfers';

import { RealTimePaymentsTransfers } from './real-time-payments-transfers';
import * as API from './';
import * as API from '.';

@@ -37,2 +38,3 @@ export class Simulations extends APIResource {

inboundWireDrawdownRequests: InboundWireDrawdownRequests = new InboundWireDrawdownRequests(this.client);
inboundFundsHolds: InboundFundsHolds = new InboundFundsHolds(this.client);
interestPayments: InterestPayments = new InterestPayments(this.client);

@@ -80,2 +82,5 @@ wireTransfers: WireTransfers = new WireTransfers(this.client);

export import InboundFundsHolds = API.InboundFundsHolds;
export import InboundFundsHoldReleaseResponse = API.InboundFundsHoldReleaseResponse;
export import InterestPayments = API.InterestPayments;

@@ -82,0 +87,0 @@ export import InterestPaymentSimulationResult = API.InterestPaymentSimulationResult;

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -9,0 +9,0 @@ export class WireDrawdownRequests extends APIResource {

// File generated from our OpenAPI spec by Stainless.
import * as Core from 'increase/core';
import { APIResource } from 'increase/resource';
import { isRequestOptions } from 'increase/core';
import * as API from './';
import { Page, PageParams } from 'increase/pagination';
import * as Core from '../core';
import { APIResource } from '../resource';
import { isRequestOptions } from '../core';
import * as API from '.';
import { Page, PageParams } from '../pagination';

@@ -218,2 +218,7 @@ export class WireTransfers extends APIResource {

type: 'wire_transfer';
/**
* The unique identifier you chose for this transfer.
*/
unique_identifier: string | null;
}

@@ -414,2 +419,9 @@

routing_number?: string;
/**
* A unique identifier you choose for the transfer. Reusing this identifer for
* another transfer will result in an error. You can query for the transfer
* associated with this identifier using the List endpoint.
*/
unique_identifier?: string;
}

@@ -429,2 +441,7 @@

external_account_id?: string;
/**
* Filter Wire Transfers to the one with the specified unique identifier.
*/
unique_identifier?: string;
}

@@ -431,0 +448,0 @@

@@ -1,4 +0,7 @@

import type { Response } from 'increase/_shims/fetch';
import type { Response } from './_shims/fetch.js';
import { APIResponse, Headers, createResponseHeaders } from './core';
type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
type ServerSentEvent = {

@@ -10,57 +13,2 @@ event: string | null;

class SSEDecoder {
private data: string[];
private event: string | null;
private chunks: string[];
constructor() {
this.event = null;
this.data = [];
this.chunks = [];
}
decode(line: string) {
if (line.endsWith('\r')) {
line = line.substring(0, line.length - 1);
}
if (!line) {
// empty line and we didn't previously encounter any messages
if (!this.event && !this.data.length) return null;
const sse: ServerSentEvent = {
event: this.event,
data: this.data.join('\n'),
raw: this.chunks,
};
this.event = null;
this.data = [];
this.chunks = [];
return sse;
}
this.chunks.push(line);
if (line.startsWith(':')) {
return null;
}
let [fieldname, _, value] = partition(line, ':');
if (value.startsWith(' ')) {
value = value.substring(1);
}
if (fieldname === 'event') {
this.event = value;
} else if (fieldname === 'data') {
this.data.push(value);
}
return null;
}
}
export class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Item>> {

@@ -87,17 +35,7 @@ /** @deprecated - please use the async iterator instead. We plan to add additional helper methods shortly. */

}
const lineDecoder = new LineDecoder();
// @ts-ignore
for await (const chunk of this.response.body) {
let text;
if (chunk instanceof Buffer) {
text = chunk.toString();
} else if ((chunk as any) instanceof Uint8Array) {
text = Buffer.from(chunk).toString();
} else {
text = chunk;
}
for (const line of lineDecoder.decode(text)) {
const iter = readableStreamAsyncIterable<Bytes>(this.response.body);
for await (const chunk of iter) {
for (const line of lineDecoder.decode(chunk)) {
const sse = this.decoder.decode(line);

@@ -115,2 +53,3 @@ if (sse) yield sse;

async *[Symbol.asyncIterator](): AsyncIterator<Item, any, undefined> {
let done = false;
try {

@@ -126,2 +65,3 @@ for await (const sse of this.iterMessages()) {

}
done = true;
} catch (e) {

@@ -133,3 +73,3 @@ // If the user calls `stream.controller.abort()`, we should exit without throwing.

// If the user `break`s, abort the ongoing request.
this.controller.abort();
if (!done) this.controller.abort();
}

@@ -139,4 +79,57 @@ }

const NEWLINE_CHARS = '\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029';
class SSEDecoder {
private data: string[];
private event: string | null;
private chunks: string[];
constructor() {
this.event = null;
this.data = [];
this.chunks = [];
}
decode(line: string) {
if (line.endsWith('\r')) {
line = line.substring(0, line.length - 1);
}
if (!line) {
// empty line and we didn't previously encounter any messages
if (!this.event && !this.data.length) return null;
const sse: ServerSentEvent = {
event: this.event,
data: this.data.join('\n'),
raw: this.chunks,
};
this.event = null;
this.data = [];
this.chunks = [];
return sse;
}
this.chunks.push(line);
if (line.startsWith(':')) {
return null;
}
let [fieldname, _, value] = partition(line, ':');
if (value.startsWith(' ')) {
value = value.substring(1);
}
if (fieldname === 'event') {
this.event = value;
} else if (fieldname === 'data') {
this.data.push(value);
}
return null;
}
}
/**

@@ -149,4 +142,9 @@ * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally

class LineDecoder {
// prettier-ignore
static NEWLINE_CHARS = new Set(['\n', '\r', '\x0b', '\x0c', '\x1c', '\x1d', '\x1e', '\x85', '\u2028', '\u2029']);
static NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
buffer: string[];
trailingCR: boolean;
textDecoder: any; // TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types.

@@ -158,3 +156,5 @@ constructor() {

decode(text: string): string[] {
decode(chunk: Bytes): string[] {
let text = this.decodeText(chunk);
if (this.trailingCR) {

@@ -173,6 +173,6 @@ text = '\r' + text;

const trailing_newline = NEWLINE_CHARS.includes(text.slice(-1));
let lines = text.split(/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g);
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
if (lines.length === 1 && !trailing_newline) {
if (lines.length === 1 && !trailingNewline) {
this.buffer.push(lines[0]!);

@@ -187,3 +187,3 @@ return [];

if (!trailing_newline) {
if (!trailingNewline) {
this.buffer = [lines.pop() || ''];

@@ -195,2 +195,39 @@ }

decodeText(bytes: Bytes): string {
if (bytes == null) return '';
if (typeof bytes === 'string') return bytes;
// Node:
if (typeof Buffer !== 'undefined') {
if (bytes instanceof Buffer) {
return bytes.toString();
}
if (bytes instanceof Uint8Array) {
return Buffer.from(bytes).toString();
}
throw new Error(
`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`,
);
}
// Browser
if (typeof TextDecoder !== 'undefined') {
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
this.textDecoder ??= new TextDecoder('utf8');
return this.textDecoder.decode(bytes);
}
throw new Error(
`Unexpected: received non-Uint8Array/ArrayBuffer (${
(bytes as any).constructor.name
}) in a web platform. Please report this error.`,
);
}
throw new Error(
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`,
);
}
flush(): string[] {

@@ -216,1 +253,34 @@ if (!this.buffer.length && !this.trailingCR) {

}
/**
* Most browsers don't yet have async iterable support for ReadableStream,
* and Node has a very different way of reading bytes from its "ReadableStream".
*
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
if (stream[Symbol.asyncIterator]) return stream;
const reader = stream.getReader();
return {
async next() {
try {
const result = await reader.read();
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
return result;
} catch (e) {
reader.releaseLock(); // release lock when stream becomes errored
throw e;
}
},
async return() {
const cancelPromise = reader.cancel();
reader.releaseLock();
await cancelPromise;
return { done: true, value: undefined };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
import { type RequestOptions } from './core';
import { type Readable } from 'increase/_shims/node-readable';
import { type BodyInit } from 'increase/_shims/fetch';
import { FormData, File, type FilePropertyBag } from 'increase/_shims/formdata';
import { getMultipartRequestOptions } from 'increase/_shims/getMultipartRequestOptions';
import { fileFromPath } from 'increase/_shims/fileFromPath';
import { type FsReadStream, isFsReadStream } from 'increase/_shims/node-readable';
import { type Readable } from './_shims/node-readable';
import { type BodyInit } from './_shims/fetch.js';
import { FormData, File, type FilePropertyBag } from './_shims/formdata.js';
import { getMultipartRequestOptions } from './_shims/getMultipartRequestOptions';
import { fileFromPath } from './_shims/fileFromPath';
import { type FsReadStream, isFsReadStream } from './_shims/node-readable';

@@ -99,3 +99,3 @@ export { fileFromPath };

export async function toFile(
value: ToFileInput,
value: ToFileInput | PromiseLike<ToFileInput>,
name?: string | null | undefined,

@@ -125,4 +125,5 @@ options: FilePropertyBag | undefined = {},

async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
if (value instanceof Promise) return getBytes(await (value as any));
async function getBytes(value: ToFileInput | PromiseLike<ToFileInput>): Promise<Array<BlobPart>> {
// resolve input promise or promiselike object
value = await value;

@@ -129,0 +130,0 @@ let parts: Array<BlobPart> = [];

@@ -1,1 +0,1 @@

export const VERSION = '0.6.0'; // x-release-please-version
export const VERSION = '0.7.0'; // x-release-please-version

@@ -5,41 +5,2 @@ 'use strict';

const core_1 = require('./core.js');
class SSEDecoder {
constructor() {
this.event = null;
this.data = [];
this.chunks = [];
}
decode(line) {
if (line.endsWith('\r')) {
line = line.substring(0, line.length - 1);
}
if (!line) {
// empty line and we didn't previously encounter any messages
if (!this.event && !this.data.length) return null;
const sse = {
event: this.event,
data: this.data.join('\n'),
raw: this.chunks,
};
this.event = null;
this.data = [];
this.chunks = [];
return sse;
}
this.chunks.push(line);
if (line.startsWith(':')) {
return null;
}
let [fieldname, _, value] = partition(line, ':');
if (value.startsWith(' ')) {
value = value.substring(1);
}
if (fieldname === 'event') {
this.event = value;
} else if (fieldname === 'data') {
this.data.push(value);
}
return null;
}
}
class Stream {

@@ -58,13 +19,5 @@ constructor(response, controller) {

const lineDecoder = new LineDecoder();
// @ts-ignore
for await (const chunk of this.response.body) {
let text;
if (chunk instanceof Buffer) {
text = chunk.toString();
} else if (chunk instanceof Uint8Array) {
text = Buffer.from(chunk).toString();
} else {
text = chunk;
}
for (const line of lineDecoder.decode(text)) {
const iter = readableStreamAsyncIterable(this.response.body);
for await (const chunk of iter) {
for (const line of lineDecoder.decode(chunk)) {
const sse = this.decoder.decode(line);

@@ -80,2 +33,3 @@ if (sse) yield sse;

async *[Symbol.asyncIterator]() {
let done = false;
try {

@@ -91,2 +45,3 @@ for await (const sse of this.iterMessages()) {

}
done = true;
} catch (e) {

@@ -98,3 +53,3 @@ // If the user calls `stream.controller.abort()`, we should exit without throwing.

// If the user `break`s, abort the ongoing request.
this.controller.abort();
if (!done) this.controller.abort();
}

@@ -104,3 +59,41 @@ }

exports.Stream = Stream;
const NEWLINE_CHARS = '\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029';
class SSEDecoder {
constructor() {
this.event = null;
this.data = [];
this.chunks = [];
}
decode(line) {
if (line.endsWith('\r')) {
line = line.substring(0, line.length - 1);
}
if (!line) {
// empty line and we didn't previously encounter any messages
if (!this.event && !this.data.length) return null;
const sse = {
event: this.event,
data: this.data.join('\n'),
raw: this.chunks,
};
this.event = null;
this.data = [];
this.chunks = [];
return sse;
}
this.chunks.push(line);
if (line.startsWith(':')) {
return null;
}
let [fieldname, _, value] = partition(line, ':');
if (value.startsWith(' ')) {
value = value.substring(1);
}
if (fieldname === 'event') {
this.event = value;
} else if (fieldname === 'data') {
this.data.push(value);
}
return null;
}
}
/**

@@ -117,3 +110,4 @@ * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally

}
decode(text) {
decode(chunk) {
let text = this.decodeText(chunk);
if (this.trailingCR) {

@@ -130,5 +124,5 @@ text = '\r' + text;

}
const trailing_newline = NEWLINE_CHARS.includes(text.slice(-1));
let lines = text.split(/\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g);
if (lines.length === 1 && !trailing_newline) {
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
if (lines.length === 1 && !trailingNewline) {
this.buffer.push(lines[0]);

@@ -141,3 +135,3 @@ return [];

}
if (!trailing_newline) {
if (!trailingNewline) {
this.buffer = [lines.pop() || ''];

@@ -147,2 +141,32 @@ }

}
decodeText(bytes) {
var _a;
if (bytes == null) return '';
if (typeof bytes === 'string') return bytes;
// Node:
if (typeof Buffer !== 'undefined') {
if (bytes instanceof Buffer) {
return bytes.toString();
}
if (bytes instanceof Uint8Array) {
return Buffer.from(bytes).toString();
}
throw new Error(
`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`,
);
}
// Browser
if (typeof TextDecoder !== 'undefined') {
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
(_a = this.textDecoder) !== null && _a !== void 0 ? _a : (this.textDecoder = new TextDecoder('utf8'));
return this.textDecoder.decode(bytes);
}
throw new Error(
`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`,
);
}
throw new Error(
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`,
);
}
flush() {

@@ -158,2 +182,5 @@ if (!this.buffer.length && !this.trailingCR) {

}
// prettier-ignore
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r', '\x0b', '\x0c', '\x1c', '\x1d', '\x1e', '\x85', '\u2028', '\u2029']);
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
function partition(str, delimiter) {

@@ -166,2 +193,33 @@ const index = str.indexOf(delimiter);

}
/**
* Most browsers don't yet have async iterable support for ReadableStream,
* and Node has a very different way of reading bytes from its "ReadableStream".
*
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
function readableStreamAsyncIterable(stream) {
if (stream[Symbol.asyncIterator]) return stream;
const reader = stream.getReader();
return {
async next() {
try {
const result = await reader.read();
if (result === null || result === void 0 ? void 0 : result.done) reader.releaseLock(); // release lock when stream becomes closed
return result;
} catch (e) {
reader.releaseLock(); // release lock when stream becomes errored
throw e;
}
},
async return() {
const cancelPromise = reader.cancel();
reader.releaseLock();
await cancelPromise;
return { done: true, value: undefined };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
//# sourceMappingURL=streaming.js.map

@@ -69,3 +69,3 @@ import { type RequestOptions } from './core.js';

export declare function toFile(
value: ToFileInput,
value: ToFileInput | PromiseLike<ToFileInput>,
name?: string | null | undefined,

@@ -72,0 +72,0 @@ options?: FilePropertyBag | undefined,

@@ -92,3 +92,4 @@ 'use strict';

var _a;
if (value instanceof Promise) return getBytes(await value);
// resolve input promise or promiselike object
value = await value;
let parts = [];

@@ -95,0 +96,0 @@ if (

@@ -1,2 +0,2 @@

export declare const VERSION = '0.6.0';
export declare const VERSION = '0.7.0';
//# sourceMappingURL=version.d.ts.map
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
exports.VERSION = void 0;
exports.VERSION = '0.6.0'; // x-release-please-version
exports.VERSION = '0.7.0'; // x-release-please-version
//# sourceMappingURL=version.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc