From 761cea0713d317f64395274b73c544d53f462bb1 Mon Sep 17 00:00:00 2001 From: Aron Atkins Date: Thu, 20 Jun 2024 10:28:21 -0400 Subject: [PATCH 1/2] use v1 vanity API rather than unversioned API available in all supported Connect versions --- src/APIClient.ts | 8 ++++---- src/Deployer.ts | 2 +- src/api-types.ts | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/APIClient.ts b/src/APIClient.ts index 04683a2..ee2b973 100644 --- a/src/APIClient.ts +++ b/src/APIClient.ts @@ -111,10 +111,10 @@ export class APIClient { .then((resp: AxiosResponse) => keysToCamel(resp.data)) } - public async updateAppVanityURL (appID: number, vanityURL: string): Promise { - return await this.client.post( - `applications/${appID}/vanities`, - { app_id: appID, path_prefix: vanityURL } + public async setContentVanityURL (contentGUID: string, vanityURL: string): Promise { + return await this.client.put( + `v1/content/${contentGUID}/vanity`, + { path: vanityURL } ).then((resp: AxiosResponse) => keysToCamel(resp.data)) } diff --git a/src/Deployer.ts b/src/Deployer.ts index 4011a54..89eea5d 100644 --- a/src/Deployer.ts +++ b/src/Deployer.ts @@ -156,7 +156,7 @@ export class Deployer { `path=${JSON.stringify(resolvedAppPath)}` ].join(' ')) - await this.client.updateAppVanityURL(app.id, resolvedAppPath) + await this.client.setContentVanityURL(app.guid, resolvedAppPath) .catch((err: any) => { debugLog(() => [ 'Deployer: failed to update vanity URL for', diff --git a/src/api-types.ts b/src/api-types.ts index 1f8afae..a3e825f 100644 --- a/src/api-types.ts +++ b/src/api-types.ts @@ -102,9 +102,7 @@ export interface ListApplicationsResponse { } export interface VanityRecordResponse { - id?: number - appId: number - appGuid: string - pathPrefix: string - createdTime?: Date + contentGuid: string + path: string + createdTime: Date } From a02dd242d8529d94dae2af25a877d0da46447d65 Mon Sep 17 00:00:00 2001 From: Aron Atkins Date: Fri, 21 Jun 2024 08:45:32 -0400 Subject: [PATCH 2/2] distclean: clean .cache/data rather than __test__/data --- Makefile | 2 +- jest.config.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9768a0f..81760fc 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ clean: .PHONY: distclean distclean: clean - rm -rf __tests__/data/* + rm -rf .cache/data .PHONY: up up: .require-license diff --git a/jest.config.js b/jest.config.js index 2d4ac65..2569186 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,6 @@ module.exports = { clearMocks: true, collectCoverage: true, coverageDirectory: 'coverage', - modulePathIgnorePatterns: ["./__tests__/data/"], preset: 'ts-jest', testEnvironment: 'node' }