@kumori/aurora-backend-handler 1.1.87 → 1.1.89

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.
@@ -198,24 +198,21 @@ export const updateTenant = async (tenant: Tenant, security: string) => {
198
198
 
199
199
  const updateBody: Record<string, any> = {
200
200
  tenant: tenant.name,
201
+ spec: {},
201
202
  };
202
203
  if (hasPlan) {
203
204
  updateBody.provider = tenant.plan!.provider || "";
204
205
  updateBody.plan = tenant.plan!.name;
205
- } else {
206
- updateBody.spec = {
207
- registry: !hasNpmRegistry
208
- ? undefined
209
- : isNpmRegistryEmpty
210
- ? null
211
- : {
212
- kind: "git",
213
- endpoint: tenant.npmRegistry!.endpoint,
214
- domain: tenant.npmRegistry!.domain,
215
- credentials: tenant.npmRegistry!.credentials,
216
- public: tenant.npmRegistry!.public,
217
- },
218
- };
206
+ } else if (hasNpmRegistry) {
207
+ updateBody.spec.registry = isNpmRegistryEmpty
208
+ ? null
209
+ : {
210
+ kind: "git",
211
+ endpoint: tenant.npmRegistry!.endpoint,
212
+ domain: tenant.npmRegistry!.domain,
213
+ credentials: tenant.npmRegistry!.credentials,
214
+ public: tenant.npmRegistry!.public,
215
+ };
219
216
  }
220
217
 
221
218
  const response = await makeGlobalWebSocketRequest(
@@ -244,6 +241,8 @@ export const updateTenant = async (tenant: Tenant, security: string) => {
244
241
  console.error("Error in tenant update WebSocket request:", err);
245
242
  const { code: contentMessage, content: errorContent } =
246
243
  extractWsErrorInfo(err);
244
+ const { plan, ...tenantWithoutPlan } = tenant;
245
+ eventHelper.tenant.publish.updateError(tenantWithoutPlan as Tenant);
247
246
  const tenantUpdateErrorNotification: Notification = {
248
247
  type: "error",
249
248
  subtype: errors.tenant.updateError.subtype,
@@ -449,14 +448,10 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
449
448
  },
450
449
  },
451
450
  }
452
- : hasPlan
453
- ? { tenant: tenant.name }
454
- : {
455
- tenant: tenant.name,
456
- spec: {
457
- registry: undefined,
458
- },
459
- };
451
+ : {
452
+ tenant: tenant.name,
453
+ spec: {},
454
+ };
460
455
  const response = await fetch(updateTenantUrl, {
461
456
  method: "PATCH",
462
457
  headers: {
@@ -480,7 +475,9 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
480
475
  };
481
476
  eventHelper.notification.publish.creation(tenantCreatedNotification);
482
477
  } else {
483
- eventHelper.tenant.publish.updateError(tenant);
478
+ // The request failed, so the plan change must not be reflected as applied.
479
+ const { plan, ...tenantWithoutPlan } = tenant;
480
+ eventHelper.tenant.publish.updateError(tenantWithoutPlan as Tenant);
484
481
 
485
482
  let errorCode = "Unknown error";
486
483
  let errorMessage = "Unknown error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {