@luna-park/plugin 1.3.1 → 1.4.1

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.
package/dist/index.mjs ADDED
@@ -0,0 +1,887 @@
1
+ import { a as LogicUtil, i as LogicType, n as ELogicType, o as makeLogicNode, r as EVarType, t as ELogicScope, u as cloneWithFunctions } from "./dist-hc-SHkAg.mjs";
2
+ import { createElementBlock, openBlock, renderSlot } from "vue";
3
+ import { Type } from "@sinclair/typebox";
4
+ //#region \0/plugin-vue/export-helper
5
+ var export_helper_default = (sfc, props) => {
6
+ const target = sfc.__vccOpts || sfc;
7
+ for (const [key, val] of props) target[key] = val;
8
+ return target;
9
+ };
10
+ //#endregion
11
+ //#region src/components/LSettingsStoryWrapper.vue
12
+ const _sfc_main = {};
13
+ const _hoisted_1 = { class: "story-wrapper" };
14
+ function _sfc_render(_ctx, _cache) {
15
+ return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]);
16
+ }
17
+ var LSettingsStoryWrapper_default = /* @__PURE__ */ export_helper_default(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-8d6cff07"]]);
18
+ //#endregion
19
+ //#region src/types/hooks.ts
20
+ let EPluginHooks = /* @__PURE__ */ function(EPluginHooks) {
21
+ EPluginHooks["BackendMiddleware"] = "backend/middleware";
22
+ EPluginHooks["BackendInputNode"] = "backend/input-node";
23
+ return EPluginHooks;
24
+ }({});
25
+ //#endregion
26
+ //#region src/types/plugin.ts
27
+ let EInjectionKey = /* @__PURE__ */ function(EInjectionKey) {
28
+ EInjectionKey["ViteImport"] = "viteImport";
29
+ EInjectionKey["VitePlugin"] = "vitePlugin";
30
+ EInjectionKey["AppImport"] = "appImport";
31
+ EInjectionKey["AppBody"] = "appBody";
32
+ EInjectionKey["AppSetup"] = "appSetup";
33
+ EInjectionKey["Style"] = "style";
34
+ EInjectionKey["ServerImport"] = "serverImport";
35
+ EInjectionKey["ServerBody"] = "serverBody";
36
+ return EInjectionKey;
37
+ }({});
38
+ //#endregion
39
+ //#region src/types/token.ts
40
+ let ETokenType = /* @__PURE__ */ function(ETokenType) {
41
+ ETokenType["Color"] = "color";
42
+ ETokenType["FontSize"] = "font-size";
43
+ ETokenType["FontWeight"] = "font-weight";
44
+ ETokenType["FontFamily"] = "font-family";
45
+ ETokenType["Length"] = "length";
46
+ ETokenType["Time"] = "time";
47
+ return ETokenType;
48
+ }({});
49
+ //#endregion
50
+ //#region ../shared/dist/chunk-CfYAbeIz.mjs
51
+ var __defProp = Object.defineProperty;
52
+ var __exportAll = (all, no_symbols) => {
53
+ let target = {};
54
+ for (var name in all) __defProp(target, name, {
55
+ get: all[name],
56
+ enumerable: true
57
+ });
58
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
59
+ return target;
60
+ };
61
+ //#endregion
62
+ //#region ../shared/dist/index.mjs
63
+ const config = {
64
+ backendUrl: "https://luna-park.app",
65
+ hostUrl: "https://host.luna-park.app",
66
+ webSocketUrl: "wss://luna-park.app"
67
+ };
68
+ const baseConfig = {
69
+ credentials: "include",
70
+ headers: {
71
+ "Accept": "application/json, text/plain",
72
+ "Content-Type": "application/json"
73
+ },
74
+ mode: "cors"
75
+ };
76
+ const baseMultiConfig = {
77
+ credentials: "include",
78
+ headers: { Accept: "application/json, text/plain" },
79
+ mode: "cors"
80
+ };
81
+ var api_default = {
82
+ async delete(url, config) {
83
+ const init = {
84
+ ...baseConfig,
85
+ method: "DELETE",
86
+ ...config
87
+ };
88
+ if (!init.body) {
89
+ init.headers = { ...init.headers };
90
+ delete init.headers?.["Content-Type"];
91
+ }
92
+ return fetch(url, init);
93
+ },
94
+ async get(url, config) {
95
+ return await fetch(url, {
96
+ ...baseConfig,
97
+ method: "GET",
98
+ ...config
99
+ });
100
+ },
101
+ getBaseUrl({ dev } = { dev: false }) {
102
+ return `${config.backendUrl}/${dev ? "dev" : "api"}`;
103
+ },
104
+ async multipart(url, data, config) {
105
+ return await fetch(url, {
106
+ ...baseMultiConfig,
107
+ body: data,
108
+ method: "POST",
109
+ ...config
110
+ });
111
+ },
112
+ async post(url, data, config) {
113
+ return await fetch(url, {
114
+ ...baseConfig,
115
+ body: JSON.stringify(data) || "{}",
116
+ method: "POST",
117
+ ...config
118
+ });
119
+ },
120
+ async put(url, data, config) {
121
+ return await fetch(url, {
122
+ ...baseConfig,
123
+ body: JSON.stringify(data) || "{}",
124
+ method: "PUT",
125
+ ...config
126
+ });
127
+ }
128
+ };
129
+ let ERouteType = /* @__PURE__ */ function(ERouteType) {
130
+ ERouteType["Get"] = "get";
131
+ ERouteType["Post"] = "post";
132
+ ERouteType["Delete"] = "delete";
133
+ ERouteType["Put"] = "put";
134
+ return ERouteType;
135
+ }({});
136
+ const TypeDate = Type.String({ format: "date-time" });
137
+ var app_exports$1 = /* @__PURE__ */ __exportAll({
138
+ app: () => app,
139
+ appEdits: () => appEdits
140
+ });
141
+ const app = Type.Object({
142
+ name: Type.String(),
143
+ config: Type.Record(Type.String(), Type.Unknown()),
144
+ tree: Type.Unknown(),
145
+ version: Type.Optional(Type.Number())
146
+ });
147
+ const appEdits = Type.Array(Type.Object({
148
+ file: Type.Unknown(),
149
+ path: Type.String()
150
+ }));
151
+ const keyConfig = Type.Object({
152
+ id: Type.Optional(Type.String()),
153
+ domain: Type.String(),
154
+ owner: Type.String(),
155
+ private: Type.String(),
156
+ public: Type.String()
157
+ });
158
+ const project = Type.Object({
159
+ id: Type.String(),
160
+ app: Type.Object({
161
+ name: Type.String(),
162
+ config: Type.Unknown()
163
+ }),
164
+ createdAt: TypeDate,
165
+ icon: Type.String(),
166
+ owner: Type.Unknown(),
167
+ updatedAt: TypeDate,
168
+ visibility: Type.Object({
169
+ liked: Type.Boolean(),
170
+ public: Type.Boolean(),
171
+ shareKey: Type.Optional(Type.String()),
172
+ starsCount: Type.Number()
173
+ })
174
+ });
175
+ const publicProject = Type.Object({ ...project.properties });
176
+ const privateProject = Type.Object({
177
+ ...project.properties,
178
+ app: Type.Unknown()
179
+ });
180
+ let EPlanKey = /* @__PURE__ */ function(EPlanKey) {
181
+ EPlanKey["Free"] = "free";
182
+ EPlanKey["Edu"] = "edu";
183
+ EPlanKey["Pro"] = "pro";
184
+ EPlanKey["Org"] = "org";
185
+ return EPlanKey;
186
+ }({});
187
+ const flags = {
188
+ free: {
189
+ compilation: {
190
+ desktop: false,
191
+ export: true,
192
+ mobile: false,
193
+ source: false,
194
+ web: true
195
+ },
196
+ editor: {
197
+ desktop: false,
198
+ web: true
199
+ },
200
+ watermark: true
201
+ },
202
+ pro: {
203
+ compilation: {
204
+ desktop: true,
205
+ export: true,
206
+ mobile: true,
207
+ source: true,
208
+ web: true
209
+ },
210
+ editor: {
211
+ desktop: true,
212
+ web: true
213
+ },
214
+ watermark: false
215
+ }
216
+ };
217
+ EPlanKey.Org, flags.pro, EPlanKey.Pro, flags.pro, EPlanKey.Edu, flags.pro, EPlanKey.Free, flags.free;
218
+ const user = Type.Object({
219
+ id: Type.Optional(Type.String()),
220
+ auth: Type.Optional(Type.Object({})),
221
+ mail: Type.String(),
222
+ plan: Type.Object({ name: Type.String({ enum: Object.values(EPlanKey) }) }),
223
+ profile: Type.Object({
224
+ other: Type.Object({
225
+ avatar: Type.String(),
226
+ bio: Type.String(),
227
+ referral: Type.String()
228
+ }),
229
+ public: Type.Object({
230
+ company: Type.String(),
231
+ location: Type.String(),
232
+ url: Type.String(),
233
+ username: Type.String()
234
+ }),
235
+ social: Type.Object({
236
+ discord: Type.String(),
237
+ github: Type.String(),
238
+ linkedin: Type.String(),
239
+ twitter: Type.String()
240
+ })
241
+ }),
242
+ settings: Type.Object({ newsletter: Type.Boolean() })
243
+ });
244
+ let EElementType = /* @__PURE__ */ function(EElementType) {
245
+ EElementType["Script"] = "script";
246
+ EElementType["Standalone"] = "standalone";
247
+ EElementType["Folder"] = "folder";
248
+ EElementType["MainLogic"] = "main";
249
+ EElementType["Logic"] = "logic";
250
+ EElementType["Config"] = "config";
251
+ EElementType["Text"] = "text";
252
+ EElementType["Store"] = "store";
253
+ EElementType["Database"] = "database";
254
+ EElementType["Component"] = "component";
255
+ EElementType["Route"] = "route";
256
+ EElementType["Type"] = "type";
257
+ EElementType["Cron"] = "cron";
258
+ EElementType["Media"] = "media";
259
+ return EElementType;
260
+ }({});
261
+ const types = {
262
+ ...app_exports$1,
263
+ keyConfig,
264
+ privateProject,
265
+ project,
266
+ publicProject,
267
+ user
268
+ };
269
+ var app_exports = /* @__PURE__ */ __exportAll({
270
+ edit: () => edit$1,
271
+ get: () => get$2
272
+ });
273
+ const get$2 = {
274
+ type: ERouteType.Get,
275
+ params: Type.Object({ id: Type.String() }),
276
+ response: { 200: Type.Object({
277
+ app: types.app,
278
+ readOnly: Type.Boolean()
279
+ }) },
280
+ url: "/app/:id"
281
+ };
282
+ const edit$1 = {
283
+ type: ERouteType.Post,
284
+ body: Type.Object({
285
+ app: Type.Optional(types.app),
286
+ deletes: Type.Optional(Type.Array(Type.String())),
287
+ edits: Type.Optional(types.appEdits)
288
+ }),
289
+ params: Type.Object({ id: Type.String() }),
290
+ response: { 200: Type.Object({ message: Type.String() }) },
291
+ url: "/app/:id"
292
+ };
293
+ var auth_exports = /* @__PURE__ */ __exportAll({
294
+ authorize: () => authorize,
295
+ client: () => client,
296
+ me: () => me,
297
+ token: () => token
298
+ });
299
+ const authorize = {
300
+ type: ERouteType.Post,
301
+ body: Type.Object({
302
+ client_id: Type.String(),
303
+ redirect_uri: Type.String(),
304
+ response_type: Type.Literal("code"),
305
+ scope: Type.Optional(Type.String())
306
+ }),
307
+ response: { 200: Type.Object({ authorization_code: Type.String() }) },
308
+ url: "/auth/authorize"
309
+ };
310
+ const token = {
311
+ type: ERouteType.Post,
312
+ body: Type.Union([Type.Object({
313
+ client_id: Type.String(),
314
+ client_secret: Type.String(),
315
+ code: Type.String(),
316
+ grant_type: Type.Literal("authorization_code"),
317
+ redirect_uri: Type.String()
318
+ }), Type.Object({
319
+ client_id: Type.String(),
320
+ client_secret: Type.String(),
321
+ grant_type: Type.Literal("refresh_token"),
322
+ refresh_token: Type.String()
323
+ })]),
324
+ response: { 200: Type.Object({
325
+ access_token: Type.String(),
326
+ expires_in: Type.Number(),
327
+ refresh_token: Type.String(),
328
+ token_type: Type.Literal("Bearer")
329
+ }) },
330
+ url: "/auth/token"
331
+ };
332
+ const me = {
333
+ type: ERouteType.Get,
334
+ headers: Type.Object({ authorization: Type.String() }),
335
+ response: { 200: Type.Object({
336
+ id: Type.String(),
337
+ mail: Type.String()
338
+ }) },
339
+ url: "/auth/me"
340
+ };
341
+ const client = {
342
+ type: ERouteType.Get,
343
+ querystring: Type.Object({
344
+ client_id: Type.String(),
345
+ redirect_uri: Type.String()
346
+ }),
347
+ response: { 200: Type.Object({ client_name: Type.String() }) },
348
+ url: "/auth/client"
349
+ };
350
+ var compiler_exports = /* @__PURE__ */ __exportAll({
351
+ build: () => build,
352
+ compile: () => compile$1,
353
+ download: () => download
354
+ });
355
+ const build = {
356
+ type: ERouteType.Post,
357
+ body: Type.Object({
358
+ entry: Type.Optional(Type.String()),
359
+ key: Type.String(),
360
+ script: Type.Unknown()
361
+ }),
362
+ params: Type.Object({ type: Type.Union([Type.Literal("main"), Type.Literal("logic")]) }),
363
+ response: { 200: Type.Object({
364
+ code: Type.String(),
365
+ message: Type.String()
366
+ }) },
367
+ url: "/compiler/build/:type"
368
+ };
369
+ const compile$1 = {
370
+ type: ERouteType.Post,
371
+ body: Type.Object({
372
+ platform: Type.Optional(Type.Union([
373
+ Type.Literal("win32"),
374
+ Type.Literal("darwin"),
375
+ Type.Literal("linux")
376
+ ])),
377
+ target: Type.Union([
378
+ Type.Literal("source"),
379
+ Type.Literal("export"),
380
+ Type.Literal("web"),
381
+ Type.Literal("desktop")
382
+ ])
383
+ }),
384
+ params: Type.Object({ id: Type.String() }),
385
+ response: { 200: Type.Object({
386
+ message: Type.String(),
387
+ target: Type.String()
388
+ }) },
389
+ url: "/compiler/compile/:id"
390
+ };
391
+ const download = {
392
+ type: ERouteType.Get,
393
+ params: Type.Object({
394
+ id: Type.String(),
395
+ platform: Type.Optional(Type.Union([
396
+ Type.Literal("win32-installer"),
397
+ Type.Literal("darwin-installer"),
398
+ Type.Literal("linux-installer"),
399
+ Type.Literal("win32-portable"),
400
+ Type.Literal("darwin-portable"),
401
+ Type.Literal("linux-portable")
402
+ ])),
403
+ target: Type.Union([
404
+ Type.Literal("source"),
405
+ Type.Literal("export"),
406
+ Type.Literal("desktop")
407
+ ])
408
+ }),
409
+ response: { 200: Type.Unknown() },
410
+ url: "/compiler/download/:id/:target/:platform?"
411
+ };
412
+ var desktop_exports = /* @__PURE__ */ __exportAll({ latest: () => latest });
413
+ const latest = {
414
+ type: ERouteType.Get,
415
+ dev: true,
416
+ querystring: Type.Object({
417
+ arch: Type.Union([
418
+ Type.Literal("x86_64"),
419
+ Type.Literal("i686"),
420
+ Type.Literal("aarch64"),
421
+ Type.Literal("armv7")
422
+ ]),
423
+ target: Type.Union([
424
+ Type.Literal("windows"),
425
+ Type.Literal("linux"),
426
+ Type.Literal("darwin")
427
+ ]),
428
+ version: Type.Optional(Type.String())
429
+ }),
430
+ response: { 200: Type.Object({
431
+ notes: Type.String(),
432
+ pub_date: Type.String(),
433
+ signature: Type.String(),
434
+ url: Type.String(),
435
+ version: Type.String()
436
+ }) },
437
+ url: "/desktop/release/latest"
438
+ };
439
+ var file_exports = /* @__PURE__ */ __exportAll({
440
+ list: () => list$3,
441
+ remove: () => remove$2,
442
+ status: () => status,
443
+ upload: () => upload
444
+ });
445
+ const upload = {
446
+ type: ERouteType.Post,
447
+ body: Type.Object({
448
+ file: Type.Object({
449
+ filename: Type.String(),
450
+ mimetype: Type.String()
451
+ }),
452
+ project: Type.Object({ value: Type.String() })
453
+ }),
454
+ multipart: true,
455
+ response: { 200: Type.Object({
456
+ name: Type.String(),
457
+ mimeType: Type.String(),
458
+ target: Type.String()
459
+ }) },
460
+ url: "/file/upload"
461
+ };
462
+ const remove$2 = {
463
+ type: ERouteType.Post,
464
+ body: Type.Object({ target: Type.String() }),
465
+ response: { 200: Type.Object({ message: Type.String() }) },
466
+ url: "/file/remove"
467
+ };
468
+ const list$3 = {
469
+ type: ERouteType.Get,
470
+ querystring: Type.Object({
471
+ limit: Type.Optional(Type.String()),
472
+ search: Type.Optional(Type.String()),
473
+ skip: Type.Optional(Type.String())
474
+ }),
475
+ response: { 200: Type.Object({
476
+ result: Type.Array(Type.Object({
477
+ id: Type.String(),
478
+ name: Type.String(),
479
+ mimeType: Type.String(),
480
+ project: Type.Object({
481
+ id: Type.String(),
482
+ name: Type.String(),
483
+ icon: Type.String()
484
+ }),
485
+ size: Type.Number(),
486
+ target: Type.String()
487
+ })),
488
+ total: Type.Number()
489
+ }) },
490
+ url: "/file/list"
491
+ };
492
+ const status = {
493
+ type: ERouteType.Get,
494
+ response: { 200: Type.Object({
495
+ limit: Type.Number(),
496
+ total: Type.Number()
497
+ }) },
498
+ url: "/file/status"
499
+ };
500
+ var integrations_exports = /* @__PURE__ */ __exportAll({ googleAuth: () => googleAuth });
501
+ const googleAuth = {
502
+ type: ERouteType.Get,
503
+ querystring: Type.Object({
504
+ code: Type.Optional(Type.String()),
505
+ scope: Type.Optional(Type.String()),
506
+ state: Type.Optional(Type.String())
507
+ }),
508
+ response: { 200: Type.Object({ token: Type.Optional(Type.String()) }) },
509
+ url: "/integrations/google/auth"
510
+ };
511
+ var keyConfig_exports = /* @__PURE__ */ __exportAll({
512
+ check: () => check$1,
513
+ create: () => create$2,
514
+ list: () => list$2,
515
+ remove: () => remove$1
516
+ });
517
+ const create$2 = {
518
+ type: ERouteType.Post,
519
+ body: Type.Object({ domain: Type.String() }),
520
+ response: { 200: Type.Object({
521
+ key: types.keyConfig,
522
+ message: Type.String()
523
+ }) },
524
+ url: "/key-config"
525
+ };
526
+ const list$2 = {
527
+ type: ERouteType.Get,
528
+ response: { 200: Type.Array(types.keyConfig) },
529
+ url: "/key-config"
530
+ };
531
+ const remove$1 = {
532
+ type: ERouteType.Delete,
533
+ params: Type.Object({ id: Type.String() }),
534
+ response: { 200: Type.Object({ message: Type.String() }) },
535
+ url: "/key-config/:id"
536
+ };
537
+ const check$1 = {
538
+ type: ERouteType.Post,
539
+ body: Type.Object({
540
+ domain: Type.String(),
541
+ key: Type.String()
542
+ }),
543
+ dev: true,
544
+ response: { 200: Type.Object({ message: Type.String() }) },
545
+ url: "/key-config/check"
546
+ };
547
+ var license_exports = /* @__PURE__ */ __exportAll({
548
+ check: () => check,
549
+ link: () => link,
550
+ list: () => list$1,
551
+ reset: () => reset
552
+ });
553
+ const reset = {
554
+ type: ERouteType.Post,
555
+ body: Type.Object({ id: Type.String() }),
556
+ response: { 200: Type.Object({ message: Type.String() }) },
557
+ url: "/license/reset"
558
+ };
559
+ const link = {
560
+ type: ERouteType.Post,
561
+ body: Type.Object({
562
+ name: Type.String(),
563
+ fingerprint: Type.String(),
564
+ key: Type.String()
565
+ }),
566
+ dev: true,
567
+ response: { 200: Type.Object({ message: Type.String() }) },
568
+ url: "/license/link"
569
+ };
570
+ const check = {
571
+ type: ERouteType.Post,
572
+ body: Type.Object({
573
+ fingerprint: Type.String(),
574
+ key: Type.String()
575
+ }),
576
+ dev: true,
577
+ response: { 200: Type.Object({
578
+ mail: Type.Optional(Type.String()),
579
+ valid: Type.Boolean(),
580
+ version: Type.Optional(Type.String())
581
+ }) },
582
+ url: "/license/check"
583
+ };
584
+ const list$1 = {
585
+ type: ERouteType.Get,
586
+ response: { 200: Type.Array(Type.Object({
587
+ id: Type.String(),
588
+ name: Type.String(),
589
+ expirationDate: TypeDate,
590
+ key: Type.String(),
591
+ lastUsed: TypeDate,
592
+ version: Type.String()
593
+ })) },
594
+ url: "/license/list"
595
+ };
596
+ var magiclink_exports = /* @__PURE__ */ __exportAll({
597
+ activate: () => activate,
598
+ create: () => create$1,
599
+ signup: () => signup
600
+ });
601
+ const activate = {
602
+ type: ERouteType.Get,
603
+ params: Type.Object({
604
+ id: Type.String(),
605
+ token: Type.String()
606
+ }),
607
+ response: { 200: Type.Object({ message: Type.String() }) },
608
+ url: "/magiclink/activate/:id/:token"
609
+ };
610
+ const create$1 = {
611
+ type: ERouteType.Post,
612
+ body: Type.Object({ mail: Type.String({ format: "email" }) }),
613
+ response: { 200: Type.Object({
614
+ expirationDate: Type.String(),
615
+ message: Type.String()
616
+ }) },
617
+ url: "/magiclink/create"
618
+ };
619
+ const signup = {
620
+ type: ERouteType.Post,
621
+ body: Type.Object({ mail: Type.String({ format: "email" }) }),
622
+ response: { 200: Type.Object({
623
+ expirationDate: Type.String(),
624
+ message: Type.String()
625
+ }) },
626
+ url: "/magiclink/signup"
627
+ };
628
+ var payment_exports = /* @__PURE__ */ __exportAll({
629
+ checkout: () => checkout,
630
+ portal: () => portal
631
+ });
632
+ const checkout = {
633
+ type: ERouteType.Post,
634
+ body: Type.Object({ plan: Type.Union([Type.Literal(EPlanKey.Pro), Type.Literal(EPlanKey.Org)]) }),
635
+ response: { 200: Type.Object({
636
+ message: Type.String(),
637
+ redirection: Type.String()
638
+ }) },
639
+ url: "/payment/checkout"
640
+ };
641
+ const portal = {
642
+ type: ERouteType.Post,
643
+ response: { 200: Type.Object({
644
+ message: Type.String(),
645
+ redirection: Type.String()
646
+ }) },
647
+ url: "/payment/portal"
648
+ };
649
+ var project_exports = /* @__PURE__ */ __exportAll({
650
+ create: () => create,
651
+ edit: () => edit,
652
+ list: () => list,
653
+ proxy: () => proxy,
654
+ remove: () => remove,
655
+ star: () => star
656
+ });
657
+ const create = {
658
+ type: ERouteType.Post,
659
+ body: Type.Object({
660
+ icon: Type.String(),
661
+ template: Type.Union([
662
+ Type.Literal("default"),
663
+ Type.Literal("empty"),
664
+ Type.Literal("frontend"),
665
+ Type.Literal("backend"),
666
+ Type.Literal("database"),
667
+ Type.Literal("testing")
668
+ ]),
669
+ title: Type.String()
670
+ }),
671
+ response: { 200: Type.Object({
672
+ message: Type.String(),
673
+ project: types.publicProject
674
+ }) },
675
+ url: "/project/create"
676
+ };
677
+ const list = {
678
+ type: ERouteType.Get,
679
+ params: Type.Object({ type: Type.Union([
680
+ Type.Literal("mine"),
681
+ Type.Literal("popular"),
682
+ Type.Literal("newest"),
683
+ Type.Literal("random"),
684
+ Type.Literal("search")
685
+ ]) }),
686
+ querystring: Type.Object({
687
+ limit: Type.Optional(Type.Number()),
688
+ search: Type.Optional(Type.String()),
689
+ skip: Type.Optional(Type.Number())
690
+ }),
691
+ response: { 200: Type.Object({ projects: Type.Array(types.publicProject) }) },
692
+ url: "/project/list/:type"
693
+ };
694
+ const remove = {
695
+ type: ERouteType.Delete,
696
+ params: Type.Object({ id: Type.String() }),
697
+ response: { 200: Type.Object({ message: Type.String() }) },
698
+ url: "/project/remove/:id"
699
+ };
700
+ const edit = {
701
+ type: ERouteType.Post,
702
+ body: types.privateProject,
703
+ response: { 200: Type.Object({ message: Type.String() }) },
704
+ url: "/project/edit"
705
+ };
706
+ const star = {
707
+ type: ERouteType.Post,
708
+ body: Type.Object({
709
+ id: Type.String(),
710
+ like: Type.Boolean()
711
+ }),
712
+ response: { 200: Type.Object({ message: Type.String() }) },
713
+ url: "/project/star"
714
+ };
715
+ const proxy = {
716
+ type: ERouteType.Post,
717
+ body: Type.Object({
718
+ body: Type.Optional(Type.Unknown()),
719
+ headers: Type.Optional(Type.Record(Type.String(), Type.String())),
720
+ method: Type.Optional(Type.Union([
721
+ Type.Literal("GET"),
722
+ Type.Literal("POST"),
723
+ Type.Literal("PUT"),
724
+ Type.Literal("DELETE")
725
+ ])),
726
+ url: Type.String({ format: "uri" })
727
+ }),
728
+ response: { 200: Type.Unknown() },
729
+ url: "/project/proxy"
730
+ };
731
+ var script_exports = /* @__PURE__ */ __exportAll({
732
+ compile: () => compile,
733
+ get: () => get$1,
734
+ update: () => update$1
735
+ });
736
+ const get$1 = {
737
+ type: ERouteType.Get,
738
+ params: Type.Object({
739
+ id: Type.String(),
740
+ script: Type.String()
741
+ }),
742
+ response: { 200: Type.String() },
743
+ url: "/script/:id/:script"
744
+ };
745
+ const compile = {
746
+ type: ERouteType.Post,
747
+ params: Type.Object({
748
+ id: Type.String(),
749
+ script: Type.String()
750
+ }),
751
+ response: { 200: Type.Object({ message: Type.String() }) },
752
+ url: "/script/:id/:script/compile"
753
+ };
754
+ const update$1 = {
755
+ type: ERouteType.Post,
756
+ body: Type.Object({ autoReload: Type.Optional(Type.Boolean()) }),
757
+ params: Type.Object({
758
+ id: Type.String(),
759
+ script: Type.String()
760
+ }),
761
+ response: { 200: Type.Object({ message: Type.String() }) },
762
+ url: "/script/:id/:script/update"
763
+ };
764
+ var turnstile_exports = /* @__PURE__ */ __exportAll({ tick: () => tick });
765
+ const tick = {
766
+ type: ERouteType.Post,
767
+ body: Type.Object({
768
+ data: Type.Optional(Type.Unknown()),
769
+ scope: Type.String()
770
+ }),
771
+ response: { 200: Type.Object({}) },
772
+ url: "/turnstile/tick"
773
+ };
774
+ var user_exports = /* @__PURE__ */ __exportAll({
775
+ disconnect: () => disconnect,
776
+ get: () => get,
777
+ ping: () => ping,
778
+ unsubscribe: () => unsubscribe,
779
+ update: () => update,
780
+ waitlist: () => waitlist
781
+ });
782
+ const ping = {
783
+ type: ERouteType.Get,
784
+ response: { 200: Type.Object({
785
+ message: Type.String(),
786
+ user: Type.Optional(types.user)
787
+ }) },
788
+ url: "/user/ping"
789
+ };
790
+ const get = {
791
+ type: ERouteType.Get,
792
+ response: { 200: types.user },
793
+ url: "/user"
794
+ };
795
+ const update = {
796
+ type: ERouteType.Post,
797
+ body: Type.Partial(types.user),
798
+ response: { 200: Type.Object({ message: Type.String() }) },
799
+ url: "/user"
800
+ };
801
+ const disconnect = {
802
+ type: ERouteType.Get,
803
+ response: { 200: Type.Object({ message: Type.String() }) },
804
+ url: "/user/disconnect"
805
+ };
806
+ const waitlist = {
807
+ type: ERouteType.Post,
808
+ body: Type.Object({ mail: Type.String({ format: "email" }) }),
809
+ response: { 200: Type.Object({ message: Type.String() }) },
810
+ url: "/user/waitlist"
811
+ };
812
+ const unsubscribe = {
813
+ type: ERouteType.Post,
814
+ body: Type.Object({ id: Type.String() }),
815
+ response: { 200: Type.Object({ message: Type.String() }) },
816
+ url: "/user/unsubscribe"
817
+ };
818
+ const routes = {
819
+ app: app_exports,
820
+ auth: auth_exports,
821
+ compiler: compiler_exports,
822
+ desktop: desktop_exports,
823
+ file: file_exports,
824
+ integrations: integrations_exports,
825
+ keyConfig: keyConfig_exports,
826
+ license: license_exports,
827
+ magiclink: magiclink_exports,
828
+ payment: payment_exports,
829
+ project: project_exports,
830
+ script: script_exports,
831
+ turnstile: turnstile_exports,
832
+ user: user_exports
833
+ };
834
+ const api = {};
835
+ for (const serviceName of Object.keys(routes)) {
836
+ api[serviceName] = {};
837
+ for (const routeName of Object.keys(routes[serviceName])) {
838
+ const route = routes[serviceName][routeName];
839
+ api[serviceName][routeName] = async (args = {}) => {
840
+ const url = new URL(api_default.getBaseUrl({ dev: route.dev }) + route.url);
841
+ if (route.params && args.params) for (const key of Object.keys(route.params.properties)) url.href = url.href.replace(`:${key}`, args.params[key]);
842
+ if (args.querystring) {
843
+ for (const key of Object.keys(args.querystring)) if (args.querystring[key]) url.searchParams.append(key, args.querystring[key].toString());
844
+ }
845
+ let service = api_default[route.type];
846
+ if (route.multipart) service = api_default.multipart;
847
+ const result = await service(url.href, args.body);
848
+ const content = await getContent(result);
849
+ if (result.status >= 400) throw new Error(`Error ${result.status} (${result.statusText}): ${content.message || content}`);
850
+ return content;
851
+ };
852
+ }
853
+ }
854
+ function getContent(response) {
855
+ if (response.headers.get("Content-Type")?.startsWith("application/json")) return response.json();
856
+ return response.text();
857
+ }
858
+ //#endregion
859
+ //#region src/index.ts
860
+ function makePlugin(plugin) {
861
+ return plugin;
862
+ }
863
+ function makeComponent(component) {
864
+ return component;
865
+ }
866
+ async function loadPlugin(plugin, env) {
867
+ const result = cloneWithFunctions(plugin);
868
+ const config = env.app?.config?.plugins?.[plugin.id]?.config;
869
+ for (const category of [
870
+ "build",
871
+ "editor",
872
+ "inject"
873
+ ]) if (result[category]) for (const key in result[category]) result[category][key] = await getPluginParam(result[category][key], {
874
+ ...env,
875
+ config
876
+ });
877
+ return result;
878
+ }
879
+ async function getPluginParam(target, env) {
880
+ if (typeof target === "function") return target({
881
+ mode: "editor",
882
+ ...env
883
+ });
884
+ return target;
885
+ }
886
+ //#endregion
887
+ export { EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin };