@snowtop/ent 0.1.0-alpha16 → 0.1.0-alpha160-test2

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 (176) hide show
  1. package/action/action.d.ts +25 -14
  2. package/action/action.js +22 -7
  3. package/action/executor.d.ts +16 -3
  4. package/action/executor.js +89 -28
  5. package/action/experimental_action.d.ts +25 -16
  6. package/action/experimental_action.js +34 -14
  7. package/action/index.d.ts +4 -1
  8. package/action/index.js +7 -1
  9. package/action/operations.d.ts +126 -0
  10. package/action/operations.js +686 -0
  11. package/action/orchestrator.d.ts +43 -12
  12. package/action/orchestrator.js +461 -101
  13. package/action/relative_value.d.ts +47 -0
  14. package/action/relative_value.js +125 -0
  15. package/action/transaction.d.ts +10 -0
  16. package/action/transaction.js +23 -0
  17. package/auth/auth.d.ts +1 -1
  18. package/core/base.d.ts +56 -23
  19. package/core/base.js +7 -1
  20. package/core/clause.d.ts +103 -39
  21. package/core/clause.js +430 -66
  22. package/core/config.d.ts +13 -3
  23. package/core/config.js +10 -1
  24. package/core/const.d.ts +3 -0
  25. package/core/const.js +6 -0
  26. package/core/context.d.ts +6 -3
  27. package/core/context.js +22 -3
  28. package/core/convert.d.ts +1 -1
  29. package/core/date.js +1 -5
  30. package/core/db.d.ts +12 -8
  31. package/core/db.js +21 -9
  32. package/core/ent.d.ts +99 -95
  33. package/core/ent.js +550 -602
  34. package/core/global_schema.d.ts +7 -0
  35. package/core/global_schema.js +51 -0
  36. package/core/loaders/assoc_count_loader.d.ts +5 -2
  37. package/core/loaders/assoc_count_loader.js +19 -3
  38. package/core/loaders/assoc_edge_loader.d.ts +2 -3
  39. package/core/loaders/assoc_edge_loader.js +23 -17
  40. package/core/loaders/index.d.ts +1 -2
  41. package/core/loaders/index.js +1 -5
  42. package/core/loaders/loader.d.ts +3 -3
  43. package/core/loaders/loader.js +4 -21
  44. package/core/loaders/object_loader.d.ts +30 -9
  45. package/core/loaders/object_loader.js +226 -79
  46. package/core/loaders/query_loader.d.ts +7 -13
  47. package/core/loaders/query_loader.js +60 -24
  48. package/core/loaders/raw_count_loader.d.ts +1 -0
  49. package/core/loaders/raw_count_loader.js +8 -3
  50. package/core/logger.d.ts +1 -1
  51. package/core/logger.js +1 -0
  52. package/core/privacy.d.ts +26 -16
  53. package/core/privacy.js +68 -51
  54. package/core/query/assoc_query.d.ts +3 -2
  55. package/core/query/assoc_query.js +10 -2
  56. package/core/query/custom_clause_query.d.ts +29 -0
  57. package/core/query/custom_clause_query.js +105 -0
  58. package/core/query/custom_query.d.ts +19 -2
  59. package/core/query/custom_query.js +111 -13
  60. package/core/query/index.d.ts +1 -0
  61. package/core/query/index.js +3 -1
  62. package/core/query/query.d.ts +18 -4
  63. package/core/query/query.js +135 -58
  64. package/core/query/shared_assoc_test.d.ts +2 -1
  65. package/core/query/shared_assoc_test.js +186 -55
  66. package/core/query/shared_test.d.ts +9 -2
  67. package/core/query/shared_test.js +529 -236
  68. package/core/query_impl.d.ts +8 -0
  69. package/core/query_impl.js +28 -0
  70. package/core/viewer.d.ts +2 -0
  71. package/core/viewer.js +3 -1
  72. package/graphql/graphql.d.ts +108 -22
  73. package/graphql/graphql.js +183 -137
  74. package/graphql/graphql_field_helpers.d.ts +9 -3
  75. package/graphql/graphql_field_helpers.js +22 -2
  76. package/graphql/index.d.ts +2 -2
  77. package/graphql/index.js +5 -5
  78. package/graphql/query/connection_type.d.ts +9 -9
  79. package/graphql/query/shared_assoc_test.js +1 -1
  80. package/graphql/query/shared_edge_connection.js +1 -19
  81. package/graphql/scalars/orderby_direction.d.ts +2 -0
  82. package/graphql/scalars/orderby_direction.js +15 -0
  83. package/imports/dataz/example1/_auth.js +128 -47
  84. package/imports/dataz/example1/_viewer.js +87 -39
  85. package/imports/index.d.ts +7 -2
  86. package/imports/index.js +20 -5
  87. package/index.d.ts +23 -5
  88. package/index.js +35 -10
  89. package/package.json +20 -19
  90. package/parse_schema/parse.d.ts +33 -9
  91. package/parse_schema/parse.js +182 -33
  92. package/schema/base_schema.d.ts +13 -3
  93. package/schema/base_schema.js +13 -0
  94. package/schema/field.d.ts +78 -21
  95. package/schema/field.js +232 -72
  96. package/schema/index.d.ts +2 -2
  97. package/schema/index.js +7 -2
  98. package/schema/json_field.d.ts +16 -4
  99. package/schema/json_field.js +32 -2
  100. package/schema/schema.d.ts +109 -20
  101. package/schema/schema.js +42 -53
  102. package/schema/struct_field.d.ts +15 -3
  103. package/schema/struct_field.js +117 -22
  104. package/schema/union_field.d.ts +1 -1
  105. package/scripts/custom_compiler.js +12 -8
  106. package/scripts/custom_graphql.js +167 -64
  107. package/scripts/migrate_v0.1.js +36 -0
  108. package/scripts/move_types.js +120 -0
  109. package/scripts/read_schema.js +22 -7
  110. package/testutils/action/complex_schemas.d.ts +69 -0
  111. package/testutils/action/complex_schemas.js +405 -0
  112. package/testutils/builder.d.ts +37 -41
  113. package/testutils/builder.js +66 -46
  114. package/testutils/db/fixture.d.ts +10 -0
  115. package/testutils/db/fixture.js +26 -0
  116. package/testutils/db/{test_db.d.ts → temp_db.d.ts} +32 -8
  117. package/testutils/db/{test_db.js → temp_db.js} +251 -48
  118. package/testutils/db/value.d.ts +7 -0
  119. package/testutils/db/value.js +251 -0
  120. package/testutils/db_mock.d.ts +16 -4
  121. package/testutils/db_mock.js +52 -9
  122. package/testutils/db_time_zone.d.ts +4 -0
  123. package/testutils/db_time_zone.js +41 -0
  124. package/testutils/ent-graphql-tests/index.d.ts +7 -1
  125. package/testutils/ent-graphql-tests/index.js +56 -26
  126. package/testutils/fake_comms.js +1 -1
  127. package/testutils/fake_data/const.d.ts +2 -1
  128. package/testutils/fake_data/const.js +3 -0
  129. package/testutils/fake_data/fake_contact.d.ts +7 -3
  130. package/testutils/fake_data/fake_contact.js +13 -7
  131. package/testutils/fake_data/fake_event.d.ts +4 -1
  132. package/testutils/fake_data/fake_event.js +7 -6
  133. package/testutils/fake_data/fake_tag.d.ts +36 -0
  134. package/testutils/fake_data/fake_tag.js +89 -0
  135. package/testutils/fake_data/fake_user.d.ts +8 -5
  136. package/testutils/fake_data/fake_user.js +31 -19
  137. package/testutils/fake_data/index.js +5 -1
  138. package/testutils/fake_data/internal.d.ts +2 -0
  139. package/testutils/fake_data/internal.js +7 -1
  140. package/testutils/fake_data/tag_query.d.ts +13 -0
  141. package/testutils/fake_data/tag_query.js +48 -0
  142. package/testutils/fake_data/test_helpers.d.ts +14 -6
  143. package/testutils/fake_data/test_helpers.js +31 -15
  144. package/testutils/fake_data/user_query.d.ts +16 -6
  145. package/testutils/fake_data/user_query.js +72 -23
  146. package/testutils/fake_log.js +1 -1
  147. package/testutils/parse_sql.d.ts +6 -0
  148. package/testutils/parse_sql.js +16 -2
  149. package/testutils/test_edge_global_schema.d.ts +15 -0
  150. package/testutils/test_edge_global_schema.js +62 -0
  151. package/testutils/write.d.ts +2 -2
  152. package/testutils/write.js +33 -7
  153. package/tsc/ast.d.ts +15 -3
  154. package/tsc/ast.js +114 -23
  155. package/tsc/compilerOptions.js +5 -1
  156. package/tsc/move_generated.d.ts +1 -0
  157. package/tsc/move_generated.js +164 -0
  158. package/tsc/transform.d.ts +22 -0
  159. package/tsc/transform.js +182 -0
  160. package/tsc/transform_action.d.ts +22 -0
  161. package/tsc/transform_action.js +183 -0
  162. package/tsc/transform_ent.d.ts +17 -0
  163. package/tsc/transform_ent.js +60 -0
  164. package/tsc/transform_schema.d.ts +27 -0
  165. package/{scripts → tsc}/transform_schema.js +146 -117
  166. package/core/loaders/index_loader.d.ts +0 -14
  167. package/core/loaders/index_loader.js +0 -27
  168. package/graphql/enums.d.ts +0 -3
  169. package/graphql/enums.js +0 -25
  170. package/scripts/move_generated.js +0 -141
  171. package/scripts/transform_actions.js +0 -266
  172. package/scripts/transform_code.d.ts +0 -1
  173. package/scripts/transform_code.js +0 -111
  174. package/scripts/transform_schema.d.ts +0 -1
  175. /package/scripts/{move_generated.d.ts → migrate_v0.1.d.ts} +0 -0
  176. /package/scripts/{transform_actions.d.ts → move_types.d.ts} +0 -0
