figmanage 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +74 -59
  2. package/dist/cli/analytics.d.ts +3 -0
  3. package/dist/cli/analytics.js +48 -0
  4. package/dist/cli/branching.d.ts +3 -0
  5. package/dist/cli/branching.js +56 -0
  6. package/dist/cli/comments.d.ts +3 -0
  7. package/dist/cli/comments.js +86 -0
  8. package/dist/cli/components.d.ts +3 -0
  9. package/dist/cli/components.js +82 -0
  10. package/dist/cli/compound-commands.d.ts +14 -0
  11. package/dist/cli/compound-commands.js +291 -0
  12. package/dist/cli/export.d.ts +3 -0
  13. package/dist/cli/export.js +51 -0
  14. package/dist/cli/files.d.ts +3 -0
  15. package/dist/cli/files.js +156 -0
  16. package/dist/cli/helpers.d.ts +7 -0
  17. package/dist/cli/helpers.js +43 -0
  18. package/dist/cli/index.js +65 -89
  19. package/dist/cli/libraries.d.ts +3 -0
  20. package/dist/cli/libraries.js +26 -0
  21. package/dist/cli/navigate.d.ts +3 -0
  22. package/dist/cli/navigate.js +192 -0
  23. package/dist/cli/org.d.ts +3 -0
  24. package/dist/cli/org.js +227 -0
  25. package/dist/cli/permissions.d.ts +3 -0
  26. package/dist/cli/permissions.js +133 -0
  27. package/dist/cli/projects.d.ts +3 -0
  28. package/dist/cli/projects.js +110 -0
  29. package/dist/cli/reading.d.ts +3 -0
  30. package/dist/cli/reading.js +51 -0
  31. package/dist/cli/teams.d.ts +3 -0
  32. package/dist/cli/teams.js +56 -0
  33. package/dist/cli/variables.d.ts +3 -0
  34. package/dist/cli/variables.js +80 -0
  35. package/dist/cli/versions.d.ts +3 -0
  36. package/dist/cli/versions.js +46 -0
  37. package/dist/cli/webhooks.d.ts +3 -0
  38. package/dist/cli/webhooks.js +100 -0
  39. package/dist/cli/whoami.js +3 -2
  40. package/dist/index.js +1 -1
  41. package/dist/operations/analytics.d.ts +10 -0
  42. package/dist/operations/analytics.js +15 -0
  43. package/dist/operations/branching.d.ts +24 -0
  44. package/dist/operations/branching.js +41 -0
  45. package/dist/operations/comments.d.ts +43 -0
  46. package/dist/operations/comments.js +65 -0
  47. package/dist/operations/components.d.ts +24 -0
  48. package/dist/operations/components.js +30 -0
  49. package/dist/operations/compound-manager.d.ts +101 -0
  50. package/dist/operations/compound-manager.js +629 -0
  51. package/dist/operations/compound.d.ts +102 -0
  52. package/dist/operations/compound.js +595 -0
  53. package/dist/operations/export.d.ts +19 -0
  54. package/dist/operations/export.js +27 -0
  55. package/dist/operations/files.d.ts +55 -0
  56. package/dist/operations/files.js +89 -0
  57. package/dist/operations/libraries.d.ts +5 -0
  58. package/dist/operations/libraries.js +10 -0
  59. package/dist/operations/navigate.d.ts +99 -0
  60. package/dist/operations/navigate.js +266 -0
  61. package/dist/operations/org.d.ts +95 -0
  62. package/dist/operations/org.js +205 -0
  63. package/dist/operations/permissions.d.ts +59 -0
  64. package/dist/operations/permissions.js +112 -0
  65. package/dist/operations/projects.d.ts +29 -0
  66. package/dist/operations/projects.js +40 -0
  67. package/dist/operations/reading.d.ts +12 -0
  68. package/dist/operations/reading.js +20 -0
  69. package/dist/operations/teams.d.ts +17 -0
  70. package/dist/operations/teams.js +17 -0
  71. package/dist/operations/variables.d.ts +17 -0
  72. package/dist/operations/variables.js +39 -0
  73. package/dist/operations/versions.d.ts +23 -0
  74. package/dist/operations/versions.js +27 -0
  75. package/dist/operations/webhooks.d.ts +25 -0
  76. package/dist/operations/webhooks.js +38 -0
  77. package/dist/tools/analytics.js +6 -16
  78. package/dist/tools/branching.js +7 -36
  79. package/dist/tools/comments.js +9 -56
  80. package/dist/tools/components.js +7 -19
  81. package/dist/tools/compound-manager.js +21 -644
  82. package/dist/tools/compound.js +32 -566
  83. package/dist/tools/export.js +4 -23
  84. package/dist/tools/files.js +21 -68
  85. package/dist/tools/libraries.js +4 -11
  86. package/dist/tools/navigate.js +23 -246
  87. package/dist/tools/org.js +29 -245
  88. package/dist/tools/permissions.js +18 -97
  89. package/dist/tools/projects.js +8 -27
  90. package/dist/tools/reading.js +5 -15
  91. package/dist/tools/teams.js +8 -16
  92. package/dist/tools/variables.js +13 -30
  93. package/dist/tools/versions.js +6 -24
  94. package/dist/tools/webhooks.js +7 -24
  95. package/package.json +1 -1
  96. package/dist/cli/commands.d.ts +0 -47
  97. package/dist/cli/commands.js +0 -1204
