@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.
- package/action/action.d.ts +8 -1
- package/action/executor.d.ts +16 -3
- package/action/executor.js +83 -27
- package/action/index.d.ts +2 -1
- package/action/operations.d.ts +126 -0
- package/action/operations.js +686 -0
- package/action/orchestrator.d.ts +22 -8
- package/action/orchestrator.js +278 -67
- package/core/base.d.ts +34 -24
- package/core/clause.d.ts +62 -79
- package/core/clause.js +77 -5
- package/core/config.d.ts +5 -1
- package/core/config.js +3 -0
- package/core/const.d.ts +3 -0
- package/core/const.js +6 -0
- package/core/context.d.ts +4 -3
- package/core/context.js +2 -1
- package/core/db.d.ts +1 -0
- package/core/db.js +7 -7
- package/core/ent.d.ts +53 -105
- package/core/ent.js +104 -599
- package/core/global_schema.d.ts +7 -0
- package/core/global_schema.js +51 -0
- package/core/loaders/assoc_count_loader.d.ts +4 -2
- package/core/loaders/assoc_count_loader.js +10 -2
- package/core/loaders/assoc_edge_loader.d.ts +2 -3
- package/core/loaders/assoc_edge_loader.js +16 -7
- package/core/loaders/index.d.ts +0 -1
- package/core/loaders/index.js +1 -3
- package/core/loaders/loader.d.ts +3 -3
- package/core/loaders/loader.js +3 -20
- package/core/loaders/object_loader.d.ts +30 -10
- package/core/loaders/object_loader.js +179 -40
- package/core/loaders/query_loader.d.ts +4 -4
- package/core/loaders/query_loader.js +14 -19
- package/core/loaders/raw_count_loader.d.ts +1 -0
- package/core/loaders/raw_count_loader.js +3 -2
- package/core/privacy.d.ts +19 -10
- package/core/privacy.js +47 -26
- package/core/query/assoc_query.js +1 -1
- package/core/query/custom_clause_query.d.ts +6 -3
- package/core/query/custom_clause_query.js +36 -9
- package/core/query/custom_query.d.ts +3 -1
- package/core/query/custom_query.js +29 -6
- package/core/query/query.d.ts +12 -2
- package/core/query/query.js +67 -38
- package/core/query/shared_assoc_test.js +151 -10
- package/core/query/shared_test.d.ts +2 -2
- package/core/query/shared_test.js +90 -30
- package/core/query_impl.d.ts +8 -0
- package/core/query_impl.js +28 -0
- package/core/viewer.d.ts +2 -0
- package/core/viewer.js +2 -0
- package/graphql/graphql.d.ts +103 -19
- package/graphql/graphql.js +169 -134
- package/graphql/graphql_field_helpers.d.ts +9 -3
- package/graphql/graphql_field_helpers.js +22 -2
- package/graphql/index.d.ts +2 -1
- package/graphql/index.js +5 -2
- package/graphql/scalars/orderby_direction.d.ts +2 -0
- package/graphql/scalars/orderby_direction.js +15 -0
- package/imports/dataz/example1/_auth.js +128 -47
- package/imports/dataz/example1/_viewer.js +87 -39
- package/imports/index.d.ts +1 -1
- package/imports/index.js +2 -2
- package/index.d.ts +12 -1
- package/index.js +18 -6
- package/package.json +20 -17
- package/parse_schema/parse.d.ts +10 -4
- package/parse_schema/parse.js +70 -24
- package/schema/base_schema.d.ts +8 -0
- package/schema/base_schema.js +11 -0
- package/schema/field.d.ts +6 -3
- package/schema/field.js +72 -17
- package/schema/index.d.ts +1 -1
- package/schema/index.js +2 -1
- package/schema/json_field.d.ts +3 -3
- package/schema/json_field.js +4 -1
- package/schema/schema.d.ts +42 -5
- package/schema/schema.js +35 -41
- package/schema/struct_field.d.ts +8 -6
- package/schema/struct_field.js +67 -8
- package/schema/union_field.d.ts +1 -1
- package/scripts/custom_compiler.js +4 -4
- package/scripts/custom_graphql.js +105 -75
- package/scripts/move_types.js +4 -1
- package/scripts/read_schema.js +2 -2
- package/testutils/action/complex_schemas.d.ts +1 -1
- package/testutils/action/complex_schemas.js +10 -3
- package/testutils/builder.d.ts +3 -0
- package/testutils/builder.js +6 -0
- package/testutils/db/temp_db.d.ts +9 -1
- package/testutils/db/temp_db.js +82 -14
- package/testutils/db_mock.js +1 -3
- package/testutils/ent-graphql-tests/index.d.ts +1 -1
- package/testutils/ent-graphql-tests/index.js +30 -19
- package/testutils/fake_comms.js +1 -1
- package/testutils/fake_data/fake_contact.d.ts +1 -1
- package/testutils/fake_data/fake_tag.d.ts +1 -1
- package/testutils/fake_data/fake_user.d.ts +3 -3
- package/testutils/fake_data/fake_user.js +15 -4
- package/testutils/fake_data/tag_query.js +8 -3
- package/testutils/fake_data/test_helpers.d.ts +3 -2
- package/testutils/fake_data/test_helpers.js +4 -4
- package/testutils/fake_data/user_query.d.ts +5 -2
- package/testutils/fake_data/user_query.js +19 -2
- package/testutils/fake_log.js +1 -1
- package/tsc/ast.js +2 -1
- package/tsc/move_generated.js +2 -2
- package/tsc/transform.d.ts +2 -2
- package/tsc/transform.js +4 -3
- package/tsc/transform_ent.js +2 -1
- package/tsc/transform_schema.js +4 -3
- package/core/loaders/index_loader.d.ts +0 -14
- package/core/loaders/index_loader.js +0 -27
package/testutils/fake_log.js
CHANGED
|
@@ -21,12 +21,12 @@ class FakeLogger {
|
|
|
21
21
|
this.logs = [];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.FakeLogger = FakeLogger;
|
|
25
24
|
// todo this is quick and ideal.
|
|
26
25
|
// more ideal is capturing all console.logs
|
|
27
26
|
// we do it in golang for example
|
|
28
27
|
// and will need this for production launch anyways
|
|
29
28
|
FakeLogger.logs = [];
|
|
29
|
+
exports.FakeLogger = FakeLogger;
|
|
30
30
|
// TODO instead of needing to add this manually
|
|
31
31
|
// we need to build a way to add global observers (and maybe triggers)
|
|
32
32
|
// to be run on every action/mutation
|
package/tsc/ast.js
CHANGED
|
@@ -31,6 +31,7 @@ const typescript_1 = __importDefault(require("typescript"));
|
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const js_yaml_1 = require("js-yaml");
|
|
33
33
|
const fs = __importStar(require("fs"));
|
|
34
|
+
const const_1 = require("../core/const");
|
|
34
35
|
function getPreText(fileContents, node, sourceFile) {
|
|
35
36
|
return fileContents.substring(node.getFullStart(), node.getStart(sourceFile));
|
|
36
37
|
}
|
|
@@ -267,7 +268,7 @@ function getCustomInfo() {
|
|
|
267
268
|
catch (e) { }
|
|
268
269
|
return {
|
|
269
270
|
viewerInfo: {
|
|
270
|
-
path:
|
|
271
|
+
path: const_1.PACKAGE,
|
|
271
272
|
name: "Viewer",
|
|
272
273
|
},
|
|
273
274
|
relativeImports,
|
package/tsc/move_generated.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.moveGenerated = void 0;
|
|
30
|
-
const
|
|
30
|
+
const glob = __importStar(require("glob"));
|
|
31
31
|
const path = __importStar(require("path"));
|
|
32
32
|
const fs = __importStar(require("fs"));
|
|
33
33
|
const typescript_1 = __importDefault(require("typescript"));
|
|
@@ -38,7 +38,7 @@ class MoveFiles {
|
|
|
38
38
|
this.globPath = globPath;
|
|
39
39
|
}
|
|
40
40
|
move() {
|
|
41
|
-
const files =
|
|
41
|
+
const files = glob.sync(this.globPath);
|
|
42
42
|
moveFiles(files);
|
|
43
43
|
}
|
|
44
44
|
}
|
package/tsc/transform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as glob from "glob";
|
|
2
2
|
import ts from "typescript";
|
|
3
3
|
interface TraverseChildResponse {
|
|
4
4
|
node?: ts.Node;
|
|
@@ -10,7 +10,7 @@ interface TraverseChildResponse {
|
|
|
10
10
|
}
|
|
11
11
|
export interface TransformFile {
|
|
12
12
|
glob: string;
|
|
13
|
-
globOptions?:
|
|
13
|
+
globOptions?: glob.GlobOptions;
|
|
14
14
|
preprocessFile?: (contents: string, file: string, sourceFile: ts.SourceFile) => boolean;
|
|
15
15
|
traverseChild(sourceFile: ts.SourceFile, contents: string, file: string, node: ts.Node): TraverseChildResponse | undefined;
|
|
16
16
|
filter?(files: string[]): string[];
|
package/tsc/transform.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.transform = void 0;
|
|
30
|
-
const
|
|
30
|
+
const glob = __importStar(require("glob"));
|
|
31
31
|
const typescript_1 = __importDefault(require("typescript"));
|
|
32
32
|
const child_process_1 = require("child_process");
|
|
33
33
|
const fs = __importStar(require("fs"));
|
|
@@ -40,10 +40,11 @@ function normalizePath(p) {
|
|
|
40
40
|
return p;
|
|
41
41
|
}
|
|
42
42
|
function transform(transform) {
|
|
43
|
-
let files =
|
|
43
|
+
let files = glob.sync(transform.glob, transform.globOptions ?? {});
|
|
44
44
|
const target = (0, compilerOptions_1.getTargetFromCurrentDir)();
|
|
45
45
|
if (transform.filter) {
|
|
46
|
-
|
|
46
|
+
const f2 = files.map((f) => (typeof f === "string" ? f : f.path));
|
|
47
|
+
files = transform.filter(f2);
|
|
47
48
|
}
|
|
48
49
|
files.forEach((file) => {
|
|
49
50
|
let { contents, sourceFile } = (0, compilerOptions_1.createSourceFile)(target, file);
|
package/tsc/transform_ent.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TransformEnt = void 0;
|
|
7
|
+
const const_1 = require("../core/const");
|
|
7
8
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
9
|
const ast_1 = require("./ast");
|
|
9
10
|
function isPrivacyPolicy(mm) {
|
|
@@ -52,7 +53,7 @@ class TransformEnt {
|
|
|
52
53
|
return {
|
|
53
54
|
rawString: classInfo.wrapClassContents(klassContents),
|
|
54
55
|
traversed,
|
|
55
|
-
imports: new Map([[
|
|
56
|
+
imports: new Map([[const_1.PACKAGE, ["PrivacyPolicy"]]]),
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
}
|
package/tsc/transform_schema.js
CHANGED
|
@@ -31,6 +31,7 @@ const typescript_1 = __importDefault(require("typescript"));
|
|
|
31
31
|
const fs = __importStar(require("fs"));
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
33
33
|
const ast_1 = require("../tsc/ast");
|
|
34
|
+
const const_1 = require("../core/const");
|
|
34
35
|
function traverseClass(fileContents, sourceFile, node, transformSchema) {
|
|
35
36
|
const ci = getTransformClassInfo(fileContents, sourceFile, node, transformSchema);
|
|
36
37
|
if (!ci) {
|
|
@@ -307,9 +308,9 @@ function parseFieldElement(element, sourceFile, fileContents, nested) {
|
|
|
307
308
|
// find which of these importPaths is being used and use that to replace
|
|
308
309
|
function findSchemaImportPath(sourceFile) {
|
|
309
310
|
const paths = {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
[const_1.PACKAGE]: true,
|
|
312
|
+
[const_1.SCHEMA_PATH]: true,
|
|
313
|
+
[`${const_1.SCHEMA_PATH}/`]: true,
|
|
313
314
|
};
|
|
314
315
|
// @ts-ignore
|
|
315
316
|
const importStatements = sourceFile.statements.filter((stmt) => typescript_1.default.isImportDeclaration(stmt));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ID, SelectBaseDataOptions, Context, Data, LoaderFactory, EdgeQueryableDataOptions, Loader } from "../base";
|
|
2
|
-
import * as clause from "../clause";
|
|
3
|
-
import { ObjectLoaderFactory } from "./object_loader";
|
|
4
|
-
export declare class IndexLoaderFactory implements LoaderFactory<ID, Data[]> {
|
|
5
|
-
name: string;
|
|
6
|
-
private factory;
|
|
7
|
-
constructor(options: SelectBaseDataOptions, col: string, opts?: {
|
|
8
|
-
extraClause?: clause.Clause;
|
|
9
|
-
sortColumn?: string;
|
|
10
|
-
toPrime?: ObjectLoaderFactory<ID>[];
|
|
11
|
-
});
|
|
12
|
-
createLoader(context?: Context): any;
|
|
13
|
-
createConfigurableLoader(options: EdgeQueryableDataOptions, context?: Context): Loader<ID, Data[]>;
|
|
14
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexLoaderFactory = void 0;
|
|
4
|
-
const query_loader_1 = require("./query_loader");
|
|
5
|
-
// we're keeping this for legacy reasons so as to not break existing callers
|
|
6
|
-
// and to decouple the change here but all callers can safely be changed here to use QueryLoaderFactory
|
|
7
|
-
// @deprecated use QueryLoaderFactory
|
|
8
|
-
class IndexLoaderFactory {
|
|
9
|
-
constructor(options, col, opts) {
|
|
10
|
-
this.factory = new query_loader_1.QueryLoaderFactory({
|
|
11
|
-
fields: options.fields,
|
|
12
|
-
tableName: options.tableName,
|
|
13
|
-
groupCol: col,
|
|
14
|
-
clause: opts?.extraClause,
|
|
15
|
-
sortColumn: opts?.sortColumn,
|
|
16
|
-
toPrime: opts?.toPrime,
|
|
17
|
-
});
|
|
18
|
-
this.name = `indexLoader:${options.tableName}:${col}`;
|
|
19
|
-
}
|
|
20
|
-
createLoader(context) {
|
|
21
|
-
return this.factory.createLoader(context);
|
|
22
|
-
}
|
|
23
|
-
createConfigurableLoader(options, context) {
|
|
24
|
-
return this.factory.createConfigurableLoader(options, context);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.IndexLoaderFactory = IndexLoaderFactory;
|