@@ -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 {};
@@ -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", () => {
@@ -0,0 +1,2 @@
1
+ import { GraphQLEnumType } from "graphql";
2
+ export declare const GraphQLOrderByDirection: GraphQLEnumType;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GraphQLOrderByDirection = void 0;
4
+ const graphql_1 = require("graphql");
5
+ exports.GraphQLOrderByDirection = new graphql_1.GraphQLEnumType({
6
+ name: "OrderByDirection",
7
+ values: {
8
+ ASC: {
9
+ value: "ASC",
10
+ },
11
+ DESC: {
12
+ value: "DESC",
13
+ },
14
+ },
15
+ });
@@ -1,54 +1,135 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.push(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.push(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
7
28
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
10
35
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
13
39
  };
14
40
  Object.defineProperty(exports, "__esModule", { value: true });
15
41
  const graphql_1 = require("../../../graphql/graphql");
16
42
  const graphql_2 = require("graphql");
17
- let UserAuthInput = class UserAuthInput {
18
- };
19
- __decorate([
20
- (0, graphql_1.gqlField)(),
21
- __metadata("design:type", String)
22
- ], UserAuthInput.prototype, "emailAddress", void 0);
23
- __decorate([
24
- (0, graphql_1.gqlField)(),
25
- __metadata("design:type", String)
26
- ], UserAuthInput.prototype, "password", void 0);
27
- UserAuthInput = __decorate([
28
- (0, graphql_1.gqlInputObjectType)()
29
- ], UserAuthInput);
30
- let UserAuthResponse = class UserAuthResponse {
31
- };
32
- __decorate([
33
- (0, graphql_1.gqlField)(),
34
- __metadata("design:type", String)
35
- ], UserAuthResponse.prototype, "token", void 0);
36
- __decorate([
37
- (0, graphql_1.gqlField)({ type: graphql_2.GraphQLID }),
38
- __metadata("design:type", Object)
39
- ], UserAuthResponse.prototype, "viewerID", void 0);
40
- UserAuthResponse = __decorate([
41
- (0, graphql_1.gqlObjectType)()
42
- ], UserAuthResponse);
43
- class AuthResolver {
44
- async userAuth(input) {
45
- throw new Error("not implemented");
46
- }
47
- }
48
- __decorate([
49
- (0, graphql_1.gqlMutation)({ name: "userAuth", type: UserAuthResponse }),
50
- __param(0, (0, graphql_1.gqlArg)("input")),
51
- __metadata("design:type", Function),
52
- __metadata("design:paramtypes", [UserAuthInput]),
53
- __metadata("design:returntype", Promise)
54
- ], AuthResolver.prototype, "userAuth", null);
43
+ let UserAuthInput = (() => {
44
+ let _classDecorators = [(0, graphql_1.gqlInputObjectType)()];
45
+ let _classDescriptor;
46
+ let _classExtraInitializers = [];
47
+ let _classThis;
48
+ let _instanceExtraInitializers = [];
49
+ let _emailAddress_decorators;
50
+ let _emailAddress_initializers = [];
51
+ let _password_decorators;
52
+ let _password_initializers = [];
53
+ var UserAuthInput = _classThis = class {
54
+ constructor() {
55
+ this.emailAddress = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _emailAddress_initializers, void 0));
56
+ this.password = __runInitializers(this, _password_initializers, void 0);
57
+ }
58
+ };
59
+ __setFunctionName(_classThis, "UserAuthInput");
60
+ (() => {
61
+ _emailAddress_decorators = [(0, graphql_1.gqlField)({
62
+ class: "UserAuthInput",
63
+ type: graphql_2.GraphQLString,
64
+ })];
65
+ _password_decorators = [(0, graphql_1.gqlField)({
66
+ class: "UserAuthInput",
67
+ type: graphql_2.GraphQLString,
68
+ })];
69
+ __esDecorate(null, null, _emailAddress_decorators, { kind: "field", name: "emailAddress", static: false, private: false, access: { has: obj => "emailAddress" in obj, get: obj => obj.emailAddress, set: (obj, value) => { obj.emailAddress = value; } } }, _emailAddress_initializers, _instanceExtraInitializers);
70
+ __esDecorate(null, null, _password_decorators, { kind: "field", name: "password", static: false, private: false, access: { has: obj => "password" in obj, get: obj => obj.password, set: (obj, value) => { obj.password = value; } } }, _password_initializers, _instanceExtraInitializers);
71
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers);
72
+ UserAuthInput = _classThis = _classDescriptor.value;
73
+ __runInitializers(_classThis, _classExtraInitializers);
74
+ })();
75
+ return UserAuthInput = _classThis;
76
+ })();
77
+ let UserAuthResponse = (() => {
78
+ let _classDecorators_1 = [(0, graphql_1.gqlObjectType)()];
79
+ let _classDescriptor_1;
80
+ let _classExtraInitializers_1 = [];
81
+ let _classThis_1;
82
+ let _instanceExtraInitializers_1 = [];
83
+ let _token_decorators;
84
+ let _token_initializers = [];
85
+ let _viewerID_decorators;
86
+ let _viewerID_initializers = [];
87
+ var UserAuthResponse = _classThis_1 = class {
88
+ constructor() {
89
+ this.token = (__runInitializers(this, _instanceExtraInitializers_1), __runInitializers(this, _token_initializers, void 0));
90
+ this.viewerID = __runInitializers(this, _viewerID_initializers, void 0);
91
+ }
92
+ };
93
+ __setFunctionName(_classThis_1, "UserAuthResponse");
94
+ (() => {
95
+ _token_decorators = [(0, graphql_1.gqlField)({
96
+ class: "UserAuthResponse",
97
+ type: graphql_2.GraphQLString,
98
+ })];
99
+ _viewerID_decorators = [(0, graphql_1.gqlField)({ class: "UserAuthResponses", type: graphql_2.GraphQLID })];
100
+ __esDecorate(null, null, _token_decorators, { kind: "field", name: "token", static: false, private: false, access: { has: obj => "token" in obj, get: obj => obj.token, set: (obj, value) => { obj.token = value; } } }, _token_initializers, _instanceExtraInitializers_1);
101
+ __esDecorate(null, null, _viewerID_decorators, { kind: "field", name: "viewerID", static: false, private: false, access: { has: obj => "viewerID" in obj, get: obj => obj.viewerID, set: (obj, value) => { obj.viewerID = value; } } }, _viewerID_initializers, _instanceExtraInitializers_1);
102
+ __esDecorate(null, _classDescriptor_1 = { value: _classThis_1 }, _classDecorators_1, { kind: "class", name: _classThis_1.name }, null, _classExtraInitializers_1);
103
+ UserAuthResponse = _classThis_1 = _classDescriptor_1.value;
104
+ __runInitializers(_classThis_1, _classExtraInitializers_1);
105
+ })();
106
+ return UserAuthResponse = _classThis_1;
107
+ })();
108
+ let AuthResolver = (() => {
109
+ var _a;
110
+ let _instanceExtraInitializers_2 = [];
111
+ let _userAuth_decorators;
112
+ return _a = class AuthResolver {
113
+ async userAuth(input) {
114
+ throw new Error("not implemented");
115
+ }
116
+ constructor() {
117
+ __runInitializers(this, _instanceExtraInitializers_2);
118
+ }
119
+ },
120
+ (() => {
121
+ _userAuth_decorators = [(0, graphql_1.gqlMutation)({
122
+ class: "AuthResolver",
123
+ name: "userAuth",
124
+ type: UserAuthResponse,
125
+ args: [
126
+ {
127
+ name: "input",
128
+ type: UserAuthInput,
129
+ },
130
+ ],
131
+ })];
132
+ __esDecorate(_a, null, _userAuth_decorators, { kind: "method", name: "userAuth", static: false, private: false, access: { has: obj => "userAuth" in obj, get: obj => obj.userAuth } }, null, _instanceExtraInitializers_2);
133
+ })(),
134
+ _a;
135
+ })();
@@ -1,46 +1,94 @@
1
1
  "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
