@luna-park/plugin 2.0.1 → 2.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.
@@ -1,4 +1,4 @@
1
- import { d as TSchema } from "./index-w5zIwwtu.mjs";
1
+ import { d as TSchema } from "./index-Dz0vJvpL.mjs";
2
2
  import * as ts$1 from "typescript";
3
3
  import ts from "typescript";
4
4
  type TExportResult = {
@@ -57,6 +57,7 @@ interface TSchemaOptions {
57
57
  index?: boolean;
58
58
  input?: string;
59
59
  insert?: number | "last";
60
+ literal?: boolean;
60
61
  max?: number;
61
62
  min?: number;
62
63
  multiplier?: number;
@@ -372,6 +373,7 @@ type TDocumentation = {
372
373
  value: unknown;
373
374
  }>;
374
375
  }>;
376
+ llm?: string;
375
377
  parameters?: Array<{
376
378
  description: string;
377
379
  name: string;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as TVector, a as LogicUtil, c as TInterfaceConstantValue, d as TSchema, f as TVoid, g as MaybePromise, h as DeepPartial, i as LogicType, l as TLogicNode, m as CVector, n as ELogicType, o as Static, p as makeLogicNode, r as EVarType, s as TInterfaceConfig, t as ELogicScope, u as TObject } from "./index-w5zIwwtu.mjs";
1
+ import { _ as TVector, a as LogicUtil, c as TInterfaceConstantValue, d as TSchema, f as TVoid, g as MaybePromise, h as DeepPartial, i as LogicType, l as TLogicNode, m as CVector, n as ELogicType, o as Static, p as makeLogicNode, r as EVarType, s as TInterfaceConfig, t as ELogicScope, u as TObject } from "./index-Dz0vJvpL.mjs";
2
2
  import { Component, ComputedRef, Directive } from "vue";
3
3
  import "@sinclair/typebox";
4
4
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
@@ -178,48 +178,6 @@ type TFileBase = TFileBaseExport & {
178
178
  id: string;
179
179
  parent?: TFolder;
180
180
  };
181
- declare enum ELayoutElement {
182
- input = "input",
183
- div = "div",
184
- media = "media",
185
- customText = "customText",
186
- component = "component",
187
- package = "package",
188
- customHtml = "customHtml",
189
- slot = "slot",
190
- template = "template",
191
- variable = "variable",
192
- link = "link"
193
- }
194
- declare enum ETokenType {
195
- Class = "class",
196
- Color = "color",
197
- FontSize = "font-size",
198
- FontWeight = "font-weight",
199
- FontFamily = "font-family",
200
- Length = "length",
201
- Time = "time"
202
- }
203
- declare module "@luna-park/logicnodes" {
204
- interface TSchemaOptions {
205
- custom?: boolean;
206
- displayGrid?: number;
207
- dual?: boolean;
208
- filter?: boolean;
209
- flex?: boolean;
210
- grid?: boolean;
211
- image?: boolean;
212
- mode?: "corner";
213
- number?: boolean;
214
- quad?: boolean;
215
- ref?: boolean;
216
- shadow?: boolean;
217
- units?: Array<string>;
218
- }
219
- interface TString<T extends string = string> {
220
- target?: string;
221
- }
222
- }
223
181
  declare enum ELayoutValueType {
224
182
  Variable = "variable",
225
183
  Property = "property",
@@ -338,6 +296,48 @@ type TValue = {
338
296
  parent?: TLogic;
339
297
  schema: TSchema;
340
298
  };
299
+ declare enum ELayoutElement {
300
+ input = "input",
301
+ div = "div",
302
+ media = "media",
303
+ customText = "customText",
304
+ component = "component",
305
+ package = "package",
306
+ customHtml = "customHtml",
307
+ slot = "slot",
308
+ template = "template",
309
+ variable = "variable",
310
+ link = "link"
311
+ }
312
+ declare enum ETokenType {
313
+ Class = "class",
314
+ Color = "color",
315
+ FontSize = "font-size",
316
+ FontWeight = "font-weight",
317
+ FontFamily = "font-family",
318
+ Length = "length",
319
+ Time = "time"
320
+ }
321
+ declare module "@luna-park/logicnodes" {
322
+ interface TSchemaOptions {
323
+ custom?: boolean;
324
+ displayGrid?: number;
325
+ dual?: boolean;
326
+ filter?: boolean;
327
+ flex?: boolean;
328
+ grid?: boolean;
329
+ image?: boolean;
330
+ mode?: "corner";
331
+ number?: boolean;
332
+ quad?: boolean;
333
+ ref?: boolean;
334
+ shadow?: boolean;
335
+ units?: Array<string>;
336
+ }
337
+ interface TString<T extends string = string> {
338
+ target?: string;
339
+ }
340
+ }
341
341
  type TTextBlock = {
342
342
  content: string;
343
343
  key: string;
@@ -391,6 +391,13 @@ type TLayoutClassOf<TStyle> = {
391
391
  };
392
392
  type TLayoutClassExport = TLayoutClassOf<TLayoutStyleExport>;
393
393
  type TLayoutClass = TLayoutClassOf<TLayoutStyle>;
394
+ /**
395
+ * Class applied to an element: `name` is a constant, a class token or a variable, applied while `toggle` is truthy (always when absent)
396
+ */
397
+ type TLayoutClassBindingOf<TVariable> = {
398
+ name: TVariable;
399
+ toggle?: TVariable;
400
+ };
394
401
  type TLayoutEventParameterOf<TVariable> = {
395
402
  schema: TSchema;
396
403
  value: TVariable;
@@ -401,7 +408,7 @@ interface TLayoutNodeOf<TElement extends TLayoutElementType, TVariable, TChild,
401
408
  id: string;
402
409
  name: string;
403
410
  children: Array<TChild>;
404
- classes: Array<TVariable>;
411
+ classes: Array<TLayoutClassBindingOf<TVariable>>;
405
412
  collapsed?: boolean;
406
413
  content: TLayoutContentOf<TElement, TVariable, TChild>;
407
414
  element: TElement;
@@ -719,6 +726,8 @@ type TApplicationConfig = {
719
726
  }>;
720
727
  state: {
721
728
  currentTab: string;
729
+ deployAppId?: string;
730
+ deployServerId?: string;
722
731
  explorerSort?: EFileSortStrategy;
723
732
  tabs: Array<string>;
724
733
  };
@@ -802,7 +811,10 @@ interface TLogicOf<TGraph, TValue, TAnchor> extends TLogicBaseOf<TGraph, TValue>
802
811
  type: EElementType.Logic | EElementType.Standalone;
803
812
  async: boolean;
804
813
  code?: string;
814
+ description?: string;
805
815
  export: boolean;
816
+ hue?: number;
817
+ icon?: string;
806
818
  inputs: Record<string, TAnchor>;
807
819
  mode: ELogicMode;
808
820
  outputs: Record<string, TAnchor>;
@@ -1157,12 +1169,18 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
1157
1169
  };
1158
1170
  llm?: string;
1159
1171
  name: string;
1160
- settings?: Array<{
1161
- component: Component;
1162
- icon?: IconDefinition | string;
1163
- label: string;
1164
- }>;
1165
1172
  windows?: Record<string, Component>;
1173
+ workspace?: {
1174
+ preview?: Component;
1175
+ sections: Array<TPluginWorkspaceSection>;
1176
+ };
1177
+ };
1178
+ type TPluginWorkspaceSection = {
1179
+ component: Component;
1180
+ description?: string;
1181
+ icon: IconDefinition | string;
1182
+ id: string;
1183
+ title: string;
1166
1184
  };
1167
1185
  type TPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: TOption<TEnv<TConfig, TInternal>, NonNullable<TBase[TCategory]>[TKey]>; }; };
