@snowtop/ent 0.1.0-alpha99 → 0.1.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.
Files changed (115) hide show
  1. package/action/action.d.ts +8 -1
  2. package/action/executor.d.ts +16 -3
  3. package/action/executor.js +83 -27
  4. package/action/index.d.ts +2 -1
  5. package/action/operations.d.ts +126 -0
  6. package/action/operations.js +686 -0
  7. package/action/orchestrator.d.ts +22 -8
  8. package/action/orchestrator.js +278 -67
  9. package/core/base.d.ts +34 -24
  10. package/core/clause.d.ts +62 -79
  11. package/core/clause.js +77 -5
  12. package/core/config.d.ts +5 -1
  13. package/core/config.js +3 -0
  14. package/core/const.d.ts +3 -0
  15. package/core/const.js +6 -0
  16. package/core/context.d.ts +4 -3
  17. package/core/context.js +2 -1
  18. package/core/db.d.ts +1 -0
  19. package/core/db.js +7 -7
  20. package/core/ent.d.ts +53 -105
  21. package/core/ent.js +104 -599
  22. package/core/global_schema.d.ts +7 -0
  23. package/core/global_schema.js +51 -0
  24. package/core/loaders/assoc_count_loader.d.ts +4 -2
  25. package/core/loaders/assoc_count_loader.js +10 -2
  26. package/core/loaders/assoc_edge_loader.d.ts +2 -3
  27. package/core/loaders/assoc_edge_loader.js +16 -7
  28. package/core/loaders/index.d.ts +0 -1
  29. package/core/loaders/index.js +1 -3
  30. package/core/loaders/loader.d.ts +3 -3
  31. package/core/loaders/loader.js +3 -20
  32. package/core/loaders/object_loader.d.ts +30 -10
  33. package/core/loaders/object_loader.js +179 -40
  34. package/core/loaders/query_loader.d.ts +4 -4
  35. package/core/loaders/query_loader.js +14 -19
  36. package/core/loaders/raw_count_loader.d.ts +1 -0
  37. package/core/loaders/raw_count_loader.js +3 -2
  38. package/core/privacy.d.ts +19 -10
  39. package/core/privacy.js +47 -26
  40. package/core/query/assoc_query.js +1 -1
  41. package/core/query/custom_clause_query.d.ts +6 -3
  42. package/core/query/custom_clause_query.js +36 -9
  43. package/core/query/custom_query.d.ts +3 -1
  44. package/core/query/custom_query.js +29 -6
  45. package/core/query/query.d.ts +12 -2
  46. package/core/query/query.js +67 -38
  47. package/core/query/shared_assoc_test.js +151 -10
  48. package/core/query/shared_test.d.ts +2 -2
  49. package/core/query/shared_test.js +90 -30
  50. package/core/query_impl.d.ts +8 -0
  51. package/core/query_impl.js +28 -0
  52. package/core/viewer.d.ts +2 -0
  53. package/core/viewer.js +2 -0
  54. package/graphql/graphql.d.ts +103 -19
  55. package/graphql/graphql.js +169 -134
  56. package/graphql/graphql_field_helpers.d.ts +9 -3
  57. package/graphql/graphql_field_helpers.js +22 -2
  58. package/graphql/index.d.ts +2 -1
  59. package/graphql/index.js +5 -2
  60. package/graphql/scalars/orderby_direction.d.ts +2 -0
  61. package/graphql/scalars/orderby_direction.js +15 -0
  62. package/imports/dataz/example1/_auth.js +128 -47
  63. package/imports/dataz/example1/_viewer.js +87 -39
  64. package/imports/index.d.ts +1 -1
  65. package/imports/index.js +2 -2
  66. package/index.d.ts +12 -1
  67. package/index.js +18 -6
  68. package/package.json +20 -17
  69. package/parse_schema/parse.d.ts +10 -4
  70. package/parse_schema/parse.js +70 -24
  71. package/schema/base_schema.d.ts +8 -0
  72. package/schema/base_schema.js +11 -0
  73. package/schema/field.d.ts +6 -3
  74. package/schema/field.js +72 -17
  75. package/schema/index.d.ts +1 -1
  76. package/schema/index.js +2 -1
  77. package/schema/json_field.d.ts +3 -3
  78. package/schema/json_field.js +4 -1
  79. package/schema/schema.d.ts +42 -5
  80. package/schema/schema.js +35 -41
  81. package/schema/struct_field.d.ts +8 -6
  82. package/schema/struct_field.js +67 -8
  83. package/schema/union_field.d.ts +1 -1
  84. package/scripts/custom_compiler.js +4 -4
  85. package/scripts/custom_graphql.js +105 -75
  86. package/scripts/move_types.js +4 -1
  87. package/scripts/read_schema.js +2 -2
  88. package/testutils/action/complex_schemas.d.ts +1 -1
  89. package/testutils/action/complex_schemas.js +10 -3
  90. package/testutils/builder.d.ts +3 -0
  91. package/testutils/builder.js +6 -0
  92. package/testutils/db/temp_db.d.ts +9 -1
  93. package/testutils/db/temp_db.js +82 -14
  94. package/testutils/db_mock.js +1 -3
  95. package/testutils/ent-graphql-tests/index.d.ts +1 -1
  96. package/testutils/ent-graphql-tests/index.js +30 -19
  97. package/testutils/fake_comms.js +1 -1
  98. package/testutils/fake_data/fake_contact.d.ts +1 -1
  99. package/testutils/fake_data/fake_tag.d.ts +1 -1
  100. package/testutils/fake_data/fake_user.d.ts +3 -3
  101. package/testutils/fake_data/fake_user.js +15 -4
  102. package/testutils/fake_data/tag_query.js +8 -3
  103. package/testutils/fake_data/test_helpers.d.ts +3 -2
  104. package/testutils/fake_data/test_helpers.js +4 -4
  105. package/testutils/fake_data/user_query.d.ts +5 -2
  106. package/testutils/fake_data/user_query.js +19 -2
  107. package/testutils/fake_log.js +1 -1
  108. package/tsc/ast.js +2 -1
  109. package/tsc/move_generated.js +2 -2
  110. package/tsc/transform.d.ts +2 -2
  111. package/tsc/transform.js +4 -3
  112. package/tsc/transform_ent.js +2 -1
  113. package/tsc/transform_schema.js +4 -3
  114. package/core/loaders/index_loader.d.ts +0 -14
  115. package/core/loaders/index_loader.js +0 -27
