@snowtop/ent 0.1.0-alpha10 → 0.1.0-alpha101

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.
Files changed (158) hide show
  1. package/action/action.d.ts +37 -31
  2. package/action/action.js +22 -7
  3. package/action/executor.d.ts +3 -3
  4. package/action/executor.js +8 -3
  5. package/action/experimental_action.d.ts +32 -22
  6. package/action/experimental_action.js +35 -9
  7. package/action/index.d.ts +2 -0
  8. package/action/index.js +7 -1
  9. package/action/orchestrator.d.ts +40 -16
  10. package/action/orchestrator.js +230 -62
  11. package/action/privacy.d.ts +2 -2
  12. package/action/relative_value.d.ts +47 -0
  13. package/action/relative_value.js +125 -0
  14. package/action/transaction.d.ts +10 -0
  15. package/action/transaction.js +23 -0
  16. package/auth/auth.d.ts +1 -1
  17. package/core/base.d.ts +49 -26
  18. package/core/base.js +7 -1
  19. package/core/clause.d.ts +88 -7
  20. package/core/clause.js +355 -63
  21. package/core/config.d.ts +12 -1
  22. package/core/config.js +7 -1
  23. package/core/context.d.ts +5 -3
  24. package/core/context.js +20 -2
  25. package/core/convert.d.ts +1 -1
  26. package/core/date.js +1 -5
  27. package/core/db.d.ts +11 -8
  28. package/core/db.js +20 -8
  29. package/core/ent.d.ts +81 -25
  30. package/core/ent.js +636 -193
  31. package/core/loaders/assoc_count_loader.d.ts +3 -2
  32. package/core/loaders/assoc_count_loader.js +10 -2
  33. package/core/loaders/assoc_edge_loader.d.ts +2 -2
  34. package/core/loaders/assoc_edge_loader.js +8 -11
  35. package/core/loaders/index.d.ts +1 -1
  36. package/core/loaders/index.js +1 -3
  37. package/core/loaders/index_loader.d.ts +2 -2
  38. package/core/loaders/loader.js +5 -5
  39. package/core/loaders/object_loader.d.ts +6 -5
  40. package/core/loaders/object_loader.js +67 -59
  41. package/core/loaders/query_loader.d.ts +6 -12
  42. package/core/loaders/query_loader.js +52 -11
  43. package/core/loaders/raw_count_loader.d.ts +2 -2
  44. package/core/loaders/raw_count_loader.js +5 -1
  45. package/core/logger.d.ts +1 -1
  46. package/core/logger.js +1 -0
  47. package/core/privacy.d.ts +25 -24
  48. package/core/privacy.js +21 -25
  49. package/core/query/assoc_query.d.ts +7 -6
  50. package/core/query/assoc_query.js +9 -1
  51. package/core/query/custom_clause_query.d.ts +26 -0
  52. package/core/query/custom_clause_query.js +78 -0
  53. package/core/query/custom_query.d.ts +20 -5
  54. package/core/query/custom_query.js +87 -12
  55. package/core/query/index.d.ts +1 -0
  56. package/core/query/index.js +3 -1
  57. package/core/query/query.d.ts +8 -4
  58. package/core/query/query.js +101 -53
  59. package/core/query/shared_assoc_test.d.ts +2 -1
  60. package/core/query/shared_assoc_test.js +35 -45
  61. package/core/query/shared_test.d.ts +8 -1
  62. package/core/query/shared_test.js +469 -236
  63. package/core/viewer.d.ts +3 -3
  64. package/core/viewer.js +1 -1
  65. package/graphql/graphql.d.ts +14 -7
  66. package/graphql/graphql.js +23 -7
  67. package/graphql/index.d.ts +0 -1
  68. package/graphql/index.js +1 -4
  69. package/graphql/query/connection_type.d.ts +9 -9
  70. package/graphql/query/edge_connection.d.ts +9 -9
  71. package/graphql/query/page_info.d.ts +1 -1
  72. package/graphql/query/shared_assoc_test.js +1 -1
  73. package/graphql/query/shared_edge_connection.js +1 -19
  74. package/imports/index.d.ts +6 -1
  75. package/imports/index.js +19 -4
  76. package/index.d.ts +12 -5
  77. package/index.js +20 -7
  78. package/package.json +17 -16
  79. package/parse_schema/parse.d.ts +29 -9
  80. package/parse_schema/parse.js +118 -11
  81. package/schema/base_schema.d.ts +5 -3
  82. package/schema/base_schema.js +5 -0
  83. package/schema/field.d.ts +74 -20
  84. package/schema/field.js +174 -69
  85. package/schema/index.d.ts +2 -2
  86. package/schema/index.js +5 -1
  87. package/schema/json_field.d.ts +13 -1
  88. package/schema/json_field.js +28 -1
  89. package/schema/schema.d.ts +81 -18
  90. package/schema/schema.js +24 -17
  91. package/schema/struct_field.d.ts +11 -1
  92. package/schema/struct_field.js +57 -21
  93. package/scripts/custom_compiler.js +10 -6
  94. package/scripts/custom_graphql.js +117 -30
  95. package/scripts/{transform_code.d.ts → migrate_v0.1.d.ts} +0 -0
  96. package/scripts/migrate_v0.1.js +36 -0
  97. package/scripts/{transform_schema.d.ts → move_types.d.ts} +0 -0
  98. package/scripts/move_types.js +117 -0
  99. package/scripts/read_schema.js +20 -5
  100. package/testutils/action/complex_schemas.d.ts +69 -0
  101. package/testutils/action/complex_schemas.js +398 -0
  102. package/testutils/builder.d.ts +46 -47
  103. package/testutils/builder.js +108 -65
  104. package/testutils/db/fixture.d.ts +10 -0
  105. package/testutils/db/fixture.js +26 -0
  106. package/testutils/db/{test_db.d.ts → temp_db.d.ts} +24 -8
  107. package/testutils/db/{test_db.js → temp_db.js} +179 -44
  108. package/testutils/db/value.d.ts +7 -0
  109. package/testutils/db/value.js +251 -0
  110. package/testutils/db_mock.d.ts +16 -4
  111. package/testutils/db_mock.js +51 -6
  112. package/testutils/db_time_zone.d.ts +4 -0
  113. package/testutils/db_time_zone.js +41 -0
  114. package/testutils/ent-graphql-tests/index.d.ts +7 -1
  115. package/testutils/ent-graphql-tests/index.js +27 -8
  116. package/testutils/fake_data/const.d.ts +2 -1
  117. package/testutils/fake_data/const.js +3 -0
  118. package/testutils/fake_data/fake_contact.d.ts +7 -3
  119. package/testutils/fake_data/fake_contact.js +15 -8
  120. package/testutils/fake_data/fake_event.d.ts +5 -2
  121. package/testutils/fake_data/fake_event.js +9 -7
  122. package/testutils/fake_data/fake_tag.d.ts +36 -0
  123. package/testutils/fake_data/fake_tag.js +89 -0
  124. package/testutils/fake_data/fake_user.d.ts +7 -4
  125. package/testutils/fake_data/fake_user.js +18 -16
  126. package/testutils/fake_data/index.js +5 -1
  127. package/testutils/fake_data/internal.d.ts +2 -0
  128. package/testutils/fake_data/internal.js +7 -1
  129. package/testutils/fake_data/tag_query.d.ts +13 -0
  130. package/testutils/fake_data/tag_query.js +43 -0
  131. package/testutils/fake_data/test_helpers.d.ts +11 -4
  132. package/testutils/fake_data/test_helpers.js +28 -12
  133. package/testutils/fake_data/user_query.d.ts +13 -6
  134. package/testutils/fake_data/user_query.js +54 -22
  135. package/testutils/fake_log.d.ts +3 -3
  136. package/testutils/parse_sql.d.ts +6 -0
  137. package/testutils/parse_sql.js +16 -2
  138. package/testutils/test_edge_global_schema.d.ts +15 -0
  139. package/testutils/test_edge_global_schema.js +62 -0
  140. package/testutils/write.d.ts +2 -2
  141. package/testutils/write.js +33 -7
  142. package/tsc/ast.d.ts +26 -2
  143. package/tsc/ast.js +163 -17
  144. package/tsc/compilerOptions.d.ts +2 -1
  145. package/tsc/compilerOptions.js +11 -2
  146. package/tsc/move_generated.d.ts +1 -0
  147. package/tsc/move_generated.js +164 -0
  148. package/tsc/transform.d.ts +22 -0
  149. package/tsc/transform.js +181 -0
  150. package/tsc/transform_action.d.ts +22 -0
  151. package/tsc/transform_action.js +183 -0
  152. package/tsc/transform_ent.d.ts +17 -0
  153. package/tsc/transform_ent.js +59 -0
  154. package/tsc/transform_schema.d.ts +27 -0
  155. package/{scripts → tsc}/transform_schema.js +145 -119
  156. package/graphql/enums.d.ts +0 -3
  157. package/graphql/enums.js +0 -25
  158. package/scripts/transform_code.js +0 -114
