ballerina-core 1.0.18 → 1.0.20

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ballerina-core",
3
3
  "author": "Dr. Giuseppe Maggiore",
4
4
  "private": false,
5
- "version": "1.0.18",
5
+ "version": "1.0.20",
6
6
  "main": "main.ts",
7
7
  "dependencies": {
8
8
  "immutable": "^5.0.0-beta.5",
@@ -4,10 +4,11 @@ import { simpleUpdater } from "../../../../../../main";
4
4
  export type CollectionReference = {
5
5
  id: string;
6
6
  displayName: string;
7
+ source?:"enum"|"stream"
7
8
  };
8
9
  export const CollectionReference = {
9
- Default: Object.assign((id: string, displayName: string): CollectionReference => ({
10
- id, displayName
10
+ Default: Object.assign((id: string, displayName: string, source?:"enum"|"stream"): CollectionReference => ({
11
+ id, displayName, source
11
12
  }), {
12
13
  empty: (): CollectionReference => CollectionReference.Default("", "")
13
14
  }),
@@ -176,7 +176,8 @@ export const toAPIRawValue = (t:Type, types:Map<TypeName, TypeDefinition>, built
176
176
  let result = converters["MultiSelection"].toAPIRawValue(raw)
177
177
  // alert(`MultiSelect result1 = ${JSON.stringify(result)}`)
178
178
  // alert(`${JSON.stringify(t.args[0])}`)
179
- result = result.map(toAPIRawValue({ kind:"lookup", name:t.args[0] }, types, builtIns, converters))
179
+ result = result.map((_:any) =>
180
+ typeof _ == "object" ? toAPIRawValue({ kind:"lookup", name:t.args[0] }, types, builtIns, converters)(_) : _)
180
181
  // alert(`MultiSelect result2 = ${JSON.stringify(result)}`)
181
182
  return result
182
183
  }
@@ -24,7 +24,7 @@ const parseOptions = (leafPredicates: any, options: any) => {
24
24
  };
25
25
 
26
26
  export const FieldView = //<Context, FieldViews extends DefaultFieldViews, EnumFieldConfigs extends {}, EnumSources extends {}>() => <ViewType extends keyof FieldViews, ViewName extends keyof FieldViews[ViewType]>
27
- (fieldViews: any, viewType: any, viewName: any, fieldName: string, label: string, enumFieldConfigs: any, enumSources: any, leafPredicates: any): any => // FieldView<Context, FieldViews, ViewType, ViewName> =>
27
+ (fieldViews: any, viewType: any, viewName: any, fieldName: string, label: string, enumFieldConfigs: EnumOptionsSources, enumSources: any, leafPredicates: any): any => // FieldView<Context, FieldViews, ViewType, ViewName> =>
28
28
  {
29
29
  if (viewType == "maybeBoolean")
30
30
  return MaybeBooleanForm<any & FormLabel, Unit>(_ => PromiseRepo.Default.mock(() => []))
@@ -50,13 +50,13 @@ export const FieldView = //<Context, FieldViews extends DefaultFieldViews, EnumF
50
50
  return EnumForm<any & FormLabel & BaseEnumContext<any, CollectionReference>, Unit, CollectionReference>(_ => PromiseRepo.Default.mock(() => []))
51
51
  .withView(((fieldViews as any)[viewType] as any)[viewName]() as any)
52
52
  .mapContext<any & EnumFormState<any & BaseEnumContext<any, CollectionReference>, CollectionReference> & Value<CollectionSelection<CollectionReference>>>(_ => ({
53
- ..._, label: label, getOptions: () => ((enumFieldConfigs as any)((enumSources as any)[fieldName]) as Promise<any>).then(options => parseOptions(leafPredicates, options))
53
+ ..._, label: label, getOptions: () => ((enumFieldConfigs as any)(((enumSources as any)[fieldName]))() as Promise<any>).then(options => parseOptions(leafPredicates, options))
54
54
  })) as any
55
55
  if (viewType == "enumMultiSelection")
56
56
  return EnumMultiselectForm<any & FormLabel & BaseEnumContext<any, CollectionReference>, Unit, CollectionReference>(_ => PromiseRepo.Default.mock(() => []))
57
57
  .withView(((fieldViews as any)[viewType] as any)[viewName]() as any)
58
58
  .mapContext<any & EnumFormState<any & BaseEnumContext<any, CollectionReference>, CollectionReference> & Value<OrderedMap<Guid, CollectionReference>>>(_ => ({
59
- ..._, label: label, getOptions: () => ((enumFieldConfigs as any)((enumSources as any)[fieldName]) as Promise<any>).then(options => parseOptions(leafPredicates, options))
59
+ ..._, label: label, getOptions: () => ((enumFieldConfigs as any)(((enumSources as any)[fieldName]))() as Promise<any>).then(options => parseOptions(leafPredicates, options))
60
60
  })) as any
61
61
  if (viewType == "streamSingleSelection")
62
62
  return SearchableInfiniteStreamForm<CollectionReference, any & FormLabel, Unit>(_ => PromiseRepo.Default.mock(() => []))
@@ -108,7 +108,7 @@ export const ParseForm = (
108
108
  fieldsInfiniteStreamsConfig: any,
109
109
  fieldsOptionsConfig: any,
110
110
  InfiniteStreamSources: any,
111
- EnumOptionsSources: any,
111
+ EnumOptionsSources: EnumOptionsSources,
112
112
  leafPredicates: any,
113
113
  visibleFieldsBoolExprs: any,
114
114
  disabledFieldsBoolExprs: any,
@@ -274,7 +274,7 @@ export type EntityApis = {
274
274
  export type EnumName = string
275
275
 
276
276
 
277
- export type EnumOptionsSources = BasicFun<EnumName, Promise<Array<[CollectionReference, BoolExpr<Unit>]>>>
277
+ export type EnumOptionsSources = BasicFun<EnumName, BasicFun<Unit,Promise<Array<[CollectionReference, BoolExpr<Unit>]>>>>
278
278
  export const parseForms =
279
279
  <LeafPredicates,>(
280
280
  builtIns: BuiltIns,