@kumori/aurora-backend-handler 1.1.86 → 1.1.87

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,7 +198,12 @@ 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
+ if (hasPlan) {
203
+ updateBody.provider = tenant.plan!.provider || "";
204
+ updateBody.plan = tenant.plan!.name;
205
+ } else {
206
+ updateBody.spec = {
202
207
  registry: !hasNpmRegistry
203
208
  ? undefined
204
209
  : isNpmRegistryEmpty
@@ -210,12 +215,7 @@ export const updateTenant = async (tenant: Tenant, security: string) => {
210
215
  credentials: tenant.npmRegistry!.credentials,
211
216
  public: tenant.npmRegistry!.public,
212
217
  },
213
- },
214
- };
215
-
216
- if (hasPlan) {
217
- updateBody.provider = tenant.plan!.provider || "";
218
- updateBody.plan = tenant.plan!.name;
218
+ };
219
219
  }
220
220
 
221
221
  const response = await makeGlobalWebSocketRequest(
@@ -434,12 +434,11 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
434
434
  tenant.plan?.provider || ""
435
435
  );
436
436
  }
437
+ const hasPlan = tenant.plan && tenant.plan?.name !== "" && tenant.plan?.provider !== "";
437
438
  const tenantBody =
438
- tenant.npmRegistry && tenant.npmRegistry.endpoint !== ""
439
+ !hasPlan && tenant.npmRegistry && tenant.npmRegistry.endpoint !== ""
439
440
  ? {
440
441
  tenant: tenant.name,
441
- provider: tenant.plan?.provider || "",
442
- plan: tenant.plan?.name || "",
443
442
  spec: {
444
443
  registry: {
445
444
  kind: "git",
@@ -450,12 +449,14 @@ export const updateTenantHTTP = async (tenant: Tenant) => {
450
449
  },
451
450
  },
452
451
  }
453
- : {
454
- tenant: tenant.name,
455
- spec: {
456
- registry: undefined,
457
- },
458
- };
452
+ : hasPlan
453
+ ? { tenant: tenant.name }
454
+ : {
455
+ tenant: tenant.name,
456
+ spec: {
457
+ registry: undefined,
458
+ },
459
+ };
459
460
  const response = await fetch(updateTenantUrl, {
460
461
  method: "PATCH",
461
462
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumori/aurora-backend-handler",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
4
4
  "description": "backend handler",
5
5
  "main": "backend-handler.ts",
6
6
  "scripts": {