7
8
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.push(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.push(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
10
35
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
13
39
  };
14
40
  Object.defineProperty(exports, "__esModule", { value: true });
15
41
  const graphql_1 = require("../../../graphql/graphql");
16
42
  const graphql_2 = require("graphql");
17
- let ViewerType = class ViewerType {
18
- constructor(viewer) {
19
- this.viewer = viewer;
20
- }
21
- get viewerID() {
22
- return this.viewer.viewerID;
23
- }
24
- };
25
- __decorate([
26
- (0, graphql_1.gqlField)({ type: graphql_2.GraphQLID, nullable: true }),
27
- __metadata("design:type", Object),
28
- __metadata("design:paramtypes", [])
29
- ], ViewerType.prototype, "viewerID", null);
30
- ViewerType = __decorate([
31
- (0, graphql_1.gqlObjectType)({ name: "Viewer" }),
32
- __metadata("design:paramtypes", [Object])
33
- ], ViewerType);
34
- class ViewerResolver {
35
- viewer(context) {
36
- return new ViewerType(context.getViewer());
37
- }
38
- }
39
- __decorate([
40
- (0, graphql_1.gqlQuery)({ name: "viewer", type: ViewerType }),
41
- __param(0, (0, graphql_1.gqlContextType)()),
42
- __metadata("design:type", Function),
43
- __metadata("design:paramtypes", [Object]),
44
- __metadata("design:returntype", ViewerType)
45
- ], ViewerResolver.prototype, "viewer", null);
46
- exports.default = ViewerResolver;
43
+ let ViewerType = (() => {
44
+ let _classDecorators = [(0, graphql_1.gqlObjectType)({ name: "Viewer" })];
45
+ let _classDescriptor;
46
+ let _classExtraInitializers = [];
47
+ let _classThis;
48
+ let _instanceExtraInitializers = [];
49
+ let _get_viewerID_decorators;
50
+ var ViewerType = _classThis = class {
51
+ constructor(viewer) {
52
+ this.viewer = (__runInitializers(this, _instanceExtraInitializers), viewer);
53
+ }
54
+ get viewerID() {
55
+ return this.viewer.viewerID;
56
+ }
57
+ };
58
+ __setFunctionName(_classThis, "ViewerType");
59
+ (() => {
60
+ _get_viewerID_decorators = [(0, graphql_1.gqlField)({
61
+ class: "ViewerType",
62
+ type: graphql_2.GraphQLID,
63
+ nullable: true,
64
+ })];
65
+ __esDecorate(_classThis, null, _get_viewerID_decorators, { kind: "getter", name: "viewerID", static: false, private: false, access: { has: obj => "viewerID" in obj, get: obj => obj.viewerID } }, null, _instanceExtraInitializers);
66
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers);
67
+ ViewerType = _classThis = _classDescriptor.value;
68
+ __runInitializers(_classThis, _classExtraInitializers);
69
+ })();
70
+ return ViewerType = _classThis;
71
+ })();
72
+ exports.default = (() => {
73
+ var _a;
74
+ let _instanceExtraInitializers_1 = [];
75
+ let _viewer_decorators;
76
+ return _a = class ViewerResolver {
77
+ viewer(context) {
78
+ return new ViewerType(context.getViewer());
79
+ }
80
+ constructor() {
81
+ __runInitializers(this, _instanceExtraInitializers_1);
82
+ }
83
+ },
84
+ (() => {
85
+ _viewer_decorators = [(0, graphql_1.gqlQuery)({
86
+ class: "ViewerResolver",
87
+ name: "viewer",
88
+ type: ViewerType,
89
+ args: [(0, graphql_1.gqlContextType)()],
90
+ })];
91
+ __esDecorate(_a, null, _viewer_decorators, { kind: "method", name: "viewer", static: false, private: false, access: { has: obj => "viewer" in obj, get: obj => obj.viewer } }, null, _instanceExtraInitializers_1);
92
+ })(),
93
+ _a;
94
+ })();
@@ -1,6 +1,7 @@
1
1
  export interface Options {
2
2
  filter?: (file: string, index: number, array: string[]) => boolean;
3
- ignore?: string | Readonly<string[]> | undefined;
3
+ justCurrentDir?: boolean;
4
+ ignore?: string | string[] | undefined;
4
5
  }
