feat: add SDK app icon and visibility tools#59
Open
Sebastian Mertens Make (MAKESEB) wants to merge 2 commits into
Open
feat: add SDK app icon and visibility tools#59Sebastian Mertens Make (MAKESEB) wants to merge 2 commits into
Sebastian Mertens Make (MAKESEB) wants to merge 2 commits into
Conversation
Copilot started reviewing on behalf of
Sebastian Mertens Make (MAKESEB)
May 29, 2026 09:33
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds SDK-level support for app icon upload/download and for marking SDK apps and modules public/private, including the underlying transport changes required to send raw binary request bodies and receive ArrayBuffer responses. The new methods are surfaced both on the typed SDKApps / SDKModules clients and as MakeTool definitions consumable by downstream tools such as Make CLI.
Changes:
- Extend the core HTTP layer (
FetchOptions,prepareBody,handleResponse) to acceptUint8Array/ArrayBufferbodies and an explicitresponseType(json|text|arrayBuffer). - Add
setIcon/getIconandmakePublic/makePrivatetoSDKApps, plusmakePublic/makePrivatetoSDKModules, with matchingMakeToolentries (including PNG validation in the icon tools). - Update the test fetch mock to surface binary request bodies as
ArrayBufferand add unit tests covering icon upload/download and visibility toggles.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Widens FetchOptions.body to allow binary payloads and adds the responseType option. |
| src/make.ts | Threads responseType through fetch/handleResponse and lets prepareBody pass binary bodies through unchanged. |
| src/endpoints/sdk/apps.ts | Adds setIcon/getIcon and makePublic/makePrivate plus the SDKAppVisibilityResponse/IconUploadResponse types. |
| src/endpoints/sdk/apps.tools.ts | Adds icon and visibility MakeTools and a local PNG header parser. |
| src/endpoints/sdk/modules.ts | Adds makePublic/makePrivate and SDKModuleVisibilityResponse. |
| src/endpoints/sdk/modules.tools.ts | Adds matching module visibility MakeTools with a shared result shaper. |
| src/index.ts | Re-exports the new visibility response types. |
| test/test.utils.ts | Teaches mockFetch to expose binary request bodies as ArrayBuffer. |
| test/sdk/apps.spec.ts | Adds tests for icon upload/download and app visibility. |
| test/sdk/modules.spec.ts | Adds a test for module visibility toggles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+30
to
+40
| function visibilityResult(scope: 'app', name: string, version: number, visibility: 'public' | 'private', response: JSONValue) { | ||
| return { | ||
| changed: true, | ||
| scope, | ||
| appName: name, | ||
| version, | ||
| visibility, | ||
| public: visibility === 'public', | ||
| response, | ||
| }; | ||
| } |
Comment on lines
+5
to
+22
| function moduleVisibilityResult( | ||
| appName: string, | ||
| appVersion: number, | ||
| moduleName: string, | ||
| visibility: 'public' | 'private', | ||
| response: JSONValue, | ||
| ) { | ||
| return { | ||
| changed: true, | ||
| scope: 'module', | ||
| appName, | ||
| version: appVersion, | ||
| moduleName, | ||
| visibility, | ||
| public: visibility === 'public', | ||
| response, | ||
| }; | ||
| } |
Comment on lines
+288
to
+312
| const response = await this.#fetch<IconUploadResponse | string>(`/sdk/apps/${name}/${version}/icon`, { | ||
| method: 'PUT', | ||
| headers: { | ||
| 'Content-Type': options.contentType ?? 'image/png', | ||
| 'imt-apps-sdk-version': options.sdkVersion ?? '2.5.0', | ||
| }, | ||
| body: iconData, | ||
| }); | ||
|
|
||
| if (response && typeof response === 'object') { | ||
| return response.success ?? response.changed ?? true; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Download an app icon at a given rendered size. | ||
| */ | ||
| async getIcon(name: string, version: number, size = 512, options: { sdkVersion?: string } = {}): Promise<ArrayBuffer> { | ||
| return await this.#fetch<ArrayBuffer>(`/sdk/apps/${name}/${version}/icon/${size}`, { | ||
| headers: { | ||
| 'imt-apps-sdk-version': options.sdkVersion ?? '2.5.0', | ||
| }, | ||
| responseType: 'arrayBuffer', | ||
| }); |
Comment on lines
389
to
409
| /** | ||
| * Prepare the request body for API calls | ||
| * | ||
| * @param body The request body - can be an object, string, or undefined | ||
| * @param headers The headers object to potentially modify the content-type | ||
| * @returns The body serialized as a string | ||
| * @protected | ||
| */ | ||
| protected prepareBody( | ||
| body: Record<string, JSONValue> | Array<JSONValue> | string | undefined, | ||
| body: Record<string, JSONValue> | Array<JSONValue> | string | Uint8Array | ArrayBuffer | undefined, | ||
| headers: Record<string, string>, | ||
| ): string { | ||
| ): string | Uint8Array | ArrayBuffer | undefined { | ||
| if (body instanceof Uint8Array || body instanceof ArrayBuffer) { | ||
| return body; | ||
| } | ||
| if (body && typeof body !== 'string') { | ||
| headers['content-type'] = 'application/json'; | ||
| return JSON.stringify(body); | ||
| } | ||
| return body as string; | ||
| return body as string | undefined; | ||
| } |
Comment on lines
488
to
+499
| /** | ||
| * Handle successful API responses | ||
| * | ||
| * Parses the response based on content-type header. | ||
| * JSON responses are parsed as objects, other responses as text. | ||
| * | ||
| * @template T The expected response type | ||
| * @param response The successful response from the API | ||
| * @returns Promise resolving to the parsed response data | ||
| * @protected | ||
| */ | ||
| protected async handleResponse<T>(response: Response): Promise<T> { | ||
| protected async handleResponse<T>(response: Response, responseType?: FetchOptions['responseType']): Promise<T> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds SDK support for app icon upload/download (check binary upload added) and app/module visibility actions, so generated consumers like Make CLI can expose these commands from SDK tool definitions.