Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use nullish coalescing for audience #319

Merged
merged 2 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/upload-client/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { REQUEST_RETRIES } from './constants.js'
* @returns {Promise<import('./types').CARLink>}
*/
export async function add(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
car,
options = {}
) {
Expand All @@ -42,7 +42,8 @@ export async function add(
return await StoreCapabilities.add
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
nb: { link, size: car.size },
proofs,
Expand Down Expand Up @@ -120,15 +121,16 @@ export async function add(
* @returns {Promise<import('./types').ListResponse<import('./types').StoreListResult>>}
*/
export async function list(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
options = {}
) {
/* c8 ignore next */
const conn = options.connection ?? connection
const result = await StoreCapabilities.list
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
proofs,
nb: {
Expand Down Expand Up @@ -167,7 +169,7 @@ export async function list(
* @param {import('./types').RequestOptions} [options]
*/
export async function remove(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
link,
options = {}
) {
Expand All @@ -176,7 +178,8 @@ export async function remove(
const result = await StoreCapabilities.remove
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
nb: { link },
proofs,
Expand Down
15 changes: 9 additions & 6 deletions packages/upload-client/src/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { REQUEST_RETRIES } from './constants.js'
* @returns {Promise<import('./types').UploadAddResponse>}
*/
export async function add(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
root,
shards,
options = {}
Expand All @@ -40,7 +40,8 @@ export async function add(
return await UploadCapabilities.add
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
nb: { root, shards },
proofs,
Expand Down Expand Up @@ -82,7 +83,7 @@ export async function add(
* @returns {Promise<import('./types').ListResponse<import('./types').UploadListResult>>}
*/
export async function list(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
options = {}
) {
/* c8 ignore next */
Expand All @@ -91,7 +92,8 @@ export async function list(
const result = await UploadCapabilities.list
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
proofs,
nb: {
Expand Down Expand Up @@ -130,7 +132,7 @@ export async function list(
* @param {import('./types').RequestOptions} [options]
*/
export async function remove(
{ issuer, with: resource, proofs, audience = servicePrincipal },
{ issuer, with: resource, proofs, audience },
root,
options = {}
) {
Expand All @@ -139,7 +141,8 @@ export async function remove(
const result = await UploadCapabilities.remove
.invoke({
issuer,
audience,
/* c8 ignore next */
audience: audience ?? servicePrincipal,
with: resource,
nb: { root },
proofs,
Expand Down