@@ -0,0 +1,24 @@
1
+ import type { AuthConfig } from '../auth/client.js';
2
+ export interface Branch {
3
+ key: string;
4
+ name: string;
5
+ thumbnail_url: string | null;
6
+ last_modified: string | null;
7
+ link_access: string | null;
8
+ }
9
+ export interface CreatedBranch {
10
+ key: string | null;
11
+ name: string;
12
+ main_file_key: string;
13
+ }
14
+ export declare function listBranches(config: AuthConfig, params: {
15
+ file_key: string;
16
+ }): Promise<Branch[]>;
17
+ export declare function createBranch(config: AuthConfig, params: {
18
+ file_key: string;
19
+ name: string;
20
+ }): Promise<CreatedBranch>;
21
+ export declare function deleteBranch(config: AuthConfig, params: {
22
+ branch_key: string;
23
+ }): Promise<void>;
24
+ //# sourceMappingURL=branching.d.ts.map
@@ -0,0 +1,41 @@
1
+ import { hasCookie } from '../auth/client.js';
2
+ import { publicClient } from '../clients/public-api.js';
3
+ import { internalClient } from '../clients/internal-api.js';
4
+ export async function listBranches(config, params) {
5
+ let branches;
6
+ if (hasCookie(config)) {
7
+ const res = await internalClient(config).get(`/api/files/${params.file_key}`);
8
+ const f = res.data?.meta || res.data;
9
+ branches = f.branches || [];
10
+ }
11
+ else {
12
+ const res = await publicClient(config).get(`/v1/files/${params.file_key}`, {
13
+ params: { branch_data: 'true', depth: '0' },
14
+ });
15
+ branches = res.data?.branches || [];
16
+ }
17
+ return branches.map((b) => ({
18
+ key: b.key,
19
+ name: b.name,
20
+ thumbnail_url: b.thumbnail_url || null,
21
+ last_modified: b.last_modified || null,
22
+ link_access: b.link_access || null,
23
+ }));
24
+ }
25
+ export async function createBranch(config, params) {
26
+ const res = await internalClient(config).post(`/api/multiplayer/${params.file_key}/branch_create?name=${encodeURIComponent(params.name)}`);
27
+ const meta = res.data?.meta || res.data || {};
28
+ const file = meta.file || meta;
29
+ const branchKey = file.key || file.file_key || null;
30
+ return {
31
+ key: branchKey,
32
+ name: params.name,
33
+ main_file_key: params.file_key,
34
+ };
35
+ }
36
+ export async function deleteBranch(config, params) {
37
+ await internalClient(config).delete('/api/files_batch', {
38
+ data: { files: [{ key: params.branch_key }], trashed: true },
39
+ });
40
+ }
41
+ //# sourceMappingURL=branching.js.map
@@ -0,0 +1,43 @@
1
+ import type { AuthConfig } from '../auth/client.js';
2
+ export interface Comment {
3
+ id: string;
4
+ parent_id: string | null;
5
+ message: string;
6
+ author: string;
7
+ author_id: string;
8
+ created_at: string;
9
+ resolved_at: string | null;
10
+ node_id: string | null;
11
+ order_id: number;
12
+ }
13
+ export interface PostedComment {
14
+ id: string;
15
+ message: string;
16
+ author: string;
17
+ created_at: string;
18
+ parent_id: string | null;
19
+ }
20
+ export interface Reaction {
21
+ emoji: string;
22
+ user: string;
23
+ created_at: string;
24
+ }
25
+ export declare function listComments(config: AuthConfig, params: {
26
+ file_key: string;
27
+ }): Promise<Comment[]>;
28
+ export declare function formatCommentsAsMarkdown(comments: Comment[]): string;
29
+ export declare function postComment(config: AuthConfig, params: {
30
+ file_key: string;
31
+ message: string;
32
+ comment_id?: string;
33
+ node_id?: string;
34
+ }): Promise<PostedComment>;
35
+ export declare function deleteComment(config: AuthConfig, params: {
36
+ file_key: string;
37
+ comment_id: string;
38
+ }): Promise<void>;
39
+ export declare function listCommentReactions(config: AuthConfig, params: {
40
+ file_key: string;
41
+ comment_id: string;
42
+ }): Promise<Reaction[]>;
43
+ //# sourceMappingURL=comments.d.ts.map
@@ -0,0 +1,65 @@
1
+ import { publicClient } from '../clients/public-api.js';
2
+ export async function listComments(config, params) {
3
+ const res = await publicClient(config).get(`/v1/files/${params.file_key}/comments`);
4
+ const comments = res.data?.comments || [];
5
+ return comments.map((c) => ({
6
+ id: c.id,
7
+ parent_id: c.parent_id || null,
8
+ message: c.message,
9
+ author: c.user?.handle,
10
+ author_id: c.user?.id,
11
+ created_at: c.created_at,
12
+ resolved_at: c.resolved_at || null,
13
+ node_id: c.client_meta?.node_id || c.client_meta?.node_offset?.node_id || null,
14
+ order_id: c.order_id,
15
+ }));
16
+ }
17
+ export function formatCommentsAsMarkdown(comments) {
18
+ const threads = new Map();
19
+ for (const c of comments) {
20
+ const parentId = c.parent_id || c.id;
21
+ if (!threads.has(parentId))
22
+ threads.set(parentId, []);
23
+ threads.get(parentId).push(c);
24
+ }
25
+ const lines = [];
26
+ for (const [, thread] of threads) {
27
+ thread.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
28
+ for (const c of thread) {
29
+ const indent = c.parent_id ? ' ' : '';
30
+ const resolved = c.resolved_at ? ' [resolved]' : '';
31
+ lines.push(`${indent}- **${c.author}** (${c.created_at})${resolved}: ${c.message}`);
32
+ }
33
+ lines.push('');
34
+ }
35
+ return lines.join('\n');
36
+ }
37
+ export async function postComment(config, params) {
38
+ const body = { message: params.message };
39
+ if (params.comment_id)
40
+ body.comment_id = params.comment_id;
41
+ if (params.node_id)
42
+ body.client_meta = { node_id: params.node_id, node_offset: { x: 0, y: 0 } };
43
+ const res = await publicClient(config).post(`/v1/files/${params.file_key}/comments`, body);
44
+ const c = res.data;
45
+ return {
46
+ id: c.id,
47
+ message: c.message,
48
+ author: c.user?.handle,
49
+ created_at: c.created_at,
50
+ parent_id: c.parent_id || null,
51
+ };
52
+ }
53
+ export async function deleteComment(config, params) {
54
+ await publicClient(config).delete(`/v1/files/${params.file_key}/comments/${params.comment_id}`);
55
+ }
56
+ export async function listCommentReactions(config, params) {
57
+ const res = await publicClient(config).get(`/v1/files/${params.file_key}/comments/${params.comment_id}/reactions`);
58
+ const reactions = res.data?.reactions || [];
59
+ return reactions.map((r) => ({
60
+ emoji: r.emoji,
61
+ user: r.user?.handle,
62
+ created_at: r.created_at,
63
+ }));
64
+ }
65
+ //# sourceMappingURL=comments.js.map
@@ -0,0 +1,24 @@
1
+ import type { AuthConfig } from '../auth/client.js';
2
+ export declare function listFileComponents(config: AuthConfig, params: {
3
+ file_key: string;
4
+ }): Promise<any[]>;
5
+ export declare function listFileStyles(config: AuthConfig, params: {
6
+ file_key: string;
7
+ }): Promise<any[]>;
8
+ export declare function listTeamComponents(config: AuthConfig, params: {
9
+ team_id: string;
10
+ page_size?: number;
11
+ cursor?: string;
12
+ }): Promise<{
13
+ components: any[];
14
+ pagination: any;
15
+ }>;
16
+ export declare function listTeamStyles(config: AuthConfig, params: {
17
+ team_id: string;
18
+ page_size?: number;
19
+ cursor?: string;
20
+ }): Promise<{
21
+ styles: any[];
22
+ pagination: any;
23
+ }>;
24
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { publicClient } from '../clients/public-api.js';
2
+ export async function listFileComponents(config, params) {
3
+ const res = await publicClient(config).get(`/v1/files/${params.file_key}/components`);
4
+ return res.data?.meta?.components || [];
5
+ }
6
+ export async function listFileStyles(config, params) {
7
+ const res = await publicClient(config).get(`/v1/files/${params.file_key}/styles`);
8
+ return res.data?.meta?.styles || [];
9
+ }
10
+ export async function listTeamComponents(config, params) {
11
+ const queryParams = { page_size: params.page_size ?? 30 };
12
+ if (params.cursor)
13
+ queryParams.after = params.cursor;
14
+ const res = await publicClient(config).get(`/v1/teams/${params.team_id}/components`, { params: queryParams });
15
+ return {
16
+ components: res.data?.meta?.components || [],
17
+ pagination: res.data?.pagination || null,
18
+ };
19
+ }
20
+ export async function listTeamStyles(config, params) {
21
+ const queryParams = { page_size: params.page_size ?? 30 };
22
+ if (params.cursor)
23
+ queryParams.after = params.cursor;
24
+ const res = await publicClient(config).get(`/v1/teams/${params.team_id}/styles`, { params: queryParams });
25
+ return {
26
+ styles: res.data?.meta?.styles || [],
27
+ pagination: res.data?.pagination || null,
28
+ };
29
+ }
30
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1,101 @@
1
+ import type { AuthConfig } from '../auth/client.js';
2
+ export declare function offboardUser(config: AuthConfig, params: {
3
+ user_identifier: string;
4
+ execute: boolean;
5
+ transfer_to?: string;
6
+ org_id?: string;
7
+ }): Promise<{
8
+ user: {
9
+ org_user_id: string;
10
+ user_id: string;
11
+ name: any;
12
+ email: any;
13
+ seat_type: any;
14
+ permission: any;
15
+ };
16
+ team_memberships: {
17
+ team_id: string;
18
+ team_name: string;
19
+ role: string;
20
+ }[];
21
+ project_permissions: {
22
+ project_id: string;
23
+ project_name: string;
24
+ team_name: string;
25
+ role: string;
26
+ }[];
27
+ file_ownership: {
28
+ file_key: string;
29
+ file_name: string;
30
+ project_name: string;
31
+ team_name: string;
32
+ }[];
33
+ summary: {
34
+ teams: number;
35
+ projects_with_access: number;
36
+ files_owned: number;
37
+ };
38
+ transfer_plan: string[];
39
+ note: string;
40
+ executed?: undefined;
41
+ actions?: undefined;
42
+ } | {
43
+ user: {
44
+ org_user_id: string;
45
+ user_id: string;
46
+ name: any;
47
+ email: any;
48
+ seat_type: any;
49
+ permission: any;
50
+ };
51
+ executed: boolean;
52
+ actions: {
53
+ action: string;
54
+ status: string;
55
+ detail?: string;
56
+ }[];
57
+ summary: {
58
+ succeeded: number;
59
+ failed: number;
60
+ total: number;
61
+ };
62
+ note: string;
63
+ team_memberships?: undefined;
64
+ project_permissions?: undefined;
65
+ file_ownership?: undefined;
66
+ transfer_plan?: undefined;
67
+ }>;
68
+ export declare function onboardUser(config: AuthConfig, params: {
69
+ email: string;
70
+ team_ids: string[];
71
+ role: string;
72
+ share_files?: string[];
73
+ seat_type?: string;
74
+ confirm?: boolean;
75
+ org_id?: string;
76
+ }): Promise<{
77
+ user_email: string;
78
+ setup_results: {
79
+ teams_joined: {
80
+ team_id: string;
81
+ team_name: string;
82
+ role: string;
83
+ status: string;
84
+ }[];
85
+ files_shared: {
86
+ file_key: string;
87
+ role: string;
88
+ status: string;
89
+ }[];
90
+ seat_change: {
91
+ status: string;
92
+ note?: string;
93
+ };
94
+ };
95
+ next_steps: string[];
96
+ }>;
97
+ export declare function quarterlyDesignOpsReport(config: AuthConfig, params: {
98
+ org_id?: string;
99
+ days: number;
100
+ }): Promise<Record<string, any>>;
101
+ //# sourceMappingURL=compound-manager.d.ts.map