Skip to content
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@
- Initial support for custom controls

## [0.3.1]
- Path bug
- Path bug

## [0.3.2]
- Publish bug
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"url": "https://github.com/Root16/bamboo"
},
"description": "Enables users to create, update, and publish Web Resources and Custom Controls for Microsoft Power Platform — directly from VS Code.",
"version": "0.3.1",
"version": "0.3.2",
"icon": "resources/bamboo-green.png",
"engines": {
"vscode": "^1.73.0"
Expand Down
34 changes: 28 additions & 6 deletions src/dataverse/DataverseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export class DataverseClient {
private solutionApi: string;
private addSolutionComponentApi: string;
private publishApi: string;
private publishAllApi: string;
private importSolutionApi: string;

constructor(private config: BambooConfig) {
this.webResourcesApi = `${this.config.baseUrl}/api/data/v9.2/webresourceset`;
this.solutionApi = `${this.config.baseUrl}/api/data/v9.2/solutions`;
this.addSolutionComponentApi = `${this.config.baseUrl}/api/data/v9.2/AddSolutionComponent`;
this.publishApi = `${this.config.baseUrl}/api/data/v9.2/PublishXml`;
this.publishAllApi = `${this.config.baseUrl}/api/data/v9.0/PublishAllXml`;
this.importSolutionApi = `${this.config.baseUrl}/api/data/v9.0/ImportSolution`;
}

Expand All @@ -39,12 +41,12 @@ export class DataverseClient {
"bamboo.customControl.publishAfterSync");

if (publish) {
const [publishSuccess, publishErrorMessage] = await logMessageWithProgress(`Publishing solution: ${path.basename(solutionPath)}`, () => {
return this.publishSolution(solutionName, token);
const [publishSuccess, publishErrorMessage] = await logMessageWithProgress(`Publishing all.`, () => {
return this.publishAllCustomizations(token);
});

if (!publishSuccess) [publishSuccess, publishErrorMessage];
logTemporaryMessage(`Published solution successfully: ${path.basename(solutionPath)}`, VerboseSetting.High);
logTemporaryMessage(`Published all successfully.`, VerboseSetting.High);
}

return [true, null];
Expand Down Expand Up @@ -213,7 +215,7 @@ export class DataverseClient {
const [addSuccess, addErrorMessage] = await logMessageWithProgress(`Adding Web Resource to solution: ${solutionName}`, () => {
return this.addToSolution(webResourceId, solutionName, token);
});

if (!addSuccess) return [addSuccess, addErrorMessage];

const publish = vscode.workspace.getConfiguration().get<boolean>(
Expand All @@ -223,7 +225,7 @@ export class DataverseClient {
const [publishSuccess, publishErrorMessage] = await logMessageWithProgress(`Publishing Web Resource: ${name}`, () => {
return this.publishWebResource(webResourceId, token);
});

if (!publishSuccess) return [publishSuccess, publishErrorMessage];
}

Expand Down Expand Up @@ -283,13 +285,33 @@ export class DataverseClient {
});

if (!response.ok) {
const data = response.json();
const data = await response.json();
console.log(data);
return [false, `Failed to publish solution: ${response.statusText}`];
}

return [true, null];
}
private async publishAllCustomizations(token: string): Promise<[boolean, string | null]> {
//@ts-expect-error cause i said so
const response = await fetch(this.publishAllApi, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
});

if (!response.ok) {
const data = await response.json();
console.log(data);
return [false, `Failed to publish all customizations: ${response.statusText}`];
}

return [true, null];
}


private async getSolution(uniqueName: string, token: string): Promise<ISolution | null> {
//@ts-expect-error cause i said so
Expand Down
Loading