package/core/viewer.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ID, Ent, Viewer, Context } from "./base";
2
2
  export declare class LoggedOutViewer implements Viewer {
3
- context?: Context | undefined;
4
- constructor(context?: Context | undefined);
3
+ context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined;
4
+ constructor(context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined);
5
5
  viewerID: null;
6
6
  viewer(): Promise<null>;
7
7
  instanceKey(): string;
@@ -18,6 +18,6 @@ export declare class IDViewer implements Viewer {
18
18
  constructor(viewerID: ID, opts?: Partial<IDViewerOptions>);
19
19
  constructor(opts: IDViewerOptions);
20
20
  setContext(ctx: Context): this;
21
- viewer(): Promise<Ent | null>;
21
+ viewer(): Promise<Ent<Viewer<Ent<any> | null, ID | null>> | null>;
22
22
  instanceKey(): string;
23
23
  }
package/core/viewer.js CHANGED
@@ -35,7 +35,7 @@ class IDViewer {
35
35
  return this.ent;
36
36
  }
37
37
  instanceKey() {
38
- return `idViewer: ${this.viewerID}`;
38
+ return `idViewer:${this.viewerID}`;
39
39
  }
40
40
  }
41
41
  exports.IDViewer = IDViewer;
@@ -3,15 +3,20 @@ import { GraphQLScalarType } from "graphql";
3
3
  interface ClassType<T = any> {
4
4
  new (...args: any[]): T;
5
5
  }
6
+ declare type StringToStringMap = {
7
+ [key: string]: string;
8
+ };
6
9
  export interface CustomType {
7
10
  type: string;
8
11
  importPath: string;
9
12
  tsType?: string;
10
13
  tsImportPath?: string;
14
+ enumMap?: StringToStringMap;
15
+ inputType?: boolean;
11
16
  [x: string]: any;
12
17
  }