5
6
  export interface PathResult {
6
7
  m: Map<string, file[]>;
@@ -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];
@@ -23,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
27
  };
24
28
  Object.defineProperty(exports, "__esModule", { value: true });
25
29
  exports.parseCustomImports = void 0;
26
- const glob_1 = __importDefault(require("glob"));
30
+ const glob = __importStar(require("glob"));
27
31
  const typescript_1 = __importDefault(require("typescript"));
28
32
  const fs = __importStar(require("fs"));
29
33
  const path = __importStar(require("path"));
@@ -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.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,29 +1,47 @@
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, AssocEdge, AssocEdgeData, loadEdgeData, loadEdgeDatas, loadEdges, loadUniqueEdge, loadUniqueNode, loadRawEdgeCountX, loadEdgeForID2, loadNodesByEdge, getEdgeTypeInGroup, } from "./core/ent";
3
+ export { DataOperation, EditNodeOptions, EditNodeOperation, RawQueryOperation, EdgeOperation, DeleteNodeOperation, AssocEdgeInputOptions, AssocEdgeInput, } from "./action/operations";
4
+ export { setGlobalSchema } from "./core/global_schema";
3
5
  import DB from "./core/db";
4
6
  export * from "./core/loaders";
5
7
  export { DB };
6
8
  export { EntPrivacyError, AlwaysAllowRule, AlwaysDenyRule, DenyIfLoggedInRule, DenyIfLoggedOutRule, AllowIfHasIdentity, AllowIfViewerRule, AllowIfFuncRule, AllowIfViewerIsRule, AllowIfViewerIsEntPropertyRule, AllowIfEntPropertyIsRule, DenyIfEntPropertyIsRule, AllowIfViewerEqualsRule, DenyIfViewerEqualsRule, AllowIfEdgeExistsRule, AllowIfViewerInboundEdgeExistsRule, AllowIfViewerOutboundEdgeExistsRule, DenyIfEdgeExistsRule, DenyIfViewerInboundEdgeExistsRule, DenyIfViewerOutboundEdgeExistsRule, DenyIfEdgeDoesNotExistRule, DenyIfViewerInboundEdgeDoesNotExistRule, DenyIfViewerOutboundEdgeDoesNotExistRule, AllowIfEntIsVisibleRule, AllowIfEntIsNotVisibleRule, DenyIfEntIsVisibleRule, DenyIfEntIsNotVisibleRule, AllowIfEntIsVisiblePolicy, DenyIfEntIsVisiblePolicy, DelayedResultRule, applyPrivacyPolicy, applyPrivacyPolicyX, AlwaysAllowPrivacyPolicy, AlwaysDenyPrivacyPolicy, AllowIfConditionAppliesRule, AllowIfSubPolicyAllowsRule, AllowIfViewerPrivacyPolicy, AllowIfViewerHasIdentityPrivacyPolicy, } from "./core/privacy";
