Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

figma-js

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

figma-js - npm Package Compare versions

Comparing version 1.8.3 to 1.8.4

97

build/main/figmaTypes.d.ts

@@ -579,10 +579,49 @@ export interface Global {

export interface ComponentMetadata {
/** The componens key */
/** The unique identifier of the element */
readonly key: string;
/** The name of the component */
/** The name of the element */
readonly name: string;
/** The description of the component as entered in the editor */
/** The description of the element as entered in the editor */
readonly description: string;
}
export interface FrameInfo {
/** Id of the frame node within the figma file */
readonly node_id: string;
/** The name of the frame */
readonly name: string;
/** Background color of the frame */
readonly background_color: string;
/** Id of the frame's residing page */
readonly page_id: string;
/** Name of the frame's residing page */
readonly page_name: string;
}
interface SharedElement extends ComponentMetadata {
/** The unique identifier of the figma file which contains the element */
readonly file_key: string;
/** URL link to the element's thumbnail image */
readonly thumbnail_urlString: string;
/** The UTC ISO 8601 time at which the element was created */
readonly created_at: string;
/** The UTC ISO 8601 time at which the element was updated */
readonly updated_at: string;
/** The user who last updated the element */
readonly user: User;
}
/**
* An arrangement of published UI elements that can be instantiated across figma files
*/
export interface FullComponentMetadata extends SharedElement {
/** Data on component's containing frame, if component resides within a frame */
readonly containing_frame: FrameInfo;
/** Data on component's containing page, if component resides in a multi-page file */
readonly containing_page: any;
}
export interface FullStyleMetadata extends SharedElement {
/** The type of style */
readonly style_type: StyleType;
/** A user specified order number by which the style can be sorted */
readonly sort_position: string;
}
/**
* A description of styles used in a file.

@@ -628,3 +667,7 @@ */

export interface User {
/** Unique stable id of the user */
readonly id: string;
/** Name of the user */
readonly handle: string;
/** URL link to the user's profile image */
readonly img_url: string;

@@ -650,2 +693,35 @@ }

}
export interface FileNodesResponse {
readonly nodes: {
readonly [key: string]: null | {
readonly document: Node;
readonly components: {
readonly [key: string]: ComponentMetadata;
};
readonly styles: {
readonly [key: string]: Style;
};
readonly schemaVersion: number;
};
};
readonly lastModified: string;
readonly name: string;
readonly thumbnailUrl: string;
readonly version: string;
}
export interface VersionMetadata {
/** Unique identifier for version */
readonly id: string;
/** The UTC ISO 8601 time at which the version was created */
readonly created_at: string;
/** The label given to the version in the editor */
readonly label: string;
/** The description of the version as entered in the editor */
readonly description: string;
/** The user that created the version */
readonly user: User;
}
export interface FileVersionsResponse {
readonly versions: ReadonlyArray<VersionMetadata>;
}
export interface FileImageResponse {

@@ -661,3 +737,3 @@ readonly err: string | null;

readonly meta: {
images: {
readonly images: {
readonly [key: string]: string;

@@ -682,1 +758,14 @@ };

}
interface PaginationResponse {
readonly cursor: {
readonly before: number;
readonly after: number;
};
}
export interface TeamComponentsResponse extends PaginationResponse {
readonly components: ReadonlyArray<FullComponentMetadata>;
}
export interface TeamStylesResponse extends PaginationResponse {
readonly styles: ReadonlyArray<FullStyleMetadata>;
}
export {};

@@ -5,6 +5,34 @@ import * as Figma from './figmaTypes';

export interface FileParams {
readonly fileId?: string;
/**
* Comma separated list of nodes that you care about in the document.
* If specified, only a subset of the document will be returned corresponding to the nodes listed, their children, and everything between the root node and the listed nodes
*/
readonly ids?: string;
/**
* Positive integer representing how deep into the document tree to traverse.
* For example, setting this to 1 returns only Pages, setting it to 2 returns Pages and all top level objects on each page.
* Not setting this parameter returns all nodes
*/
readonly depth?: number;
/**
* A specific version ID to get. Omitting this will get the current version of the file
*/
readonly version?: string;
/**
* Set to "paths" to export vector data
*/
readonly geometry?: string;
}
export interface FileNodesParams {
/** A list of node IDs to retrieve and convert */
readonly ids: ReadonlyArray<string>;
/**
* A specific version ID to get. Omitting this will get the current version of the file
*/
readonly version?: string;
/**
* Set to "paths" to export vector data
*/
readonly geometry?: string;
}
export declare type exportFormatOptions = 'jpg' | 'png' | 'svg' | 'pdf';

@@ -25,4 +53,4 @@ export interface FileImageParams {

* Whether to simplify inside/outside strokes and use stroke attribute if
* possible instead of <mask>. Default: true.
* @default false
* possible instead of <mask>.
* @default true
*/

@@ -39,2 +67,17 @@ readonly svg_simplify_stroke?: boolean;

}
export interface PaginationParams {
/**
* Number of items in a paged list of results.
* @default 30
*/
readonly page_size?: number;
/**
* A map that indicates the starting/ending point from which objects are returned.
* The cursor value is an internally tracked integer that doesn't correspond to any Ids
*/
readonly cursor?: {
readonly before?: number;
readonly after?: number;
};
}
export interface ClientOptions {

@@ -56,5 +99,24 @@ /** access token returned from OAuth authentication */

* @param {fileId} String File to export JSON from
* @see https://www.figma.com/developers/api#get-files-endpoint
*/
readonly file: (fileId: string, params?: FileParams) => AxiosPromise<Figma.FileResponse>;
/**
* Returns a list of the versions of a file.
* The file key can be parsed from any Figma node url:
* https://www.figma.com/file/:key/:title.
* @param {fileId} String File to get version history from
* @see https://www.figma.com/developers/api#get-file-versions-endpoint
*/
readonly fileVersions: (fileId: string, ids: ReadonlyArray<string>, params?: FileNodesParams) => AxiosPromise<Figma.FileVersionsResponse>;
/**
* Returns the nodes referenced to by :ids as a JSON object.
* The nodes are retrieved from the Figma file referenced to by :key.
* The node Id and file key can be parsed from any Figma node url:
* https://www.figma.com/file/:key/:title?node-id=:id.
* @param {fileId} String File to export JSON from
* @param {params} FileNodesParams
* @see https://www.figma.com/developers/api#get-file-nodes-endpoint
*/
readonly fileNodes: (fileId: string, params: FileNodesParams) => AxiosPromise<Figma.FileNodesResponse>;
/**
* If no error occurs, "images" will be populated with a map from

@@ -70,2 +132,3 @@ * node IDs to URLs of the rendered images, and "status" will be omitted.

* @param {params} FileImageParams
* @see https://www.figma.com/developers/api#get-images-endpoint
*/

@@ -85,2 +148,3 @@ readonly fileImages: (fileId: string, params: FileImageParams) => AxiosPromise<Figma.FileImageResponse>;

* @param {fileId} String File to export images from
* @see https://www.figma.com/developers/api#get-image-fills-endpoint
*/

@@ -91,2 +155,3 @@ readonly fileImageFills: (fileId: string) => AxiosPromise<Figma.FileImageFillsResponse>;

* @param {fileId} String File to get comments from
* @see https://www.figma.com/developers/api#get-comments-endpoint
*/

@@ -98,5 +163,13 @@ readonly comments: (fileId: string) => AxiosPromise<Figma.CommentsResponse>;

* @param {params} PostCommentParams
* @see https://www.figma.com/developers/api#post-comments-endpoint
*/
readonly postComment: (fileId: string, params: PostCommentParams) => AxiosPromise<Figma.Comment>;
/**
* Get user information for the authenticated user.
* @see https://www.figma.com/developers/api#get-me-endpoint
*/
readonly me: () => AxiosPromise<Figma.User & {
readonly email: string;
}>;
/**
* Lists the projects for a specified team. Note that this will only

@@ -106,2 +179,3 @@ * return projects visible to the authenticated user or owner of the

* @param {teamId} String Id of the team to list projects from
* @see https://www.figma.com/developers/api#get-team-projects-endpoint
*/

@@ -112,5 +186,30 @@ readonly teamProjects: (teamId: string) => AxiosPromise<Figma.TeamProjectsResponse>;

* @param {projectId} String Id of the project to list files from
* @see https://www.figma.com/developers/api#get-project-files-endpoint
*/
readonly projectFiles: (projectId: string) => AxiosPromise<Figma.ProjectFilesResponse>;
/**
* Get a paginated list of published components within a team library
* @param {teamId} String Id of the team to list components from
* @see https://www.figma.com/developers/api#get-team-components-endpoint
*/
readonly teamComponents: (teamId: string, params?: PaginationParams) => AxiosPromise<Figma.TeamComponentsResponse>;
/**
* Get metadata on a component by key.
* @param {key} The unique identifier of the component.
* @see https://www.figma.com/developers/api#get-component-endpoint
*/
readonly component: (key: string) => AxiosPromise<Figma.FullComponentMetadata>;
/**
* Get a paginated list of published styles within a team library
* @param {teamId} String Id of the team to list components from
* @see https://www.figma.com/developers/api#get-team-styles-endpoint
*/
readonly teamStyles: (teamId: string, params?: PaginationParams) => AxiosPromise<Figma.TeamStylesResponse>;
/**
* Get metadata on a style by key.
* @param {key} The unique identifier of the style.
* @see https://www.figma.com/developers/api#get-style-endpoint
*/
readonly style: (key: string) => AxiosPromise<Figma.FullStyleMetadata>;
}
export declare const Client: (opts: ClientOptions) => ClientInterface;

@@ -22,2 +22,6 @@ "use strict";

file: (fileId, params = {}) => client.get(`files/${fileId}`, { params }),
fileVersions: fileId => client.get(`files/${fileId}/versions`),
fileNodes: (fileId, params) => client.get(`files/${fileId}/nodes`, {
params: Object.assign({}, params, { ids: params.ids.join(',') })
}),
fileImages: (fileId, params) => client.get(`images/${fileId}`, {

@@ -29,6 +33,11 @@ params: Object.assign({}, params, { ids: params.ids.join(',') })

postComment: (fileId, params) => client.post(`files/${fileId}/comments`, params),
me: () => client.get(`me`),
teamProjects: teamId => client.get(`teams/${teamId}/projects`),
projectFiles: projectId => client.get(`projects/${projectId}/files`)
projectFiles: projectId => client.get(`projects/${projectId}/files`),
teamComponents: (teamId, params = {}) => client.get(`teams/${teamId}/components`, { params }),
component: key => client.get(`components/${key}`),
teamStyles: (teamId, params = {}) => client.get(`teams/${teamId}/styles`, { params }),
style: key => client.get(`styles/${key}`)
};
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFHQSxrREFBMkQ7QUFzSTlDLFFBQUEsTUFBTSxHQUFHLENBQUMsSUFBbUIsRUFBbUIsRUFBRTtJQUM3RCxNQUFNLE9BQU8sR0FBRyxJQUFJLENBQUMsV0FBVztRQUM5QixDQUFDLENBQUM7WUFDRSxhQUFhLEVBQUUsVUFBVSxJQUFJLENBQUMsV0FBVyxFQUFFO1NBQzVDO1FBQ0gsQ0FBQyxDQUFDO1lBQ0UsZUFBZSxFQUFFLElBQUksQ0FBQyxtQkFBbUI7U0FDMUMsQ0FBQztJQUVOLE1BQU0sTUFBTSxHQUFHLGVBQUssQ0FBQyxNQUFNLENBQUM7UUFDMUIsT0FBTyxFQUFFLFdBQVcsSUFBSSxDQUFDLE9BQU8sSUFBSSxlQUFlLE1BQU07UUFDekQsT0FBTztLQUNSLENBQUMsQ0FBQztJQUVILE9BQU87UUFDTCxNQUFNO1FBRU4sSUFBSSxFQUFFLENBQUMs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FBQztRQUV0RCxTQUFTLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLGNBQWMsR0FBRyxFQUFFLENBQUM7UUFFakQsVUFBVSxFQUFFLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxFQUFFLEVBQUUsRUFBRSxDQUNsQyxNQUFNLENBQUMsR0FBRyxDQUFDLFNBQVMsTUFBTSxTQUFTLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQztRQUVsRCxLQUFLLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFVBQVUsR0FBRyxFQUFFLENBQUM7S0FDMUMsQ0FBQztBQUNKLENBQUMsQ0FBQyJ9

@@ -579,10 +579,49 @@ export interface Global {

export interface ComponentMetadata {
/** The componens key */
/** The unique identifier of the element */
readonly key: string;
/** The name of the component */
/** The name of the element */
readonly name: string;
/** The description of the component as entered in the editor */
/** The description of the element as entered in the editor */
readonly description: string;
}
export interface FrameInfo {
/** Id of the frame node within the figma file */
readonly node_id: string;
/** The name of the frame */
readonly name: string;
/** Background color of the frame */
readonly background_color: string;
/** Id of the frame's residing page */
readonly page_id: string;
/** Name of the frame's residing page */
readonly page_name: string;
}
interface SharedElement extends ComponentMetadata {
/** The unique identifier of the figma file which contains the element */
readonly file_key: string;
/** URL link to the element's thumbnail image */
readonly thumbnail_urlString: string;
/** The UTC ISO 8601 time at which the element was created */
readonly created_at: string;
/** The UTC ISO 8601 time at which the element was updated */
readonly updated_at: string;
/** The user who last updated the element */
readonly user: User;
}
/**
* An arrangement of published UI elements that can be instantiated across figma files
*/
export interface FullComponentMetadata extends SharedElement {
/** Data on component's containing frame, if component resides within a frame */
readonly containing_frame: FrameInfo;
/** Data on component's containing page, if component resides in a multi-page file */
readonly containing_page: any;
}
export interface FullStyleMetadata extends SharedElement {
/** The type of style */
readonly style_type: StyleType;
/** A user specified order number by which the style can be sorted */
readonly sort_position: string;
}
/**
* A description of styles used in a file.

@@ -628,3 +667,7 @@ */

export interface User {
/** Unique stable id of the user */
readonly id: string;
/** Name of the user */
readonly handle: string;
/** URL link to the user's profile image */
readonly img_url: string;

@@ -650,2 +693,35 @@ }

}
export interface FileNodesResponse {
readonly nodes: {
readonly [key: string]: null | {
readonly document: Node;
readonly components: {
readonly [key: string]: ComponentMetadata;
};
readonly styles: {
readonly [key: string]: Style;
};
readonly schemaVersion: number;
};
};
readonly lastModified: string;
readonly name: string;
readonly thumbnailUrl: string;
readonly version: string;
}
export interface VersionMetadata {
/** Unique identifier for version */
readonly id: string;
/** The UTC ISO 8601 time at which the version was created */
readonly created_at: string;
/** The label given to the version in the editor */
readonly label: string;
/** The description of the version as entered in the editor */
readonly description: string;
/** The user that created the version */
readonly user: User;
}
export interface FileVersionsResponse {
readonly versions: ReadonlyArray<VersionMetadata>;
}
export interface FileImageResponse {

@@ -661,3 +737,3 @@ readonly err: string | null;

readonly meta: {
images: {
readonly images: {
readonly [key: string]: string;

@@ -682,1 +758,14 @@ };

}
interface PaginationResponse {
readonly cursor: {
readonly before: number;
readonly after: number;
};
}
export interface TeamComponentsResponse extends PaginationResponse {
readonly components: ReadonlyArray<FullComponentMetadata>;
}
export interface TeamStylesResponse extends PaginationResponse {
readonly styles: ReadonlyArray<FullStyleMetadata>;
}
export {};

@@ -5,6 +5,34 @@ import * as Figma from './figmaTypes';

export interface FileParams {
readonly fileId?: string;
/**
* Comma separated list of nodes that you care about in the document.
* If specified, only a subset of the document will be returned corresponding to the nodes listed, their children, and everything between the root node and the listed nodes
*/
readonly ids?: string;
/**
* Positive integer representing how deep into the document tree to traverse.
* For example, setting this to 1 returns only Pages, setting it to 2 returns Pages and all top level objects on each page.
* Not setting this parameter returns all nodes
*/
readonly depth?: number;
/**
* A specific version ID to get. Omitting this will get the current version of the file
*/
readonly version?: string;
/**
* Set to "paths" to export vector data
*/
readonly geometry?: string;
}
export interface FileNodesParams {
/** A list of node IDs to retrieve and convert */
readonly ids: ReadonlyArray<string>;
/**
* A specific version ID to get. Omitting this will get the current version of the file
*/
readonly version?: string;
/**
* Set to "paths" to export vector data
*/
readonly geometry?: string;
}
export declare type exportFormatOptions = 'jpg' | 'png' | 'svg' | 'pdf';

@@ -25,4 +53,4 @@ export interface FileImageParams {

* Whether to simplify inside/outside strokes and use stroke attribute if
* possible instead of <mask>. Default: true.
* @default false
* possible instead of <mask>.
* @default true
*/

@@ -39,2 +67,17 @@ readonly svg_simplify_stroke?: boolean;

}
export interface PaginationParams {
/**
* Number of items in a paged list of results.
* @default 30
*/
readonly page_size?: number;
/**
* A map that indicates the starting/ending point from which objects are returned.
* The cursor value is an internally tracked integer that doesn't correspond to any Ids
*/
readonly cursor?: {
readonly before?: number;
readonly after?: number;
};
}
export interface ClientOptions {

@@ -56,5 +99,24 @@ /** access token returned from OAuth authentication */

* @param {fileId} String File to export JSON from
* @see https://www.figma.com/developers/api#get-files-endpoint
*/
readonly file: (fileId: string, params?: FileParams) => AxiosPromise<Figma.FileResponse>;
/**
* Returns a list of the versions of a file.
* The file key can be parsed from any Figma node url:
* https://www.figma.com/file/:key/:title.
* @param {fileId} String File to get version history from
* @see https://www.figma.com/developers/api#get-file-versions-endpoint
*/
readonly fileVersions: (fileId: string, ids: ReadonlyArray<string>, params?: FileNodesParams) => AxiosPromise<Figma.FileVersionsResponse>;
/**
* Returns the nodes referenced to by :ids as a JSON object.
* The nodes are retrieved from the Figma file referenced to by :key.
* The node Id and file key can be parsed from any Figma node url:
* https://www.figma.com/file/:key/:title?node-id=:id.
* @param {fileId} String File to export JSON from
* @param {params} FileNodesParams
* @see https://www.figma.com/developers/api#get-file-nodes-endpoint
*/
readonly fileNodes: (fileId: string, params: FileNodesParams) => AxiosPromise<Figma.FileNodesResponse>;
/**
* If no error occurs, "images" will be populated with a map from

@@ -70,2 +132,3 @@ * node IDs to URLs of the rendered images, and "status" will be omitted.

* @param {params} FileImageParams
* @see https://www.figma.com/developers/api#get-images-endpoint
*/

@@ -85,2 +148,3 @@ readonly fileImages: (fileId: string, params: FileImageParams) => AxiosPromise<Figma.FileImageResponse>;

* @param {fileId} String File to export images from
* @see https://www.figma.com/developers/api#get-image-fills-endpoint
*/

@@ -91,2 +155,3 @@ readonly fileImageFills: (fileId: string) => AxiosPromise<Figma.FileImageFillsResponse>;

* @param {fileId} String File to get comments from
* @see https://www.figma.com/developers/api#get-comments-endpoint
*/

@@ -98,5 +163,13 @@ readonly comments: (fileId: string) => AxiosPromise<Figma.CommentsResponse>;

* @param {params} PostCommentParams
* @see https://www.figma.com/developers/api#post-comments-endpoint
*/
readonly postComment: (fileId: string, params: PostCommentParams) => AxiosPromise<Figma.Comment>;
/**
* Get user information for the authenticated user.
* @see https://www.figma.com/developers/api#get-me-endpoint
*/
readonly me: () => AxiosPromise<Figma.User & {
readonly email: string;
}>;
/**
* Lists the projects for a specified team. Note that this will only

@@ -106,2 +179,3 @@ * return projects visible to the authenticated user or owner of the

* @param {teamId} String Id of the team to list projects from
* @see https://www.figma.com/developers/api#get-team-projects-endpoint
*/

@@ -112,5 +186,30 @@ readonly teamProjects: (teamId: string) => AxiosPromise<Figma.TeamProjectsResponse>;

* @param {projectId} String Id of the project to list files from
* @see https://www.figma.com/developers/api#get-project-files-endpoint
*/
readonly projectFiles: (projectId: string) => AxiosPromise<Figma.ProjectFilesResponse>;
/**
* Get a paginated list of published components within a team library
* @param {teamId} String Id of the team to list components from
* @see https://www.figma.com/developers/api#get-team-components-endpoint
*/
readonly teamComponents: (teamId: string, params?: PaginationParams) => AxiosPromise<Figma.TeamComponentsResponse>;
/**
* Get metadata on a component by key.
* @param {key} The unique identifier of the component.
* @see https://www.figma.com/developers/api#get-component-endpoint
*/
readonly component: (key: string) => AxiosPromise<Figma.FullComponentMetadata>;
/**
* Get a paginated list of published styles within a team library
* @param {teamId} String Id of the team to list components from
* @see https://www.figma.com/developers/api#get-team-styles-endpoint
*/
readonly teamStyles: (teamId: string, params?: PaginationParams) => AxiosPromise<Figma.TeamStylesResponse>;
/**
* Get metadata on a style by key.
* @param {key} The unique identifier of the style.
* @see https://www.figma.com/developers/api#get-style-endpoint
*/
readonly style: (key: string) => AxiosPromise<Figma.FullStyleMetadata>;
}
export declare const Client: (opts: ClientOptions) => ClientInterface;

@@ -31,2 +31,8 @@ var __assign = (this && this.__assign) || function () {

},
fileVersions: function (fileId) { return client.get("files/" + fileId + "/versions"); },
fileNodes: function (fileId, params) {
return client.get("files/" + fileId + "/nodes", {
params: __assign({}, params, { ids: params.ids.join(',') })
});
},
fileImages: function (fileId, params) {

@@ -42,6 +48,17 @@ return client.get("images/" + fileId, {

},
me: function () { return client.get("me"); },
teamProjects: function (teamId) { return client.get("teams/" + teamId + "/projects"); },
projectFiles: function (projectId) { return client.get("projects/" + projectId + "/files"); }
projectFiles: function (projectId) { return client.get("projects/" + projectId + "/files"); },
teamComponents: function (teamId, params) {
if (params === void 0) { params = {}; }
return client.get("teams/" + teamId + "/components", { params: params });
},
component: function (key) { return client.get("components/" + key); },
teamStyles: function (teamId, params) {
if (params === void 0) { params = {}; }
return client.get("teams/" + teamId + "/styles", { params: params });
},
style: function (key) { return client.get("styles/" + key); }
};
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFHQSxPQUFPLEtBQXNDLE1BQU0sT0FBTyxDQUFDO0FBc0kzRCxNQUFNLENBQUMsSUFBTSxNQUFNLEdBQUcsVUFBQyxJQUFtQjtJQUN4QyxJQUFNLE9BQU8sR0FBRyxJQUFJLENBQUMsV0FBVztRQUM5QixDQUFDLENBQUM7WUFDRSxhQUFhLEVBQUUsWUFBVSxJQUFJLENBQUMsV0FBYTtTQUM1QztRQUNILENBQUMsQ0FBQztZQUNFLGVBQWUsRUFBRSxJ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simple wrapper for the Figma API",

@@ -5,0 +5,0 @@ "main": "build/main/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc