@galaxy-io/filament-ts 0.1.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/LICENSE +201 -0
- package/README.md +192 -0
- package/dist/BaseClient.d.ts +57 -0
- package/dist/BaseClient.js +44 -0
- package/dist/Client.d.ts +47 -0
- package/dist/Client.js +70 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +2 -0
- package/dist/api/resources/auth/client/Client.d.ts +126 -0
- package/dist/api/resources/auth/client/Client.js +365 -0
- package/dist/api/resources/auth/client/index.d.ts +1 -0
- package/dist/api/resources/auth/client/index.js +1 -0
- package/dist/api/resources/auth/client/requests/AuthV1AcceptInviteRequest.d.ts +14 -0
- package/dist/api/resources/auth/client/requests/AuthV1AcceptInviteRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/AuthV1GetTokenRequest.d.ts +15 -0
- package/dist/api/resources/auth/client/requests/AuthV1GetTokenRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/AuthV1LoginRequest.d.ts +13 -0
- package/dist/api/resources/auth/client/requests/AuthV1LoginRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/AuthV1RegisterRequest.d.ts +16 -0
- package/dist/api/resources/auth/client/requests/AuthV1RegisterRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/GetConfigAuthRequest.d.ts +15 -0
- package/dist/api/resources/auth/client/requests/GetConfigAuthRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/GetSessionAuthRequest.d.ts +15 -0
- package/dist/api/resources/auth/client/requests/GetSessionAuthRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/LogoutAuthRequest.d.ts +15 -0
- package/dist/api/resources/auth/client/requests/LogoutAuthRequest.js +2 -0
- package/dist/api/resources/auth/client/requests/index.d.ts +7 -0
- package/dist/api/resources/auth/client/requests/index.js +1 -0
- package/dist/api/resources/auth/exports.d.ts +2 -0
- package/dist/api/resources/auth/exports.js +3 -0
- package/dist/api/resources/auth/index.d.ts +1 -0
- package/dist/api/resources/auth/index.js +1 -0
- package/dist/api/resources/connection/client/Client.d.ts +85 -0
- package/dist/api/resources/connection/client/Client.js +275 -0
- package/dist/api/resources/connection/client/index.d.ts +1 -0
- package/dist/api/resources/connection/client/index.js +1 -0
- package/dist/api/resources/connection/client/requests/IngestionV1CreateConnectionRequest.d.ts +16 -0
- package/dist/api/resources/connection/client/requests/IngestionV1CreateConnectionRequest.js +2 -0
- package/dist/api/resources/connection/client/requests/IngestionV1DeleteConnectionRequest.d.ts +12 -0
- package/dist/api/resources/connection/client/requests/IngestionV1DeleteConnectionRequest.js +2 -0
- package/dist/api/resources/connection/client/requests/IngestionV1GetConnectionRequest.d.ts +12 -0
- package/dist/api/resources/connection/client/requests/IngestionV1GetConnectionRequest.js +2 -0
- package/dist/api/resources/connection/client/requests/IngestionV1ListConnectionsRequest.d.ts +16 -0
- package/dist/api/resources/connection/client/requests/IngestionV1ListConnectionsRequest.js +2 -0
- package/dist/api/resources/connection/client/requests/IngestionV1UpdateConnectionRequest.d.ts +12 -0
- package/dist/api/resources/connection/client/requests/IngestionV1UpdateConnectionRequest.js +2 -0
- package/dist/api/resources/connection/client/requests/index.d.ts +5 -0
- package/dist/api/resources/connection/client/requests/index.js +1 -0
- package/dist/api/resources/connection/exports.d.ts +2 -0
- package/dist/api/resources/connection/exports.js +3 -0
- package/dist/api/resources/connection/index.d.ts +1 -0
- package/dist/api/resources/connection/index.js +1 -0
- package/dist/api/resources/connector/client/Client.d.ts +87 -0
- package/dist/api/resources/connector/client/Client.js +277 -0
- package/dist/api/resources/connector/client/index.d.ts +1 -0
- package/dist/api/resources/connector/client/index.js +1 -0
- package/dist/api/resources/connector/client/requests/IngestionV1DiscoverResourcesRequest.d.ts +15 -0
- package/dist/api/resources/connector/client/requests/IngestionV1DiscoverResourcesRequest.js +2 -0
- package/dist/api/resources/connector/client/requests/IngestionV1GetConnectorRequest.d.ts +13 -0
- package/dist/api/resources/connector/client/requests/IngestionV1GetConnectorRequest.js +2 -0
- package/dist/api/resources/connector/client/requests/IngestionV1GetResourceColumnsRequest.d.ts +15 -0
- package/dist/api/resources/connector/client/requests/IngestionV1GetResourceColumnsRequest.js +2 -0
- package/dist/api/resources/connector/client/requests/IngestionV1ListConnectorsRequest.d.ts +15 -0
- package/dist/api/resources/connector/client/requests/IngestionV1ListConnectorsRequest.js +2 -0
- package/dist/api/resources/connector/client/requests/IngestionV1ValidateConfigRequest.d.ts +15 -0
- package/dist/api/resources/connector/client/requests/IngestionV1ValidateConfigRequest.js +2 -0
- package/dist/api/resources/connector/client/requests/index.d.ts +5 -0
- package/dist/api/resources/connector/client/requests/index.js +1 -0
- package/dist/api/resources/connector/exports.d.ts +2 -0
- package/dist/api/resources/connector/exports.js +3 -0
- package/dist/api/resources/connector/index.d.ts +1 -0
- package/dist/api/resources/connector/index.js +1 -0
- package/dist/api/resources/index.d.ts +16 -0
- package/dist/api/resources/index.js +16 -0
- package/dist/api/resources/member/client/Client.d.ts +74 -0
- package/dist/api/resources/member/client/Client.js +214 -0
- package/dist/api/resources/member/client/index.d.ts +1 -0
- package/dist/api/resources/member/client/index.js +1 -0
- package/dist/api/resources/member/client/requests/AuthV1InviteMemberRequest.d.ts +15 -0
- package/dist/api/resources/member/client/requests/AuthV1InviteMemberRequest.js +2 -0
- package/dist/api/resources/member/client/requests/AuthV1RemoveMemberRequest.d.ts +12 -0
- package/dist/api/resources/member/client/requests/AuthV1RemoveMemberRequest.js +2 -0
- package/dist/api/resources/member/client/requests/AuthV1SetMemberRoleRequest.d.ts +13 -0
- package/dist/api/resources/member/client/requests/AuthV1SetMemberRoleRequest.js +2 -0
- package/dist/api/resources/member/client/requests/ListMemberRequest.d.ts +15 -0
- package/dist/api/resources/member/client/requests/ListMemberRequest.js +2 -0
- package/dist/api/resources/member/client/requests/index.d.ts +4 -0
- package/dist/api/resources/member/client/requests/index.js +1 -0
- package/dist/api/resources/member/exports.d.ts +2 -0
- package/dist/api/resources/member/exports.js +3 -0
- package/dist/api/resources/member/index.d.ts +1 -0
- package/dist/api/resources/member/index.js +1 -0
- package/dist/api/resources/metrics/client/Client.d.ts +41 -0
- package/dist/api/resources/metrics/client/Client.js +117 -0
- package/dist/api/resources/metrics/client/index.d.ts +1 -0
- package/dist/api/resources/metrics/client/index.js +1 -0
- package/dist/api/resources/metrics/client/requests/MetricsV1QueryAggregateRequest.d.ts +19 -0
- package/dist/api/resources/metrics/client/requests/MetricsV1QueryAggregateRequest.js +2 -0
- package/dist/api/resources/metrics/client/requests/MetricsV1QueryTimeseriesRequest.d.ts +29 -0
- package/dist/api/resources/metrics/client/requests/MetricsV1QueryTimeseriesRequest.js +2 -0
- package/dist/api/resources/metrics/client/requests/index.d.ts +2 -0
- package/dist/api/resources/metrics/client/requests/index.js +1 -0
- package/dist/api/resources/metrics/exports.d.ts +2 -0
- package/dist/api/resources/metrics/exports.js +3 -0
- package/dist/api/resources/metrics/index.d.ts +1 -0
- package/dist/api/resources/metrics/index.js +1 -0
- package/dist/api/resources/pipeline/client/Client.d.ts +126 -0
- package/dist/api/resources/pipeline/client/Client.js +398 -0
- package/dist/api/resources/pipeline/client/index.d.ts +1 -0
- package/dist/api/resources/pipeline/client/index.js +1 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1CreatePipelineRequest.d.ts +21 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1CreatePipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1DeletePipelineRequest.d.ts +12 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1DeletePipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1GetPipelineRequest.d.ts +15 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1GetPipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1ListPipelinesRequest.d.ts +18 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1ListPipelinesRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1RunPipelineRequest.d.ts +29 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1RunPipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1UpdatePipelineRequest.d.ts +17 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1UpdatePipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1ValidatePipelineRequest.d.ts +14 -0
- package/dist/api/resources/pipeline/client/requests/IngestionV1ValidatePipelineRequest.js +2 -0
- package/dist/api/resources/pipeline/client/requests/index.d.ts +7 -0
- package/dist/api/resources/pipeline/client/requests/index.js +1 -0
- package/dist/api/resources/pipeline/exports.d.ts +3 -0
- package/dist/api/resources/pipeline/exports.js +4 -0
- package/dist/api/resources/pipeline/index.d.ts +2 -0
- package/dist/api/resources/pipeline/index.js +2 -0
- package/dist/api/resources/pipeline/resources/index.d.ts +6 -0
- package/dist/api/resources/pipeline/resources/index.js +6 -0
- package/dist/api/resources/pipeline/resources/notifier/client/Client.d.ts +71 -0
- package/dist/api/resources/pipeline/resources/notifier/client/Client.js +223 -0
- package/dist/api/resources/pipeline/resources/notifier/client/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/notifier/client/index.js +1 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1CreatePipelineNotifierRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1CreatePipelineNotifierRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1DeletePipelineNotifierRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1DeletePipelineNotifierRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1ListPipelineNotifiersRequest.d.ts +12 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1ListPipelineNotifiersRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1UpdatePipelineNotifierRequest.d.ts +14 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/IngestionV1UpdatePipelineNotifierRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/index.d.ts +4 -0
- package/dist/api/resources/pipeline/resources/notifier/client/requests/index.js +1 -0
- package/dist/api/resources/pipeline/resources/notifier/exports.d.ts +2 -0
- package/dist/api/resources/pipeline/resources/notifier/exports.js +3 -0
- package/dist/api/resources/pipeline/resources/notifier/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/notifier/index.js +1 -0
- package/dist/api/resources/pipeline/resources/schedule/client/Client.d.ts +45 -0
- package/dist/api/resources/pipeline/resources/schedule/client/Client.js +121 -0
- package/dist/api/resources/pipeline/resources/schedule/client/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/schedule/client/index.js +1 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/IngestionV1CreatePipelineScheduleRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/IngestionV1CreatePipelineScheduleRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/IngestionV1UpdatePipelineScheduleRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/IngestionV1UpdatePipelineScheduleRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/index.d.ts +2 -0
- package/dist/api/resources/pipeline/resources/schedule/client/requests/index.js +1 -0
- package/dist/api/resources/pipeline/resources/schedule/exports.d.ts +2 -0
- package/dist/api/resources/pipeline/resources/schedule/exports.js +3 -0
- package/dist/api/resources/pipeline/resources/schedule/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/schedule/index.js +1 -0
- package/dist/api/resources/pipeline/resources/version/client/Client.d.ts +55 -0
- package/dist/api/resources/pipeline/resources/version/client/Client.js +169 -0
- package/dist/api/resources/pipeline/resources/version/client/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/version/client/index.js +1 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1CreatePipelineVersionRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1CreatePipelineVersionRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1GetPipelineVersionRequest.d.ts +13 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1GetPipelineVersionRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1ListPipelineVersionsRequest.d.ts +14 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/IngestionV1ListPipelineVersionsRequest.js +2 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/index.d.ts +3 -0
- package/dist/api/resources/pipeline/resources/version/client/requests/index.js +1 -0
- package/dist/api/resources/pipeline/resources/version/exports.d.ts +2 -0
- package/dist/api/resources/pipeline/resources/version/exports.js +3 -0
- package/dist/api/resources/pipeline/resources/version/index.d.ts +1 -0
- package/dist/api/resources/pipeline/resources/version/index.js +1 -0
- package/dist/api/resources/run/client/Client.d.ts +55 -0
- package/dist/api/resources/run/client/Client.js +163 -0
- package/dist/api/resources/run/client/index.d.ts +1 -0
- package/dist/api/resources/run/client/index.js +1 -0
- package/dist/api/resources/run/client/requests/IngestionV1GetRunRequest.d.ts +12 -0
- package/dist/api/resources/run/client/requests/IngestionV1GetRunRequest.js +2 -0
- package/dist/api/resources/run/client/requests/IngestionV1ListRunsRequest.d.ts +23 -0
- package/dist/api/resources/run/client/requests/IngestionV1ListRunsRequest.js +2 -0
- package/dist/api/resources/run/client/requests/IngestionV1SignalRunRequest.d.ts +18 -0
- package/dist/api/resources/run/client/requests/IngestionV1SignalRunRequest.js +2 -0
- package/dist/api/resources/run/client/requests/index.d.ts +3 -0
- package/dist/api/resources/run/client/requests/index.js +1 -0
- package/dist/api/resources/run/exports.d.ts +2 -0
- package/dist/api/resources/run/exports.js +3 -0
- package/dist/api/resources/run/index.d.ts +1 -0
- package/dist/api/resources/run/index.js +1 -0
- package/dist/api/resources/serviceAccount/client/Client.d.ts +75 -0
- package/dist/api/resources/serviceAccount/client/Client.js +227 -0
- package/dist/api/resources/serviceAccount/client/index.d.ts +1 -0
- package/dist/api/resources/serviceAccount/client/index.js +1 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1CreateServiceAccountRequest.d.ts +14 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1CreateServiceAccountRequest.js +2 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1RemoveServiceAccountRequest.d.ts +12 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1RemoveServiceAccountRequest.js +2 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1RotateServiceAccountSecretRequest.d.ts +12 -0
- package/dist/api/resources/serviceAccount/client/requests/AuthV1RotateServiceAccountSecretRequest.js +2 -0
- package/dist/api/resources/serviceAccount/client/requests/ListServiceAccountRequest.d.ts +15 -0
- package/dist/api/resources/serviceAccount/client/requests/ListServiceAccountRequest.js +2 -0
- package/dist/api/resources/serviceAccount/client/requests/index.d.ts +4 -0
- package/dist/api/resources/serviceAccount/client/requests/index.js +1 -0
- package/dist/api/resources/serviceAccount/exports.d.ts +2 -0
- package/dist/api/resources/serviceAccount/exports.js +3 -0
- package/dist/api/resources/serviceAccount/index.d.ts +1 -0
- package/dist/api/resources/serviceAccount/index.js +1 -0
- package/dist/api/types/AuthV1AcceptInviteResponse.d.ts +1 -0
- package/dist/api/types/AuthV1AcceptInviteResponse.js +2 -0
- package/dist/api/types/AuthV1CreateServiceAccountResponse.d.ts +9 -0
- package/dist/api/types/AuthV1CreateServiceAccountResponse.js +2 -0
- package/dist/api/types/AuthV1GetAuthConfigRequest.d.ts +1 -0
- package/dist/api/types/AuthV1GetAuthConfigRequest.js +2 -0
- package/dist/api/types/AuthV1GetAuthConfigResponse.d.ts +14 -0
- package/dist/api/types/AuthV1GetAuthConfigResponse.js +2 -0
- package/dist/api/types/AuthV1GetSessionRequest.d.ts +5 -0
- package/dist/api/types/AuthV1GetSessionRequest.js +2 -0
- package/dist/api/types/AuthV1GetSessionResponse.d.ts +6 -0
- package/dist/api/types/AuthV1GetSessionResponse.js +2 -0
- package/dist/api/types/AuthV1GetTokenResponse.d.ts +8 -0
- package/dist/api/types/AuthV1GetTokenResponse.js +2 -0
- package/dist/api/types/AuthV1InviteMemberResponse.d.ts +8 -0
- package/dist/api/types/AuthV1InviteMemberResponse.js +2 -0
- package/dist/api/types/AuthV1ListMembersRequest.d.ts +1 -0
- package/dist/api/types/AuthV1ListMembersRequest.js +2 -0
- package/dist/api/types/AuthV1ListMembersResponse.d.ts +9 -0
- package/dist/api/types/AuthV1ListMembersResponse.js +2 -0
- package/dist/api/types/AuthV1ListServiceAccountsRequest.d.ts +1 -0
- package/dist/api/types/AuthV1ListServiceAccountsRequest.js +2 -0
- package/dist/api/types/AuthV1ListServiceAccountsResponse.d.ts +5 -0
- package/dist/api/types/AuthV1ListServiceAccountsResponse.js +2 -0
- package/dist/api/types/AuthV1LoginResponse.d.ts +1 -0
- package/dist/api/types/AuthV1LoginResponse.js +2 -0
- package/dist/api/types/AuthV1LogoutRequest.d.ts +4 -0
- package/dist/api/types/AuthV1LogoutRequest.js +2 -0
- package/dist/api/types/AuthV1LogoutResponse.d.ts +1 -0
- package/dist/api/types/AuthV1LogoutResponse.js +2 -0
- package/dist/api/types/AuthV1Member.d.ts +10 -0
- package/dist/api/types/AuthV1Member.js +2 -0
- package/dist/api/types/AuthV1RegisterResponse.d.ts +3 -0
- package/dist/api/types/AuthV1RegisterResponse.js +2 -0
- package/dist/api/types/AuthV1RemoveMemberResponse.d.ts +1 -0
- package/dist/api/types/AuthV1RemoveMemberResponse.js +2 -0
- package/dist/api/types/AuthV1RemoveServiceAccountResponse.d.ts +1 -0
- package/dist/api/types/AuthV1RemoveServiceAccountResponse.js +2 -0
- package/dist/api/types/AuthV1Role.d.ts +11 -0
- package/dist/api/types/AuthV1Role.js +11 -0
- package/dist/api/types/AuthV1RotateServiceAccountSecretResponse.d.ts +8 -0
- package/dist/api/types/AuthV1RotateServiceAccountSecretResponse.js +2 -0
- package/dist/api/types/AuthV1ServiceAccount.d.ts +12 -0
- package/dist/api/types/AuthV1ServiceAccount.js +2 -0
- package/dist/api/types/AuthV1SetMemberRoleResponse.d.ts +1 -0
- package/dist/api/types/AuthV1SetMemberRoleResponse.js +2 -0
- package/dist/api/types/ConnectError.d.ts +36 -0
- package/dist/api/types/ConnectError.js +23 -0
- package/dist/api/types/ConnectErrorDetailsAny.d.ts +13 -0
- package/dist/api/types/ConnectErrorDetailsAny.js +2 -0
- package/dist/api/types/ConnectProtocolVersion.d.ts +5 -0
- package/dist/api/types/ConnectProtocolVersion.js +5 -0
- package/dist/api/types/ConnectTimeoutHeader.d.ts +4 -0
- package/dist/api/types/ConnectTimeoutHeader.js +2 -0
- package/dist/api/types/GoogleProtobufListValue.d.ts +5 -0
- package/dist/api/types/GoogleProtobufListValue.js +2 -0
- package/dist/api/types/GoogleProtobufNullValue.d.ts +10 -0
- package/dist/api/types/GoogleProtobufNullValue.js +10 -0
- package/dist/api/types/GoogleProtobufStruct.d.ts +5 -0
- package/dist/api/types/GoogleProtobufStruct.js +2 -0
- package/dist/api/types/GoogleProtobufValue.d.ts +4 -0
- package/dist/api/types/GoogleProtobufValue.js +2 -0
- package/dist/api/types/IngestionV1CandidateStatus.d.ts +8 -0
- package/dist/api/types/IngestionV1CandidateStatus.js +8 -0
- package/dist/api/types/IngestionV1CandidateValue.d.ts +9 -0
- package/dist/api/types/IngestionV1CandidateValue.js +2 -0
- package/dist/api/types/IngestionV1ConfigField.d.ts +22 -0
- package/dist/api/types/IngestionV1ConfigField.js +2 -0
- package/dist/api/types/IngestionV1ConfigSchema.d.ts +7 -0
- package/dist/api/types/IngestionV1ConfigSchema.js +2 -0
- package/dist/api/types/IngestionV1Connection.d.ts +36 -0
- package/dist/api/types/IngestionV1Connection.js +2 -0
- package/dist/api/types/IngestionV1ConnectorKind.d.ts +7 -0
- package/dist/api/types/IngestionV1ConnectorKind.js +7 -0
- package/dist/api/types/IngestionV1ConnectorMaturity.d.ts +7 -0
- package/dist/api/types/IngestionV1ConnectorMaturity.js +7 -0
- package/dist/api/types/IngestionV1ConnectorSpec.d.ts +18 -0
- package/dist/api/types/IngestionV1ConnectorSpec.js +2 -0
- package/dist/api/types/IngestionV1CreateConnectionResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1CreateConnectionResponse.js +2 -0
- package/dist/api/types/IngestionV1CreatePipelineNotifierResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1CreatePipelineNotifierResponse.js +2 -0
- package/dist/api/types/IngestionV1CreatePipelineResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1CreatePipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1CreatePipelineScheduleResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1CreatePipelineScheduleResponse.js +2 -0
- package/dist/api/types/IngestionV1CreatePipelineVersionResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1CreatePipelineVersionResponse.js +2 -0
- package/dist/api/types/IngestionV1DeleteConnectionResponse.d.ts +1 -0
- package/dist/api/types/IngestionV1DeleteConnectionResponse.js +2 -0
- package/dist/api/types/IngestionV1DeletePipelineNotifierResponse.d.ts +1 -0
- package/dist/api/types/IngestionV1DeletePipelineNotifierResponse.js +2 -0
- package/dist/api/types/IngestionV1DeletePipelineResponse.d.ts +1 -0
- package/dist/api/types/IngestionV1DeletePipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1DiscoverResourcesResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1DiscoverResourcesResponse.js +2 -0
- package/dist/api/types/IngestionV1EdgeValidation.d.ts +20 -0
- package/dist/api/types/IngestionV1EdgeValidation.js +2 -0
- package/dist/api/types/IngestionV1EnumOption.d.ts +7 -0
- package/dist/api/types/IngestionV1EnumOption.js +2 -0
- package/dist/api/types/IngestionV1ExecutionDesiredState.d.ts +8 -0
- package/dist/api/types/IngestionV1ExecutionDesiredState.js +8 -0
- package/dist/api/types/IngestionV1ExecutionMode.d.ts +10 -0
- package/dist/api/types/IngestionV1ExecutionMode.js +10 -0
- package/dist/api/types/IngestionV1ExecutionObservedState.d.ts +16 -0
- package/dist/api/types/IngestionV1ExecutionObservedState.js +16 -0
- package/dist/api/types/IngestionV1ExecutionStatus.d.ts +17 -0
- package/dist/api/types/IngestionV1ExecutionStatus.js +2 -0
- package/dist/api/types/IngestionV1FieldCondition.d.ts +4 -0
- package/dist/api/types/IngestionV1FieldCondition.js +2 -0
- package/dist/api/types/IngestionV1FieldScope.d.ts +6 -0
- package/dist/api/types/IngestionV1FieldScope.js +6 -0
- package/dist/api/types/IngestionV1FieldType.d.ts +13 -0
- package/dist/api/types/IngestionV1FieldType.js +13 -0
- package/dist/api/types/IngestionV1GetConnectionResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetConnectionResponse.js +2 -0
- package/dist/api/types/IngestionV1GetConnectorResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetConnectorResponse.js +2 -0
- package/dist/api/types/IngestionV1GetPipelineResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetPipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1GetPipelineVersionResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetPipelineVersionResponse.js +2 -0
- package/dist/api/types/IngestionV1GetResourceColumnsResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetResourceColumnsResponse.js +2 -0
- package/dist/api/types/IngestionV1GetRunResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1GetRunResponse.js +2 -0
- package/dist/api/types/IngestionV1ListConnectionsResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ListConnectionsResponse.js +2 -0
- package/dist/api/types/IngestionV1ListConnectorsResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ListConnectorsResponse.js +2 -0
- package/dist/api/types/IngestionV1ListPipelineNotifiersResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1ListPipelineNotifiersResponse.js +2 -0
- package/dist/api/types/IngestionV1ListPipelineVersionsResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ListPipelineVersionsResponse.js +2 -0
- package/dist/api/types/IngestionV1ListPipelinesResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ListPipelinesResponse.js +2 -0
- package/dist/api/types/IngestionV1ListRunsResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ListRunsResponse.js +2 -0
- package/dist/api/types/IngestionV1NotificationType.d.ts +9 -0
- package/dist/api/types/IngestionV1NotificationType.js +9 -0
- package/dist/api/types/IngestionV1Notifier.d.ts +23 -0
- package/dist/api/types/IngestionV1Notifier.js +2 -0
- package/dist/api/types/IngestionV1NotifierEvent.d.ts +14 -0
- package/dist/api/types/IngestionV1NotifierEvent.js +14 -0
- package/dist/api/types/IngestionV1NotifierInput.d.ts +16 -0
- package/dist/api/types/IngestionV1NotifierInput.js +2 -0
- package/dist/api/types/IngestionV1PaginationRequest.d.ts +10 -0
- package/dist/api/types/IngestionV1PaginationRequest.js +2 -0
- package/dist/api/types/IngestionV1PaginationResponse.d.ts +10 -0
- package/dist/api/types/IngestionV1PaginationResponse.js +2 -0
- package/dist/api/types/IngestionV1Pipeline.d.ts +28 -0
- package/dist/api/types/IngestionV1Pipeline.js +2 -0
- package/dist/api/types/IngestionV1PipelineEdge.d.ts +25 -0
- package/dist/api/types/IngestionV1PipelineEdge.js +2 -0
- package/dist/api/types/IngestionV1PipelineEdgeRun.d.ts +8 -0
- package/dist/api/types/IngestionV1PipelineEdgeRun.js +2 -0
- package/dist/api/types/IngestionV1PipelineGraph.d.ts +5 -0
- package/dist/api/types/IngestionV1PipelineGraph.js +2 -0
- package/dist/api/types/IngestionV1PipelineNode.d.ts +17 -0
- package/dist/api/types/IngestionV1PipelineNode.js +2 -0
- package/dist/api/types/IngestionV1PipelineSchedule.d.ts +11 -0
- package/dist/api/types/IngestionV1PipelineSchedule.js +2 -0
- package/dist/api/types/IngestionV1PipelineScheduleConfig.d.ts +7 -0
- package/dist/api/types/IngestionV1PipelineScheduleConfig.js +2 -0
- package/dist/api/types/IngestionV1PipelineScheduleOverlapPolicy.d.ts +10 -0
- package/dist/api/types/IngestionV1PipelineScheduleOverlapPolicy.js +10 -0
- package/dist/api/types/IngestionV1PipelineVersion.d.ts +11 -0
- package/dist/api/types/IngestionV1PipelineVersion.js +2 -0
- package/dist/api/types/IngestionV1RatePolicy.d.ts +7 -0
- package/dist/api/types/IngestionV1RatePolicy.js +2 -0
- package/dist/api/types/IngestionV1ReadMode.d.ts +7 -0
- package/dist/api/types/IngestionV1ReadMode.js +7 -0
- package/dist/api/types/IngestionV1ReplicationMode.d.ts +11 -0
- package/dist/api/types/IngestionV1ReplicationMode.js +11 -0
- package/dist/api/types/IngestionV1Requirement.d.ts +16 -0
- package/dist/api/types/IngestionV1Requirement.js +2 -0
- package/dist/api/types/IngestionV1RequirementKind.d.ts +6 -0
- package/dist/api/types/IngestionV1RequirementKind.js +6 -0
- package/dist/api/types/IngestionV1Resource.d.ts +8 -0
- package/dist/api/types/IngestionV1Resource.js +2 -0
- package/dist/api/types/IngestionV1ResourceColumn.d.ts +13 -0
- package/dist/api/types/IngestionV1ResourceColumn.js +2 -0
- package/dist/api/types/IngestionV1ResourceColumns.d.ts +5 -0
- package/dist/api/types/IngestionV1ResourceColumns.js +2 -0
- package/dist/api/types/IngestionV1ResourceCursorConfig.d.ts +5 -0
- package/dist/api/types/IngestionV1ResourceCursorConfig.js +2 -0
- package/dist/api/types/IngestionV1ResourceValidation.d.ts +11 -0
- package/dist/api/types/IngestionV1ResourceValidation.js +2 -0
- package/dist/api/types/IngestionV1RunEvent.d.ts +16 -0
- package/dist/api/types/IngestionV1RunEvent.js +2 -0
- package/dist/api/types/IngestionV1RunEventFields.d.ts +18 -0
- package/dist/api/types/IngestionV1RunEventFields.js +2 -0
- package/dist/api/types/IngestionV1RunInfo.d.ts +34 -0
- package/dist/api/types/IngestionV1RunInfo.js +2 -0
- package/dist/api/types/IngestionV1RunOptions.d.ts +18 -0
- package/dist/api/types/IngestionV1RunOptions.js +2 -0
- package/dist/api/types/IngestionV1RunPipelineResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1RunPipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1RunResourceState.d.ts +11 -0
- package/dist/api/types/IngestionV1RunResourceState.js +2 -0
- package/dist/api/types/IngestionV1RunSignal.d.ts +9 -0
- package/dist/api/types/IngestionV1RunSignal.js +9 -0
- package/dist/api/types/IngestionV1RunSnapshot.d.ts +6 -0
- package/dist/api/types/IngestionV1RunSnapshot.js +2 -0
- package/dist/api/types/IngestionV1RunStatus.d.ts +13 -0
- package/dist/api/types/IngestionV1RunStatus.js +13 -0
- package/dist/api/types/IngestionV1SignalRunResponse.d.ts +8 -0
- package/dist/api/types/IngestionV1SignalRunResponse.js +2 -0
- package/dist/api/types/IngestionV1SortBy.d.ts +7 -0
- package/dist/api/types/IngestionV1SortBy.js +7 -0
- package/dist/api/types/IngestionV1SortOrder.d.ts +6 -0
- package/dist/api/types/IngestionV1SortOrder.js +6 -0
- package/dist/api/types/IngestionV1SortingRequest.d.ts +5 -0
- package/dist/api/types/IngestionV1SortingRequest.js +2 -0
- package/dist/api/types/IngestionV1TailRunRequest.d.ts +8 -0
- package/dist/api/types/IngestionV1TailRunRequest.js +2 -0
- package/dist/api/types/IngestionV1TailRunResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1TailRunResponse.js +2 -0
- package/dist/api/types/IngestionV1UpdateConnectionResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1UpdateConnectionResponse.js +2 -0
- package/dist/api/types/IngestionV1UpdatePipelineNotifierResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1UpdatePipelineNotifierResponse.js +2 -0
- package/dist/api/types/IngestionV1UpdatePipelineResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1UpdatePipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1UpdatePipelineScheduleResponse.d.ts +4 -0
- package/dist/api/types/IngestionV1UpdatePipelineScheduleResponse.js +2 -0
- package/dist/api/types/IngestionV1ValidateConfigResponse.d.ts +5 -0
- package/dist/api/types/IngestionV1ValidateConfigResponse.js +2 -0
- package/dist/api/types/IngestionV1ValidatePipelineResponse.d.ts +7 -0
- package/dist/api/types/IngestionV1ValidatePipelineResponse.js +2 -0
- package/dist/api/types/IngestionV1ValidationError.d.ts +4 -0
- package/dist/api/types/IngestionV1ValidationError.js +2 -0
- package/dist/api/types/IngestionV1WorkerConfiguration.d.ts +12 -0
- package/dist/api/types/IngestionV1WorkerConfiguration.js +2 -0
- package/dist/api/types/IngestionV1WorkerResources.d.ts +10 -0
- package/dist/api/types/IngestionV1WorkerResources.js +2 -0
- package/dist/api/types/IngestionV1WorkerToleration.d.ts +11 -0
- package/dist/api/types/IngestionV1WorkerToleration.js +2 -0
- package/dist/api/types/IngestionV1WriteMode.d.ts +12 -0
- package/dist/api/types/IngestionV1WriteMode.js +12 -0
- package/dist/api/types/MetricsV1AggregateRow.d.ts +7 -0
- package/dist/api/types/MetricsV1AggregateRow.js +2 -0
- package/dist/api/types/MetricsV1Metric.d.ts +18 -0
- package/dist/api/types/MetricsV1Metric.js +18 -0
- package/dist/api/types/MetricsV1MetricDimension.d.ts +8 -0
- package/dist/api/types/MetricsV1MetricDimension.js +8 -0
- package/dist/api/types/MetricsV1MetricFilter.d.ts +9 -0
- package/dist/api/types/MetricsV1MetricFilter.js +2 -0
- package/dist/api/types/MetricsV1MetricGranularity.d.ts +7 -0
- package/dist/api/types/MetricsV1MetricGranularity.js +7 -0
- package/dist/api/types/MetricsV1QueryAggregateResponse.d.ts +4 -0
- package/dist/api/types/MetricsV1QueryAggregateResponse.js +2 -0
- package/dist/api/types/MetricsV1QueryTimeseriesResponse.d.ts +4 -0
- package/dist/api/types/MetricsV1QueryTimeseriesResponse.js +2 -0
- package/dist/api/types/MetricsV1Timeseries.d.ts +12 -0
- package/dist/api/types/MetricsV1Timeseries.js +2 -0
- package/dist/api/types/MetricsV1TimeseriesPoint.d.ts +7 -0
- package/dist/api/types/MetricsV1TimeseriesPoint.js +2 -0
- package/dist/api/types/index.d.ts +129 -0
- package/dist/api/types/index.js +129 -0
- package/dist/auth/OAuthAuthProvider.d.ts +45 -0
- package/dist/auth/OAuthAuthProvider.js +124 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/core/auth/AuthProvider.d.ts +8 -0
- package/dist/core/auth/AuthProvider.js +6 -0
- package/dist/core/auth/AuthRequest.d.ts +9 -0
- package/dist/core/auth/AuthRequest.js +1 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +29 -0
- package/dist/core/auth/BearerToken.d.ts +7 -0
- package/dist/core/auth/BearerToken.js +13 -0
- package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/core/auth/NoOpAuthProvider.js +5 -0
- package/dist/core/auth/index.d.ts +5 -0
- package/dist/core/auth/index.js +4 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/base64.js +22 -0
- package/dist/core/exports.d.ts +1 -0
- package/dist/core/exports.js +1 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +1 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/core/fetcher/BinaryResponse.js +14 -0
- package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/core/fetcher/EndpointMetadata.js +1 -0
- package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/core/fetcher/EndpointSupplier.js +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/core/fetcher/Fetcher.js +223 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +83 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +90 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +40 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +10 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +5 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +30 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +3 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +8 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +13 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +66 -0
- package/dist/core/fetcher/index.d.ts +13 -0
- package/dist/core/fetcher/index.js +7 -0
- package/dist/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/core/fetcher/makePassthroughRequest.js +141 -0
- package/dist/core/fetcher/makeRequest.d.ts +6 -0
- package/dist/core/fetcher/makeRequest.js +53 -0
- package/dist/core/fetcher/redactUrl.d.ts +2 -0
- package/dist/core/fetcher/redactUrl.js +84 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +56 -0
- package/dist/core/fetcher/signals.d.ts +5 -0
- package/dist/core/fetcher/signals.js +28 -0
- package/dist/core/headers.d.ts +2 -0
- package/dist/core/headers.js +27 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +6 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +19 -0
- package/dist/core/logging/exports.d.ts +18 -0
- package/dist/core/logging/exports.js +9 -0
- package/dist/core/logging/index.d.ts +1 -0
- package/dist/core/logging/index.js +1 -0
- package/dist/core/logging/logger.d.ts +126 -0
- package/dist/core/logging/logger.js +140 -0
- package/dist/core/requestBody.d.ts +12 -0
- package/dist/core/requestBody.js +23 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +1 -0
- package/dist/core/runtime/runtime.d.ts +28 -0
- package/dist/core/runtime/runtime.js +171 -0
- package/dist/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/core/url/QueryStringBuilder.js +78 -0
- package/dist/core/url/encodePathParam.d.ts +1 -0
- package/dist/core/url/encodePathParam.js +18 -0
- package/dist/core/url/index.d.ts +4 -0
- package/dist/core/url/index.js +4 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +65 -0
- package/dist/core/url/qs.d.ts +7 -0
- package/dist/core/url/qs.js +76 -0
- package/dist/errors/FilamentError.d.ts +15 -0
- package/dist/errors/FilamentError.js +38 -0
- package/dist/errors/FilamentTimeoutError.d.ts +6 -0
- package/dist/errors/FilamentTimeoutError.js +15 -0
- package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/errors/handleNonStatusCodeError.js +32 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +2 -0
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/package.json +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logging/exports.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logging/exports.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RawResponse } from "./RawResponse.js";
|
|
2
|
+
/**
|
|
3
|
+
* The response of an API call.
|
|
4
|
+
* It is a successful response or a failed response.
|
|
5
|
+
*/
|
|
6
|
+
export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | FailedResponse<Failure>;
|
|
7
|
+
export interface SuccessfulResponse<T> {
|
|
8
|
+
ok: true;
|
|
9
|
+
body: T;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `rawResponse` instead
|
|
12
|
+
*/
|
|
13
|
+
headers?: Record<string, any>;
|
|
14
|
+
rawResponse: RawResponse;
|
|
15
|
+
}
|
|
16
|
+
export interface FailedResponse<T> {
|
|
17
|
+
ok: false;
|
|
18
|
+
error: T;
|
|
19
|
+
rawResponse: RawResponse;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type BinaryResponse = {
|
|
2
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
3
|
+
bodyUsed: Response["bodyUsed"];
|
|
4
|
+
/**
|
|
5
|
+
* Returns a ReadableStream of the response body.
|
|
6
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body)
|
|
7
|
+
*/
|
|
8
|
+
stream: () => Response["body"];
|
|
9
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */
|
|
10
|
+
arrayBuffer: () => ReturnType<Response["arrayBuffer"]>;
|
|
11
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
|
|
12
|
+
blob: () => ReturnType<Response["blob"]>;
|
|
13
|
+
/**
|
|
14
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
15
|
+
* Some versions of the Fetch API may not support this method.
|
|
16
|
+
*/
|
|
17
|
+
bytes?(): Promise<Uint8Array>;
|
|
18
|
+
};
|
|
19
|
+
export declare function getBinaryResponse(response: Response): BinaryResponse;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function getBinaryResponse(response) {
|
|
2
|
+
const binaryResponse = {
|
|
3
|
+
get bodyUsed() {
|
|
4
|
+
return response.bodyUsed;
|
|
5
|
+
},
|
|
6
|
+
stream: () => response.body,
|
|
7
|
+
arrayBuffer: response.arrayBuffer.bind(response),
|
|
8
|
+
blob: response.blob.bind(response),
|
|
9
|
+
};
|
|
10
|
+
if ("bytes" in response && typeof response.bytes === "function") {
|
|
11
|
+
binaryResponse.bytes = response.bytes.bind(response);
|
|
12
|
+
}
|
|
13
|
+
return binaryResponse;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SecuritySchemeKey = string;
|
|
2
|
+
/**
|
|
3
|
+
* A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme.
|
|
4
|
+
* All schemes in the collection must be satisfied for authentication to be successful.
|
|
5
|
+
*/
|
|
6
|
+
export type SecuritySchemeCollection = Record<SecuritySchemeKey, AuthScope[]>;
|
|
7
|
+
export type AuthScope = string;
|
|
8
|
+
export type EndpointMetadata = {
|
|
9
|
+
/**
|
|
10
|
+
* An array of security scheme collections. Each collection represents an alternative way to authenticate.
|
|
11
|
+
*/
|
|
12
|
+
security?: SecuritySchemeCollection[];
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
2
|
+
import type { Supplier } from "./Supplier.js";
|
|
3
|
+
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
+
endpointMetadata?: EndpointMetadata;
|
|
5
|
+
}) => T | Promise<T>;
|
|
6
|
+
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
|
+
export declare const EndpointSupplier: {
|
|
8
|
+
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
+
endpointMetadata?: EndpointMetadata;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type LogConfig, type Logger } from "../logging/logger.js";
|
|
2
|
+
import type { APIResponse } from "./APIResponse.js";
|
|
3
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
4
|
+
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
5
|
+
export declare namespace Fetcher {
|
|
6
|
+
interface Args {
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
headers?: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`).
|
|
13
|
+
* Retained for backwards compatibility with custom fetchers and callers that
|
|
14
|
+
* still construct request args with a query-parameter object.
|
|
15
|
+
*/
|
|
16
|
+
queryParameters?: Record<string, unknown>;
|
|
17
|
+
queryString?: string;
|
|
18
|
+
body?: unknown;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
withCredentials?: boolean;
|
|
22
|
+
abortSignal?: AbortSignal;
|
|
23
|
+
requestType?: "json" | "file" | "bytes" | "form" | "other";
|
|
24
|
+
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer" | "binary-response";
|
|
25
|
+
duplex?: "half";
|
|
26
|
+
endpointMetadata?: EndpointMetadata;
|
|
27
|
+
fetchFn?: typeof fetch;
|
|
28
|
+
logging?: LogConfig | Logger;
|
|
29
|
+
}
|
|
30
|
+
type Error = FailedStatusCodeError | NonJsonError | BodyIsNullError | TimeoutError | UnknownError;
|
|
31
|
+
interface FailedStatusCodeError {
|
|
32
|
+
reason: "status-code";
|
|
33
|
+
statusCode: number;
|
|
34
|
+
body: unknown;
|
|
35
|
+
}
|
|
36
|
+
interface NonJsonError {
|
|
37
|
+
reason: "non-json";
|
|
38
|
+
statusCode: number;
|
|
39
|
+
rawBody: string;
|
|
40
|
+
}
|
|
41
|
+
interface BodyIsNullError {
|
|
42
|
+
reason: "body-is-null";
|
|
43
|
+
statusCode: number;
|
|
44
|
+
}
|
|
45
|
+
interface TimeoutError {
|
|
46
|
+
reason: "timeout";
|
|
47
|
+
cause?: unknown;
|
|
48
|
+
}
|
|
49
|
+
interface UnknownError {
|
|
50
|
+
reason: "unknown";
|
|
51
|
+
errorMessage: string;
|
|
52
|
+
cause?: unknown;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
|
|
56
|
+
export declare const fetcher: FetchFunction;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { toJson } from "../json.js";
|
|
2
|
+
import { createLogger } from "../logging/logger.js";
|
|
3
|
+
import { createRequestUrl } from "./createRequestUrl.js";
|
|
4
|
+
import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
5
|
+
import { getErrorResponseBody } from "./getErrorResponseBody.js";
|
|
6
|
+
import { getFetchFn } from "./getFetchFn.js";
|
|
7
|
+
import { getRequestBody } from "./getRequestBody.js";
|
|
8
|
+
import { getResponseBody } from "./getResponseBody.js";
|
|
9
|
+
import { Headers } from "./Headers.js";
|
|
10
|
+
import { makeRequest } from "./makeRequest.js";
|
|
11
|
+
import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js";
|
|
12
|
+
import { redactUrl, SENSITIVE_QUERY_PARAMS } from "./redactUrl.js";
|
|
13
|
+
import { requestWithRetries } from "./requestWithRetries.js";
|
|
14
|
+
const SENSITIVE_HEADERS = new Set([
|
|
15
|
+
"authorization",
|
|
16
|
+
"www-authenticate",
|
|
17
|
+
"x-api-key",
|
|
18
|
+
"api-key",
|
|
19
|
+
"apikey",
|
|
20
|
+
"x-api-token",
|
|
21
|
+
"x-auth-token",
|
|
22
|
+
"auth-token",
|
|
23
|
+
"cookie",
|
|
24
|
+
"set-cookie",
|
|
25
|
+
"proxy-authorization",
|
|
26
|
+
"proxy-authenticate",
|
|
27
|
+
"x-csrf-token",
|
|
28
|
+
"x-xsrf-token",
|
|
29
|
+
"x-session-token",
|
|
30
|
+
"x-access-token",
|
|
31
|
+
]);
|
|
32
|
+
function redactHeaders(headers) {
|
|
33
|
+
const filtered = {};
|
|
34
|
+
for (const [key, value] of headers instanceof Headers ? headers.entries() : Object.entries(headers)) {
|
|
35
|
+
if (SENSITIVE_HEADERS.has(key.toLowerCase())) {
|
|
36
|
+
filtered[key] = "[REDACTED]";
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
filtered[key] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return filtered;
|
|
43
|
+
}
|
|
44
|
+
function redactQueryParameters(queryParameters) {
|
|
45
|
+
if (queryParameters == null) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const redacted = {};
|
|
49
|
+
for (const [key, value] of Object.entries(queryParameters)) {
|
|
50
|
+
redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value;
|
|
51
|
+
}
|
|
52
|
+
return redacted;
|
|
53
|
+
}
|
|
54
|
+
async function getHeaders(args) {
|
|
55
|
+
const newHeaders = new Headers();
|
|
56
|
+
newHeaders.set("Accept", args.responseType === "json"
|
|
57
|
+
? "application/json"
|
|
58
|
+
: args.responseType === "text"
|
|
59
|
+
? "text/plain"
|
|
60
|
+
: args.responseType === "sse"
|
|
61
|
+
? "text/event-stream"
|
|
62
|
+
: "*/*");
|
|
63
|
+
if (args.body !== undefined && args.contentType != null) {
|
|
64
|
+
newHeaders.set("Content-Type", args.contentType);
|
|
65
|
+
}
|
|
66
|
+
if (args.headers == null) {
|
|
67
|
+
return newHeaders;
|
|
68
|
+
}
|
|
69
|
+
for (const [key, value] of Object.entries(args.headers)) {
|
|
70
|
+
const result = await EndpointSupplier.get(value, { endpointMetadata: args.endpointMetadata ?? {} });
|
|
71
|
+
if (typeof result === "string") {
|
|
72
|
+
newHeaders.set(key, result);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (result == null) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
newHeaders.set(key, `${result}`);
|
|
79
|
+
}
|
|
80
|
+
return newHeaders;
|
|
81
|
+
}
|
|
82
|
+
export async function fetcherImpl(args) {
|
|
83
|
+
let url = args.url;
|
|
84
|
+
if (args.queryString != null && args.queryString.length > 0) {
|
|
85
|
+
url = `${url}?${args.queryString}`;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
url = createRequestUrl(args.url, args.queryParameters);
|
|
89
|
+
}
|
|
90
|
+
const requestBody = await getRequestBody({
|
|
91
|
+
body: args.body,
|
|
92
|
+
type: args.requestType ?? "other",
|
|
93
|
+
});
|
|
94
|
+
const fetchFn = args.fetchFn ?? (await getFetchFn());
|
|
95
|
+
const headers = await getHeaders(args);
|
|
96
|
+
const logger = createLogger(args.logging);
|
|
97
|
+
if (logger.isDebug()) {
|
|
98
|
+
const metadata = {
|
|
99
|
+
method: args.method,
|
|
100
|
+
url: redactUrl(url),
|
|
101
|
+
headers: redactHeaders(headers),
|
|
102
|
+
queryParameters: redactQueryParameters(args.queryParameters),
|
|
103
|
+
hasBody: requestBody != null,
|
|
104
|
+
};
|
|
105
|
+
logger.debug("Making HTTP request", metadata);
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const response = await requestWithRetries(async () => makeRequest(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex, args.responseType === "streaming" || args.responseType === "sse"), args.maxRetries);
|
|
109
|
+
if (response.status >= 200 && response.status < 400) {
|
|
110
|
+
if (logger.isDebug()) {
|
|
111
|
+
const metadata = {
|
|
112
|
+
method: args.method,
|
|
113
|
+
url: redactUrl(url),
|
|
114
|
+
statusCode: response.status,
|
|
115
|
+
responseHeaders: redactHeaders(response.headers),
|
|
116
|
+
};
|
|
117
|
+
logger.debug("HTTP request succeeded", metadata);
|
|
118
|
+
}
|
|
119
|
+
const body = await getResponseBody(response, args.responseType);
|
|
120
|
+
return {
|
|
121
|
+
ok: true,
|
|
122
|
+
body: body,
|
|
123
|
+
headers: response.headers,
|
|
124
|
+
rawResponse: toRawResponse(response),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
if (logger.isError()) {
|
|
129
|
+
const metadata = {
|
|
130
|
+
method: args.method,
|
|
131
|
+
url: redactUrl(url),
|
|
132
|
+
statusCode: response.status,
|
|
133
|
+
responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries())),
|
|
134
|
+
};
|
|
135
|
+
logger.error("HTTP request failed with error status", metadata);
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
error: {
|
|
140
|
+
reason: "status-code",
|
|
141
|
+
statusCode: response.status,
|
|
142
|
+
body: await getErrorResponseBody(response),
|
|
143
|
+
},
|
|
144
|
+
rawResponse: toRawResponse(response),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
if (args.abortSignal?.aborted) {
|
|
150
|
+
if (logger.isError()) {
|
|
151
|
+
const metadata = {
|
|
152
|
+
method: args.method,
|
|
153
|
+
url: redactUrl(url),
|
|
154
|
+
};
|
|
155
|
+
logger.error("HTTP request was aborted", metadata);
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
ok: false,
|
|
159
|
+
error: {
|
|
160
|
+
reason: "unknown",
|
|
161
|
+
errorMessage: "The user aborted a request",
|
|
162
|
+
cause: error,
|
|
163
|
+
},
|
|
164
|
+
rawResponse: abortRawResponse,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
else if (error instanceof Error && error.name === "AbortError") {
|
|
168
|
+
if (logger.isError()) {
|
|
169
|
+
const metadata = {
|
|
170
|
+
method: args.method,
|
|
171
|
+
url: redactUrl(url),
|
|
172
|
+
timeoutMs: args.timeoutMs,
|
|
173
|
+
};
|
|
174
|
+
logger.error("HTTP request timed out", metadata);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
ok: false,
|
|
178
|
+
error: {
|
|
179
|
+
reason: "timeout",
|
|
180
|
+
cause: error,
|
|
181
|
+
},
|
|
182
|
+
rawResponse: abortRawResponse,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
else if (error instanceof Error) {
|
|
186
|
+
if (logger.isError()) {
|
|
187
|
+
const metadata = {
|
|
188
|
+
method: args.method,
|
|
189
|
+
url: redactUrl(url),
|
|
190
|
+
errorMessage: error.message,
|
|
191
|
+
};
|
|
192
|
+
logger.error("HTTP request failed with error", metadata);
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
ok: false,
|
|
196
|
+
error: {
|
|
197
|
+
reason: "unknown",
|
|
198
|
+
errorMessage: error.message,
|
|
199
|
+
cause: error,
|
|
200
|
+
},
|
|
201
|
+
rawResponse: unknownRawResponse,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (logger.isError()) {
|
|
205
|
+
const metadata = {
|
|
206
|
+
method: args.method,
|
|
207
|
+
url: redactUrl(url),
|
|
208
|
+
error: toJson(error),
|
|
209
|
+
};
|
|
210
|
+
logger.error("HTTP request failed with unknown error", metadata);
|
|
211
|
+
}
|
|
212
|
+
return {
|
|
213
|
+
ok: false,
|
|
214
|
+
error: {
|
|
215
|
+
reason: "unknown",
|
|
216
|
+
errorMessage: toJson(error),
|
|
217
|
+
cause: error,
|
|
218
|
+
},
|
|
219
|
+
rawResponse: unknownRawResponse,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export const fetcher = fetcherImpl;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
let Headers;
|
|
2
|
+
if (typeof globalThis.Headers !== "undefined") {
|
|
3
|
+
Headers = globalThis.Headers;
|
|
4
|
+
}
|
|
5
|
+
else {
|
|
6
|
+
Headers = class Headers {
|
|
7
|
+
headers;
|
|
8
|
+
constructor(init) {
|
|
9
|
+
this.headers = new Map();
|
|
10
|
+
if (init) {
|
|
11
|
+
if (init instanceof Headers) {
|
|
12
|
+
init.forEach((value, key) => this.append(key, value));
|
|
13
|
+
}
|
|
14
|
+
else if (Array.isArray(init)) {
|
|
15
|
+
for (const [key, value] of init) {
|
|
16
|
+
if (typeof key === "string" && typeof value === "string") {
|
|
17
|
+
this.append(key, value);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
throw new TypeError("Each header entry must be a [string, string] tuple");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
for (const [key, value] of Object.entries(init)) {
|
|
26
|
+
if (typeof value === "string") {
|
|
27
|
+
this.append(key, value);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new TypeError("Header values must be strings");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
append(name, value) {
|
|
37
|
+
const key = name.toLowerCase();
|
|
38
|
+
const existing = this.headers.get(key) || [];
|
|
39
|
+
this.headers.set(key, [...existing, value]);
|
|
40
|
+
}
|
|
41
|
+
delete(name) {
|
|
42
|
+
const key = name.toLowerCase();
|
|
43
|
+
this.headers.delete(key);
|
|
44
|
+
}
|
|
45
|
+
get(name) {
|
|
46
|
+
const key = name.toLowerCase();
|
|
47
|
+
const values = this.headers.get(key);
|
|
48
|
+
return values ? values.join(", ") : null;
|
|
49
|
+
}
|
|
50
|
+
has(name) {
|
|
51
|
+
const key = name.toLowerCase();
|
|
52
|
+
return this.headers.has(key);
|
|
53
|
+
}
|
|
54
|
+
set(name, value) {
|
|
55
|
+
const key = name.toLowerCase();
|
|
56
|
+
this.headers.set(key, [value]);
|
|
57
|
+
}
|
|
58
|
+
forEach(callbackfn, thisArg) {
|
|
59
|
+
const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn;
|
|
60
|
+
this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this));
|
|
61
|
+
}
|
|
62
|
+
getSetCookie() {
|
|
63
|
+
return this.headers.get("set-cookie") || [];
|
|
64
|
+
}
|
|
65
|
+
*entries() {
|
|
66
|
+
for (const [key, values] of this.headers.entries()) {
|
|
67
|
+
yield [key, values.join(", ")];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
*keys() {
|
|
71
|
+
yield* this.headers.keys();
|
|
72
|
+
}
|
|
73
|
+
*values() {
|
|
74
|
+
for (const values of this.headers.values()) {
|
|
75
|
+
yield values.join(", ");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
[Symbol.iterator]() {
|
|
79
|
+
return this.entries();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export { Headers };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { WithRawResponse } from "./RawResponse.js";
|
|
2
|
+
/**
|
|
3
|
+
* A promise that returns the parsed response and lets you retrieve the raw response too.
|
|
4
|
+
*/
|
|
5
|
+
export declare class HttpResponsePromise<T> extends Promise<T> {
|
|
6
|
+
private innerPromise;
|
|
7
|
+
private unwrappedPromise;
|
|
8
|
+
private constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Creates an `HttpResponsePromise` from a function that returns a promise.
|
|
11
|
+
*
|
|
12
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
13
|
+
* @param args - Arguments to pass to the function.
|
|
14
|
+
* @returns An `HttpResponsePromise` instance.
|
|
15
|
+
*/
|
|
16
|
+
static fromFunction<F extends (...args: never[]) => Promise<WithRawResponse<T>>, T>(fn: F, ...args: Parameters<F>): HttpResponsePromise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a function that returns an `HttpResponsePromise` from a function that returns a promise.
|
|
19
|
+
*
|
|
20
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
21
|
+
* @returns A function that returns an `HttpResponsePromise` instance.
|
|
22
|
+
*/
|
|
23
|
+
static interceptFunction<F extends (...args: never[]) => Promise<WithRawResponse<T>>, T = Awaited<ReturnType<F>>["data"]>(fn: F): (...args: Parameters<F>) => HttpResponsePromise<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates an `HttpResponsePromise` from an existing promise.
|
|
26
|
+
*
|
|
27
|
+
* @param promise - A promise resolving to a `WithRawResponse` object.
|
|
28
|
+
* @returns An `HttpResponsePromise` instance.
|
|
29
|
+
*/
|
|
30
|
+
static fromPromise<T>(promise: Promise<WithRawResponse<T>>): HttpResponsePromise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an `HttpResponsePromise` from an executor function.
|
|
33
|
+
*
|
|
34
|
+
* @param executor - A function that takes resolve and reject callbacks to create a promise.
|
|
35
|
+
* @returns An `HttpResponsePromise` instance.
|
|
36
|
+
*/
|
|
37
|
+
static fromExecutor<T>(executor: (resolve: (value: WithRawResponse<T>) => void, reject: (reason?: unknown) => void) => void): HttpResponsePromise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates an `HttpResponsePromise` from a resolved result.
|
|
40
|
+
*
|
|
41
|
+
* @param result - A `WithRawResponse` object to resolve immediately.
|
|
42
|
+
* @returns An `HttpResponsePromise` instance.
|
|
43
|
+
*/
|
|
44
|
+
static fromResult<T>(result: WithRawResponse<T>): HttpResponsePromise<T>;
|
|
45
|
+
private unwrap;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
48
|
+
/** @inheritdoc */
|
|
49
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
50
|
+
/** @inheritdoc */
|
|
51
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves the data and raw response.
|
|
54
|
+
*
|
|
55
|
+
* @returns A promise resolving to a `WithRawResponse` object.
|
|
56
|
+
*/
|
|
57
|
+
withRawResponse(): Promise<WithRawResponse<T>>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A promise that returns the parsed response and lets you retrieve the raw response too.
|
|
3
|
+
*/
|
|
4
|
+
export class HttpResponsePromise extends Promise {
|
|
5
|
+
innerPromise;
|
|
6
|
+
unwrappedPromise;
|
|
7
|
+
constructor(promise) {
|
|
8
|
+
// Initialize with a no-op to avoid premature parsing
|
|
9
|
+
super((resolve) => {
|
|
10
|
+
resolve(undefined);
|
|
11
|
+
});
|
|
12
|
+
this.innerPromise = promise;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates an `HttpResponsePromise` from a function that returns a promise.
|
|
16
|
+
*
|
|
17
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
18
|
+
* @param args - Arguments to pass to the function.
|
|
19
|
+
* @returns An `HttpResponsePromise` instance.
|
|
20
|
+
*/
|
|
21
|
+
static fromFunction(fn, ...args) {
|
|
22
|
+
return new HttpResponsePromise(fn(...args));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a function that returns an `HttpResponsePromise` from a function that returns a promise.
|
|
26
|
+
*
|
|
27
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
28
|
+
* @returns A function that returns an `HttpResponsePromise` instance.
|
|
29
|
+
*/
|
|
30
|
+
static interceptFunction(fn) {
|
|
31
|
+
return (...args) => {
|
|
32
|
+
return HttpResponsePromise.fromPromise(fn(...args));
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates an `HttpResponsePromise` from an existing promise.
|
|
37
|
+
*
|
|
38
|
+
* @param promise - A promise resolving to a `WithRawResponse` object.
|
|
39
|
+
* @returns An `HttpResponsePromise` instance.
|
|
40
|
+
*/
|
|
41
|
+
static fromPromise(promise) {
|
|
42
|
+
return new HttpResponsePromise(promise);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates an `HttpResponsePromise` from an executor function.
|
|
46
|
+
*
|
|
47
|
+
* @param executor - A function that takes resolve and reject callbacks to create a promise.
|
|
48
|
+
* @returns An `HttpResponsePromise` instance.
|
|
49
|
+
*/
|
|
50
|
+
static fromExecutor(executor) {
|
|
51
|
+
const promise = new Promise(executor);
|
|
52
|
+
return new HttpResponsePromise(promise);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates an `HttpResponsePromise` from a resolved result.
|
|
56
|
+
*
|
|
57
|
+
* @param result - A `WithRawResponse` object to resolve immediately.
|
|
58
|
+
* @returns An `HttpResponsePromise` instance.
|
|
59
|
+
*/
|
|
60
|
+
static fromResult(result) {
|
|
61
|
+
const promise = Promise.resolve(result);
|
|
62
|
+
return new HttpResponsePromise(promise);
|
|
63
|
+
}
|
|
64
|
+
unwrap() {
|
|
65
|
+
if (!this.unwrappedPromise) {
|
|
66
|
+
this.unwrappedPromise = this.innerPromise.then(({ data }) => data);
|
|
67
|
+
}
|
|
68
|
+
return this.unwrappedPromise;
|
|
69
|
+
}
|
|
70
|
+
/** @inheritdoc */
|
|
71
|
+
then(onfulfilled, onrejected) {
|
|
72
|
+
return this.unwrap().then(onfulfilled, onrejected);
|
|
73
|
+
}
|
|
74
|
+
/** @inheritdoc */
|
|
75
|
+
catch(onrejected) {
|
|
76
|
+
return this.unwrap().catch(onrejected);
|
|
77
|
+
}
|
|
78
|
+
/** @inheritdoc */
|
|
79
|
+
finally(onfinally) {
|
|
80
|
+
return this.unwrap().finally(onfinally);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Retrieves the data and raw response.
|
|
84
|
+
*
|
|
85
|
+
* @returns A promise resolving to a `WithRawResponse` object.
|
|
86
|
+
*/
|
|
87
|
+
async withRawResponse() {
|
|
88
|
+
return await this.innerPromise;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw response from the fetch call excluding the body.
|
|
3
|
+
*/
|
|
4
|
+
export type RawResponse = Omit<{
|
|
5
|
+
[K in keyof Response as Response[K] extends Function ? never : K]: Response[K];
|
|
6
|
+
}, "ok" | "body" | "bodyUsed">;
|
|
7
|
+
/**
|
|
8
|
+
* A raw response indicating that the request was aborted.
|
|
9
|
+
*/
|
|
10
|
+
export declare const abortRawResponse: RawResponse;
|
|
11
|
+
/**
|
|
12
|
+
* A raw response indicating an unknown error.
|
|
13
|
+
*/
|
|
14
|
+
export declare const unknownRawResponse: RawResponse;
|
|
15
|
+
/**
|
|
16
|
+
* Converts a `RawResponse` object into a `RawResponse` by extracting its properties,
|
|
17
|
+
* excluding the `body` and `bodyUsed` fields.
|
|
18
|
+
*
|
|
19
|
+
* @param response - The `RawResponse` object to convert.
|
|
20
|
+
* @returns A `RawResponse` object containing the extracted properties of the input response.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toRawResponse(response: Response): RawResponse;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a `RawResponse` from a standard `Response` object.
|
|
25
|
+
*/
|
|
26
|
+
export interface WithRawResponse<T> {
|
|
27
|
+
readonly data: T;
|
|
28
|
+
readonly rawResponse: RawResponse;
|
|
29
|
+
}
|