7
9
  export * from "./core/query";
10
+ export * from "./core/query_impl";
8
11
  export * from "./schema/";
9
12
  import * as q from "./core/clause";
13
+ export { Clause } from "./core/clause";
10
14
  declare const query: {
11
15
  Eq: typeof q.Eq;
12
16
  NotEq: typeof q.NotEq;
13
17
  And: typeof q.And;
14
18
  AndOptional: typeof q.AndOptional;
15
19
  Or: typeof q.Or;
20
+ OrOptional: typeof q.OrOptional;
16
21
  In: typeof q.In;
22
+ UuidIn: typeof q.UuidIn;
23
+ IntegerIn: typeof q.IntegerIn;
24
+ TextIn: typeof q.TextIn;
25
+ DBTypeIn: typeof q.DBTypeIn;
26
+ UuidNotIn: typeof q.UuidNotIn;
27
+ IntegerNotIn: typeof q.IntegerNotIn;
28
+ TextNotIn: typeof q.TextNotIn;
29
+ DBTypeNotIn: typeof q.DBTypeNotIn;
17
30
  Greater: typeof q.Greater;
18
31
  Less: typeof q.Less;
19
32
  GreaterEq: typeof q.GreaterEq;
20
33
  LessEq: typeof q.LessEq;
21
34
  ArrayEq: typeof q.ArrayEq;
22
35
  ArrayNotEq: typeof q.ArrayNotEq;
23
- ArrayGreater: typeof q.ArrayGreater;
24
- ArrayLess: typeof q.ArrayLess;
25
- ArrayGreaterEq: typeof q.ArrayGreaterEq;
26
- ArrayLessEq: typeof q.ArrayLessEq;
36
+ PostgresArrayContainsValue: typeof q.PostgresArrayContainsValue;
37
+ PostgresArrayContains: typeof q.PostgresArrayContains;
38
+ PostgresArrayNotContainsValue: typeof q.PostgresArrayNotContainsValue;
39
+ PostgresArrayNotContains: typeof q.PostgresArrayNotContains;
40
+ PostgresArrayOverlaps: typeof q.PostgresArrayOverlaps;
41
+ PostgresArrayNotOverlaps: typeof q.PostgresArrayNotOverlaps;
42
+ JSONPathValuePredicate: typeof q.JSONPathValuePredicate;
43
+ JSONObjectFieldKeyASJSON: typeof q.JSONObjectFieldKeyASJSON;
44
+ JSONObjectFieldKeyAsText: typeof q.JSONObjectFieldKeyAsText;
27
45
  TsQuery: typeof q.TsQuery;
28
46
  PlainToTsQuery: typeof q.PlainToTsQuery;
29
47
  PhraseToTsQuery: typeof q.PhraseToTsQuery;