1168
1186
  type TProxyPlugin<TConfig extends TSchema = TSchema, TInternal = unknown, TBase extends TBasePlugin<TConfig, TInternal> = TBasePlugin<TConfig, TInternal>> = Omit<TBase, "build" | "editor" | "inject"> & { [TCategory in "build" | "editor" | "inject"]?: { [TKey in keyof NonNullable<TBase[TCategory]>]: Promise<NonNullable<TBase[TCategory]>[TKey]>; }; };
@@ -1201,4 +1219,4 @@ export declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: T
1201
1219
  export declare function sortPlugins<T extends Pick<TBasePlugin, "dependencies" | "id">>(plugins: Array<T>): Array<T>;
1202
1220
  export declare function getPluginApi<TApi = unknown>(plugin: Pick<TBasePlugin, "api" | "config" | "id"> | undefined, env: Partial<TEnv>): Promise<TApi | undefined>;
1203
1221
  export declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
1204
- export { EDBCondition, EDBOperation, EElementType, ELogicScope, ELogicType, ETokenType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TAnyLogicExport, type TApplication, type TApplicationExport, type TBasePlugin, type TComponent, type TDBCondition, type TDBOperation, type TElementPanel, type TElementPanelAction, type TElementPanelProps, type TEnv, type TFile, type TFileComponent, type TFileComponentExport, type TFileConfig, type TFileConfigExport, type TFileCron, type TFileCronExport, type TFileDatabase, type TFileDatabaseExport, type TFileExport, type TFileMedia, type TFileMediaExport, type TFileRoute, type TFileRouteExport, type TFileScript, type TFileScriptExport, type TFileStore, type TFileStoreExport, type TFileText, type TFileTextExport, type TFileType, type TFileTypeExport, type TFolder, type TFolderExport, type THookParams, type THost, type TInterface, type TInterfaceEditorProps, type TLayoutSchema, type TLayoutSchemaExport, type TLogic, type TLogicExport, type TLogicMain, type TLogicMainExport, type TLogicNode, type TOption, type TPanels, type TPlugin, type TPluginElement, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
1222
+ export { EDBCondition, EDBOperation, EElementType, ELogicScope, ELogicType, ETokenType, EVarType, _default as LSettingsStoryWrapper, LogicType, LogicUtil, type Static, type TAnyLogic, type TAnyLogicExport, type TApplication, type TApplicationExport, type TBasePlugin, type TComponent, type TDBCondition, type TDBOperation, type TElementPanel, type TElementPanelAction, type TElementPanelProps, type TEnv, type TFile, type TFileComponent, type TFileComponentExport, type TFileConfig, type TFileConfigExport, type TFileCron, type TFileCronExport, type TFileDatabase, type TFileDatabaseExport, type TFileExport, type TFileMedia, type TFileMediaExport, type TFileRoute, type TFileRouteExport, type TFileScript, type TFileScriptExport, type TFileStore, type TFileStoreExport, type TFileText, type TFileTextExport, type TFileType, type TFileTypeExport, type TFolder, type TFolderExport, type THookParams, type THost, type TInterface, type TInterfaceEditorProps, type TLayoutSchema, type TLayoutSchemaExport, type TLogic, type TLogicExport, type TLogicMain, type TLogicMainExport, type TLogicNode, type TOption, type TPanels, type TPlugin, type TPluginElement, type TPluginWorkspaceSection, type TProxyPlugin, type TRouteGuard, type TSchema, type TSlot, type TTemplate, type TToken, makeLogicNode };
package/dist/index.mjs CHANGED
@@ -26,73 +26,7 @@ var __exportAll = (all, no_symbols) => {
26
26
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
27
27
  return target;
28
28
  };
29
- // ../shared/dist/index.mjs
30
- const config = {
31
- backendUrl: "https://luna-park.app",
32
- hostUrl: "https://host.luna-park.app",
33
- webSocketUrl: "wss://luna-park.app"
34
- };
35
- const baseConfig = {
36
- credentials: "include",
37
- headers: {
38
- "Accept": "application/json, text/plain",
39
- "Content-Type": "application/json"
40
- },
41
- mode: "cors"
42
- };
43
- const baseMultiConfig = {
44
- credentials: "include",
45
- headers: { Accept: "application/json, text/plain" },
46
- mode: "cors"
47
- };
48
- var api_default = {
49
- async delete(url, config) {
50
- const init = {
51
- ...baseConfig,
52
- method: "DELETE",
53
- ...config
54
- };
55
- if (!init.body) {
56
- init.headers = { ...init.headers };
57
- delete init.headers["Content-Type"];
58
- }
59
- return fetch(url, init);
60
- },
61
- async get(url, config) {
62
- return await fetch(url, {
63
- ...baseConfig,
64
- method: "GET",
65
- ...config
66
- });
67
- },
68
- getBaseUrl({ dev } = { dev: false }) {
69
- return `${config.backendUrl}/${dev ? "dev" : "api"}`;
70
- },
71
- async multipart(url, data, config) {
72
- return await fetch(url, {
73
- ...baseMultiConfig,
74
- body: data,
75
- method: "POST",
76
- ...config
77
- });
78
- },
79
- async post(url, data, config) {
80
- return await fetch(url, {
81
- ...baseConfig,
82
- body: JSON.stringify(data) || "{}",
83
- method: "POST",
84
- ...config
85
- });
86
- },
87
- async put(url, data, config) {
88
- return await fetch(url, {
89
- ...baseConfig,
90
- body: JSON.stringify(data) || "{}",
91
- method: "PUT",
92
- ...config
93
- });
94
- }
95
- };
29
+ // ../shared/dist/types-CvOhRij4.mjs
96
30
  const TypeDate = Type.String({ format: "date-time" });
97
31
  var app_exports$1 = /* @__PURE__ */ __exportAll({
98
32
  app: () => app,
@@ -111,7 +45,7 @@ const appEdits = Type.Array(Type.Object({
111
45
  file: Type.Unknown(),
112
46
  path: Type.String()
113
47
  }));
114
- const project = Type.Object({
48
+ const project$1 = Type.Object({
115
49
  id: Type.String(),
116
50
  app: Type.Object({
117
51
  name: Type.String(),
@@ -128,9 +62,9 @@ const project = Type.Object({
128
62
  starsCount: Type.Number()
129
63
  })
130
64
  });
131
- const publicProject = project;
65
+ const publicProject = project$1;
132
66
  const privateProject = Type.Object({
133
- ...project.properties,
67
+ ...project$1.properties,
134
68
  app: Type.Unknown()
135
69
  });
136
70
  const session = Type.Object({
@@ -189,7 +123,6 @@ const flags = {
189
123
  flags.pro, flags.pro, flags.free;
190
124
  const user = Type.Object({
191
125
  id: Type.Optional(Type.String()),
192
- auth: Type.Optional(Type.Object({})),
193
126
  mail: Type.String(),
194
127
  plan: Type.Object({
195
128
  name: Type.Enum(EPlanKey),
@@ -240,6 +173,81 @@ let EElementType = /* @__PURE__ */ function(EElementType) {
240
173
  EElementType["Media"] = "media";
241
174
  return EElementType;
242
175
  }({});
176
+ const types = {
177
+ ...app_exports$1,
178
+ privateProject,
179
+ project: project$1,
180
+ publicProject,
181
+ session,
182
+ user
183
+ };
184
+ // ../shared/dist/index.mjs
185
+ const config = {
186
+ backendUrl: "https://luna-park.app",
187
+ hostUrl: "https://host.luna-park.app",
188
+ webSocketUrl: "wss://luna-park.app"
189
+ };
190
+ const baseConfig = {
191
+ credentials: "include",
192
+ headers: {
193
+ "Accept": "application/json, text/plain",
194
+ "Content-Type": "application/json"
195
+ },
196
+ mode: "cors"
197
+ };
198
+ const baseMultiConfig = {
199
+ credentials: "include",
200
+ headers: { Accept: "application/json, text/plain" },
201
+ mode: "cors"
202
+ };
203
+ var api_default = {
204
+ async delete(url, config) {
205
+ const init = {
206
+ ...baseConfig,
207
+ method: "DELETE",
208
+ ...config
209
+ };
210
+ if (!init.body) {
211
+ init.headers = { ...init.headers };
212
+ delete init.headers["Content-Type"];
213
+ }
214
+ return fetch(url, init);
215
+ },
216
+ async get(url, config) {
217
+ return await fetch(url, {
218
+ ...baseConfig,
219
+ method: "GET",
220
+ ...config
221
+ });
222
+ },
223
+ getBaseUrl({ dev } = { dev: false }) {
224
+ return `${config.backendUrl}/${dev ? "dev" : "api"}`;
225
+ },
226
+ async multipart(url, data, config) {
227
+ return await fetch(url, {
228
+ ...baseMultiConfig,
229
+ body: data,
230
+ method: "POST",
231
+ ...config
232
+ });
233
+ },
234
+ async post(url, data, config) {
235
+ return await fetch(url, {
236
+ ...baseConfig,
237
+ body: JSON.stringify(data) || "{}",
238
+ method: "POST",
239
+ ...config
240
+ });
241
+ },
242
+ async put(url, data, config) {
243
+ return await fetch(url, {
244
+ ...baseConfig,
245
+ body: JSON.stringify(data) || "{}",
246
+ method: "PUT",
247
+ ...config
248
+ });
249
+ }
250
+ };
243
251
  let EDBOperation = /* @__PURE__ */ function(EDBOperation) {
244
252
  EDBOperation["And"] = "and";
245
253
  EDBOperation["Or"] = "or";
@@ -260,14 +268,6 @@ let EDBCondition = /* @__PURE__ */ function(EDBCondition) {
260
268
  EDBCondition["Contains"] = "contains";
261
269
  return EDBCondition;
262
270
  }({});
263
- const types = {
264
- ...app_exports$1,
265
- privateProject,
266
- project,
267
- publicProject,
268
- session,
269
- user
270
- };
271
271
  var app_exports = /* @__PURE__ */ __exportAll({
272
272
  edit: () => edit$1,
273
273
  get: () => get$3
@@ -396,23 +396,37 @@ const download = {
396
396
  url: "/compiler/download/:id/:target"
397
397
  };
398
398
  var deploy_exports = /* @__PURE__ */ __exportAll({
399
+ addDomain: () => addDomain,
399
400
  addServerMember: () => addServerMember,
401
+ checkManagedDomain: () => checkManagedDomain,
402
+ claimManagedDomain: () => claimManagedDomain,
400
403
  create: () => create$2,
404
+ createDesktop: () => createDesktop,
405
+ destroyApplication: () => destroyApplication,
406
+ destroyEnvironment: () => destroyEnvironment,
407
+ environmentLink: () => environmentLink,
401
408
  environments: () => environments,
402
409
  events: () => events,
403
410
  getVariables: () => getVariables,
411
+ listDomains: () => listDomains,
404
412
  listServerMembers: () => listServerMembers,
405
413
  listServers: () => listServers,
414
+ managedDomainZone: () => managedDomainZone,
406
415
  monitoringLink: () => monitoringLink,
407
416
  promote: () => promote,
408
417
  rebuild: () => rebuild,
418
+ registerDesktop: () => registerDesktop,
419
+ removeDomain: () => removeDomain,
409
420
  removeServerMember: () => removeServerMember,
421
+ revokeEnvironmentLinks: () => revokeEnvironmentLinks,
410
422
  rollback: () => rollback,
411
423
  runtime: () => runtime,
412
424
  serverBackups: () => serverBackups,
413
425
  setAutoUpdate: () => setAutoUpdate,
426
+ setEnvironmentAccess: () => setEnvironmentAccess,
414
427
  setVariables: () => setVariables,
415
- updateServer: () => updateServer
428
+ updateServer: () => updateServer,
429
+ verifyDomain: () => verifyDomain
416
430
  });
417
431
  const create$2 = {
418
432
  type: "post",
@@ -430,6 +444,32 @@ const environmentParams = Type.Object({
430
444
  environment: environmentKind
431
445
  });
432
446
  const messageResponse = Type.Object({ message: Type.String() });
447
+ const registerDesktop = {
448
+ type: "post",
449
+ body: Type.Object({
450
+ name: Type.String({
451
+ maxLength: 200,
452
+ minLength: 1
453
+ }),
454
+ icon: Type.String({ maxLength: 64 })
455
+ }),
456
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
457
+ url: "/deploy/desktop"
458
+ };
459
+ const createDesktop = {
460
+ type: "post",
461
+ body: Type.Object({
462
+ archive: Type.Object({
463
+ filename: Type.String(),
464
+ mimetype: Type.String()
465
+ }),
466
+ serverId: Type.Object({ value: Type.String({ format: "uuid" }) })
467
+ }),
468
+ multipart: true,
469
+ params: environmentParams,
470
+ response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
471
+ url: "/deploy/desktop/:appId/:environment"
472
+ };
433
473
  const deploymentSummary = Type.Object({
434
474
  id: Type.String({ format: "uuid" }),
435
475
  baseHash: Type.Union([Type.String(), Type.Null()]),
@@ -504,6 +544,7 @@ const environments = {
504
544
  environments: Type.Array(Type.Object({
505
545
  active: Type.Union([deploymentSummary, Type.Null()]),
506
546
  history: Type.Array(deploymentSummary),
547
+ isPrivate: Type.Boolean(),
507
548
  kind: environmentKind,
508
549
  pending: Type.Union([deploymentSummary, Type.Null()]),
509
550
  status: Type.String(),
@@ -513,6 +554,99 @@ const environments = {
513
554
  }) },
514
555
  url: "/deploy/:appId/environments"
515
556
  };
557
+ const environmentLink = {
558
+ type: "post",
559
+ body: Type.Object({ mode: Type.Union([Type.Literal("open"), Type.Literal("share")]) }),
560
+ params: environmentParams,
561
+ response: { 200: Type.Object({
562
+ expiresAt: Type.Union([Type.String(), Type.Null()]),
563
+ url: Type.String()
564
+ }) },
565
+ url: "/deploy/:appId/:environment/link"
566
+ };
567
+ const environmentDomain = Type.Object({
568
+ id: Type.String({ format: "uuid" }),
569
+ hostname: Type.String(),
570
+ lastError: Type.Union([Type.String(), Type.Null()]),
571
+ managed: Type.Boolean(),
572
+ records: Type.Object({
573
+ a: Type.Union([Type.String(), Type.Null()]),
574
+ aaaa: Type.Union([Type.String(), Type.Null()])
575
+ }),
576
+ routed: Type.Boolean(),
577
+ verifiedAt: Type.Union([Type.String(), Type.Null()])
578
+ });
579
+ const domainParams = Type.Object({
580
+ ...environmentParams.properties,
581
+ domainId: Type.String({ format: "uuid" })
582
+ });
583
+ const listDomains = {
584
+ type: "get",
585
+ params: environmentParams,
586
+ response: { 200: Type.Array(environmentDomain) },
587
+ url: "/deploy/:appId/:environment/domains"
588
+ };
589
+ const addDomain = {
590
+ type: "post",
591
+ body: Type.Object({ hostname: Type.String({
592
+ maxLength: 260,
593
+ minLength: 1
594
+ }) }),
595
+ params: environmentParams,
596
+ response: { 200: environmentDomain },
597
+ url: "/deploy/:appId/:environment/domains"
598
+ };
599
+ const removeDomain = {
600
+ type: "delete",
601
+ params: domainParams,
602
+ response: { 200: messageResponse },
603
+ url: "/deploy/:appId/:environment/domains/:domainId"
604
+ };
605
+ const verifyDomain = {
606
+ type: "post",
607
+ params: domainParams,
608
+ response: { 200: environmentDomain },
609
+ url: "/deploy/:appId/:environment/domains/:domainId/verify"
610
+ };
611
+ const managedDomainZone = {
612
+ type: "get",
613
+ response: { 200: Type.Object({ zone: Type.Union([Type.String(), Type.Null()]) }) },
614
+ url: "/deploy/managed-domain-zone"
615
+ };
616
+ const checkManagedDomain = {
617
+ type: "get",
618
+ params: environmentParams,
619
+ querystring: Type.Object({ label: Type.String({ maxLength: 80 }) }),
620
+ response: { 200: Type.Object({
621
+ available: Type.Boolean(),
622
+ hostname: Type.Union([Type.String(), Type.Null()]),
623
+ reason: Type.Union([Type.String(), Type.Null()])
624
+ }) },
625
+ url: "/deploy/:appId/:environment/managed-domain"
626
+ };
627
+ const claimManagedDomain = {
628
+ type: "post",
629
+ body: Type.Object({ label: Type.String({
630
+ maxLength: 80,
631
+ minLength: 1
632
+ }) }),
633
+ params: environmentParams,
634
+ response: { 200: environmentDomain },
635
+ url: "/deploy/:appId/:environment/managed-domain"
636
+ };
637
+ const setEnvironmentAccess = {
638
+ type: "put",
639
+ body: Type.Object({ isPrivate: Type.Boolean() }),
640
+ params: environmentParams,
641
+ response: { 200: messageResponse },
642
+ url: "/deploy/:appId/:environment/access"
643
+ };
644
+ const revokeEnvironmentLinks = {
645
+ type: "post",
646
+ params: environmentParams,
647
+ response: { 200: messageResponse },
648
+ url: "/deploy/:appId/:environment/revoke-links"
649
+ };
516
650
  const events = {
517
651
  type: "get",
518
652
  params: Type.Object({ deploymentId: Type.String({ format: "uuid" }) }),
@@ -560,6 +694,18 @@ const promote = {
560
694
  response: { 200: Type.Object({ id: Type.String({ format: "uuid" }) }) },
561
695
  url: "/deploy/:appId/promote/:stagingDeploymentId"
562
696
  };
697
+ const destroyEnvironment = {
698
+ type: "delete",
699
+ params: environmentParams,
700
+ response: { 200: messageResponse },
701
+ url: "/deploy/:appId/:environment"
702
+ };
703
+ const destroyApplication = {
704
+ type: "delete",
705
+ params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
706
+ response: { 200: messageResponse },
707
+ url: "/deploy/:appId"
708
+ };
563
709
  const setAutoUpdate = {
564
710
  type: "put",
565
711
  body: Type.Object({ enabled: Type.Boolean() }),
@@ -938,16 +1084,103 @@ const update$1 = {
938
1084
  url: "/script/:id/:script/update"
939
1085
  };
940
1086
  var turnstile_exports = /* @__PURE__ */ __exportAll({ tick: () => tick });
1087
+ const shortText = Type.String({ maxLength: 256 });
1088
+ const longText = Type.String({ maxLength: 5e4 });
1089
+ const desktop = Type.Object({
1090
+ id: Type.String({ format: "uuid" }),
1091
+ os: Type.Optional(Type.Unknown()),
1092
+ version: Type.Optional(Type.String({ maxLength: 32 }))
1093
+ });
1094
+ const project = Type.Object({
1095
+ id: shortText,
1096
+ name: shortText
1097
+ });
1098
+ const reportKind = Type.Union([
1099
+ Type.Literal("bug"),
1100
+ Type.Literal("documentation"),
1101
+ Type.Literal("suggestion")
1102
+ ]);
1103
+ function tickEvent(scope, data) {
1104
+ return Type.Object({
1105
+ data: Type.Object({
1106
+ ...data,
1107
+ desktop: Type.Optional(desktop)
1108
+ }, { additionalProperties: false }),
1109
+ scope: Type.Literal(scope)
1110
+ });
1111
+ }
1112
+ /**
1113
+ * Validated by `scope` only: with the server's `removeAdditional`, a plain union strips the fields of later events while trying earlier ones
1114
+ */
1115
+ const tickEvents = Type.Union([
1116
+ tickEvent("page", {
1117
+ event: Type.Literal("view"),
1118
+ path: Type.String({ maxLength: 2048 }),
1119
+ subject: shortText
1120
+ }),
1121
+ tickEvent("referrer", {
1122
+ event: Type.Literal("arrive"),
1123
+ subject: Type.String({ maxLength: 2048 })
1124
+ }),
1125
+ tickEvent("referral", {
1126
+ event: Type.Literal("arrive"),
1127
+ subject: shortText
1128
+ }),
1129
+ tickEvent("challenge", {
1130
+ attempt: Type.Optional(Type.Integer({
1131
+ maximum: 1e4,
1132
+ minimum: 1
1133
+ })),
1134
+ event: Type.Union([
1135
+ Type.Literal("intro"),
1136
+ Type.Literal("start"),
1137
+ Type.Literal("see"),
1138
+ Type.Literal("step"),
1139
+ Type.Literal("fail"),
1140
+ Type.Literal("done")
1141
+ ]),
1142
+ step: Type.Optional(Type.Integer({
1143
+ maximum: 1e3,
1144
+ minimum: 0
1145
+ })),
1146
+ subject: Type.Optional(shortText)
1147
+ }),
1148
+ tickEvent("editor", {
1149
+ event: Type.Literal("open"),
1150
+ subject: shortText
1151
+ }),
1152
+ tickEvent("desktop", {
1153
+ event: Type.Union([
1154
+ Type.Literal("start"),
1155
+ Type.Literal("create-project"),
1156
+ Type.Literal("open-project")
1157
+ ]),
1158
+ template: Type.Optional(shortText)
1159
+ }),
1160
+ tickEvent("error", {
1161
+ event: Type.Optional(Type.Literal("error")),
1162
+ message: longText,
1163
+ project: Type.Optional(project)
1164
+ }),
1165
+ tickEvent("ai-report", {
1166
+ date: shortText,
1167
+ details: longText,
1168
+ event: Type.Optional(reportKind),
1169
+ example: longText,
1170
+ kind: Type.Optional(reportKind),
1171
+ model: shortText,
1172
+ project: Type.Optional(project),
1173
+ title: longText
1174
+ })
1175
+ ]);
941
1176
  const tick = {
942
1177
  type: "post",
943
- body: Type.Object({
944
- data: Type.Optional(Type.Intersect([Type.Object({ desktop: Type.Optional(Type.Object({
945
- id: Type.String({ minLength: 1 }),
946
- os: Type.Optional(Type.Unknown()),
947
- version: Type.Optional(Type.String())
948
- }, { additionalProperties: true })) }, { additionalProperties: true }), Type.Record(Type.String(), Type.Unknown())])),
949
- scope: Type.String()
1178
+ body: Type.Unsafe({
1179
+ type: "object",
1180
+ discriminator: { propertyName: "scope" },
1181
+ oneOf: tickEvents.anyOf
950
1182
  }),
1183
+ keepalive: true,
951
1184
  response: { 200: Type.Object({}) },
952
1185
  url: "/turnstile/tick"
953
1186
  };
@@ -1061,7 +1294,7 @@ for (const [serviceName, serviceRoutes] of Object.entries(routes)) {
1061
1294
  if (args.querystring) {
1062
1295
  for (const key of Object.keys(args.querystring)) if (args.querystring[key]) url.searchParams.append(key, args.querystring[key].toString());
1063
1296
  }
1064
- const result = await (route.multipart ? api_default.multipart : api_default[route.type])(url.href, args.body);
1297
+ const result = await (route.multipart ? api_default.multipart : api_default[route.type])(url.href, args.body, route.keepalive ? { keepalive: true } : void 0);
1065
1298
  const content = await getContent(result);
1066
1299
  if (result.status >= 400) throw new Error(`Error ${result.status} (${result.statusText}): ${content.message || content}`);
1067
1300
  return content;
@@ -1178,10 +1411,12 @@ LogicType.string(), LogicType.string({
1178
1411
  name: "Source",
1179
1412
  description: "The source"
1180
1413
  });
1414
+ // ../shared/dist/layout.mjs
1181
1415
  const baseEvent = LogicType.object({
1182
1416
  preventDefault: LogicType.function(LogicType.object({}), LogicType.void(), { description: "Prevent the default action of the event" }),
1183
1417
  target: LogicType.interface("HTMLElement")
1184
1418
  });
1419
+ LogicType.object({ ...baseEvent.properties }, { name: "Event" });
1185
1420
  LogicType.object({
1186
1421
  ...baseEvent.properties,
1187
1422
  data: LogicType.string({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luna-park/plugin",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "description": "Plugin helper for Luna Park.",
6
6
  "homepage": "https://luna-park.app",