bb-relay 0.0.22 → 0.0.24

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