Skip to content

Commit

Permalink
Merge branch 'main' into renovate/inquirer-10.x
Browse files Browse the repository at this point in the history
  • Loading branch information
shabaraba authored Aug 21, 2024
2 parents 4e02410 + a333de0 commit 4ae73d5
Show file tree
Hide file tree
Showing 11 changed files with 438 additions and 336 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"@cybozu/license-manager": "^1.2.1",
"@octokit/rest": "^20.1.1",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.43",
"@types/node": "^18.19.45",
"babel-jest": "^29.7.0",
"comment-json": "^4.2.4",
"comment-json": "^4.2.5",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-plugin/templates/modern/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint src"
},
"dependencies": {
"core-js": "^3.37.1",
"core-js": "^3.38.1",
"@kintone/rest-api-client": "^5.5.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/dts-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"license": "MIT",
"dependencies": {
"@cybozu/eslint-config": "^23.0.0",
"axios": "^1.7.3",
"axios": "^1.7.4",
"commander": "^12.1.0",
"eslint": "^8.57.0",
"form-data": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-packer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@
"buffer": "^6.0.3",
"constants-browserify": "^1.0.0",
"crypto-browserify": "^3.12.0",
"cssnano": "^7.0.4",
"cssnano": "^7.0.5",
"execa": "^5.1.1",
"glob": "^10.4.5",
"jest-environment-jsdom": "^29.7.0",
"normalize.css": "^8.0.1",
"path-browserify": "^1.0.1",
"postcss": "^8.4.40",
"postcss": "^8.4.41",
"postcss-cli": "^11.0.0",
"process": "^0.11.10",
"redux-logger": "^3.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-uploader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"chalk": "^4.1.2",
"meow": "^9.0.0",
"os-locale": "^5.0.0",
"puppeteer": "^22.13.1"
"puppeteer": "^23.1.0"
},
"devDependencies": {
"@types/inquirer": "8.2.10"
Expand Down
22 changes: 22 additions & 0 deletions packages/rest-api-client/docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [getRequiredPlugins](#getRequiredPlugins)
- [getApps](#getApps)
- [updatePlugin](#updatePlugin)
- [installPlugin](#installPlugin)

## Overview

Expand Down Expand Up @@ -119,3 +120,24 @@ Updates an imported plug-in in the Kintone environment.
#### Reference

- https://kintone.dev/en/docs/kintone/rest-api/plugins/update-plugin/

### installPlugin

Install an imported plug-in in the Kintone environment.

#### Parameters

| Name | Type | Required | Description |
| ------- | :----: | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fileKey | String | Yes | The fileKey representing an uploaded file.<br />Use the following API to upload the file and retrieve the fileKey: [Upload File](https://kintone.dev/en/docs/kintone/rest-api/files/upload-file/) |

#### Returns

| Name | Type | Description |
| ------- | :----: | ---------------------------------- |
| id | String | The installed plug-in ID. |
| version | String | The version number of the plug-in. |

#### Reference

- https://kintone.dev/en/docs/kintone/rest-api/plugins/install-plugin/
8 changes: 4 additions & 4 deletions packages/rest-api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@
"@types/js-base64": "^3.3.1",
"@types/mime": "^3.0.4",
"@types/qs": "^6.9.15",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"rollup-plugin-ecma-version-validator": "^0.2.13",
"rollup-plugin-license": "^3.5.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-polyfill-node": "^0.13.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"babel-loader": "^9.1.3",
"vite": "^5.3.5",
"vite": "^5.4.2",
"rimraf": "^5.0.10",
"cross-env": "^7.0.3"
},
"dependencies": {
"core-js": "^3.37.1",
"axios": "^1.7.3",
"core-js": "^3.38.1",
"axios": "^1.7.4",
"form-data": "^4.0.0",
"js-base64": "^3.7.7",
"mime": "^3.0.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/rest-api-client/src/client/PluginClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import type {
GetRequiredPluginsForResponse,
UpdatePluginForRequest,
UpdatePluginForResponse,
InstallPluginForRequest,
InstallPluginForResponse,
} from "./types/plugin";

export class PluginClient extends BaseClient {
Expand Down Expand Up @@ -36,4 +38,11 @@ export class PluginClient extends BaseClient {
const path = this.buildPath({ endpointName: "plugin" });
return this.client.put(path, params);
}

public installPlugin(
params: InstallPluginForRequest,
): Promise<InstallPluginForResponse> {
const path = this.buildPath({ endpointName: "plugin" });
return this.client.post(path, params);
}
}
18 changes: 18 additions & 0 deletions packages/rest-api-client/src/client/__tests__/PluginClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,22 @@ describe("PluginClient", () => {
expect(mockClient.getLogs()[0].params).toEqual(params);
});
});

describe("installPlugin", () => {
const params = {
fileKey: "fileKey",
};
beforeEach(async () => {
await pluginClient.installPlugin(params);
});
it("should pass the path to the http client", () => {
expect(mockClient.getLogs()[0].path).toBe("/k/v1/plugin.json");
});
it("should send a POST request", () => {
expect(mockClient.getLogs()[0].method).toBe("post");
});
it("should pass the param to the http client", () => {
expect(mockClient.getLogs()[0].params).toEqual(params);
});
});
});
9 changes: 9 additions & 0 deletions packages/rest-api-client/src/client/types/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ export type UpdatePluginForResponse = {
id: PluginID;
version: string;
};

export type InstallPluginForRequest = {
fileKey: string;
};

export type InstallPluginForResponse = {
id: PluginID;
version: string;
};
Loading

0 comments on commit 4ae73d5

Please sign in to comment.