bb-relay 0.0.21 → 0.0.23

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 (39) hide show
  1. package/dist/Plugin-BMoQ48uq.d.mts +46 -0
  2. package/dist/Plugin-BojCB5ZJ.d.ts +46 -0
  3. package/dist/Result-BLbZLEgX.d.mts +6 -0
  4. package/dist/Result-BLbZLEgX.d.ts +6 -0
  5. package/dist/api.d.mts +350 -4
  6. package/dist/api.d.ts +350 -4
  7. package/dist/database.d.mts +2 -44
  8. package/dist/database.d.ts +2 -44
  9. package/dist/editor.d.mts +1 -0
  10. package/dist/editor.d.ts +1 -0
  11. package/dist/index.d.mts +38 -14
  12. package/dist/index.d.ts +38 -14
  13. package/dist/index.js +101 -37
  14. package/dist/index.mjs +101 -37
  15. package/package.json +1 -1
  16. package/src/api.ts +10 -1
  17. package/src/editor.ts +2 -0
  18. package/src/index.ts +4 -2
  19. package/src/lib/validate-manifest/index.ts +76 -0
  20. package/src/lib/validate-upload/index.ts +12 -0
  21. package/src/relay/index.ts +11 -11
  22. package/src/relay/registerEvent.ts +4 -3
  23. package/src/relay/registerRequest.ts +5 -6
  24. package/src/relay/storage-bridge.ts +7 -7
  25. package/src/types/api/BBEvent.ts +35 -2
  26. package/src/types/api/EventParam.ts +1 -0
  27. package/src/types/api/EventReturn.ts +1 -0
  28. package/src/types/api/RequestParam.ts +1 -0
  29. package/src/types/editor/Manifest.ts +24 -1
  30. package/src/types/requests/app/index.ts +6 -13
  31. package/src/types/requests/file/index.ts +9 -13
  32. package/src/types/requests/folder/index.ts +6 -7
  33. package/src/types/requests/git.ts +15 -16
  34. package/src/types/requests/project.ts +2 -3
  35. package/src/types/requests/storage.ts +21 -11
  36. package/src/utils/extract-styles.ts +22 -0
  37. package/dist/api-D-t6UimA.d.mts +0 -302
  38. package/dist/api-D7yHosgq.d.ts +0 -302
  39. package/src/lib/validate-manifest.ts +0 -34
@@ -0,0 +1,46 @@
1
+ import { W as Wrapper } from './Project-B7IjpqOJ.mjs';
2
+
3
+ type BaseRelease = {
4
+ storageRef: string;
5
+ changes: string;
6
+ version: string;
7
+ type: "production" | "beta" | "draft";
8
+ slug: string;
9
+ metadata: {
10
+ uploadedAt: number;
11
+ totalFiles: number;
12
+ totalSize: number;
13
+ };
14
+ createdAt: string;
15
+ id: string;
16
+ updatedAt: string;
17
+ userId: string;
18
+ installs: number;
19
+ };
20
+ type Release = Wrapper<BaseRelease>;
21
+
22
+ type Status = Omit<Release["doc"], "type">;
23
+ /**
24
+ * This will be pulled from two firestore
25
+ * The part of name, description etc will be in the main
26
+ * Things like installs will be in the registry
27
+ */
28
+ type BasePlugin = {
29
+ userId: string;
30
+ slug: string;
31
+ name: string;
32
+ description: string | null;
33
+ archived?: boolean;
34
+ deprecated?: boolean;
35
+ beta: Status | null;
36
+ production: Status | null;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ tags: string[];
40
+ username: string;
41
+ id: string;
42
+ avatar?: string;
43
+ };
44
+ type Plugin = Wrapper<BasePlugin>;
45
+
46
+ export type { Plugin as P, Release as R };
@@ -0,0 +1,46 @@
1
+ import { W as Wrapper } from './Project-B_Vppjgw.js';
2
+
3
+ type BaseRelease = {
4
+ storageRef: string;
5
+ changes: string;
6
+ version: string;
7
+ type: "production" | "beta" | "draft";
8
+ slug: string;
9
+ metadata: {
10
+ uploadedAt: number;
11
+ totalFiles: number;
12
+ totalSize: number;
13
+ };
14
+ createdAt: string;
15
+ id: string;
16
+ updatedAt: string;
17
+ userId: string;
18
+ installs: number;
19
+ };
20
+ type Release = Wrapper<BaseRelease>;
21
+
22
+ type Status = Omit<Release["doc"], "type">;
23
+ /**
24
+ * This will be pulled from two firestore
25
+ * The part of name, description etc will be in the main
26
+ * Things like installs will be in the registry
27
+ */
28
+ type BasePlugin = {
29
+ userId: string;
30
+ slug: string;
31
+ name: string;
32
+ description: string | null;
33
+ archived?: boolean;
34
+ deprecated?: boolean;
35
+ beta: Status | null;
36
+ production: Status | null;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ tags: string[];
40
+ username: string;
41
+ id: string;
42
+ avatar?: string;
43
+ };
44
+ type Plugin = Wrapper<BasePlugin>;
45
+
46
+ export type { Plugin as P, Release as R };
@@ -0,0 +1,6 @@
1
+ type Result<T = null> = {
2
+ data: T | null;
3
+ error: string | null;
4
+ };
5
+
6
+ export type { Result as R };
@@ -0,0 +1,6 @@
1
+ type Result<T = null> = {
2
+ data: T | null;
3
+ error: string | null;
4
+ };
5
+
6
+ export type { Result as R };
package/dist/api.d.mts CHANGED
@@ -1,5 +1,351 @@
1
- export { a as BBEvent, B as BBRequest, E as EventReturn, R as RequestReturn } from './api-D-t6UimA.mjs';
2
- import './FileStat-CmS6lR3e.mjs';
3
- import './Project-B7IjpqOJ.mjs';
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
4
  import './PROJECT_CATEGORY-BivLHtB6.mjs';
5
- import './Commit-PdsjrKSG.mjs';
5
+
6
+ type Load = {
7
+ styles: string;
8
+ theme: "light" | "dark";
9
+ languages: string[];
10
+ };
11
+
12
+ type LanguageChange = {
13
+ type: "language";
14
+ languages: string[];
15
+ };
16
+ type ThemeChange = {
17
+ type: "theme";
18
+ theme: "dark" | "light";
19
+ };
20
+ type IconChange = {
21
+ type: "icon";
22
+ };
23
+ type ProjectUpdate = {
24
+ type: "project-update";
25
+ project: Partial<Project["doc"]>;
26
+ };
27
+ type ProjectChange = {
28
+ type: "project-change";
29
+ project: Partial<Project["doc"]>;
30
+ };
31
+ type ProjectEmpty = {
32
+ type: "project-empty";
33
+ };
34
+ type BBEvent = {
35
+ app: {
36
+ response: LanguageChange | ThemeChange | IconChange;
37
+ };
38
+ load: {
39
+ response: Load;
40
+ };
41
+ project: {
42
+ response: ProjectUpdate | ProjectChange | ProjectEmpty;
43
+ };
44
+ selection: {
45
+ response: {
46
+ type: "file" | "folder";
47
+ path: string;
48
+ };
49
+ };
50
+ token: {
51
+ response: string;
52
+ };
53
+ file: {
54
+ response: string;
55
+ };
56
+ folder: {
57
+ response: string;
58
+ };
59
+ editor: {
60
+ response: FileContent | null;
61
+ };
62
+ };
63
+
64
+ type FileRequests = {
65
+ "file:read": {
66
+ args: {
67
+ path: string;
68
+ type?: FileContent["type"];
69
+ };
70
+ response: FileContent;
71
+ };
72
+ "file:delete": {
73
+ args: {
74
+ path: string;
75
+ };
76
+ response: null;
77
+ };
78
+ "file:write": {
79
+ args: FileContent;
80
+ response: null;
81
+ };
82
+ "file:list": {
83
+ args: {
84
+ glob?: string;
85
+ } | null;
86
+ response: string[];
87
+ };
88
+ "file:stat": {
89
+ args: {
90
+ path: string;
91
+ };
92
+ response: FileStat;
93
+ };
94
+ "file:copy": {
95
+ args: CopyArg;
96
+ response: null;
97
+ };
98
+ "file:select": {
99
+ args: {
100
+ path: string;
101
+ };
102
+ response: null;
103
+ };
104
+ };
105
+
106
+ type FolderStat = {
107
+ name: string;
108
+ fullPath: string;
109
+ createdAt: string;
110
+ modifiedAt: string;
111
+ size: number;
112
+ fileCount: number;
113
+ folderCount: number;
114
+ };
115
+
116
+ type FolderRequest = {
117
+ "folder:read": {
118
+ args: {
119
+ path: string;
120
+ };
121
+ response: FolderContent;
122
+ };
123
+ "folder:create": {
124
+ args: {
125
+ path: string;
126
+ };
127
+ response: null;
128
+ };
129
+ "folder:delete": {
130
+ args: {
131
+ path: string;
132
+ };
133
+ response: null;
134
+ };
135
+ "folder:stat": {
136
+ args: {
137
+ path: string;
138
+ };
139
+ response: FolderStat;
140
+ };
141
+ "folder:copy": {
142
+ args: CopyArg;
143
+ response: null;
144
+ };
145
+ "folder:select": {
146
+ args: {
147
+ path: string;
148
+ };
149
+ response: null;
150
+ };
151
+ };
152
+
153
+ type StorageRequests = {
154
+ "storage:set-item": {
155
+ args: {
156
+ key: string;
157
+ value: string;
158
+ };
159
+ response: null;
160
+ };
161
+ "storage:get-item": {
162
+ args: {
163
+ key: string;
164
+ };
165
+ response: string;
166
+ };
167
+ "storage:remove-item": {
168
+ args: {
169
+ key: string;
170
+ };
171
+ response: null;
172
+ };
173
+ "storage:clear": {
174
+ args: null;
175
+ response: null;
176
+ };
177
+ "storage:key": {
178
+ args: {
179
+ index: number;
180
+ };
181
+ response: string[];
182
+ };
183
+ "storage:length": {
184
+ args: null;
185
+ response: string[];
186
+ };
187
+ "storage:sync": {
188
+ args: {
189
+ [key: string]: string;
190
+ };
191
+ response: {
192
+ [key: string]: string;
193
+ };
194
+ };
195
+ "storage:load": {
196
+ args: null;
197
+ response: {
198
+ [key: string]: string;
199
+ };
200
+ };
201
+ };
202
+
203
+ type ProjectRequest = {
204
+ "project:update": {
205
+ args: Project["update"];
206
+ response: null;
207
+ };
208
+ "project:read": {
209
+ args: null;
210
+ response: Project["doc"];
211
+ };
212
+ };
213
+
214
+ type AppRequest = {
215
+ "app:ping": {
216
+ args: null;
217
+ response: "pong";
218
+ };
219
+ "app:version": {
220
+ args: null;
221
+ response: string;
222
+ };
223
+ "app:language": {
224
+ args: null;
225
+ response: string[];
226
+ };
227
+ "app:icon": {
228
+ args: {
229
+ extensionId: string;
230
+ isFolder?: boolean;
231
+ };
232
+ response: string;
233
+ };
234
+ "app:styles": {
235
+ args: null;
236
+ response: string;
237
+ };
238
+ "app:theme": {
239
+ args: null;
240
+ response: "light" | "dark";
241
+ };
242
+ };
243
+
244
+ type GitRequests = {
245
+ "git:init": {
246
+ args: null;
247
+ response: null;
248
+ };
249
+ "git:stage": {
250
+ args: {
251
+ path: string;
252
+ };
253
+ response: null;
254
+ };
255
+ "git:unstage": {
256
+ args: {
257
+ path: string;
258
+ };
259
+ response: null;
260
+ };
261
+ "git:stage-all": {
262
+ args: null;
263
+ response: null;
264
+ };
265
+ "git:unstage-all": {
266
+ args: null;
267
+ response: null;
268
+ };
269
+ "git:commit": {
270
+ args: {
271
+ message: string;
272
+ };
273
+ response: null;
274
+ };
275
+ "git:checkout": {
276
+ args: {
277
+ ref: string;
278
+ };
279
+ response: null;
280
+ };
281
+ "git:discard": {
282
+ args: {
283
+ path: string;
284
+ };
285
+ response: null;
286
+ };
287
+ "git:discard-all": {
288
+ args: null;
289
+ response: null;
290
+ };
291
+ "git:log": {
292
+ args: null;
293
+ response: Commit[];
294
+ };
295
+ "git:diff": {
296
+ args: {
297
+ path: string;
298
+ };
299
+ response: null;
300
+ };
301
+ "git:push": {
302
+ args: null;
303
+ response: null;
304
+ };
305
+ "git:pull": {
306
+ args: null;
307
+ response: null;
308
+ };
309
+ "git:status": {
310
+ args: {
311
+ path: string;
312
+ };
313
+ response: GitFileStatus;
314
+ };
315
+ "git:status-list": {
316
+ args: null;
317
+ response: GitFileStatus[];
318
+ };
319
+ };
320
+
321
+ type BBRequest = FileRequests & FolderRequest & StorageRequests & ProjectRequest & AppRequest & GitRequests;
322
+
323
+ type EventParam<K extends keyof BBEvent> = {
324
+ id: string;
325
+ type: K;
326
+ source: "event";
327
+ };
328
+
329
+ interface EventReturn<K extends keyof BBEvent> {
330
+ id: string;
331
+ type: K;
332
+ response: BBEvent[K]["response"];
333
+ responseId: string;
334
+ }
335
+
336
+ type RequestParam<K extends keyof BBRequest> = {
337
+ id: string;
338
+ type: K;
339
+ arg: BBRequest[K]["args"];
340
+ source: "request";
341
+ };
342
+
343
+ interface RequestReturn<K extends keyof BBRequest> {
344
+ id: string;
345
+ type: K;
346
+ response: BBRequest[K]["response"] | null;
347
+ error: null | string;
348
+ responseId: string;
349
+ }
350
+
351
+ export type { BBEvent, BBRequest, EventParam, EventReturn, RequestParam, RequestReturn };