13
- declare type Type = GraphQLScalarType | ClassType | string | CustomType;
14
- export declare type GraphQLConnection<T> = {
18
+ type Type = GraphQLScalarType | ClassType | string | CustomType;
19
+ export type GraphQLConnection<T> = {
15
20
  node: T;
16
21
  };
17
22
  export interface gqlFieldOptions {
@@ -24,7 +29,7 @@ export interface gqlObjectOptions {
24
29
  name?: string;
25
30
  description?: string;
26
31
  }
27
- declare type gqlTopLevelOptions = Exclude<gqlFieldOptions, "nullable">;
32
+ type gqlTopLevelOptions = Exclude<gqlFieldOptions, "nullable">;
28
33
  export declare enum CustomFieldType {
29
34
  Accessor = "ACCESSOR",
30
35
  Field = "FIELD",
@@ -42,6 +47,8 @@ interface CustomFieldImpl {
42
47
  export interface CustomField extends CustomFieldImpl {
43
48
  args: Field[];
44
49
  results: Field[];
50
+ extraImports?: any[];
51
+ functionContents?: string;
45
52
  }
46
53
  export interface CustomMutation extends CustomField {
47
54
  }
@@ -51,15 +58,15 @@ export interface ProcessedCustomField extends CustomFieldImpl {
51
58
  args: ProcessedField[];
52
59
  results: ProcessedField[];
53
60
  }
54
- export declare type ProcessCustomFieldMap = {
55
- [key: string]: ProcessedCustomField;
61
+ export type ProcessCustomFieldMap = {
62
+ [key: string]: ProcessedCustomField[];
56
63
  };
57
64
  export interface CustomObject {
58
65
  nodeName: string;
59
66
  className: string;
60
67
  description?: string;
61
68
  }
62
- declare type NullableListOptions = "contents" | "contentsAndList";
69
+ type NullableListOptions = "contents" | "contentsAndList";
63
70
  interface FieldImpl {
64
71
  type: string;
65
72
  tsType?: string;
@@ -85,7 +92,7 @@ declare enum NullableResult {
85
92
  export declare const knownAllowedNames: Map<string, string>;
86
93
  export declare const knownDisAllowedNames: Map<string, boolean>;
87
94
  export declare const isCustomType: (type: Type) => type is CustomType;
88
- export declare const addCustomType: (type: CustomType) => void;
95
+ export declare const addCustomType: (type: CustomType, gqlCapture: typeof GQLCapture) => void;
89
96
  export declare class GQLCapture {
90
97
  private static enabled;
91
98
  static enable(enabled: boolean): void;
@@ -61,13 +61,15 @@ exports.isCustomType = isCustomType;
61
61
  const isGraphQLScalarType = (type) => {
62
62
  return type.serialize !== undefined;
63
63
  };
64
- const addCustomType = (type) => {
64
+ const addCustomType = (type, gqlCapture) => {
65
65
  // TODO these should return ReadOnly objects...
66
- const customType = GQLCapture.getCustomTypes().get(type.type);
67
- if (customType && customType !== type) {
68
- throw new Error(`cannot add multiple custom types of name ${type.type}`);
66
+ const customTypes = gqlCapture.getCustomTypes();
67
+ const customType = customTypes.get(type.type);
68
+ if (customType && customType === type) {
69
+ return;
69
70
  }
70
- if (customType) {
71
+ if (type.enumMap) {
72
+ customTypes.set(type.type, type);
71
73
  return;
72
74
  }
73
75
  try {
@@ -85,9 +87,21 @@ const addCustomType = (type) => {
85
87
  }
86
88
  }
87
89
  catch (e) {
90
+ if (type.secondaryImportPath) {
91
+ (0, exports.addCustomType)({
92
+ ...type,
93
+ importPath: type.secondaryImportPath,
94
+ }, gqlCapture);
95
+ }
96
+ return;
97
+ }
98
+ if (customType) {
99
+ if (JSON.stringify(customType) !== JSON.stringify(type)) {
100
+ throw new Error(`cannot add multiple custom types of name ${type.type}`);
101
+ }
88
102
  return;
89
103
  }
90
- GQLCapture.getCustomTypes().set(type.type, type);
104
+ customTypes.set(type.type, type);
91
105
  };
92
106
  exports.addCustomType = addCustomType;
93
107
  const getType = (typ, result) => {
@@ -111,7 +125,8 @@ const getType = (typ, result) => {
111
125
  }
112
126
  if ((0, exports.isCustomType)(typ)) {
113
127
  result.type = typ.type;
114
- (0, exports.addCustomType)(typ);
128
+ // TODO???
129
+ (0, exports.addCustomType)(typ, GQLCapture);
115
130
  return;
116
131
  }
117
132
  // GraphQLScalarType or ClassType
@@ -433,6 +448,7 @@ class GQLCapture {
433
448
  this.customInputObjects.forEach((_val, key) => baseArgs.set(key, true));
434
449
  baseArgs.set("Context", true);
435
450
  this.customTypes.forEach((_val, key) => baseArgs.set(key, true));
451
+ // TODO this should be aware of knownCustomTypes
436
452
  const resolveFields = (fields) => {
437
453
  fields.forEach((field) => {
438
454
  // we have a check earlier that *should* make this path impossible
@@ -7,5 +7,4 @@ export { GraphQLNodeInterface } from "./builtins/node";
7
7
  export { GraphQLConnectionInterface } from "./builtins/connection";
8
8
  export { GraphQLEdgeInterface } from "./builtins/edge";
9
9
  export { NodeResolver, EntNodeResolver, registerResolver, clearResolvers, resolveID, nodeIDEncoder, mustDecodeIDFromGQLID, mustDecodeNullableIDFromGQLID, encodeGQLID, } from "./node_resolver";
10
- export { convertFromGQLEnum, convertToGQLEnum } from "./enums";
11
10
  export { transformUnionTypes } from "./mutations/union";
package/graphql/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformUnionTypes = exports.convertToGQLEnum = exports.convertFromGQLEnum = exports.encodeGQLID = exports.mustDecodeNullableIDFromGQLID = exports.mustDecodeIDFromGQLID = exports.nodeIDEncoder = exports.resolveID = exports.clearResolvers = exports.registerResolver = exports.EntNodeResolver = exports.GraphQLEdgeInterface = exports.GraphQLConnectionInterface = exports.GraphQLNodeInterface = exports.GraphQLConnectionType = exports.GraphQLEdgeType = exports.GraphQLEdgeConnection = exports.GraphQLPageInfo = exports.GraphQLTime = exports.gqlFileUpload = exports.GQLCapture = exports.gqlConnection = exports.gqlContextType = exports.gqlMutation = exports.gqlQuery = exports.gqlObjectType = exports.gqlInputObjectType = exports.gqlArgType = exports.gqlArg = exports.gqlField = void 0;
3
+ exports.transformUnionTypes = exports.encodeGQLID = exports.mustDecodeNullableIDFromGQLID = exports.mustDecodeIDFromGQLID = exports.nodeIDEncoder = exports.resolveID = exports.clearResolvers = exports.registerResolver = exports.EntNodeResolver = exports.GraphQLEdgeInterface = exports.GraphQLConnectionInterface = exports.GraphQLNodeInterface = exports.GraphQLConnectionType = exports.GraphQLEdgeType = exports.GraphQLEdgeConnection = exports.GraphQLPageInfo = exports.GraphQLTime = exports.gqlFileUpload = exports.GQLCapture = exports.gqlConnection = exports.gqlContextType = exports.gqlMutation = exports.gqlQuery = exports.gqlObjectType = exports.gqlInputObjectType = exports.gqlArgType = exports.gqlArg = exports.gqlField = void 0;
4
4
  var graphql_1 = require("./graphql");
5
5
  Object.defineProperty(exports, "gqlField", { enumerable: true, get: function () { return graphql_1.gqlField; } });
6
6
  Object.defineProperty(exports, "gqlArg", { enumerable: true, get: function () { return graphql_1.gqlArg; } });
@@ -37,8 +37,5 @@ Object.defineProperty(exports, "nodeIDEncoder", { enumerable: true, get: functio
37
37
  Object.defineProperty(exports, "mustDecodeIDFromGQLID", { enumerable: true, get: function () { return node_resolver_1.mustDecodeIDFromGQLID; } });
38
38
  Object.defineProperty(exports, "mustDecodeNullableIDFromGQLID", { enumerable: true, get: function () { return node_resolver_1.mustDecodeNullableIDFromGQLID; } });
39
39
  Object.defineProperty(exports, "encodeGQLID", { enumerable: true, get: function () { return node_resolver_1.encodeGQLID; } });
40
- var enums_1 = require("./enums");
41
- Object.defineProperty(exports, "convertFromGQLEnum", { enumerable: true, get: function () { return enums_1.convertFromGQLEnum; } });
42
- Object.defineProperty(exports, "convertToGQLEnum", { enumerable: true, get: function () { return enums_1.convertToGQLEnum; } });
43
40
  var union_1 = require("./mutations/union");
44
41
  Object.defineProperty(exports, "transformUnionTypes", { enumerable: true, get: function () { return union_1.transformUnionTypes; } });
@@ -1,16 +1,16 @@
1
1
  import { GraphQLFieldConfigMap, GraphQLObjectType, GraphQLInterfaceType } from "graphql";
2
2
  import { RequestContext } from "../../core/context";
3
3
  import { GraphQLEdge } from "./edge_connection";
4
- import { Data } from "../../core/base";
5
- declare type nodeType = GraphQLObjectType | GraphQLInterfaceType;
6
- export declare class GraphQLEdgeType<TNode extends nodeType, TEdge extends Data> extends GraphQLObjectType {
7
- constructor(name: string, nodeType: TNode, optionalFields?: () => GraphQLFieldConfigMap<GraphQLEdge<TEdge>, RequestContext>);
4
+ import { Data, Viewer } from "../../core/base";
5
+ type nodeType = GraphQLObjectType | GraphQLInterfaceType;
6
+ export declare class GraphQLEdgeType<TNode extends nodeType, TEdge extends Data, TViewer extends Viewer> extends GraphQLObjectType {
7
+ constructor(name: string, nodeType: TNode, optionalFields?: () => GraphQLFieldConfigMap<GraphQLEdge<TEdge>, RequestContext<TViewer>>);
8
8
  }
9
- interface connectionOptions<T extends Data> {
10
- fields?(): GraphQLFieldConfigMap<GraphQLEdge<T>, RequestContext>;
9
+ interface connectionOptions<T extends Data, TViewer extends Viewer> {
10
+ fields?(): GraphQLFieldConfigMap<GraphQLEdge<T>, RequestContext<TViewer>>;
11
11
  }
12
- export declare class GraphQLConnectionType<TNode extends nodeType, TEdge extends Data> extends GraphQLObjectType {
13
- edgeType: GraphQLEdgeType<TNode, TEdge>;
14
- constructor(name: string, nodeType: TNode, options?: connectionOptions<TEdge>);
12
+ export declare class GraphQLConnectionType<TNode extends nodeType, TEdge extends Data, TViewer extends Viewer> extends GraphQLObjectType {
13
+ edgeType: GraphQLEdgeType<TNode, TEdge, TViewer>;
14
+ constructor(name: string, nodeType: TNode, options?: connectionOptions<TEdge, TViewer>);
15
15
  }
16
16
  export {};
@@ -1,30 +1,30 @@
1
1
  import { EdgeQuery, PaginationInfo } from "../../core/query/query";
2
- import { Data, Ent, Viewer } from "../../core/base";
2
+ import { Data, Ent, ID, Viewer } from "../../core/base";
3
3
  export interface GraphQLEdge<T extends Data> {
4
4
  edge: T;
5
5
  node: Ent;
6
6
  cursor: string;
7
7
  }
8
- interface edgeQueryCtr<T extends Ent, TEdge extends Data> {
9
- (v: Viewer, src: T): EdgeQuery<T, Ent, TEdge>;
8
+ interface edgeQueryCtr<T extends Ent, TEdge extends Data, TViewer extends Viewer> {
9
+ (v: TViewer, src: T): EdgeQuery<T, Ent, TEdge>;
10
10
  }
11
- interface edgeQueryCtr2<T extends Ent, TEdge extends Data> {
12
- (v: Viewer): EdgeQuery<T, Ent, TEdge>;
11
+ interface edgeQueryCtr2<T extends Ent, TEdge extends Data, TViewer extends Viewer> {
12
+ (v: TViewer): EdgeQuery<T, Ent, TEdge>;
13
13
  }
14
- export declare class GraphQLEdgeConnection<TSource extends Ent, TEdge extends Data> {
14
+ export declare class GraphQLEdgeConnection<TSource extends Ent, TEdge extends Data, TViewer extends Viewer = Viewer> {
15
15
  query: EdgeQuery<TSource, Ent, TEdge>;
16
16
  private results;
17
17
  private viewer;
18
18
  private source?;
19
19
  private args?;
20
- constructor(viewer: Viewer, source: TSource, getQuery: edgeQueryCtr<TSource, TEdge>, args?: Data);
21
- constructor(viewer: Viewer, getQuery: edgeQueryCtr2<TSource, TEdge>, args?: Data);
20
+ constructor(viewer: TViewer, source: TSource, getQuery: edgeQueryCtr<TSource, TEdge, TViewer>, args?: Data);
21
+ constructor(viewer: TViewer, getQuery: edgeQueryCtr2<TSource, TEdge, TViewer>, args?: Data);
22
22
  first(limit: number, cursor?: string): void;
23
23
  last(limit: number, cursor?: string): void;
24
24
  modifyQuery(fn: (query: EdgeQuery<TSource, Ent, TEdge>) => EdgeQuery<TSource, Ent, TEdge>): void;
25
25
  queryTotalCount(): Promise<number>;
26
26
  queryEdges(): Promise<GraphQLEdge<TEdge>[]>;
27
- queryNodes(): Promise<Ent[]>;
27
+ queryNodes(): Promise<Ent<Viewer<Ent<any> | null, ID | null>>[]>;
28
28
  private defaultPageInfo;
29
29
  queryPageInfo(): Promise<PaginationInfo>;
30
30
  private queryData;
@@ -1,4 +1,4 @@
1
1
  import { GraphQLObjectType } from "graphql";
2
2
  import { RequestContext } from "../../core/context";
3
3
  import { PaginationInfo } from "../../core/query/query";
4
- export declare const GraphQLPageInfo: GraphQLObjectType<PaginationInfo, RequestContext>;
4
+ export declare const GraphQLPageInfo: GraphQLObjectType<PaginationInfo, RequestContext<import("../..").Viewer<import("../..").Ent<any> | null, import("../..").ID | null>>>;
@@ -139,7 +139,7 @@ function sharedAssocTests() {
139
139
  const conn = new connection_type_1.GraphQLConnectionType("CustomEdge", eventType);
140
140
  const length = (m) => {
141
141
  let count = 0;
142
- for (let k in m) {
142
+ for (let _ in m) {
143
143
  count++;
144
144
  }
145
145
  return count;
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.commonTests = void 0;
4
- const pg_1 = require("pg");
5
4
  const viewer_1 = require("../../core/viewer");
6
5
  const ent_1 = require("../../core/ent");
7
- const db_mock_1 = require("../../testutils/db_mock");
8
6
  const edge_connection_1 = require("./edge_connection");
9
7
  const test_helpers_1 = require("../../testutils/fake_data/test_helpers");
10
- jest.mock("pg");
11
- db_mock_1.QueryRecorder.mockPool(pg_1.Pool);
12
8
  class TestConnection {
13
9
  constructor(getQuery, ents, filter) {
14
10
  this.getQuery = getQuery;
@@ -48,23 +44,9 @@ class TestConnection {
48
44
  }
49
45
  const commonTests = (opts) => {
50
46
  function getCursorFrom(contacts, idx) {
51
- // we depend on the fact that the same time is used for the edge and created_at
52
- // based on getContactBuilder
53
- // so regardless of if we're doing assoc or custom queries, we can get the time
54
- // from the created_at field
55
47
  return (0, ent_1.getCursor)({
56
48
  row: contacts[idx],
57
- col: "createdAt",
58
- conv: (t) => {
59
- //sqlite
60
- if (typeof t === "string") {
61
- return Date.parse(t);
62
- }
63
- return t.getTime();
64
- },
65
- // we want the right column to be encoded in the cursor as opposed e.g. time for
66
- // assoc queries, created_at for index/custom queries
67
- cursorKey: opts.sortCol,
49
+ col: "id",
68
50
  });
69
51
  }
70
52
  describe("no filters", () => {
@@ -1,5 +1,6 @@
1
1
  export interface Options {
2
2
  filter?: (file: string, index: number, array: string[]) => boolean;
3
+ justCurrentDir?: boolean;
3
4
  ignore?: string | Readonly<string[]> | undefined;
4
5
  }
5
6
  export interface PathResult {
@@ -10,7 +11,11 @@ interface classResult {
10
11
  class: classInfo;
11
12
  file: file;
12
13
  }
13
- export declare function parseCustomImports(filePath: string, opts?: Options): PathResult;
14
+ interface ParseInput {
15
+ root: string;
16
+ opts?: Options;
17
+ }
18
+ export declare function parseCustomImports(filePath: string, inputs: ParseInput[]): PathResult;
14
19
  export interface importInfo {
15
20
  name: string;
16
21
  importPath: string;
package/imports/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -34,7 +38,11 @@ function getFiles(filePath, opts) {
34
38
  }
35
39
  // graphql path should be passed to this
36
40
  // this is more agnostic about what it expect here
37
- let files = glob_1.default.sync(`${filePath}/**/*.ts`, {
41
+ let pattern = `${filePath}/**/*.ts`;
42
+ if (opts?.justCurrentDir) {
43
+ pattern = `${filePath}/**.ts`;
44
+ }
45
+ let files = glob_1.default.sync(pattern, {
38
46
  ignore: opts?.ignore,
39
47
  });
40
48
  if (opts?.filter) {
@@ -42,8 +50,15 @@ function getFiles(filePath, opts) {
42
50
  }
43
51
  return files;
44
52
  }
45
- function parseCustomImports(filePath, opts) {
46
- const files = getFiles(filePath, opts);
53
+ function parseCustomImports(filePath, inputs) {
54
+ const files = [];
55
+ // simplifies tests and other simple callsites
56
+ if (inputs.length === 0) {
57
+ inputs.push({ root: filePath });
58
+ }
59
+ for (const input of inputs) {
60
+ files.push(...getFiles(input.root, input.opts));
61
+ }
47
62
  const options = (0, compilerOptions_1.readCompilerOptions)(filePath);
48
63
  let classMap = new Map();
49
64
  files.forEach((file) => {
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./core/base";
2
- export { loadEnt, loadCustomData, loadCustomEnts, loadEntX, loadEnts, CustomQuery, loadDerivedEnt, loadDerivedEntX, loadEntViaKey, loadEntXViaKey, performRawQuery, loadRowX, loadRow, loadRows, DataOperation, EditNodeOptions, EditNodeOperation, EdgeOperation, DeleteNodeOperation, AssocEdge, AssocEdgeInputOptions, AssocEdgeInput, AssocEdgeData, loadEdgeData, loadEdgeDatas, loadEdges, loadUniqueEdge, loadUniqueNode, loadRawEdgeCountX, loadEdgeForID2, loadNodesByEdge, getEdgeTypeInGroup, } from "./core/ent";
2
+ export { loadEnt, loadCustomData, loadCustomEnts, loadCustomCount, loadEntX, loadEnts, CustomQuery, loadDerivedEnt, loadDerivedEntX, loadEntViaKey, loadEntXViaKey, performRawQuery, loadRowX, loadRow, loadRows, DataOperation, EditNodeOptions, EditNodeOperation, RawQueryOperation, EdgeOperation, DeleteNodeOperation, AssocEdge, AssocEdgeInputOptions, AssocEdgeInput, AssocEdgeData, loadEdgeData, loadEdgeDatas, loadEdges, loadUniqueEdge, loadUniqueNode, loadRawEdgeCountX, loadEdgeForID2, loadNodesByEdge, getEdgeTypeInGroup, setGlobalSchema, } from "./core/ent";
3
3
  import DB from "./core/db";
4
4
  export * from "./core/loaders";
5
5
  export { DB };
@@ -7,12 +7,14 @@ export { EntPrivacyError, AlwaysAllowRule, AlwaysDenyRule, DenyIfLoggedInRule, D
7
7
  export * from "./core/query";
8
8
  export * from "./schema/";
9
9
  import * as q from "./core/clause";
10
+ export { Clause } from "./core/clause";
10
11
  declare const query: {
11
12
  Eq: typeof q.Eq;
12
13
  NotEq: typeof q.NotEq;
13
14
  And: typeof q.And;
14
15
  AndOptional: typeof q.AndOptional;
15
16
  Or: typeof q.Or;
17
+ OrOptional: typeof q.OrOptional;
16
18
  In: typeof q.In;
17
19
  Greater: typeof q.Greater;
18
20
  Less: typeof q.Less;
@@ -20,10 +22,15 @@ declare const query: {
20
22
  LessEq: typeof q.LessEq;
21
23
  ArrayEq: typeof q.ArrayEq;
22
24
  ArrayNotEq: typeof q.ArrayNotEq;
23
- ArrayGreater: typeof q.ArrayGreater;
24
- ArrayLess: typeof q.ArrayLess;
25
- ArrayGreaterEq: typeof q.ArrayGreaterEq;
26
- ArrayLessEq: typeof q.ArrayLessEq;
25
+ PostgresArrayContainsValue: typeof q.PostgresArrayContainsValue;
26
+ PostgresArrayContains: typeof q.PostgresArrayContains;
27
+ PostgresArrayNotContainsValue: typeof q.PostgresArrayNotContainsValue;
28
+ PostgresArrayNotContains: typeof q.PostgresArrayNotContains;
29
+ PostgresArrayOverlaps: typeof q.PostgresArrayOverlaps;
30
+ PostgresArrayNotOverlaps: typeof q.PostgresArrayNotOverlaps;
31
+ JSONPathValuePredicate: typeof q.JSONPathValuePredicate;
32
+ JSONObjectFieldKeyASJSON: typeof q.JSONObjectFieldKeyASJSON;
33
+ JSONObjectFieldKeyAsText: typeof q.JSONObjectFieldKeyAsText;
27
34
  TsQuery: typeof q.TsQuery;
28
35
  PlainToTsQuery: typeof q.PlainToTsQuery;
29
36
  PhraseToTsQuery: typeof q.PhraseToTsQuery;
package/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -25,13 +29,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
30
  };
27
31
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.DenyIfViewerInboundEdgeDoesNotExistRule = exports.DenyIfEdgeDoesNotExistRule = exports.DenyIfViewerOutboundEdgeExistsRule = exports.DenyIfViewerInboundEdgeExistsRule = exports.DenyIfEdgeExistsRule = exports.AllowIfViewerOutboundEdgeExistsRule = exports.AllowIfViewerInboundEdgeExistsRule = exports.AllowIfEdgeExistsRule = exports.DenyIfViewerEqualsRule = exports.AllowIfViewerEqualsRule = exports.DenyIfEntPropertyIsRule = exports.AllowIfEntPropertyIsRule = exports.AllowIfViewerIsEntPropertyRule = exports.AllowIfViewerIsRule = exports.AllowIfFuncRule = exports.AllowIfViewerRule = exports.AllowIfHasIdentity = exports.DenyIfLoggedOutRule = exports.DenyIfLoggedInRule = exports.AlwaysDenyRule = exports.AlwaysAllowRule = exports.EntPrivacyError = exports.DB = exports.getEdgeTypeInGroup = exports.loadNodesByEdge = exports.loadEdgeForID2 = exports.loadRawEdgeCountX = exports.loadUniqueNode = exports.loadUniqueEdge = exports.loadEdges = exports.loadEdgeDatas = exports.loadEdgeData = exports.AssocEdgeData = exports.AssocEdge = exports.DeleteNodeOperation = exports.EdgeOperation = exports.EditNodeOperation = exports.loadRows = exports.loadRow = exports.loadRowX = exports.performRawQuery = exports.loadEntXViaKey = exports.loadEntViaKey = exports.loadDerivedEntX = exports.loadDerivedEnt = exports.loadEnts = exports.loadEntX = exports.loadCustomEnts = exports.loadCustomData = exports.loadEnt = void 0;
29
- exports.setLogLevels = exports.loadConfig = exports.LoggedOutViewer = exports.IDViewer = exports.ContextCache = exports.query = exports.AllowIfViewerHasIdentityPrivacyPolicy = exports.AllowIfViewerPrivacyPolicy = exports.AllowIfSubPolicyAllowsRule = exports.AllowIfConditionAppliesRule = exports.AlwaysDenyPrivacyPolicy = exports.AlwaysAllowPrivacyPolicy = exports.applyPrivacyPolicyX = exports.applyPrivacyPolicy = exports.DelayedResultRule = exports.DenyIfEntIsVisiblePolicy = exports.AllowIfEntIsVisiblePolicy = exports.DenyIfEntIsNotVisibleRule = exports.DenyIfEntIsVisibleRule = exports.AllowIfEntIsNotVisibleRule = exports.AllowIfEntIsVisibleRule = exports.DenyIfViewerOutboundEdgeDoesNotExistRule = void 0;
32
+ exports.DenyIfViewerInboundEdgeExistsRule = exports.DenyIfEdgeExistsRule = exports.AllowIfViewerOutboundEdgeExistsRule = exports.AllowIfViewerInboundEdgeExistsRule = exports.AllowIfEdgeExistsRule = exports.DenyIfViewerEqualsRule = exports.AllowIfViewerEqualsRule = exports.DenyIfEntPropertyIsRule = exports.AllowIfEntPropertyIsRule = exports.AllowIfViewerIsEntPropertyRule = exports.AllowIfViewerIsRule = exports.AllowIfFuncRule = exports.AllowIfViewerRule = exports.AllowIfHasIdentity = exports.DenyIfLoggedOutRule = exports.DenyIfLoggedInRule = exports.AlwaysDenyRule = exports.AlwaysAllowRule = exports.EntPrivacyError = exports.DB = exports.setGlobalSchema = exports.getEdgeTypeInGroup = exports.loadNodesByEdge = exports.loadEdgeForID2 = exports.loadRawEdgeCountX = exports.loadUniqueNode = exports.loadUniqueEdge = exports.loadEdges = exports.loadEdgeDatas = exports.loadEdgeData = exports.AssocEdgeData = exports.AssocEdge = exports.DeleteNodeOperation = exports.EdgeOperation = exports.RawQueryOperation = exports.EditNodeOperation = exports.loadRows = exports.loadRow = exports.loadRowX = exports.performRawQuery = exports.loadEntXViaKey = exports.loadEntViaKey = exports.loadDerivedEntX = exports.loadDerivedEnt = exports.loadEnts = exports.loadEntX = exports.loadCustomCount = exports.loadCustomEnts = exports.loadCustomData = exports.loadEnt = void 0;
33
+ exports.setLogLevels = exports.loadConfig = exports.LoggedOutViewer = exports.IDViewer = exports.ContextCache = exports.query = exports.AllowIfViewerHasIdentityPrivacyPolicy = exports.AllowIfViewerPrivacyPolicy = exports.AllowIfSubPolicyAllowsRule = exports.AllowIfConditionAppliesRule = exports.AlwaysDenyPrivacyPolicy = exports.AlwaysAllowPrivacyPolicy = exports.applyPrivacyPolicyX = exports.applyPrivacyPolicy = exports.DelayedResultRule = exports.DenyIfEntIsVisiblePolicy = exports.AllowIfEntIsVisiblePolicy = exports.DenyIfEntIsNotVisibleRule = exports.DenyIfEntIsVisibleRule = exports.AllowIfEntIsNotVisibleRule = exports.AllowIfEntIsVisibleRule = exports.DenyIfViewerOutboundEdgeDoesNotExistRule = exports.DenyIfViewerInboundEdgeDoesNotExistRule = exports.DenyIfEdgeDoesNotExistRule = exports.DenyIfViewerOutboundEdgeExistsRule = void 0;
30
34
  __exportStar(require("./core/base"), exports);
31
35
  var ent_1 = require("./core/ent");
32
36
  Object.defineProperty(exports, "loadEnt", { enumerable: true, get: function () { return ent_1.loadEnt; } });
33
37
  Object.defineProperty(exports, "loadCustomData", { enumerable: true, get: function () { return ent_1.loadCustomData; } });
34
38
  Object.defineProperty(exports, "loadCustomEnts", { enumerable: true, get: function () { return ent_1.loadCustomEnts; } });
39
+ Object.defineProperty(exports, "loadCustomCount", { enumerable: true, get: function () { return ent_1.loadCustomCount; } });
35
40
  Object.defineProperty(exports, "loadEntX", { enumerable: true, get: function () { return ent_1.loadEntX; } });
36
41
  Object.defineProperty(exports, "loadEnts", { enumerable: true, get: function () { return ent_1.loadEnts; } });
37
42
  Object.defineProperty(exports, "loadDerivedEnt", { enumerable: true, get: function () { return ent_1.loadDerivedEnt; } });
@@ -44,6 +49,7 @@ Object.defineProperty(exports, "loadRowX", { enumerable: true, get: function ()
44
49
  Object.defineProperty(exports, "loadRow", { enumerable: true, get: function () { return ent_1.loadRow; } });
45
50
  Object.defineProperty(exports, "loadRows", { enumerable: true, get: function () { return ent_1.loadRows; } });
46
51
  Object.defineProperty(exports, "EditNodeOperation", { enumerable: true, get: function () { return ent_1.EditNodeOperation; } });
52
+ Object.defineProperty(exports, "RawQueryOperation", { enumerable: true, get: function () { return ent_1.RawQueryOperation; } });
47
53
  Object.defineProperty(exports, "EdgeOperation", { enumerable: true, get: function () { return ent_1.EdgeOperation; } });
48
54
  Object.defineProperty(exports, "DeleteNodeOperation", { enumerable: true, get: function () { return ent_1.DeleteNodeOperation; } });
49
55
  Object.defineProperty(exports, "AssocEdge", { enumerable: true, get: function () { return ent_1.AssocEdge; } });
@@ -57,6 +63,7 @@ Object.defineProperty(exports, "loadRawEdgeCountX", { enumerable: true, get: fun
57
63
  Object.defineProperty(exports, "loadEdgeForID2", { enumerable: true, get: function () { return ent_1.loadEdgeForID2; } });
58
64
  Object.defineProperty(exports, "loadNodesByEdge", { enumerable: true, get: function () { return ent_1.loadNodesByEdge; } });
59
65
  Object.defineProperty(exports, "getEdgeTypeInGroup", { enumerable: true, get: function () { return ent_1.getEdgeTypeInGroup; } });
66
+ Object.defineProperty(exports, "setGlobalSchema", { enumerable: true, get: function () { return ent_1.setGlobalSchema; } });
60
67
  const db_1 = __importDefault(require("./core/db"));
61
68
  exports.DB = db_1.default;
62
69
  __exportStar(require("./core/loaders"), exports);
@@ -109,6 +116,7 @@ const query = {
109
116
  And: q.And,
110
117
  AndOptional: q.AndOptional,
111
118
  Or: q.Or,
119
+ OrOptional: q.OrOptional,
112
120
  In: q.In,
113
121
  Greater: q.Greater,
114
122
  Less: q.Less,
@@ -116,10 +124,15 @@ const query = {
116
124
  LessEq: q.LessEq,
117
125
  ArrayEq: q.ArrayEq,
118
126
  ArrayNotEq: q.ArrayNotEq,
119
- ArrayGreater: q.ArrayGreater,
120
- ArrayLess: q.ArrayLess,
121
- ArrayGreaterEq: q.ArrayGreaterEq,
122
- ArrayLessEq: q.ArrayLessEq,
127
+ PostgresArrayContainsValue: q.PostgresArrayContainsValue,
128
+ PostgresArrayContains: q.PostgresArrayContains,
129
+ PostgresArrayNotContainsValue: q.PostgresArrayNotContainsValue,
130
+ PostgresArrayNotContains: q.PostgresArrayNotContains,
131
+ PostgresArrayOverlaps: q.PostgresArrayOverlaps,
132
+ PostgresArrayNotOverlaps: q.PostgresArrayNotOverlaps,
133
+ JSONPathValuePredicate: q.JSONPathValuePredicate,
134
+ JSONObjectFieldKeyASJSON: q.JSONObjectFieldKeyASJSON,
135
+ JSONObjectFieldKeyAsText: q.JSONObjectFieldKeyAsText,
123
136
  TsQuery: q.TsQuery,
124
137
  PlainToTsQuery: q.PlainToTsQuery,
125
138
  PhraseToTsQuery: q.PhraseToTsQuery,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha10",
3
+ "version": "0.1.0-alpha101",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -8,26 +8,27 @@
8
8
  "example": "examples"
9
9
  },
10
10
  "dependencies": {
11
- "@types/node": "^15.0.2",
11
+ "@types/node": "^18.11.18",
12
12
  "camel-case": "^4.1.2",
13
- "dataloader": "^2.0.0",
14
- "glob": "^7.1.6",
15
- "graph-data-structure": "^1.12.0",
13
+ "cosmiconfig": "^8.0.0",
14
+ "dataloader": "^2.1.0",
15
+ "glob": "^8.0.3",
16
+ "graph-data-structure": "^2.0.0",
16
17
  "js-yaml": "^4.1.0",
17
- "json5": "^2.1.3",
18
- "luxon": "^1.25.0",
18
+ "json5": "^2.2.2",
19
+ "luxon": "^3.1.1",
19
20
  "memoizee": "^0.4.15",
20
- "minimist": "^1.2.6",
21
+ "minimist": "^1.2.7",
21
22
  "pascal-case": "^3.1.2",
22
- "pg": "^8.0.3",
23
- "prettier": "^2.3.2",
23
+ "pg": "^8.8.0",
24
+ "prettier": "^2.8.1",
24
25
  "reflect-metadata": "^0.1.13",
25
- "snake-case": "^3.0.3",
26
- "ts-node": "^10.2.1",
27
- "tsconfig-paths": "^3.11.0",
28
- "tslib": "^2.3.1",
29
- "typescript": "^4.4.2",
30
- "uuid": "^8.3.2"
26
+ "snake-case": "^3.0.4",
27
+ "ts-node": "^10.9.1",
28
+ "tsconfig-paths": "^4.1.1",
29
+ "tslib": "^2.4.1",
30
+ "typescript": "^4.9.4",
31
+ "uuid": "^9.0.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "better-sqlite3": "^7.4.1",
@@ -1,14 +1,14 @@
1
1
  import { Schema, Field, AssocEdge, AssocEdgeGroup, Action } from "../schema";
2
- import { ActionField, Type } from "../schema/schema";
2
+ import { ActionField, Type, GlobalSchema } from "../schema/schema";
3
3
  declare enum NullableResult {
4
4
  CONTENTS = "contents",
5
5
  CONTENTS_AND_LIST = "contentsAndList",
6
6
  ITEM = "true"
7
7
  }
8
- declare type ProcessedActionField = Omit<ActionField, "nullable"> & {
8
+ type ProcessedActionField = Omit<ActionField, "nullable"> & {
9
9
  nullable?: NullableResult;
10
10
  };
11
- declare type ProcessedAssocEdge = Omit<AssocEdge, "actionOnlyFields" | "edgeActions"> & {
11
+ type ProcessedAssocEdge = Omit<AssocEdge, "actionOnlyFields" | "edgeActions"> & {
12
12
  patternName?: string;
13
13
  edgeActions?: OutputAction[];
14
14
  };
@@ -18,17 +18,18 @@ interface TransformFlags {
18
18
  transformsInsert?: boolean;
19
19
  transformsUpdate?: boolean;
20
20
  }
21
- declare type ProcessedSchema = Omit<Schema, "edges" | "actions" | "edgeGroups" | "fields"> & TransformFlags & {
21
+ type ProcessedSchema = Omit<Schema, "edges" | "actions" | "edgeGroups" | "fields"> & TransformFlags & {
22
22
  actions: OutputAction[];
23
23
  assocEdges: ProcessedAssocEdge[];
24
24
  assocEdgeGroups: ProcessedAssocEdgeGroup[];
25
25
  fields: ProcessedField[];
26
26
  schemaPath?: string;
27
+ patternNames?: string[];
27
28
  };
28
- declare type ProcessedAssocEdgeGroup = Omit<AssocEdgeGroup, "edgeAction"> & {
29
+ type ProcessedAssocEdgeGroup = Omit<AssocEdgeGroup, "edgeAction"> & {
29
30
  edgeAction?: OutputAction;
30
31
  };
31
- declare type OutputAction = Omit<Action, "actionOnlyFields"> & {
32
+ type OutputAction = Omit<Action, "actionOnlyFields"> & {
32
33
  actionOnlyFields?: ProcessedActionField[];
33
34
  };
34
35
  interface schemasDict {
@@ -38,13 +39,14 @@ interface ProcessedPattern {
38
39
  name: string;
39
40
  assocEdges: ProcessedAssocEdge[];
40
41
  fields: ProcessedField[];
42
+ disableMixin?: boolean;
41
43
  }
42
- declare type ProcessedType = Omit<Type, "subFields" | "listElemType" | "unionFields"> & {
44
+ type ProcessedType = Omit<Type, "subFields" | "listElemType" | "unionFields"> & {
43
45
  subFields?: ProcessedField[];
44
46
  listElemType?: ProcessedType;
45
47
  unionFields?: ProcessedField[];
46
48
  };
47
- declare type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOnCreate" | "privacyPolicy" | "type"> & {
49
+ type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOnCreate" | "privacyPolicy" | "type" | "serverDefault"> & {
48
50
  name: string;
49
51
  hasDefaultValueOnCreate?: boolean;
50
52
  hasDefaultValueOnEdit?: boolean;
@@ -52,6 +54,7 @@ declare type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOn
52
54
  hasFieldPrivacy?: boolean;
53
55
  derivedFields?: ProcessedField[];
54
56
  type: ProcessedType;
57
+ serverDefault?: string;
55
58
  };
56
59
  interface patternsDict {
57
60
  [key: string]: ProcessedPattern;
@@ -59,9 +62,26 @@ interface patternsDict {
59
62
  interface Result {
60
63
  schemas: schemasDict;
61
64
  patterns: patternsDict;
65
+ globalSchema?: ProcessedGlobalSchema;
66
+ config?: {
67
+ rome?: RomeConfig;
68
+ };
62
69
  }
63
70
  declare type PotentialSchemas = {
64
71
  [key: string]: any;
65
72
  };
66
- export declare function parseSchema(potentialSchemas: PotentialSchemas): Result;
73
+ export declare function parseSchema(potentialSchemas: PotentialSchemas, globalSchema?: GlobalSchema): Promise<Result>;
74
+ interface RomeConfig {
75
+ indentStyle?: string;
76
+ lineWidth?: number;
77
+ indentSize?: number;
78
+ quoteStyle?: string;
79
+ quoteProperties?: string;
80
+ trailingComma?: string;
81
+ }
82
+ interface ProcessedGlobalSchema {
83
+ globalEdges: ProcessedAssocEdge[];
84
+ extraEdgeFields: ProcessedField[];
85
+ initForEdges?: boolean;
86
+ }
67
87
  export {};