@luna-park/plugin 2.2.0 → 2.4.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-Dz0vJvpL.mjs";
1
+ import { d as TSchema } from "./index-kGM_G99G.mjs";
2
2
  import * as ts$1 from "typescript";
3
3
  import ts from "typescript";
4
4
  type TExportResult = {
@@ -43,7 +43,6 @@ declare enum EVarType {
43
43
  void = "void"
44
44
  }
45
45
  type TProperties = Record<string, TSchema>;
46
- /** Schema options, augmentable by the packages that own each option with `declare module "@luna-park/logicnodes"`. Other keys are free for plugin inputs. */
47
46
  interface TSchemaOptions {
48
47
  [key: string]: unknown;
49
48
  access?: TSchema<TObject>;
@@ -63,8 +62,10 @@ interface TSchemaOptions {
63
62
  multiplier?: number;
64
63
  notNull?: boolean;
65
64
  onDelete?: string;
65
+ parent?: string;
66
66
  readonly?: boolean;
67
67
  search?: boolean;
68
+ secret?: boolean;
68
69
  step?: number;
69
70
  suffix?: string;
70
71
  template?: Array<TSchema>;
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-Dz0vJvpL.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-kGM_G99G.mjs";
2
2
  import { Component, ComputedRef, Directive } from "vue";
3
3
  import "@sinclair/typebox";
4
4
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
@@ -39,6 +39,7 @@ type TComponent<TProps extends Record<string, TSchema> = Record<string, TSchema>
39
39
  link?: string;
40
40
  };
41
41
  emits?: Record<string, TSchema> | ((attributes: TAttributes<TProps, TInternals>) => Record<string, TSchema>);
42
+ guides?: Array<string>;
42
43
  icon?: IconDefinition | string;
43
44
  internals?: TInternals;
44
45
  llm?: string;
@@ -371,10 +372,9 @@ type TLayoutContentOf<TElement extends TLayoutElementType, TVariable, TChild> =
371
372
  */
372
373
  type TLayoutStyleRulesExport = Record<string, Record<string, TMaybeDynamicVariableExport>>;
373
374
  type TLayoutStyleRules = Record<string, Record<string, TMaybeDynamicVariable>>;
374
- type TLayoutStyleStatesOf<TRules> = {
375
- default?: TRules;
376
- hover?: TRules;
377
- };
375
+ type TLayoutStylePseudo = "active" | "focus-visible" | "hover";
376
+ type TLayoutStyleState = "default" | TLayoutStylePseudo;
377
+ type TLayoutStyleStatesOf<TRules> = Partial<Record<TLayoutStyleState, TRules>>;
378
378
  type TLayoutStyleStatesExport = TLayoutStyleStatesOf<TLayoutStyleRulesExport>;
379
379
  type TLayoutStyleStates = TLayoutStyleStatesOf<TLayoutStyleRules>;
380
380
  type TLayoutStyleOf<TStates> = {
@@ -439,6 +439,7 @@ type TComponentOptions = {
439
439
  type: EComponentType;
440
440
  path: string;
441
441
  preview: EComponentPreview;
442
+ previewBackground?: string;
442
443
  previewSize?: string;
443
444
  seo?: TPageSeo;
444
445
  };
@@ -678,12 +679,21 @@ type TApplicationToken = {
678
679
  name: string;
679
680
  value: string;
680
681
  };
682
+ declare enum EColorTokenRole {
683
+ Background = "background",
684
+ Content = "content"
685
+ }
686
+ type TApplicationColorToken = TApplicationToken & {
687
+ role?: EColorTokenRole;
688
+ };
681
689
  type TApplicationFontToken = TApplicationToken & {
682
690
  cdn?: string;
683
691
  default?: boolean;
692
+ italic?: boolean;
693
+ weights?: Array<number>;
684
694
  };
685
695
  type TApplicationTokens = {
686
- colors: Array<TApplicationToken>;
696
+ colors: Array<TApplicationColorToken>;
687
697
  fonts: Array<TApplicationFontToken>;
688
698
  lengths: Array<TApplicationToken>;
689
699
  };
@@ -735,12 +745,14 @@ type TApplicationConfig = {
735
745
  strategy: EResponsiveStrategy;
736
746
  };
737
747
  web: {
748
+ favicon?: TApplicationFavicon;
738
749
  history: EHistoryMode;
739
750
  pwa: boolean;
740
751
  pwaConfig?: TApplicationPwaConfig;
741
752
  seo?: TApplicationSeoConfig;
742
753
  };
743
754
  };
755
+ type TApplicationFavicon = string | Pick<TDynamicVariableExport, "_dynamic" | "access" | "type">;
744
756
  type TApplicationSeoConfig = {
745
757
  description: string;
746
758
  image: string;
@@ -1023,6 +1035,7 @@ type TDBCondition = {
1023
1035
  type: "column";
1024
1036
  target: Array<string>;
1025
1037
  });
1038
+ declare function getPluginSecretEnvName(pluginId: string, name: string): string;
1026
1039
  export declare enum EPluginHooks {
1027
1040
  BackendMiddleware = "backend/middleware",
1028
1041
  BackendInputNode = "backend/input-node",
@@ -1153,6 +1166,7 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
1153
1166
  attributes?: Record<string, unknown>;
1154
1167
  };
1155
1168
  };
1169
+ guides?: Record<string, TPluginGuide>;
1156
1170
  hooks?: { [THook in EPluginHooks]?: (params: THookParams[THook]) => MaybePromise<void>; };
1157
1171
  icon: string;
1158
1172
  id: string;
@@ -1171,10 +1185,15 @@ type TBasePlugin<TConfig extends TSchema = TSchema, TInternals = unknown> = {
1171
1185
  name: string;
1172
1186
  windows?: Record<string, Component>;
1173
1187
  workspace?: {
1188
+ openOnClick?: boolean;
1174
1189
  preview?: Component;
1175
- sections: Array<TPluginWorkspaceSection>;
1190
+ sections?: Array<TPluginWorkspaceSection>;
1176
1191
  };
1177
1192
  };
1193
+ type TPluginGuide = {
1194
+ content: string;
1195
+ description: string;
1196
+ };
1178
1197
  type TPluginWorkspaceSection = {
1179
1198
  component: Component;
1180
1199
  description?: string;
@@ -1204,6 +1223,7 @@ type TEnv<TConfig extends TSchema = TSchema, TInternals = unknown> = {
1204
1223
  internals: TInternals;
1205
1224
  log: (message: string, severity?: "info" | "warning" | "error") => void;
1206
1225
  mode: "build" | "editor";
1226
+ secrets?: TSecrets;
1207
1227
  };
1208
1228
  type THost = {
1209
1229
  readonly available: boolean;
@@ -1216,6 +1236,13 @@ type THost = {
1216
1236
  removeFile: (path: string) => Promise<void>;
1217
1237
  writeFile: (path: string, data: Uint8Array) => Promise<void>;
1218
1238
  };
1239
+ type TSecrets = {
1240
+ readonly available: boolean;
1241
+ get: (name: string) => Promise<string | undefined>;
1242
+ list: () => Promise<Array<string>>;
1243
+ remove: (name: string) => Promise<void>;
1244
+ set: (name: string, value: string) => Promise<void>;
1245
+ };
1219
1246
  type TOption<TParams = unknown, TResult = unknown> = TResult | ((env: TParams) => Promise<TResult> | TResult);
1220
1247
  export declare function makePlugin<TConfig extends TSchema, TInternal>(plugin: TPlugin<TConfig, TInternal>): TPlugin<TConfig, TInternal>;
1221
1248
  export declare function makeComponent<TProps extends Record<string, TSchema>>(component: TComponent<TProps>): TComponent<TProps>;
@@ -1223,4 +1250,4 @@ export declare function loadPlugin<TConfig extends TSchema, TInternal>(plugin: T
1223
1250
  export declare function sortPlugins<T extends Pick<TBasePlugin, "dependencies" | "id">>(plugins: Array<T>): Array<T>;
1224
1251
  export declare function getPluginApi<TApi = unknown>(plugin: Pick<TBasePlugin, "api" | "config" | "id"> | undefined, env: Partial<TEnv>): Promise<TApi | undefined>;
1225
1252
  export declare function getPluginParam<T>(target: TOption<TEnv, T>, env: Partial<TEnv>): Promise<T>;
1226
- 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 };
1253
+ 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 TPluginGuide, type TPluginWorkspaceSection, type TProxyPlugin, type TRouteGuard, type TSchema, type TSecrets, type TSlot, type TTemplate, type TToken, getPluginSecretEnvName, makeLogicNode };
package/dist/index.mjs CHANGED
@@ -62,7 +62,7 @@ defineServerTier("economy", "small", 20, ["cx23"], {
62
62
  diskGb: 320,
63
63
  memoryGb: 16
64
64
  });
65
- // ../shared/dist/types-DX6OvWhQ.mjs
65
+ // ../shared/dist/types-Ck0zcB88.mjs
66
66
  const TypeDate = Type.String({ format: "date-time" });
67
67
  var app_exports$1 = /* @__PURE__ */ __exportAll({
68
68
  app: () => app,
@@ -170,6 +170,10 @@ const user = Type.Object({
170
170
  bio: Type.String(),
171
171
  referral: Type.String()
172
172
  }),
173
+ private: Type.Object({
174
+ firstName: Type.String({ maxLength: 80 }),
175
+ lastName: Type.String({ maxLength: 80 })
176
+ }),
173
177
  public: Type.Object({
174
178
  company: Type.String(),
175
179
  location: Type.String(),
@@ -183,6 +187,7 @@ const user = Type.Object({
183
187
  twitter: Type.String()
184
188
  })
185
189
  }),
190
+ roles: Type.Optional(Type.Array(Type.String())),
186
191
  settings: Type.Object({
187
192
  newsletter: Type.Boolean(),
188
193
  onboarding: Type.Boolean()
@@ -306,9 +311,9 @@ let EDBCondition = /* @__PURE__ */ function(EDBCondition) {
306
311
  }({});
307
312
  var app_exports = /* @__PURE__ */ __exportAll({
308
313
  edit: () => edit$1,
309
- get: () => get$3
314
+ get: () => get$4
310
315
  });
311
- const get$3 = {
316
+ const get$4 = {
312
317
  type: "get",
313
318
  params: Type.Object({ id: Type.String() }),
314
319
  response: { 200: Type.Object({
@@ -389,11 +394,11 @@ const client = {
389
394
  url: "/auth/client"
390
395
  };
391
396
  var challenge_exports = /* @__PURE__ */ __exportAll({
392
- get: () => get$2,
397
+ get: () => get$3,
393
398
  update: () => update$2
394
399
  });
395
400
  const progression = Type.Object({ done: Type.Array(Type.String()) });
396
- const get$2 = {
401
+ const get$3 = {
397
402
  type: "get",
398
403
  response: { 200: progression },
399
404
  url: "/challenge"
@@ -448,6 +453,7 @@ var deploy_exports = /* @__PURE__ */ __exportAll({
448
453
  getVariables: () => getVariables,
449
454
  listArchives: () => listArchives,
450
455
  listDomains: () => listDomains,
456
+ listServerAlerts: () => listServerAlerts,
451
457
  listServerMembers: () => listServerMembers,
452
458
  listServerTiers: () => listServerTiers,
453
459
  listServers: () => listServers,
@@ -465,6 +471,7 @@ var deploy_exports = /* @__PURE__ */ __exportAll({
465
471
  serverBackups: () => serverBackups,
466
472
  setAutoUpdate: () => setAutoUpdate,
467
473
  setEnvironmentAccess: () => setEnvironmentAccess,
474
+ setServerIpv4: () => setServerIpv4,
468
475
  setVariables: () => setVariables,
469
476
  updateServer: () => updateServer,
470
477
  verifyDomain: () => verifyDomain
@@ -484,7 +491,7 @@ const environmentParams = Type.Object({
484
491
  appId: Type.String({ format: "uuid" }),
485
492
  environment: environmentKind
486
493
  });
487
- const messageResponse = Type.Object({ message: Type.String() });
494
+ const messageResponse$1 = Type.Object({ message: Type.String() });
488
495
  const registerDesktop = {
489
496
  type: "post",
490
497
  body: Type.Object({
@@ -534,13 +541,29 @@ const listServers = {
534
541
  response: { 200: Type.Array(Type.Object({
535
542
  id: Type.String({ format: "uuid" }),
536
543
  name: Type.String(),
544
+ capacity: Type.Object({
545
+ disk: Type.Union([Type.Object({
546
+ free: Type.Number(),
547
+ total: Type.Number()
548
+ }), Type.Null()]),
549
+ environments: Type.Integer(),
550
+ maxEnvironments: Type.Union([Type.Integer(), Type.Null()])
551
+ }),
537
552
  displayName: Type.Union([Type.String(), Type.Null()]),
553
+ ipv4: Type.Union([Type.String(), Type.Null()]),
554
+ ipv4Requested: Type.Boolean(),
555
+ ipv4Status: Type.Union([
556
+ Type.Literal("attaching"),
557
+ Type.Literal("detaching"),
558
+ Type.Null()
559
+ ]),
538
560
  ipv6: Type.Union([Type.String(), Type.Null()]),
539
561
  maintenanceHour: Type.Integer(),
540
562
  ownerMail: Type.Union([Type.String(), Type.Null()]),
541
563
  readyAt: Type.Union([Type.String(), Type.Null()]),
542
564
  role: Type.Union([Type.Literal("member"), Type.Literal("owner")]),
543
565
  status: Type.String(),
566
+ tier: Type.Union([Type.String(), Type.Null()]),
544
567
  url: Type.Union([Type.String(), Type.Null()])
545
568
  })) },
546
569
  url: "/deploy/servers"
@@ -569,7 +592,7 @@ const removeServerMember = {
569
592
  serverId: Type.String({ format: "uuid" }),
570
593
  userId: Type.String({ format: "uuid" })
571
594
  }),
572
- response: { 200: messageResponse },
595
+ response: { 200: messageResponse$1 },
573
596
  url: "/deploy/servers/:serverId/members/:userId"
574
597
  };
575
598
  const monitoringLink = {
@@ -641,7 +664,7 @@ const addDomain = {
641
664
  const removeDomain = {
642
665
  type: "delete",
643
666
  params: domainParams,
644
- response: { 200: messageResponse },
667
+ response: { 200: messageResponse$1 },
645
668
  url: "/deploy/:appId/:environment/domains/:domainId"
646
669
  };
647
670
  const verifyDomain = {
@@ -680,13 +703,13 @@ const setEnvironmentAccess = {
680
703
  type: "put",
681
704
  body: Type.Object({ isPrivate: Type.Boolean() }),
682
705
  params: environmentParams,
683
- response: { 200: messageResponse },
706
+ response: { 200: messageResponse$1 },
684
707
  url: "/deploy/:appId/:environment/access"
685
708
  };
686
709
  const revokeEnvironmentLinks = {
687
710
  type: "post",
688
711
  params: environmentParams,
689
- response: { 200: messageResponse },
712
+ response: { 200: messageResponse$1 },
690
713
  url: "/deploy/:appId/:environment/revoke-links"
691
714
  };
692
715
  const events = {
@@ -715,7 +738,7 @@ const setVariables = {
715
738
  type: "put",
716
739
  body: Type.Object({ variables: Type.String({ maxLength: 65536 }) }),
717
740
  params: environmentParams,
718
- response: { 200: messageResponse },
741
+ response: { 200: messageResponse$1 },
719
742
  url: "/deploy/:appId/:environment/variables"
720
743
  };
721
744
  const rollback = {
@@ -739,20 +762,20 @@ const promote = {
739
762
  const destroyEnvironment = {
740
763
  type: "delete",
741
764
  params: environmentParams,
742
- response: { 200: messageResponse },
765
+ response: { 200: messageResponse$1 },
743
766
  url: "/deploy/:appId/:environment"
744
767
  };
745
768
  const destroyApplication = {
746
769
  type: "delete",
747
770
  params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
748
- response: { 200: messageResponse },
771
+ response: { 200: messageResponse$1 },
749
772
  url: "/deploy/:appId"
750
773
  };
751
774
  const setAutoUpdate = {
752
775
  type: "put",
753
776
  body: Type.Object({ enabled: Type.Boolean() }),
754
777
  params: Type.Object({ appId: Type.String({ format: "uuid" }) }),
755
- response: { 200: messageResponse },
778
+ response: { 200: messageResponse$1 },
756
779
  url: "/deploy/:appId/auto-update"
757
780
  };
758
781
  const updateServer = {
@@ -762,9 +785,29 @@ const updateServer = {
762
785
  minimum: 0
763
786
  }) }),
764
787
  params: Type.Object({ serverId: Type.String({ format: "uuid" }) }),
765
- response: { 200: messageResponse },
788
+ response: { 200: messageResponse$1 },
766
789
  url: "/deploy/servers/:serverId"
767
790
  };
791
+ const setServerIpv4 = {
792
+ type: "put",
793
+ body: Type.Object({ enabled: Type.Boolean() }),
794
+ params: serverParams,
795
+ response: { 200: messageResponse$1 },
796
+ url: "/deploy/servers/:serverId/ipv4"
797
+ };
798
+ const listServerAlerts = {
799
+ type: "get",
800
+ params: serverParams,
801
+ response: { 200: Type.Array(Type.Object({
802
+ id: Type.String({ format: "uuid" }),
803
+ key: Type.String(),
804
+ level: Type.Union([Type.Literal("critical"), Type.Literal("warning")]),
805
+ message: Type.String(),
806
+ openedAt: Type.String(),
807
+ resolvedAt: Type.Union([Type.String(), Type.Null()])
808
+ })) },
809
+ url: "/deploy/servers/:serverId/alerts"
810
+ };
768
811
  const serverBackups = {
769
812
  type: "get",
770
813
  params: Type.Object({ serverId: Type.String({ format: "uuid" }) }),
@@ -788,9 +831,9 @@ const renameServer = {
788
831
  const listArchives = {
789
832
  type: "get",
790
833
  response: { 200: Type.Array(Type.Object({
834
+ id: Type.String({ format: "uuid" }),
791
835
  createdAt: Type.String(),
792
836
  expiresAt: Type.Union([Type.String(), Type.Null()]),
793
- id: Type.String({ format: "uuid" }),
794
837
  serverName: Type.String(),
795
838
  size: Type.Union([Type.Number(), Type.Null()]),
796
839
  status: Type.String()
@@ -878,8 +921,8 @@ const versions = {
878
921
  url: "/desktop/release/versions"
879
922
  };
880
923
  var file_exports = /* @__PURE__ */ __exportAll({
881
- list: () => list$2,
882
- remove: () => remove$1,
924
+ list: () => list$3,
925
+ remove: () => remove$2,
883
926
  status: () => status,
884
927
  upload: () => upload
885
928
  });
@@ -900,13 +943,13 @@ const upload = {
900
943
  }) },
901
944
  url: "/file/upload"
902
945
  };
903
- const remove$1 = {
946
+ const remove$2 = {
904
947
  type: "post",
905
948
  body: Type.Object({ target: Type.String() }),
906
949
  response: { 200: Type.Object({ message: Type.String() }) },
907
950
  url: "/file/remove"
908
951
  };
909
- const list$2 = {
952
+ const list$3 = {
910
953
  type: "get",
911
954
  querystring: Type.Object({
912
955
  limit: Type.Optional(Type.String()),
@@ -953,7 +996,7 @@ var license_exports = /* @__PURE__ */ __exportAll({
953
996
  check: () => check,
954
997
  connect: () => connect,
955
998
  link: () => link,
956
- list: () => list$1,
999
+ list: () => list$2,
957
1000
  reset: () => reset
958
1001
  });
959
1002
  const TypeMachineFingerprint = Type.String({ pattern: "^v1:[0-9a-f]{64}$" });
@@ -991,7 +1034,7 @@ const check = {
991
1034
  }) },
992
1035
  url: "/license/check"
993
1036
  };
994
- const list$1 = {
1037
+ const list$2 = {
995
1038
  type: "get",
996
1039
  response: { 200: Type.Array(Type.Object({
997
1040
  id: Type.String(),
@@ -1087,9 +1130,9 @@ const serverCheckout = {
1087
1130
  url: "/payment/server/checkout"
1088
1131
  };
1089
1132
  const serverSubscription = Type.Object({
1133
+ id: Type.String({ format: "uuid" }),
1090
1134
  cancelAt: Type.Union([Type.String(), Type.Null()]),
1091
1135
  currentPeriodEnd: Type.Union([Type.String(), Type.Null()]),
1092
- id: Type.String({ format: "uuid" }),
1093
1136
  ipv4: Type.Boolean(),
1094
1137
  provisioningError: Type.Union([Type.String(), Type.Null()]),
1095
1138
  serverId: Type.Union([Type.String({ format: "uuid" }), Type.Null()]),
@@ -1104,20 +1147,14 @@ const listServerSubscriptions = {
1104
1147
  var project_exports = /* @__PURE__ */ __exportAll({
1105
1148
  create: () => create,
1106
1149
  edit: () => edit,
1107
- list: () => list,
1108
- remove: () => remove,
1150
+ list: () => list$1,
1151
+ remove: () => remove$1,
1109
1152
  star: () => star
1110
1153
  });
1111
1154
  const create = {
1112
1155
  type: "post",
1113
1156
  body: Type.Object({
1114
1157
  icon: Type.String(),
1115
- template: Type.Union([
1116
- Type.Literal("default"),
1117
- Type.Literal("landing"),
1118
- Type.Literal("nuxt"),
1119
- Type.Literal("testing")
1120
- ]),
1121
1158
  title: Type.String()
1122
1159
  }),
1123
1160
  response: { 200: Type.Object({
@@ -1126,7 +1163,7 @@ const create = {
1126
1163
  }) },
1127
1164
  url: "/project/create"
1128
1165
  };
1129
- const list = {
1166
+ const list$1 = {
1130
1167
  type: "get",
1131
1168
  params: Type.Object({ type: Type.Union([
1132
1169
  Type.Literal("mine"),
@@ -1143,7 +1180,7 @@ const list = {
1143
1180
  response: { 200: Type.Object({ projects: Type.Array(types.publicProject) }) },
1144
1181
  url: "/project/list/:type"
1145
1182
  };
1146
- const remove = {
1183
+ const remove$1 = {
1147
1184
  type: "delete",
1148
1185
  params: Type.Object({ id: Type.String() }),
1149
1186
  response: { 200: Type.Object({ message: Type.String() }) },
@@ -1166,10 +1203,10 @@ const star = {
1166
1203
  };
1167
1204
  var script_exports = /* @__PURE__ */ __exportAll({
1168
1205
  compile: () => compile,
1169
- get: () => get$1,
1206
+ get: () => get$2,
1170
1207
  update: () => update$1
1171
1208
  });
1172
- const get$1 = {
1209
+ const get$2 = {
1173
1210
  type: "get",
1174
1211
  params: Type.Object({
1175
1212
  id: Type.String(),
@@ -1197,6 +1234,55 @@ const update$1 = {
1197
1234
  response: { 200: Type.Object({ message: Type.String() }) },
1198
1235
  url: "/script/:id/:script/update"
1199
1236
  };
1237
+ var secret_exports = /* @__PURE__ */ __exportAll({
1238
+ get: () => get$1,
1239
+ list: () => list,
1240
+ remove: () => remove,
1241
+ set: () => set
1242
+ });
1243
+ const projectParams = Type.Object({ id: Type.String() });
1244
+ const secretQuery = Type.Object({
1245
+ name: Type.String({
1246
+ maxLength: 128,
1247
+ pattern: "^[A-Za-z_][A-Za-z0-9_]*$"
1248
+ }),
1249
+ scope: Type.String({
1250
+ maxLength: 128,
1251
+ pattern: "^[A-Za-z0-9][A-Za-z0-9_-]*(/[A-Za-z0-9][A-Za-z0-9_-]*)?$"
1252
+ })
1253
+ });
1254
+ const messageResponse = Type.Object({ message: Type.String() });
1255
+ const list = {
1256
+ type: "get",
1257
+ params: projectParams,
1258
+ response: { 200: Type.Object({ secrets: Type.Array(Type.Object({
1259
+ name: Type.String(),
1260
+ scope: Type.String()
1261
+ })) }) },
1262
+ url: "/project/:id/secrets"
1263
+ };
1264
+ const get$1 = {
1265
+ type: "get",
1266
+ params: projectParams,
1267
+ querystring: secretQuery,
1268
+ response: { 200: Type.Object({ value: Type.String() }) },
1269
+ url: "/project/:id/secret"
1270
+ };
1271
+ const set = {
1272
+ type: "put",
1273
+ body: Type.Object({ value: Type.String({ maxLength: 65536 }) }),
1274
+ params: projectParams,
1275
+ querystring: secretQuery,
1276
+ response: { 200: messageResponse },
1277
+ url: "/project/:id/secret"
1278
+ };
1279
+ const remove = {
1280
+ type: "delete",
1281
+ params: projectParams,
1282
+ querystring: secretQuery,
1283
+ response: { 200: messageResponse },
1284
+ url: "/project/:id/secret"
1285
+ };
1200
1286
  var turnstile_exports = /* @__PURE__ */ __exportAll({ tick: () => tick });
1201
1287
  const shortText = Type.String({ maxLength: 256 });
1202
1288
  const longText = Type.String({ maxLength: 5e4 });
@@ -1223,9 +1309,6 @@ function tickEvent(scope, data) {
1223
1309
  scope: Type.Literal(scope)
1224
1310
  });
1225
1311
  }
1226
- /**
1227
- * Validated by `scope` only: with the server's `removeAdditional`, a plain union strips the fields of later events while trying earlier ones
1228
- */
1229
1312
  const tickEvents = Type.Union([
1230
1313
  tickEvent("page", {
1231
1314
  event: Type.Literal("view"),
@@ -1240,6 +1323,17 @@ const tickEvents = Type.Union([
1240
1323
  event: Type.Literal("arrive"),
1241
1324
  subject: shortText
1242
1325
  }),
1326
+ tickEvent("landing", {
1327
+ event: Type.Union([
1328
+ Type.Literal("start"),
1329
+ Type.Literal("download"),
1330
+ Type.Literal("video"),
1331
+ Type.Literal("template"),
1332
+ Type.Literal("edit"),
1333
+ Type.Literal("compare")
1334
+ ]),
1335
+ subject: Type.Optional(shortText)
1336
+ }),
1243
1337
  tickEvent("challenge", {
1244
1338
  attempt: Type.Optional(Type.Integer({
1245
1339
  maximum: 1e4,
@@ -1396,6 +1490,7 @@ const routes = {
1396
1490
  payment: payment_exports,
1397
1491
  project: project_exports,
1398
1492
  script: script_exports,
1493
+ secret: secret_exports,
1399
1494
  turnstile: turnstile_exports,
1400
1495
  user: user_exports
1401
1496
  };
@@ -1458,7 +1553,18 @@ const primitives = [
1458
1553
  EVarType.unknown
1459
1554
  ];
1460
1555
  const ordered = [EVarType.number, EVarType.string];
1461
- comparison("===", 8, primitives, (input, [arg]) => input === arg), comparison("!==", 8, primitives, (input, [arg]) => input !== arg), comparison(">", 9, ordered, (input, [arg]) => input > arg), comparison(">=", 9, ordered, (input, [arg]) => input >= arg), comparison("<", 9, ordered, (input, [arg]) => input < arg), comparison("<=", 9, ordered, (input, [arg]) => input <= arg), binary("&&", 4, [EVarType.boolean], (input, [arg]) => Boolean(input && arg)), binary("||", 3, primitives, (input, [arg]) => input || arg), binary("+", 11, [EVarType.number, EVarType.string], (input, [arg]) => input + arg), binary("-", 11, [EVarType.number], (input, [arg]) => input - arg), binary("*", 12, [EVarType.number], (input, [arg]) => input * arg), binary("/", 12, [EVarType.number], (input, [arg]) => input / arg), binary("%", 12, [EVarType.number], (input, [arg]) => input % arg), EVarType.boolean, EVarType.number, EVarType.unknown, LogicType.string(), EVarType.boolean, EVarType.string, EVarType.unknown, LogicType.number(), EVarType.number, EVarType.string, EVarType.unknown, LogicType.boolean();
1556
+ comparison("===", 8, primitives, (input, [arg]) => input === arg), comparison("!==", 8, primitives, (input, [arg]) => input !== arg), comparison(">", 9, ordered, (input, [arg]) => input > arg), comparison(">=", 9, ordered, (input, [arg]) => input >= arg), comparison("<", 9, ordered, (input, [arg]) => input < arg), comparison("<=", 9, ordered, (input, [arg]) => input <= arg), binary("&&", 4, [EVarType.boolean], (input, [arg]) => Boolean(input && arg)), binary("||", 3, primitives, (input, [arg]) => input || arg), binary("+", 11, [EVarType.number, EVarType.string], (input, [arg]) => input + arg, (input, [arg]) => {
1557
+ return [input, arg].some((schema) => isSchemaType(schema, EVarType.string)) ? LogicType.string() : strip(input);
1558
+ }), binary("-", 11, [EVarType.number], (input, [arg]) => input - arg), binary("*", 12, [EVarType.number], (input, [arg]) => input * arg), binary("/", 12, [EVarType.number], (input, [arg]) => input / arg), binary("%", 12, [EVarType.number], (input, [arg]) => input % arg), EVarType.boolean, EVarType.number, EVarType.unknown, LogicType.string(), EVarType.boolean, EVarType.string, EVarType.unknown, LogicType.number(), EVarType.number, EVarType.string, EVarType.unknown, LogicType.boolean();
1559
+ function getSecretEnvName(scope, name) {
1560
+ return `${scope}_${name}`.replaceAll(/[^a-zA-Z0-9]+/g, "_").toUpperCase();
1561
+ }
1562
+ function getPluginSecretScope(pluginId) {
1563
+ return `plugin/${pluginId}`;
1564
+ }
1565
+ function getPluginSecretEnvName(pluginId, name) {
1566
+ return getSecretEnvName(getPluginSecretScope(pluginId), name);
1567
+ }
1462
1568
  // src/types/hooks.ts
1463
1569
  let EPluginHooks = /* @__PURE__ */ function(EPluginHooks) {
1464
1570
  EPluginHooks["BackendMiddleware"] = "backend/middleware";
@@ -1531,55 +1637,7 @@ const baseEvent = LogicType.object({
1531
1637
  target: LogicType.interface("HTMLElement")
1532
1638
  });
1533
1639
  LogicType.object({ ...baseEvent.properties }, { name: "Event" });
1534
- LogicType.object({
1535
- ...baseEvent.properties,
1536
- data: LogicType.string({
1537
- description: "Value of the character inserted",
1538
- example: "a"
1539
- }),
1540
- inputType: LogicType.string({
1541
- description: "Type of change",
1542
- example: "insertText"
1543
- })
1544
- }, { name: "Input Event" }), LogicType.object({
1545
- ...baseEvent.properties,
1546
- altKey: LogicType.boolean({
1547
- description: "Alt key was pressed",
1548
- example: false
1549
- }),
1550
- charCode: LogicType.number({
1551
- description: "Unicode value of a character key pressed",
1552
- example: 97
1553
- }),
1554
- code: LogicType.string({
1555
- description: "Physical key code",
1556
- example: "KeyA"
1557
- }),
1558
- ctrlKey: LogicType.boolean({
1559
- description: "Ctrl key was pressed",
1560
- example: false
1561
- }),
1562
- key: LogicType.string({
1563
- description: "Value of a key or keys pressed by the user",
1564
- example: "a"
1565
- }),
1566
- keyCode: LogicType.number({
1567
- description: "Unicode value of a non-character key",
1568
- example: 65
1569
- }),
1570
- metaKey: LogicType.boolean({
1571
- description: "Meta key was pressed",
1572
- example: false
1573
- }),
1574
- repeat: LogicType.boolean({
1575
- description: "Key is being held down and repeating",
1576
- example: false
1577
- }),
1578
- shiftKey: LogicType.boolean({
1579
- description: "Shift key was pressed",
1580
- example: false
1581
- })
1582
- }, { name: "Keyboard Event" }), LogicType.object({
1640
+ const mouseEvent = LogicType.object({
1583
1641
  ...baseEvent.properties,
1584
1642
  altKey: LogicType.boolean({
1585
1643
  description: "Alt key was pressed",
@@ -1641,7 +1699,74 @@ LogicType.object({
1641
1699
  description: "Shift key was pressed",
1642
1700
  example: false
1643
1701
  })
1644
- }, { name: "Mouse Event" }), LogicType.object({
1702
+ }, { name: "Mouse Event" });
1703
+ LogicType.object({
1704
+ ...baseEvent.properties,
1705
+ data: LogicType.string({
1706
+ description: "Value of the character inserted",
1707
+ example: "a"
1708
+ }),
1709
+ inputType: LogicType.string({
1710
+ description: "Type of change",
1711
+ example: "insertText"
1712
+ })
1713
+ }, { name: "Input Event" }), LogicType.object({
1714
+ ...baseEvent.properties,
1715
+ altKey: LogicType.boolean({
1716
+ description: "Alt key was pressed",
1717
+ example: false
1718
+ }),
1719
+ charCode: LogicType.number({
1720
+ description: "Unicode value of a character key pressed",
1721
+ example: 97
1722
+ }),
1723
+ code: LogicType.string({
1724
+ description: "Physical key code",
1725
+ example: "KeyA"
1726
+ }),
1727
+ ctrlKey: LogicType.boolean({
1728
+ description: "Ctrl key was pressed",
1729
+ example: false
1730
+ }),
1731
+ key: LogicType.string({
1732
+ description: "Value of a key or keys pressed by the user",
1733
+ example: "a"
1734
+ }),
1735
+ keyCode: LogicType.number({
1736
+ description: "Unicode value of a non-character key",
1737
+ example: 65
1738
+ }),
1739
+ metaKey: LogicType.boolean({
1740
+ description: "Meta key was pressed",
1741
+ example: false
1742
+ }),
1743
+ repeat: LogicType.boolean({
1744
+ description: "Key is being held down and repeating",
1745
+ example: false
1746
+ }),
1747
+ shiftKey: LogicType.boolean({
1748
+ description: "Shift key was pressed",
1749
+ example: false
1750
+ })
1751
+ }, { name: "Keyboard Event" }), LogicType.object({
1752
+ ...mouseEvent.properties,
1753
+ isPrimary: LogicType.boolean({
1754
+ description: "Pointer is the primary one of its type (first finger, main mouse)",
1755
+ example: true
1756
+ }),
1757
+ pointerId: LogicType.number({
1758
+ description: "Unique ID of the pointer causing the event",
1759
+ example: 1
1760
+ }),
1761
+ pointerType: LogicType.string({
1762
+ description: "Device type: mouse, pen or touch",
1763
+ example: "mouse"
1764
+ }),
1765
+ pressure: LogicType.number({
1766
+ description: "Normalized pressure, from 0 to 1",
1767
+ example: .5
1768
+ })
1769
+ }, { name: "Pointer Event" }), LogicType.object({
1645
1770
  ...baseEvent.properties,
1646
1771
  submitter: LogicType.interface("HTMLElement", { description: "Button that submitted the form" })
1647
1772
  }, { name: "Submit Event" }), LogicType.object({
@@ -1674,7 +1799,7 @@ let ETokenType = /* @__PURE__ */ function(ETokenType) {
1674
1799
  return ETokenType;
1675
1800
  }({});
1676
1801
  function buildGridSpan(value) {
1677
- return /^\s*\d+\s*$/.test(String(value)) ? `span ${value}` : value;
1802
+ return typeof value === "number" ? `span ${value}` : value;
1678
1803
  }
1679
1804
  LogicType.object({
1680
1805
  background: LogicType.object({
@@ -2491,4 +2616,4 @@ async function getPluginParam(target, env) {
2491
2616
  });
2492
2617
  return target;
2493
2618
  }
2494
- export { EDBCondition, EDBOperation, EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginApi, getPluginParam, loadPlugin, makeComponent, makeLogicNode, makePlugin, sortPlugins };
2619
+ export { EDBCondition, EDBOperation, EElementType, EInjectionKey, ELogicScope, ELogicType, EPluginHooks, ETokenType, EVarType, LSettingsStoryWrapper_default as LSettingsStoryWrapper, LogicType, LogicUtil, getPluginApi, getPluginParam, getPluginSecretEnvName, loadPlugin, makeComponent, makeLogicNode, makePlugin, sortPlugins };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luna-park/plugin",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "private": false,
5
5
  "description": "Plugin helper for Luna Park.",
6
6
  "homepage": "https://luna-park.app",