Skip to content

Commit

Permalink
fix: fix all next cursors
Browse files Browse the repository at this point in the history
This is likely a breaking change for external consumers. However behaviour of this function was incorrect at all times, which is why we will release as patch
  • Loading branch information
eljefedelrodeodeljefe committed Jan 10, 2019
1 parent 6672096 commit 7495e35
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/v0/auditActions.ts
Expand Up @@ -67,7 +67,7 @@ export class AuditActions {
const response = await this.http.getClient().get(uri)

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ ...q, uri: response.data.cursor.next })
next = (): Promise<AuditsResponse> => this.getAll({ ...q, uri: response.data.cursor.next })
}

return resolve({
Expand Down
2 changes: 1 addition & 1 deletion src/v0/branches.ts
Expand Up @@ -82,7 +82,7 @@ export class Branches {
}

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<BranchesResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down
6 changes: 3 additions & 3 deletions src/v0/deliveries.ts
Expand Up @@ -173,7 +173,7 @@ export class Deliveries {
const response = await this.http.getClient().get(uri)

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<DeliveriesResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down Expand Up @@ -248,7 +248,7 @@ export class Deliveries {
return new Promise(async (resolve, reject) => {
let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/${deliveryId}/pdf?format=uri`
}/${deliveryId}/pdf?format=uri`

try {
const response = await this.http.getClient().post(uri, null, {
Expand Down Expand Up @@ -302,7 +302,7 @@ export class Deliveries {

let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/${deliveryId}/in_progress`
}/${deliveryId}/in_progress`

if (query && query.embed) {
const queryString = query.embed
Expand Down
2 changes: 1 addition & 1 deletion src/v0/invoices.ts
Expand Up @@ -132,7 +132,7 @@ export class Invoices {
const response = await this.http.getClient().get(uri)

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<InvoicesResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down
10 changes: 5 additions & 5 deletions src/v0/vouchers.ts
Expand Up @@ -96,7 +96,7 @@ export class Vouchers {

uri = `${this.options.base}${this.endpoint}/${this.options.user}${
queryString ? `?${queryString}` : ''
}`
}`
}

const response = await this.http.getClient().get(uri)
Expand All @@ -105,7 +105,7 @@ export class Vouchers {
}

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<VouchersResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down Expand Up @@ -222,7 +222,7 @@ export class Vouchers {
}

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<VoucherLogsResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down Expand Up @@ -331,7 +331,7 @@ export class VoucherLogs {

uri = `${this.options.base}${this.endpoint}/${this.options.user}/logs${
queryString ? `?${queryString}` : ''
}`
}`
}

const response = await this.http.getClient().get(uri)
Expand All @@ -340,7 +340,7 @@ export class VoucherLogs {
}

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<VoucherLogsResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down
2 changes: 1 addition & 1 deletion src/v1/products.ts
Expand Up @@ -142,7 +142,7 @@ export class Products {
response.status !== 200 && reject(new errors.ProductsFetchFailed())

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<ProductsResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down
2 changes: 1 addition & 1 deletion src/v1/registers.ts
Expand Up @@ -55,7 +55,7 @@ export class Registers {
const response = await this.http.getClient().get(uri)

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<RegistersResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand Down
12 changes: 6 additions & 6 deletions src/v1/transactions.ts
Expand Up @@ -60,7 +60,7 @@ export class Transactions {
const response = await this.http.getClient().get(uri)

if (response.data.cursor && response.data.cursor.next) {
next = this.getAll({ uri: response.data.cursor.next })
next = (): Promise<TransactionResponse> => this.getAll({ uri: response.data.cursor.next })
}

return resolve({
Expand All @@ -85,7 +85,7 @@ export class Transactions {
} else {
uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/${transactionId}/legacy/${template}/pdf`
}/${transactionId}/legacy/${template}/pdf`
}

if (query && query.format) {
Expand Down Expand Up @@ -131,7 +131,7 @@ export class Signing {
try {
let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/initialise`
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/initialise`

const response = await this.http.getClient().post(uri, signingConfiguration, {
headers: {
Expand All @@ -157,7 +157,7 @@ export class Signing {
try {
let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/yearly`
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/yearly`

const response = await this.http.getClient().post(uri, undefined, {
headers: {
Expand All @@ -183,7 +183,7 @@ export class Signing {
try {
let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/monthly`
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/monthly`

const response = await this.http.getClient().post(uri, undefined, {
headers: {
Expand All @@ -209,7 +209,7 @@ export class Signing {
try {
let uri = `${this.options.base}${this.endpoint}/${
this.options.user
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/zero`
}/legacy/signing/${singingResourceType}/${singingResource}/${signingSystem}/zero`

const response = await this.http.getClient().post(uri, undefined, {
headers: {
Expand Down

0 comments on commit 7495e35

Please sign in to comment.