@snowtop/ent 0.0.32-alpha.3 → 0.0.32-alpha.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.0.32-alpha.3",
3
+ "version": "0.0.32-alpha.4",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/schema/field.js CHANGED
@@ -81,8 +81,9 @@ class UUIDField extends BaseField {
81
81
  ];
82
82
  }
83
83
  }
84
- if (options.fieldEdge?.enforceSchema && !options.fieldEdge.loadRowByType) {
85
- throw new Error(`cannot enforceSchema if loadRowByType wasn't passed in`);
84
+ if (options.fieldEdge?.enforceSchema &&
85
+ !options.fieldEdge.getLoaderOptions) {
86
+ throw new Error(`cannot enforceSchema if getLoaderOptions wasn't passed in`);
86
87
  }
87
88
  }
88
89
  isBuilder(val) {
@@ -92,8 +93,8 @@ class UUIDField extends BaseField {
92
93
  if (!this.options.fieldEdge?.enforceSchema) {
93
94
  return true;
94
95
  }
95
- const loadRowByType = this.options.fieldEdge.loadRowByType;
96
- const loadRowOptions = loadRowByType(this.options.fieldEdge.schema);
96
+ const getLoaderOptions = this.options.fieldEdge.getLoaderOptions;
97
+ const loadRowOptions = getLoaderOptions(this.options.fieldEdge.schema);
97
98
  if (this.isBuilder(val)) {
98
99
  // if builder, the ent type of the builder and the ent type returned by the load constructor should match
99
100
  return val.ent === loadRowOptions.ent;
@@ -102,7 +102,7 @@ export interface ForeignKey {
102
102
  disableIndex?: boolean;
103
103
  disableBuilderType?: boolean;
104
104
  }
105
- declare type loadRowFn = (type: string) => LoadEntOptions<Ent>;
105
+ declare type getLoaderOptionsFn = (type: any) => LoadEntOptions<Ent>;
106
106
  export interface InverseFieldEdge {
107
107
  name: string;
108
108
  edgeConstName?: string;
@@ -113,7 +113,7 @@ export interface FieldEdge {
113
113
  schema: string;
114
114
  inverseEdge?: string | InverseFieldEdge;
115
115
  enforceSchema?: boolean;
116
- loadRowByType?: loadRowFn;
116
+ getLoaderOptions?: getLoaderOptionsFn;
117
117
  disableBuilderType?: boolean;
118
118
  }
119
119
  export interface FieldOptions {