@forge/storage
Advanced tools
Comparing version 1.5.11 to 1.5.12-next.0
@@ -651,2 +651,41 @@ "use strict"; | ||
}); | ||
describe('listCustomEntities', () => { | ||
it('should use default values', async () => { | ||
const apiClientMock = getApiClientMock({ | ||
data: { | ||
appStoredCustomEntities: { | ||
edges: [] | ||
} | ||
} | ||
}); | ||
const globalStorage = getStorage(apiClientMock); | ||
const response = await globalStorage.listCustomEntities({}); | ||
expect(response).toMatchObject({ | ||
results: [], | ||
nextCursor: null | ||
}); | ||
verifyApiClientCalledWith(apiClientMock, { | ||
contextAri | ||
}, gql_queries_1.CustomEntityQueries.listQuery(contextAri, {}).query); | ||
}); | ||
it('should return cursor when results are not present', async () => { | ||
const apiClientMock = getApiClientMock({ | ||
data: { | ||
appStoredCustomEntities: { | ||
edges: [], | ||
cursor: 'DUMMY_CURSOR' | ||
} | ||
} | ||
}); | ||
const globalStorage = getStorage(apiClientMock); | ||
const response = await globalStorage.listCustomEntities({}); | ||
expect(response).toMatchObject({ | ||
results: [], | ||
nextCursor: 'DUMMY_CURSOR' | ||
}); | ||
verifyApiClientCalledWith(apiClientMock, { | ||
contextAri | ||
}, gql_queries_1.CustomEntityQueries.listQuery(contextAri, {}).query); | ||
}); | ||
}); | ||
}); |
@@ -58,11 +58,9 @@ "use strict"; | ||
async listCustomEntities(options) { | ||
var _a; | ||
const requestBody = gql_queries_1.CustomEntityQueries.listQuery(this.doGetAppContextAri(), options); | ||
const response = await this.query(requestBody); | ||
const edges = response.appStoredCustomEntities.edges; | ||
const nextCursor = (_a = edges === null || edges === void 0 ? void 0 : edges[edges.length - 1]) === null || _a === void 0 ? void 0 : _a.cursor; | ||
const results = edges.map(({ node }) => node); | ||
return { | ||
results, | ||
nextCursor | ||
nextCursor: response.appStoredCustomEntities.cursor || null | ||
}; | ||
@@ -69,0 +67,0 @@ } |
{ | ||
"name": "@forge/storage", | ||
"version": "1.5.11", | ||
"version": "1.5.12-next.0", | ||
"description": "Forge Storage methods", | ||
@@ -5,0 +5,0 @@ "author": "Atlassian", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122407
2549
2