@@ -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,7 +1,7 @@
1
1
  export interface Options {
2
2
  filter?: (file: string, index: number, array: string[]) => boolean;
3
3
  justCurrentDir?: boolean;
4
- ignore?: string | Readonly<string[]> | undefined;
4
+ ignore?: string | string[] | undefined;
5
5
  }
6
6
  export interface PathResult {
7
7
  m: Map<string, file[]>;
package/imports/index.js CHANGED
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.parseCustomImports = void 0;
30
- const glob_1 = __importDefault(require("glob"));
30
+ const glob = __importStar(require("glob"));
31
31
  const typescript_1 = __importDefault(require("typescript"));
32
32
  const fs = __importStar(require("fs"));
33
33
  const path = __importStar(require("path"));
@@ -42,7 +42,7 @@ function getFiles(filePath, opts) {
42
42
  if (opts?.justCurrentDir) {
43
43
  pattern = `${filePath}/**.ts`;
44
44
  }
45
- let files = glob_1.default.sync(pattern, {
45
+ let files = glob.sync(pattern, {
46
46
  ignore: opts?.ignore,
47
47
  });
48
48
  if (opts?.filter) {
package/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  export * from "./core/base";
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";
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";
10
13
  export { Clause } from "./core/clause";
@@ -16,6 +19,14 @@ declare const query: {
16
19
  Or: typeof q.Or;
17
20
  OrOptional: typeof q.OrOptional;
18
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;
19
30
  Greater: typeof q.Greater;
20
31
  Less: typeof q.Less;
21
32
  GreaterEq: typeof q.GreaterEq;
package/index.js CHANGED
@@ -29,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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.DeleteNodeOperation = exports.EdgeOperation = exports.RawQueryOperation = exports.EditNodeOperation = exports.getEdgeTypeInGroup = exports.loadNodesByEdge = exports.loadEdgeForID2 = exports.loadRawEdgeCountX = exports.loadUniqueNode = exports.loadUniqueEdge = exports.loadEdges = exports.loadEdgeDatas = exports.loadEdgeData = exports.AssocEdgeData = exports.AssocEdge = 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
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;
34
34
  __exportStar(require("./core/base"), exports);
35
35
  var ent_1 = require("./core/ent");
@@ -48,10 +48,6 @@ Object.defineProperty(exports, "performRawQuery", { enumerable: true, get: funct
48
48
  Object.defineProperty(exports, "loadRowX", { enumerable: true, get: function () { return ent_1.loadRowX; } });
49
49
  Object.defineProperty(exports, "loadRow", { enumerable: true, get: function () { return ent_1.loadRow; } });
50
50
  Object.defineProperty(exports, "loadRows", { enumerable: true, get: function () { return ent_1.loadRows; } });
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; } });
53
- Object.defineProperty(exports, "EdgeOperation", { enumerable: true, get: function () { return ent_1.EdgeOperation; } });
54
- Object.defineProperty(exports, "DeleteNodeOperation", { enumerable: true, get: function () { return ent_1.DeleteNodeOperation; } });
55
51
  Object.defineProperty(exports, "AssocEdge", { enumerable: true, get: function () { return ent_1.AssocEdge; } });
56
52
  Object.defineProperty(exports, "AssocEdgeData", { enumerable: true, get: function () { return ent_1.AssocEdgeData; } });
57
53
  Object.defineProperty(exports, "loadEdgeData", { enumerable: true, get: function () { return ent_1.loadEdgeData; } });
@@ -63,7 +59,14 @@ Object.defineProperty(exports, "loadRawEdgeCountX", { enumerable: true, get: fun
63
59
  Object.defineProperty(exports, "loadEdgeForID2", { enumerable: true, get: function () { return ent_1.loadEdgeForID2; } });
64
60
  Object.defineProperty(exports, "loadNodesByEdge", { enumerable: true, get: function () { return ent_1.loadNodesByEdge; } });
65
61
  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; } });
62
+ // TODO should these even be exported from the root?
63
+ var operations_1 = require("./action/operations");
64
+ Object.defineProperty(exports, "EditNodeOperation", { enumerable: true, get: function () { return operations_1.EditNodeOperation; } });
65
+ Object.defineProperty(exports, "RawQueryOperation", { enumerable: true, get: function () { return operations_1.RawQueryOperation; } });
66
+ Object.defineProperty(exports, "EdgeOperation", { enumerable: true, get: function () { return operations_1.EdgeOperation; } });
67
+ Object.defineProperty(exports, "DeleteNodeOperation", { enumerable: true, get: function () { return operations_1.DeleteNodeOperation; } });
68
+ var global_schema_1 = require("./core/global_schema");
69
+ Object.defineProperty(exports, "setGlobalSchema", { enumerable: true, get: function () { return global_schema_1.setGlobalSchema; } });
67
70
  const db_1 = __importDefault(require("./core/db"));
68
71
  exports.DB = db_1.default;
69
72
  __exportStar(require("./core/loaders"), exports);
@@ -108,6 +111,7 @@ Object.defineProperty(exports, "AllowIfSubPolicyAllowsRule", { enumerable: true,
108
111
  Object.defineProperty(exports, "AllowIfViewerPrivacyPolicy", { enumerable: true, get: function () { return privacy_1.AllowIfViewerPrivacyPolicy; } });
109
112
  Object.defineProperty(exports, "AllowIfViewerHasIdentityPrivacyPolicy", { enumerable: true, get: function () { return privacy_1.AllowIfViewerHasIdentityPrivacyPolicy; } });
110
113
  __exportStar(require("./core/query"), exports);
114
+ __exportStar(require("./core/query_impl"), exports);
111
115
  __exportStar(require("./schema/"), exports);
112
116
  const q = __importStar(require("./core/clause"));
113
117
  const query = {
@@ -118,6 +122,14 @@ const query = {
118
122
  Or: q.Or,
119
123
  OrOptional: q.OrOptional,
120
124
  In: q.In,
125
+ UuidIn: q.UuidIn,
126
+ IntegerIn: q.IntegerIn,
127
+ TextIn: q.TextIn,
128
+ DBTypeIn: q.DBTypeIn,
129
+ UuidNotIn: q.UuidNotIn,
130
+ IntegerNotIn: q.IntegerNotIn,
131
+ TextNotIn: q.TextNotIn,
132
+ DBTypeNotIn: q.DBTypeNotIn,
121
133
  Greater: q.Greater,
122
134
  Less: q.Less,
123
135
  GreaterEq: q.GreaterEq,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha99",
3
+ "version": "0.1.0",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -8,39 +8,42 @@
8
8
  "example": "examples"
9
9
  },
10
10
  "dependencies": {
11
- "@types/node": "^18.11.18",
11
+ "@types/node": "^20.2.5",
12
12
  "camel-case": "^4.1.2",
13
- "cosmiconfig": "^8.0.0",
14
- "dataloader": "^2.1.0",
15
- "glob": "^8.0.3",
16
- "graph-data-structure": "^2.0.0",
13
+ "cosmiconfig": "^8.1.3",
14
+ "dataloader": "^2.2.2",
15
+ "glob": "^10.2.6",
16
+ "graph-data-structure": "^3.3.0",
17
17
  "js-yaml": "^4.1.0",
18
- "json5": "^2.2.2",
19
- "luxon": "^3.1.1",
18
+ "json5": "^2.2.3",
19
+ "luxon": "^3.3.0",
20
20
  "memoizee": "^0.4.15",
21
- "minimist": "^1.2.7",
21
+ "minimist": "^1.2.8",
22
22
  "pascal-case": "^3.1.2",
23
- "pg": "^8.8.0",
24
- "prettier": "^2.8.1",
25
- "reflect-metadata": "^0.1.13",
23
+ "pg": "^8.11.0",
24
+ "prettier": "^2.8.8",
26
25
  "snake-case": "^3.0.4",
27
26
  "ts-node": "^10.9.1",
28
- "tsconfig-paths": "^4.1.1",
29
- "tslib": "^2.4.1",
30
- "typescript": "^4.9.4",
27
+ "tsconfig-paths": "^4.2.0",
28
+ "tslib": "^2.5.2",
29
+ "typescript": "^5.0.4",
31
30
  "uuid": "^9.0.0"
32
31
  },
33
32
  "peerDependencies": {
34
- "better-sqlite3": "^7.4.1",
33
+ "@swc-node/register": "^1.6.5",
34
+ "better-sqlite3": "^8.4.0",
35
35
  "graphql": "^16.5.0"
36
36
  },
37
37
  "peerDependenciesMeta": {
38
38
  "better-sqlite3": {
39
39
  "optional": true
40
+ },
41
+ "@swc-node/register": {
42
+ "optional": true
40
43
  }
41
44
  },
42
45
  "engines": {
43
- "node": ">=14.0"
46
+ "node": ">=16.0"
44
47
  },
45
48
  "devDependencies": {},
46
49
  "scripts": {},
@@ -1,5 +1,6 @@
1
1
  import { Schema, Field, AssocEdge, AssocEdgeGroup, Action } from "../schema";
2
- import { ActionField, Type, GlobalSchema } from "../schema/schema";
2
+ import { ActionField, Type, FieldMap, GlobalSchema, TransformReadBetaResult, CanViewerDo } from "../schema/schema";
3
+ export declare function processFields(src: FieldMap | Field[], patternName?: string): Promise<ProcessedField[]>;
3
4
  declare enum NullableResult {
4
5
  CONTENTS = "contents",
5
6
  CONTENTS_AND_LIST = "contentsAndList",
@@ -15,6 +16,7 @@ type ProcessedAssocEdge = Omit<AssocEdge, "actionOnlyFields" | "edgeActions"> &
15
16
  interface TransformFlags {
16
17
  transformsSelect?: boolean;
17
18
  transformsDelete?: boolean;
19
+ transformsLoaderCodegen?: TransformReadBetaResult;
18
20
  transformsInsert?: boolean;
19
21
  transformsUpdate?: boolean;
20
22
  }
@@ -29,8 +31,9 @@ type ProcessedSchema = Omit<Schema, "edges" | "actions" | "edgeGroups" | "fields
29
31
  type ProcessedAssocEdgeGroup = Omit<AssocEdgeGroup, "edgeAction"> & {
30
32
  edgeAction?: OutputAction;
31
33
  };
32
- type OutputAction = Omit<Action, "actionOnlyFields"> & {
34
+ type OutputAction = Omit<Action, "actionOnlyFields" | "canViewerDo"> & {
33
35
  actionOnlyFields?: ProcessedActionField[];
36
+ canViewerDo?: CanViewerDo;
34
37
  };
35
38
  interface schemasDict {
36
39
  [key: string]: ProcessedSchema;
@@ -46,12 +49,13 @@ type ProcessedType = Omit<Type, "subFields" | "listElemType" | "unionFields"> &
46
49
  listElemType?: ProcessedType;
47
50
  unionFields?: ProcessedField[];
48
51
  };
49
- type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOnCreate" | "privacyPolicy" | "type" | "serverDefault"> & {
52
+ export type ProcessedField = Omit<Field, "defaultValueOnEdit" | "defaultValueOnCreate" | "privacyPolicy" | "type" | "serverDefault"> & {
50
53
  name: string;
51
54
  hasDefaultValueOnCreate?: boolean;
52
55
  hasDefaultValueOnEdit?: boolean;
53
56
  patternName?: string;
54
57
  hasFieldPrivacy?: boolean;
58
+ hasEditFieldPrivacy?: boolean;
55
59
  derivedFields?: ProcessedField[];
56
60
  type: ProcessedType;
57
61
  serverDefault?: string;
@@ -82,6 +86,8 @@ interface RomeConfig {
82
86
  interface ProcessedGlobalSchema {
83
87
  globalEdges: ProcessedAssocEdge[];
84
88
  extraEdgeFields: ProcessedField[];
85
- initForEdges?: boolean;
89
+ init?: boolean;
90
+ transformsEdges?: boolean;
91
+ globalFields?: ProcessedField[];
86
92
  }
87
93
  export {};