bb-relay 0.0.20 → 0.0.21

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 (102) hide show
  1. package/dist/{Checkpoint-BDzkE4x-.d.mts → Commit-PdsjrKSG.d.mts} +2 -2
  2. package/dist/{Checkpoint-BDzkE4x-.d.ts → Commit-PdsjrKSG.d.ts} +2 -2
  3. package/dist/FileStat-CmS6lR3e.d.mts +35 -0
  4. package/dist/FileStat-CmS6lR3e.d.ts +35 -0
  5. package/dist/{Project-CaBJDjOU.d.mts → Project-B7IjpqOJ.d.mts} +2 -2
  6. package/dist/{Project-CSkTbftG.d.ts → Project-B_Vppjgw.d.ts} +2 -2
  7. package/dist/api-D-t6UimA.d.mts +302 -0
  8. package/dist/api-D7yHosgq.d.ts +302 -0
  9. package/dist/api.d.mts +5 -0
  10. package/dist/api.d.ts +5 -0
  11. package/dist/api.js +1 -0
  12. package/dist/api.mjs +0 -0
  13. package/dist/constant.js +1 -3
  14. package/dist/constant.mjs +0 -2
  15. package/dist/database.d.mts +3 -3
  16. package/dist/database.d.ts +3 -3
  17. package/dist/editor.d.mts +4 -41
  18. package/dist/editor.d.ts +4 -41
  19. package/dist/index.d.mts +6 -236
  20. package/dist/index.d.ts +6 -236
  21. package/dist/index.js +1 -3
  22. package/dist/index.mjs +0 -2
  23. package/dist/locale.js +1 -3
  24. package/dist/locale.mjs +0 -2
  25. package/package.json +2 -9
  26. package/src/api.ts +6 -0
  27. package/src/editor.ts +7 -11
  28. package/src/index.ts +2 -17
  29. package/src/types/api/BBEvent.ts +13 -34
  30. package/src/types/api/BBRequest.ts +12 -5
  31. package/src/types/database/Project.ts +2 -2
  32. package/src/types/editor/Commit.ts +11 -0
  33. package/src/types/editor/CopyArg.ts +2 -5
  34. package/src/types/editor/Nav.ts +8 -2
  35. package/src/types/requests/app/Load.ts +7 -0
  36. package/src/types/requests/app/index.ts +33 -0
  37. package/src/types/{files/FileInfo.ts → requests/file/FileStat.ts} +2 -2
  38. package/src/types/requests/file/index.ts +38 -0
  39. package/src/types/requests/folder/FolderContent.ts +4 -0
  40. package/src/types/requests/folder/FolderEntry.ts +5 -0
  41. package/src/types/requests/folder/FolderStat.ts +9 -0
  42. package/src/types/requests/folder/index.ts +33 -0
  43. package/src/types/requests/git.ts +65 -0
  44. package/src/types/requests/project.ts +15 -0
  45. package/src/types/requests/storage.ts +24 -0
  46. package/dist/chunk-NBMM2TZK.js +0 -33
  47. package/dist/chunk-S47CVTVK.mjs +0 -33
  48. package/dist/dev.d.mts +0 -11
  49. package/dist/dev.d.ts +0 -11
  50. package/dist/dev.js +0 -4991
  51. package/dist/dev.mjs +0 -4991
  52. package/src/dev.ts +0 -4
  53. package/src/load-virtual-editor/app/StatusState.ts +0 -6
  54. package/src/load-virtual-editor/app/css.ts +0 -154
  55. package/src/load-virtual-editor/app/store.ts +0 -25
  56. package/src/load-virtual-editor/events/handle-dir-update.ts +0 -23
  57. package/src/load-virtual-editor/events/handle-file-update.ts +0 -23
  58. package/src/load-virtual-editor/events/handle-load.ts +0 -39
  59. package/src/load-virtual-editor/events/handle-selected.ts +0 -30
  60. package/src/load-virtual-editor/index.ts +0 -52
  61. package/src/load-virtual-editor/lib/indexedStorage.ts +0 -28
  62. package/src/load-virtual-editor/mocks/generate-files.ts +0 -25
  63. package/src/load-virtual-editor/node/NodeState.ts +0 -23
  64. package/src/load-virtual-editor/node/copyDir.ts +0 -14
  65. package/src/load-virtual-editor/node/copyFile.ts +0 -14
  66. package/src/load-virtual-editor/node/createDir.ts +0 -10
  67. package/src/load-virtual-editor/node/createFile.ts +0 -13
  68. package/src/load-virtual-editor/node/deleteDir.ts +0 -10
  69. package/src/load-virtual-editor/node/deleteFile.ts +0 -13
  70. package/src/load-virtual-editor/node/formatPath.ts +0 -13
  71. package/src/load-virtual-editor/node/formatText.ts +0 -19
  72. package/src/load-virtual-editor/node/generateDirs.ts +0 -13
  73. package/src/load-virtual-editor/node/getDescendantLevel.ts +0 -9
  74. package/src/load-virtual-editor/node/getDirInfo.ts +0 -33
  75. package/src/load-virtual-editor/node/getFileInfo.ts +0 -31
  76. package/src/load-virtual-editor/node/getFiles.ts +0 -17
  77. package/src/load-virtual-editor/node/getParent.ts +0 -11
  78. package/src/load-virtual-editor/node/readDir.ts +0 -41
  79. package/src/load-virtual-editor/node/readFile.ts +0 -46
  80. package/src/load-virtual-editor/node/store.ts +0 -206
  81. package/src/load-virtual-editor/node/watch.ts +0 -9
  82. package/src/load-virtual-editor/node/writeFile.ts +0 -21
  83. package/src/load-virtual-editor/postResponse.ts +0 -21
  84. package/src/load-virtual-editor/request/requestFS.ts +0 -199
  85. package/src/load-virtual-editor/request/requestSelected.ts +0 -45
  86. package/src/load-virtual-editor/selected/SelectedState.ts +0 -7
  87. package/src/load-virtual-editor/selected/selectDir.ts +0 -13
  88. package/src/load-virtual-editor/selected/selectFile.ts +0 -13
  89. package/src/load-virtual-editor/selected/store.ts +0 -27
  90. package/src/load-virtual-editor/selected/watch.ts +0 -9
  91. package/src/types/api/DirRequests.ts +0 -39
  92. package/src/types/api/ProjectRequest.ts +0 -11
  93. package/src/types/editor/Checkpoint.ts +0 -11
  94. package/src/types/editor/DirectoryContents.ts +0 -4
  95. package/src/types/editor/DirectoryStats.ts +0 -4
  96. package/src/types/editor/RenameType.ts +0 -4
  97. package/src/types/files/FileTypes.ts +0 -13
  98. package/src/types/files/ReadFile.ts +0 -17
  99. package/src/types/files/index.ts +0 -31
  100. package/src/types/status/Load.ts +0 -16
  101. package/src/types/storage/index.ts +0 -11
  102. /package/src/types/{editor → requests/file}/FileContent.ts +0 -0
@@ -1,4 +1,4 @@
1
- type Checkpoint = {
1
+ type Commit = {
2
2
  sha: string;
3
3
  message: string;
4
4
  timestamp: number;
@@ -8,4 +8,4 @@ type Checkpoint = {
8
8
  };
9
9
  };
10
10
 
11
- export type { Checkpoint as C };
11
+ export type { Commit as C };
@@ -1,4 +1,4 @@
1
- type Checkpoint = {
1
+ type Commit = {
2
2
  sha: string;
3
3
  message: string;
4
4
  timestamp: number;
@@ -8,4 +8,4 @@ type Checkpoint = {
8
8
  };
9
9
  };
10
10
 
11
- export type { Checkpoint as C };
11
+ export type { Commit as C };
@@ -0,0 +1,35 @@
1
+ type CopyArg = {
2
+ source: string;
3
+ destination: string;
4
+ };
5
+
6
+ interface FolderContent {
7
+ files: string[];
8
+ folders: string[];
9
+ }
10
+
11
+ type FileEncoding = Extract<BufferEncoding, "utf8" | "hex" | "base64" | "base64url">;
12
+ type FileContent = {
13
+ path: string;
14
+ content: string;
15
+ type: FileEncoding;
16
+ };
17
+
18
+ interface GitFileStatus {
19
+ filePath: string;
20
+ staged: boolean;
21
+ status: "new" | "modified" | "deleted";
22
+ }
23
+
24
+ type FileStat = {
25
+ name: string;
26
+ fullPath: string;
27
+ createdAt: string;
28
+ modifiedAt: string;
29
+ ext: string;
30
+ size: number;
31
+ wordCount: number;
32
+ summary: string;
33
+ };
34
+
35
+ export type { CopyArg as C, FolderContent as F, GitFileStatus as G, FileContent as a, FileStat as b };
@@ -0,0 +1,35 @@
1
+ type CopyArg = {
2
+ source: string;
3
+ destination: string;
4
+ };
5
+
6
+ interface FolderContent {
7
+ files: string[];
8
+ folders: string[];
9
+ }
10
+
11
+ type FileEncoding = Extract<BufferEncoding, "utf8" | "hex" | "base64" | "base64url">;
12
+ type FileContent = {
13
+ path: string;
14
+ content: string;
15
+ type: FileEncoding;
16
+ };
17
+
18
+ interface GitFileStatus {
19
+ filePath: string;
20
+ staged: boolean;
21
+ status: "new" | "modified" | "deleted";
22
+ }
23
+
24
+ type FileStat = {
25
+ name: string;
26
+ fullPath: string;
27
+ createdAt: string;
28
+ modifiedAt: string;
29
+ ext: string;
30
+ size: number;
31
+ wordCount: number;
32
+ summary: string;
33
+ };
34
+
35
+ export type { CopyArg as C, FolderContent as F, GitFileStatus as G, FileContent as a, FileStat as b };
@@ -1,5 +1,5 @@
1
1
  import { P as PROJECT_CATEGORY } from './PROJECT_CATEGORY-BivLHtB6.mjs';
2
- import { C as Checkpoint } from './Checkpoint-BDzkE4x-.mjs';
2
+ import { C as Commit } from './Commit-PdsjrKSG.mjs';
3
3
 
4
4
  type BaseWithId = {
5
5
  id: string | number;
@@ -24,7 +24,7 @@ interface BaseProject {
24
24
  tags?: string[];
25
25
  description?: string;
26
26
  category?: Category;
27
- history?: Checkpoint[];
27
+ history?: Commit[];
28
28
  userId: string;
29
29
  }
30
30
  type Project = Wrapper<BaseProject>;
@@ -1,5 +1,5 @@
1
1
  import { P as PROJECT_CATEGORY } from './PROJECT_CATEGORY-BivLHtB6.js';
2
- import { C as Checkpoint } from './Checkpoint-BDzkE4x-.js';
2
+ import { C as Commit } from './Commit-PdsjrKSG.js';
3
3
 
4
4
  type BaseWithId = {
5
5
  id: string | number;
@@ -24,7 +24,7 @@ interface BaseProject {
24
24
  tags?: string[];
25
25
  description?: string;
26
26
  category?: Category;
27
- history?: Checkpoint[];
27
+ history?: Commit[];
28
28
  userId: string;
29
29
  }
30
30
  type Project = Wrapper<BaseProject>;
@@ -0,0 +1,302 @@
1
+ import { a as FileContent, b as FileStat, C as CopyArg, F as FolderContent, G as GitFileStatus } from './FileStat-CmS6lR3e.mjs';
2
+ import { P as Project } from './Project-B7IjpqOJ.mjs';
3
+ import { C as Commit } from './Commit-PdsjrKSG.mjs';
4
+
5
+ type BBEvent = {
6
+ app: {
7
+ response: "load" | "language" | "theme";
8
+ };
9
+ project: {
10
+ response: "updated" | "changed";
11
+ };
12
+ selection: {
13
+ response: {
14
+ type: "file" | "folder";
15
+ path: string;
16
+ };
17
+ };
18
+ token: {
19
+ response: string;
20
+ };
21
+ file: {
22
+ response: string;
23
+ };
24
+ folder: {
25
+ response: string;
26
+ };
27
+ editor: {
28
+ response: FileContent | null;
29
+ };
30
+ };
31
+
32
+ type Result<T = null> = {
33
+ data: T | null;
34
+ error: string | null;
35
+ };
36
+
37
+ type FileRequests = {
38
+ "file:read": {
39
+ args: {
40
+ path: string;
41
+ };
42
+ response: Result<FileContent>;
43
+ };
44
+ "file:delete": {
45
+ args: {
46
+ path: string;
47
+ };
48
+ response: Result;
49
+ };
50
+ "file:write": {
51
+ args: {
52
+ path: string;
53
+ content: FileContent;
54
+ };
55
+ response: Result;
56
+ };
57
+ "file:list": {
58
+ args: {
59
+ glob?: string;
60
+ } | null;
61
+ response: Result<string[]>;
62
+ };
63
+ "file:stat": {
64
+ args: {
65
+ path: string;
66
+ };
67
+ response: Result<FileStat>;
68
+ };
69
+ "file:copy": {
70
+ args: CopyArg;
71
+ response: Result;
72
+ };
73
+ "file:select": {
74
+ args: {
75
+ path: string;
76
+ };
77
+ response: Result;
78
+ };
79
+ };
80
+
81
+ type FolderStat = {
82
+ name: string;
83
+ fullPath: string;
84
+ createdAt: string;
85
+ modifiedAt: string;
86
+ size: number;
87
+ fileCount: number;
88
+ folderCount: number;
89
+ };
90
+
91
+ type FolderRequest = {
92
+ "folder:read": {
93
+ args: {
94
+ path: string;
95
+ };
96
+ response: Result<FolderContent>;
97
+ };
98
+ "folder:create": {
99
+ args: {
100
+ path: string;
101
+ };
102
+ response: Result;
103
+ };
104
+ "folder:delete": {
105
+ args: {
106
+ path: string;
107
+ };
108
+ response: Result;
109
+ };
110
+ "folder:stat": {
111
+ args: {
112
+ path: string;
113
+ };
114
+ response: Result<FolderStat>;
115
+ };
116
+ "folder:copy": {
117
+ args: CopyArg;
118
+ response: Result;
119
+ };
120
+ "folder:select": {
121
+ args: {
122
+ path: string;
123
+ };
124
+ response: Result;
125
+ };
126
+ };
127
+
128
+ type StorageRequests = {
129
+ "storage:set": {
130
+ args: {
131
+ key: string;
132
+ value: string;
133
+ };
134
+ response: Result;
135
+ };
136
+ "storage:get": {
137
+ args: {
138
+ key: string;
139
+ };
140
+ response: Result<string>;
141
+ };
142
+ "storage:remove": {
143
+ args: {
144
+ key: string;
145
+ };
146
+ response: Result;
147
+ };
148
+ "storage:clear": {
149
+ args: null;
150
+ response: Result;
151
+ };
152
+ "storage:keys": {
153
+ args: null;
154
+ response: Result<string[]>;
155
+ };
156
+ };
157
+
158
+ type ProjectRequest = {
159
+ "project:update": {
160
+ args: Project["update"];
161
+ response: Result;
162
+ };
163
+ "project:read": {
164
+ args: null;
165
+ response: Result<Project["doc"]>;
166
+ };
167
+ };
168
+
169
+ type Load = {
170
+ styles: string;
171
+ theme: "light" | "dark";
172
+ languages: string[];
173
+ };
174
+
175
+ type AppRequest = {
176
+ "app:ping": {
177
+ args: null;
178
+ response: Result<"pong">;
179
+ };
180
+ "app:version": {
181
+ args: null;
182
+ response: Result<string>;
183
+ };
184
+ "app:load": {
185
+ args: null;
186
+ response: Result<Load>;
187
+ };
188
+ "app:language": {
189
+ args: null;
190
+ response: Result<string[]>;
191
+ };
192
+ "app:icon": {
193
+ args: {
194
+ extensionId: string;
195
+ isFolder?: boolean;
196
+ };
197
+ response: Result<string>;
198
+ };
199
+ "app:styles": {
200
+ args: null;
201
+ response: Result<string>;
202
+ };
203
+ "app:theme": {
204
+ args: null;
205
+ response: Result<"light" | "dark">;
206
+ };
207
+ };
208
+
209
+ type GitRequests = {
210
+ "git:init": {
211
+ args: null;
212
+ response: Result;
213
+ };
214
+ "git:stage": {
215
+ args: {
216
+ path: string;
217
+ };
218
+ response: Result;
219
+ };
220
+ "git:unstage": {
221
+ args: {
222
+ path: string;
223
+ };
224
+ response: Result;
225
+ };
226
+ "git:stage-all": {
227
+ args: null;
228
+ response: Result;
229
+ };
230
+ "git:unstage-all": {
231
+ args: null;
232
+ response: Result;
233
+ };
234
+ "git:commit": {
235
+ args: {
236
+ message: string;
237
+ };
238
+ response: Result;
239
+ };
240
+ "git:checkout": {
241
+ args: {
242
+ ref: string;
243
+ };
244
+ response: Result;
245
+ };
246
+ "git:discard": {
247
+ args: {
248
+ path: string;
249
+ };
250
+ response: Result;
251
+ };
252
+ "git:discard-all": {
253
+ args: null;
254
+ response: Result;
255
+ };
256
+ "git:log": {
257
+ args: null;
258
+ response: Result<Commit[]>;
259
+ };
260
+ "git:diff": {
261
+ args: {
262
+ path: string;
263
+ };
264
+ response: Result;
265
+ };
266
+ "git:push": {
267
+ args: null;
268
+ response: Result;
269
+ };
270
+ "git:pull": {
271
+ args: null;
272
+ response: Result;
273
+ };
274
+ "git:status": {
275
+ args: {
276
+ path: string;
277
+ };
278
+ response: Result<GitFileStatus>;
279
+ };
280
+ "git:status-list": {
281
+ args: null;
282
+ response: Result<GitFileStatus[]>;
283
+ };
284
+ };
285
+
286
+ type BBRequest = FileRequests & FolderRequest & StorageRequests & ProjectRequest & AppRequest & GitRequests;
287
+
288
+ interface EventReturn<K extends keyof BBEvent> {
289
+ type: K;
290
+ response: BBEvent[K]["response"];
291
+ responseId: string;
292
+ }
293
+
294
+ interface RequestReturn<K extends keyof BBRequest> {
295
+ id: string;
296
+ type: K;
297
+ response: BBRequest[K]["response"] | null;
298
+ error: null | string;
299
+ responseId: string;
300
+ }
301
+
302
+ export type { BBRequest as B, EventReturn as E, RequestReturn as R, BBEvent as a, Result as b };