From 5eec331370f7399443835298d96d2411395edd03 Mon Sep 17 00:00:00 2001 From: Felipe Forbeck Date: Thu, 19 Dec 2024 20:01:30 -0300 Subject: [PATCH] fix(w3up-client): create space options (#113) The `options` field should be optional, and if not set, we still want to grant access to Storacha Gateway to serve the content of the space. --- packages/w3up-client/src/client.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/w3up-client/src/client.js b/packages/w3up-client/src/client.js index d80a2517f..f19dc452b 100644 --- a/packages/w3up-client/src/client.js +++ b/packages/w3up-client/src/client.js @@ -266,14 +266,14 @@ export class Client extends Base { * @property {boolean} [skipGatewayAuthorization] - Whether to skip the Gateway authorization. It means that the content of the space will not be served by any Gateway. * * @param {string} name - The name of the space to create. - * @param {SpaceCreateOptions} options - Options for the space creation. + * @param {SpaceCreateOptions} [options] - Options for the space creation. * @returns {Promise} The created space owned by the agent. */ async createSpace(name, options) { // Save the space to authorize the client to use the space const space = await this._agent.createSpace(name) - const account = options.account + const account = options?.account if (account) { // Provision the account with the space const provisionResult = await account.provision(space.did()) @@ -305,8 +305,8 @@ export class Client extends Base { } // Authorize the listed Gateway Services to serve content from the created space - if (options.skipGatewayAuthorization !== true) { - let authorizeGatewayServices = options.authorizeGatewayServices + if (!options || options.skipGatewayAuthorization !== true) { + let authorizeGatewayServices = options?.authorizeGatewayServices if (!authorizeGatewayServices || authorizeGatewayServices.length === 0) { // If no Gateway Services are provided, authorize the Storacha Gateway Service authorizeGatewayServices = [