@luna-park/plugin 1.2.0 → 1.3.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.
@@ -54,7 +54,7 @@ declare type Static<T extends TSchema> = T extends {
54
54
  optional: true;
55
55
  } ? (T["static"] | undefined) : T["static"];
56
56
 
57
- declare type StaticFunction<TInputs extends TObject, TOutput extends TSchema> = (...args: Array<Static<TInputs>[string]>) => Promise<Static<TOutput>>;
57
+ declare type StaticFunction<TInputs extends TObject, TOutput extends TSchema, TPromise extends boolean = false> = TPromise extends true ? (...args: Array<Static<TInputs>[string]>) => Promise<Static<TOutput>> : (...args: Array<Static<TInputs>[string]>) => Static<TOutput>;
58
58
 
59
59
  declare type StaticObject<T extends TProperties> = {
60
60
  [K in RequiredKeys<T>]: Static<T[K]>;
@@ -70,11 +70,10 @@ declare type StaticUnion<T extends Array<TSchema>> = {
70
70
 
71
71
  declare type TAnyLogic = TExec | TObject | TRecord<any, any> | TInterface | TType | TArray<any> | TString | TNumber | TBoolean | TUnknown | TUndefined | TUnion<any> | TFunction<any, any> | TVoid;
72
72
 
73
- declare interface TArguments<TType = any> {
74
- name?: string;
73
+ declare interface TArguments<TType = unknown> {
75
74
  build?: (arg: unknown) => unknown;
76
75
  customizable?: boolean;
77
- default?: TType;
76
+ default?: TType | (() => TType);
78
77
  defaultType?: TSchema;
79
78
  description?: string;
80
79
  dynamic?: ((arg: {
@@ -86,10 +85,13 @@ declare interface TArguments<TType = any> {
86
85
  example?: unknown;
87
86
  format?: "date-time" | "email" | "color";
88
87
  multiple?: boolean;
88
+ name?: string;
89
89
  optional?: boolean;
90
90
  options?: {
91
+ access?: TSchema<TObject>;
91
92
  format?: (arg: TType) => TType;
92
93
  freeze?: boolean;
94
+ readonly?: boolean;
93
95
  } & Record<string, unknown>;
94
96
  parse?: (arg: unknown) => unknown;
95
97
  placeholder?: string;
@@ -101,14 +103,14 @@ declare interface TArguments<TType = any> {
101
103
  }
102
104
 
103
105
  declare interface TArray<T extends TSchema = TSchema> {
104
- type: EVarType.array;
105
106
  items: T;
106
107
  static: Array<Static<T>>;
108
+ type: EVarType.array;
107
109
  }
108
110
 
109
111
  declare interface TBoolean {
110
- type: EVarType.boolean;
111
112
  static: boolean;
113
+ type: EVarType.boolean;
112
114
  }
113
115
 
114
116
  declare type TEnum<TEnumType> = Array<TEnumType> | Record<string, TEnumType>;
@@ -174,72 +176,72 @@ declare type TExportType = {
174
176
  type: string | Record<string, TExportType>;
175
177
  };
176
178
 
177
- declare interface TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TUnknown> {
178
- type: EVarType.function;
179
+ declare interface TFunction<TInputs extends TObject = TObject, TOutput extends TSchema = TUnknown, TPromise extends boolean = false> {
179
180
  inputs: TInputs;
180
181
  output: TOutput;
181
- static: StaticFunction<TInputs, TOutput>;
182
+ static: StaticFunction<TInputs, TOutput, TPromise>;
183
+ type: EVarType.function;
182
184
  }
183
185
 
184
186
  declare interface TInterface<T = unknown> {
185
- type: EVarType.interface;
186
187
  class?: new (...args: any) => T;
187
188
  className: string;
188
189
  static: T;
190
+ type: EVarType.interface;
189
191
  }
190
192
 
191
193
  declare interface TNumber {
192
- type: EVarType.number;
193
194
  static: number;
195
+ type: EVarType.number;
194
196
  }
195
197
 
196
198
  declare interface TObject<T extends TProperties = TProperties> {
197
- type: EVarType.object;
198
199
  properties: T;
199
200
  static: StaticObject<T>;
201
+ type: EVarType.object;
200
202
  }
201
203
 
202
204
  declare type TProperties = Record<string, TSchema>;
203
205
 
204
206
  declare interface TRecord<TKey extends TString | TNumber = TString, TValue extends TSchema = TSchema> {
205
- type: EVarType.record;
206
207
  key: TKey;
207
208
  static: StaticRecord<TKey, TValue>;
209
+ type: EVarType.record;
208
210
  value: TValue;
209
211
  }
210
212
 
211
213
  declare type TSchema<TLogic extends TAnyLogic = TAnyLogic> = TArguments & TLogic;
212
214
 
213
215
  declare interface TString {
214
- type: EVarType.string;
215
216
  static: string;
217
+ type: EVarType.string;
216
218
  }
217
219
 
218
220
  declare interface TType<T extends TSchema = TSchema> {
219
- type: EVarType.type;
220
221
  static: T;
221
222
  target: Array<string>;
223
+ type: EVarType.type;
222
224
  }
223
225
 
224
226
  declare interface TUndefined {
225
- type: EVarType.undefined;
226
227
  static: undefined;
228
+ type: EVarType.undefined;
227
229
  }
228
230
 
229
231
  declare interface TUnion<T extends Array<TSchema> = Array<TSchema>> {
230
- type: EVarType.union;
231
232
  elements: T;
232
233
  static: StaticUnion<T>;
234
+ type: EVarType.union;
233
235
  }
234
236
 
235
237
  declare interface TUnknown {
236
- type: EVarType.unknown;
237
238
  static: unknown;
239
+ type: EVarType.unknown;
238
240
  }
239
241
 
240
242
  declare interface TVoid {
241
- type: EVarType.void;
242
243
  static: void;
244
+ type: EVarType.void;
243
245
  }
244
246
 
245
247
  export { }