@snowtop/ent 0.2.4 → 0.2.6
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.js +5 -5
- package/action/executor.d.ts +1 -1
- package/action/executor.js +4 -4
- package/action/experimental_action.d.ts +7 -4
- package/action/experimental_action.js +18 -8
- package/action/operations.js +17 -7
- package/action/orchestrator.d.ts +10 -2
- package/action/orchestrator.js +29 -31
- package/action/privacy.d.ts +2 -2
- package/action/relative_value.js +3 -3
- package/auth/auth.d.ts +0 -1
- package/auth/auth.js +4 -5
- package/core/base.js +5 -5
- package/core/clause.js +76 -67
- package/core/config.d.ts +1 -1
- package/core/config.js +22 -9
- package/core/context.d.ts +0 -1
- package/core/convert.d.ts +0 -1
- package/core/convert.js +16 -17
- package/core/date.js +1 -2
- package/core/db.js +17 -7
- package/core/ent.d.ts +2 -0
- package/core/ent.js +127 -92
- package/core/global_schema.js +6 -7
- package/core/loaders/assoc_count_loader.d.ts +2 -2
- package/core/loaders/assoc_count_loader.js +17 -7
- package/core/loaders/assoc_edge_loader.d.ts +2 -2
- package/core/loaders/assoc_edge_loader.js +44 -20
- package/core/loaders/cache_utils.d.ts +1 -0
- package/core/loaders/cache_utils.js +28 -0
- package/core/loaders/index.d.ts +1 -0
- package/core/loaders/index.js +4 -1
- package/core/loaders/loader.d.ts +2 -0
- package/core/loaders/loader.js +20 -3
- package/core/loaders/object_loader.d.ts +6 -4
- package/core/loaders/object_loader.js +86 -48
- package/core/loaders/query_loader.d.ts +2 -2
- package/core/loaders/query_loader.js +25 -9
- package/core/loaders/raw_count_loader.d.ts +2 -2
- package/core/loaders/raw_count_loader.js +22 -10
- package/core/logger.js +6 -7
- package/core/privacy.d.ts +2 -2
- package/core/privacy.js +4 -5
- package/core/query/assoc_query.js +17 -7
- package/core/query/query.js +17 -7
- package/core/query/shared_assoc_test.js +1 -2
- package/core/query_impl.js +4 -5
- package/core/viewer.d.ts +2 -2
- package/graphql/graphql_field_helpers.js +22 -22
- package/graphql/mutations/union.js +1 -2
- package/graphql/node_resolver.js +7 -7
- package/graphql/query/shared_assoc_test.js +1 -2
- package/graphql/scalars/date.js +8 -3
- package/graphql/scalars/time.d.ts +1 -1
- package/imports/dataz/example1/_auth.js +14 -10
- package/imports/index.js +18 -9
- package/index.js +17 -7
- package/names/names.js +61 -18
- package/package.json +14 -17
- package/parse_schema/parse.js +2 -3
- package/schema/binary_field.js +3 -3
- package/schema/field.js +45 -35
- package/schema/json_field.js +7 -7
- package/schema/schema.js +12 -12
- package/schema/struct_field.js +4 -4
- package/schema/union_field.js +3 -3
- package/scripts/custom_compiler.js +17 -7
- package/scripts/custom_graphql.js +17 -7
- package/scripts/fix_action_exports.js +17 -7
- package/scripts/move_types.js +17 -7
- package/scripts/read_schema.js +17 -7
- package/testutils/action/complex_schemas.js +28 -18
- package/testutils/builder.d.ts +1 -1
- package/testutils/builder.js +7 -7
- package/testutils/db/fixture.js +1 -2
- package/testutils/db/temp_db.js +54 -44
- package/testutils/db/value.js +3 -4
- package/testutils/db_mock.js +12 -0
- package/testutils/ent-graphql-tests/index.d.ts +3 -3
- package/testutils/ent-graphql-tests/index.js +27 -18
- package/testutils/fake_data/const.js +2 -2
- package/testutils/fake_data/fake_contact.js +20 -10
- package/testutils/fake_data/fake_event.js +20 -10
- package/testutils/fake_data/fake_tag.js +21 -11
- package/testutils/fake_data/fake_user.js +21 -11
- package/testutils/fake_data/test_helpers.js +17 -17
- package/testutils/fake_data/user_query.js +19 -9
- package/testutils/parse_sql.js +151 -43
- package/testutils/query.js +2 -3
- package/testutils/soft_delete.js +17 -7
- package/testutils/test_edge_global_schema.js +17 -7
- package/testutils/write.js +20 -11
- package/tsc/ast.js +27 -18
- package/tsc/compilerOptions.js +22 -13
- package/tsc/move_generated.js +18 -9
- package/tsc/transform.js +18 -9
- package/tsc/transform_action.js +17 -7
- package/tsc/transform_schema.js +17 -7
package/core/logger.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setLogLevels = setLogLevels;
|
|
4
|
+
exports.clearLogLevels = clearLogLevels;
|
|
5
|
+
exports.log = log;
|
|
6
|
+
exports.logIf = logIf;
|
|
7
|
+
exports.logTrace = logTrace;
|
|
8
|
+
exports.logEnabled = logEnabled;
|
|
4
9
|
var m = {
|
|
5
10
|
query: "log",
|
|
6
11
|
warn: "warn",
|
|
@@ -16,11 +21,9 @@ function setLogLevels(levels) {
|
|
|
16
21
|
}
|
|
17
22
|
levels.forEach((level) => logLevels.set(level, true));
|
|
18
23
|
}
|
|
19
|
-
exports.setLogLevels = setLogLevels;
|
|
20
24
|
function clearLogLevels() {
|
|
21
25
|
logLevels.clear();
|
|
22
26
|
}
|
|
23
|
-
exports.clearLogLevels = clearLogLevels;
|
|
24
27
|
function log(level, msg) {
|
|
25
28
|
if (logLevels.has(level)) {
|
|
26
29
|
// mostly for sqlite error but fine for any type of error
|
|
@@ -32,20 +35,16 @@ function log(level, msg) {
|
|
|
32
35
|
console[m[level]](msg);
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
|
-
exports.log = log;
|
|
36
38
|
function logIf(level, logFn) {
|
|
37
39
|
if (logLevels.has(level)) {
|
|
38
40
|
console[m[level]](logFn());
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
|
-
exports.logIf = logIf;
|
|
42
43
|
function logTrace() {
|
|
43
44
|
if (logLevels.has("debug")) {
|
|
44
45
|
console.trace();
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
exports.logTrace = logTrace;
|
|
48
48
|
function logEnabled(level) {
|
|
49
49
|
return logLevels.has(level);
|
|
50
50
|
}
|
|
51
|
-
exports.logEnabled = logEnabled;
|
package/core/privacy.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export declare class AllowIfEntIsVisiblePolicy<TEnt extends Ent<TViewer>, TViewe
|
|
|
88
88
|
private options;
|
|
89
89
|
constructor(id: ID, options: LoadEntOptions<TEnt, TViewer>);
|
|
90
90
|
rules: {
|
|
91
|
-
apply(_v: Viewer
|
|
91
|
+
apply(_v: Viewer, _ent?: Ent): Promise<PrivacyResult>;
|
|
92
92
|
}[];
|
|
93
93
|
}
|
|
94
94
|
export declare class DenyIfEntIsVisiblePolicy<TEnt extends Ent<TViewer>, TViewer extends Viewer> implements PrivacyPolicy<TEnt, TViewer> {
|
|
@@ -96,7 +96,7 @@ export declare class DenyIfEntIsVisiblePolicy<TEnt extends Ent<TViewer>, TViewer
|
|
|
96
96
|
private options;
|
|
97
97
|
constructor(id: ID, options: LoadEntOptions<TEnt, TViewer>);
|
|
98
98
|
rules: {
|
|
99
|
-
apply(_v: Viewer
|
|
99
|
+
apply(_v: Viewer, _ent?: Ent): Promise<PrivacyResult>;
|
|
100
100
|
}[];
|
|
101
101
|
}
|
|
102
102
|
export declare class DenyIfEntIsVisibleRule<TEnt extends Ent<TViewer>, TViewer extends Viewer> implements PrivacyPolicyRule<TEnt, TViewer> {
|
package/core/privacy.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.AllowIfViewerHasIdentityPrivacyPolicy = exports.AllowIfViewerPrivacyPolicy = exports.AlwaysDenyPrivacyPolicy = exports.AlwaysAllowPrivacyPolicy = exports.AllowIfSubPolicyAllowsRule = exports.DelayedResultRule = exports.AllowIfConditionAppliesRule = exports.DenyIfViewerOutboundEdgeToEntPropertyDoesNotExistRule = exports.DenyIfViewerInboundEdgeToEntPropertyDoesNotExistRule = exports.DenyIfViewerOutboundEdgeDoesNotExistRule = exports.DenyIfViewerInboundEdgeDoesNotExistRule = exports.DenyIfEdgeDoesNotExistRule = exports.DenyIfEdgeExistsFromEntPropertyToViewerRule = exports.DenyIfViewerOutboundEdgeToEntPropertyExistsRule = exports.DenyIfEdgeExistsFromViewerToEntPropertyRule = exports.DenyIfViewerInboundEdgeToEntPropertyExistsRule = exports.DenyIfEdgeExistsFromEntToViewerRule = exports.DenyIfViewerOutboundEdgeExistsRule = exports.DenyIfEdgeExistsFromViewerToEntRule = exports.DenyIfViewerInboundEdgeExistsRule = exports.DenyIfEdgeExistsRule = exports.AllowIfEdgeExistsFromEntPropertyToViewerRule = exports.AllowIfEdgeExistsFromViewerToEntPropertyRule = exports.AllowIfEdgeExistsFromEntToViewerRule = exports.AllowIfViewerOutboundEdgeExistsRule = exports.AllowIfEdgeExistsFromViewerToEntRule = exports.AllowIfViewerInboundEdgeExistsRule = exports.AllowIfEdgeDoesNotExistRule = exports.AllowIfEdgeExistsRule = exports.DenyIfEntIsNotVisibleRule = exports.DenyIfEntIsVisibleRule = exports.DenyIfEntIsVisiblePolicy = exports.AllowIfEntIsVisiblePolicy = exports.AllowIfEntIsNotVisibleRule = exports.AllowIfEntIsVisibleRule = exports.DenyIfEntPropertyIsRule = exports.AllowIfEntPropertyIsRule = exports.AllowIfViewerIsEntPropertyRule = exports.AllowIfViewerIsRule = exports.DenyIfFuncRule = exports.AllowIfFuncRule = exports.DenyIfViewerEqualsRule = exports.AllowIfViewerEqualsRule = exports.AllowIfViewerRule = exports.AllowIfHasIdentity = exports.DenyIfLoggedInRule = exports.DenyIfLoggedOutRule = exports.AlwaysDenyRule = exports.AlwaysAllowRule = exports.EntPrivacyError = void 0;
|
|
4
|
+
exports.applyPrivacyPolicy = applyPrivacyPolicy;
|
|
5
|
+
exports.applyPrivacyPolicyX = applyPrivacyPolicyX;
|
|
6
|
+
exports.applyPrivacyPolicyImpl = applyPrivacyPolicyImpl;
|
|
5
7
|
const types_1 = require("util/types");
|
|
6
8
|
const base_1 = require("./base");
|
|
7
9
|
const ent_1 = require("./ent");
|
|
@@ -627,7 +629,6 @@ async function applyPrivacyPolicy(v, policy, ent) {
|
|
|
627
629
|
const err = await applyPrivacyPolicyImpl(v, policy, ent);
|
|
628
630
|
return err === null;
|
|
629
631
|
}
|
|
630
|
-
exports.applyPrivacyPolicy = applyPrivacyPolicy;
|
|
631
632
|
async function applyPrivacyPolicyX(v, policy, ent, throwErr) {
|
|
632
633
|
const err = await applyPrivacyPolicyImpl(v, policy, ent, throwErr);
|
|
633
634
|
if (err !== null) {
|
|
@@ -635,7 +636,6 @@ async function applyPrivacyPolicyX(v, policy, ent, throwErr) {
|
|
|
635
636
|
}
|
|
636
637
|
return true;
|
|
637
638
|
}
|
|
638
|
-
exports.applyPrivacyPolicyX = applyPrivacyPolicyX;
|
|
639
639
|
// this will throw an exception if fails or return error | null?
|
|
640
640
|
async function applyPrivacyPolicyImpl(v, policy, ent, throwErr) {
|
|
641
641
|
for (const rule of policy.rules) {
|
|
@@ -659,7 +659,6 @@ async function applyPrivacyPolicyImpl(v, policy, ent, throwErr) {
|
|
|
659
659
|
}
|
|
660
660
|
return new EntInvalidPrivacyPolicyError(policy, ent);
|
|
661
661
|
}
|
|
662
|
-
exports.applyPrivacyPolicyImpl = applyPrivacyPolicyImpl;
|
|
663
662
|
exports.AlwaysAllowPrivacyPolicy = {
|
|
664
663
|
rules: [exports.AlwaysAllowRule],
|
|
665
664
|
};
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.AssocEdgeQueryBase = void 0;
|
|
27
37
|
const clause = __importStar(require("../clause"));
|
package/core/query/query.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assocTests =
|
|
3
|
+
exports.assocTests = assocTests;
|
|
4
4
|
const base_1 = require("../base");
|
|
5
5
|
const ent_1 = require("../ent");
|
|
6
6
|
const viewer_1 = require("../viewer");
|
|
@@ -1483,4 +1483,3 @@ function assocTests(ml, global = false) {
|
|
|
1483
1483
|
});
|
|
1484
1484
|
});
|
|
1485
1485
|
}
|
|
1486
|
-
exports.assocTests = assocTests;
|
package/core/query_impl.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getOrderByPhrase = getOrderByPhrase;
|
|
4
|
+
exports.reverseOrderBy = reverseOrderBy;
|
|
5
|
+
exports.getJoinInfo = getJoinInfo;
|
|
6
|
+
exports.buildQuery = buildQuery;
|
|
4
7
|
function getOrderByPhrase(orderby, alias) {
|
|
5
8
|
return orderby
|
|
6
9
|
.map((v) => {
|
|
@@ -19,7 +22,6 @@ function getOrderByPhrase(orderby, alias) {
|
|
|
19
22
|
})
|
|
20
23
|
.join(", ");
|
|
21
24
|
}
|
|
22
|
-
exports.getOrderByPhrase = getOrderByPhrase;
|
|
23
25
|
function reverseOrderBy(orderby) {
|
|
24
26
|
return orderby.map((o) => {
|
|
25
27
|
const o2 = { ...o };
|
|
@@ -27,7 +29,6 @@ function reverseOrderBy(orderby) {
|
|
|
27
29
|
return o2;
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
|
-
exports.reverseOrderBy = reverseOrderBy;
|
|
31
32
|
function getJoinInfo(join, clauseIdx = 1) {
|
|
32
33
|
let valuesUsed = 0;
|
|
33
34
|
const str = join
|
|
@@ -61,7 +62,6 @@ function getJoinInfo(join, clauseIdx = 1) {
|
|
|
61
62
|
valuesUsed,
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
exports.getJoinInfo = getJoinInfo;
|
|
65
65
|
function buildQuery(options) {
|
|
66
66
|
const fieldsAlias = options.fieldsAlias ?? options.alias;
|
|
67
67
|
const fields = options.fields
|
|
@@ -110,4 +110,3 @@ function buildQuery(options) {
|
|
|
110
110
|
}
|
|
111
111
|
return parts.join(" ");
|
|
112
112
|
}
|
|
113
|
-
exports.buildQuery = buildQuery;
|
package/core/viewer.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ID, Ent, Viewer, Context } from "./base";
|
|
2
2
|
export declare class LoggedOutViewer implements Viewer {
|
|
3
|
-
context?: Context
|
|
3
|
+
context?: Context | undefined;
|
|
4
4
|
marker: string;
|
|
5
|
-
constructor(context?: Context
|
|
5
|
+
constructor(context?: Context | undefined);
|
|
6
6
|
viewerID: null;
|
|
7
7
|
viewer(): Promise<null>;
|
|
8
8
|
instanceKey(): string;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CustomObjectTypes = void 0;
|
|
4
|
+
exports.validateOneCustomField = validateOneCustomField;
|
|
5
|
+
exports.validateCustomFields = validateCustomFields;
|
|
6
|
+
exports.validateCustomMutations = validateCustomMutations;
|
|
7
|
+
exports.validateCustomQueries = validateCustomQueries;
|
|
8
|
+
exports.validateFields = validateFields;
|
|
9
|
+
exports.validateNoCustomFields = validateNoCustomFields;
|
|
10
|
+
exports.validateCustomArgs = validateCustomArgs;
|
|
11
|
+
exports.validateCustomInputObjects = validateCustomInputObjects;
|
|
12
|
+
exports.validateCustomObjects = validateCustomObjects;
|
|
13
|
+
exports.validateCustomInterfaces = validateCustomInterfaces;
|
|
14
|
+
exports.validateCustomUnions = validateCustomUnions;
|
|
15
|
+
exports.validateNoCustomArgs = validateNoCustomArgs;
|
|
16
|
+
exports.validateNoCustomQueries = validateNoCustomQueries;
|
|
17
|
+
exports.validateNoCustomMutations = validateNoCustomMutations;
|
|
18
|
+
exports.validateNoCustomInputObjects = validateNoCustomInputObjects;
|
|
19
|
+
exports.validateNoCustomObjects = validateNoCustomObjects;
|
|
20
|
+
exports.validateNoCustomTypes = validateNoCustomTypes;
|
|
21
|
+
exports.validateNoCustomInterfaces = validateNoCustomInterfaces;
|
|
22
|
+
exports.validateNoCustomUnions = validateNoCustomUnions;
|
|
23
|
+
exports.validateNoCustom = validateNoCustom;
|
|
24
|
+
exports.validateCustomTypes = validateCustomTypes;
|
|
4
25
|
const graphql_1 = require("./graphql");
|
|
5
26
|
function validateOneCustomField(expected) {
|
|
6
27
|
let customFields = graphql_1.GQLCapture.getCustomFields();
|
|
@@ -10,7 +31,6 @@ function validateOneCustomField(expected) {
|
|
|
10
31
|
expect(fields).toBeDefined();
|
|
11
32
|
validateCustomFieldImpl(expected, fields[0]);
|
|
12
33
|
}
|
|
13
|
-
exports.validateOneCustomField = validateOneCustomField;
|
|
14
34
|
function validateCustomFieldsImpl(expected, actual) {
|
|
15
35
|
expect(actual.length).toBe(expected.length);
|
|
16
36
|
for (let i = 0; i < actual.length; i++) {
|
|
@@ -48,15 +68,12 @@ function validateCustomFields(expected) {
|
|
|
48
68
|
validateCustomFieldsImpl(expFields, list);
|
|
49
69
|
}
|
|
50
70
|
}
|
|
51
|
-
exports.validateCustomFields = validateCustomFields;
|
|
52
71
|
function validateCustomMutations(expected) {
|
|
53
72
|
validateCustomFieldsImpl(expected, graphql_1.GQLCapture.getCustomMutations());
|
|
54
73
|
}
|
|
55
|
-
exports.validateCustomMutations = validateCustomMutations;
|
|
56
74
|
function validateCustomQueries(expected) {
|
|
57
75
|
validateCustomFieldsImpl(expected, graphql_1.GQLCapture.getCustomQueries());
|
|
58
76
|
}
|
|
59
|
-
exports.validateCustomQueries = validateCustomQueries;
|
|
60
77
|
function validateFields(actual, expected) {
|
|
61
78
|
expect(actual.length).toBe(expected.length);
|
|
62
79
|
for (let j = 0; j < actual.length; j++) {
|
|
@@ -73,11 +90,9 @@ function validateFields(actual, expected) {
|
|
|
73
90
|
}
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
|
-
exports.validateFields = validateFields;
|
|
77
93
|
function validateNoCustomFields() {
|
|
78
94
|
expect(graphql_1.GQLCapture.getCustomFields().size).toBe(0);
|
|
79
95
|
}
|
|
80
|
-
exports.validateNoCustomFields = validateNoCustomFields;
|
|
81
96
|
function validateCustom(expected, actual) {
|
|
82
97
|
expect(actual.size).toBe(expected.length);
|
|
83
98
|
for (let i = 0; i < expected.length; i++) {
|
|
@@ -92,55 +107,42 @@ function validateCustom(expected, actual) {
|
|
|
92
107
|
function validateCustomArgs(expected) {
|
|
93
108
|
validateCustom(expected, graphql_1.GQLCapture.getCustomArgs());
|
|
94
109
|
}
|
|
95
|
-
exports.validateCustomArgs = validateCustomArgs;
|
|
96
110
|
function validateCustomInputObjects(expected) {
|
|
97
111
|
validateCustom(expected, graphql_1.GQLCapture.getCustomInputObjects());
|
|
98
112
|
}
|
|
99
|
-
exports.validateCustomInputObjects = validateCustomInputObjects;
|
|
100
113
|
function validateCustomObjects(expected) {
|
|
101
114
|
validateCustom(expected, graphql_1.GQLCapture.getCustomObjects());
|
|
102
115
|
}
|
|
103
|
-
exports.validateCustomObjects = validateCustomObjects;
|
|
104
116
|
function validateCustomInterfaces(expected) {
|
|
105
117
|
validateCustom(expected, graphql_1.GQLCapture.getCustomInterfaces());
|
|
106
118
|
}
|
|
107
|
-
exports.validateCustomInterfaces = validateCustomInterfaces;
|
|
108
119
|
function validateCustomUnions(expected) {
|
|
109
120
|
validateCustom(expected, graphql_1.GQLCapture.getCustomUnions());
|
|
110
121
|
}
|
|
111
|
-
exports.validateCustomUnions = validateCustomUnions;
|
|
112
122
|
function validateNoCustomArgs() {
|
|
113
123
|
expect(graphql_1.GQLCapture.getCustomArgs().size).toBe(0);
|
|
114
124
|
}
|
|
115
|
-
exports.validateNoCustomArgs = validateNoCustomArgs;
|
|
116
125
|
function validateNoCustomQueries() {
|
|
117
126
|
expect(graphql_1.GQLCapture.getCustomQueries().length).toBe(0);
|
|
118
127
|
}
|
|
119
|
-
exports.validateNoCustomQueries = validateNoCustomQueries;
|
|
120
128
|
function validateNoCustomMutations() {
|
|
121
129
|
expect(graphql_1.GQLCapture.getCustomMutations().length).toBe(0);
|
|
122
130
|
}
|
|
123
|
-
exports.validateNoCustomMutations = validateNoCustomMutations;
|
|
124
131
|
function validateNoCustomInputObjects() {
|
|
125
132
|
expect(graphql_1.GQLCapture.getCustomInputObjects().size).toBe(0);
|
|
126
133
|
}
|
|
127
|
-
exports.validateNoCustomInputObjects = validateNoCustomInputObjects;
|
|
128
134
|
function validateNoCustomObjects() {
|
|
129
135
|
expect(graphql_1.GQLCapture.getCustomObjects().size).toBe(0);
|
|
130
136
|
}
|
|
131
|
-
exports.validateNoCustomObjects = validateNoCustomObjects;
|
|
132
137
|
function validateNoCustomTypes() {
|
|
133
138
|
expect(graphql_1.GQLCapture.getCustomTypes().size).toBe(0);
|
|
134
139
|
}
|
|
135
|
-
exports.validateNoCustomTypes = validateNoCustomTypes;
|
|
136
140
|
function validateNoCustomInterfaces() {
|
|
137
141
|
expect(graphql_1.GQLCapture.getCustomInterfaces().size).toBe(0);
|
|
138
142
|
}
|
|
139
|
-
exports.validateNoCustomInterfaces = validateNoCustomInterfaces;
|
|
140
143
|
function validateNoCustomUnions() {
|
|
141
144
|
expect(graphql_1.GQLCapture.getCustomUnions().size).toBe(0);
|
|
142
145
|
}
|
|
143
|
-
exports.validateNoCustomUnions = validateNoCustomUnions;
|
|
144
146
|
var CustomObjectTypes;
|
|
145
147
|
(function (CustomObjectTypes) {
|
|
146
148
|
CustomObjectTypes[CustomObjectTypes["Field"] = 1] = "Field";
|
|
@@ -172,7 +174,6 @@ function validateNoCustom(...exceptions) {
|
|
|
172
174
|
validate(CustomObjectTypes.Interface, validateNoCustomInterfaces);
|
|
173
175
|
validate(CustomObjectTypes.Union, validateNoCustomUnions);
|
|
174
176
|
}
|
|
175
|
-
exports.validateNoCustom = validateNoCustom;
|
|
176
177
|
function validateCustomTypes(expected) {
|
|
177
178
|
const actual = graphql_1.GQLCapture.getCustomTypes();
|
|
178
179
|
expect(actual.size).toBe(expected.length);
|
|
@@ -186,4 +187,3 @@ function validateCustomTypes(expected) {
|
|
|
186
187
|
expect(obj.tsImportPath).toBe(expectedObj.tsImportPath);
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
|
-
exports.validateCustomTypes = validateCustomTypes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformUnionTypes =
|
|
3
|
+
exports.transformUnionTypes = transformUnionTypes;
|
|
4
4
|
// this transforms an input for union types from graphql format to TS format
|
|
5
5
|
// in graphql, we represent it as UnionType = {foo: FooType, bar: BarType, baz: BazType}
|
|
6
6
|
// in TS, we repseent it as UnionType = FooType | BarType | BazType
|
|
@@ -32,4 +32,3 @@ function transformUnionTypes(input, pathsList) {
|
|
|
32
32
|
}
|
|
33
33
|
return input;
|
|
34
34
|
}
|
|
35
|
-
exports.transformUnionTypes = transformUnionTypes;
|
package/graphql/node_resolver.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.nodeIDEncoder = exports.EntNodeResolver = void 0;
|
|
4
|
+
exports.registerResolver = registerResolver;
|
|
5
|
+
exports.clearResolvers = clearResolvers;
|
|
6
|
+
exports.resolveID = resolveID;
|
|
7
|
+
exports.mustDecodeIDFromGQLID = mustDecodeIDFromGQLID;
|
|
8
|
+
exports.mustDecodeNullableIDFromGQLID = mustDecodeNullableIDFromGQLID;
|
|
9
|
+
exports.encodeGQLID = encodeGQLID;
|
|
4
10
|
function encodeHelper(nodeType, id) {
|
|
5
11
|
return btoa(`node:${nodeType}:${id}`);
|
|
6
12
|
}
|
|
@@ -43,12 +49,10 @@ let resolvers = new Map();
|
|
|
43
49
|
async function registerResolver(name, resolver) {
|
|
44
50
|
resolvers.set(name, resolver);
|
|
45
51
|
}
|
|
46
|
-
exports.registerResolver = registerResolver;
|
|
47
52
|
// mainly needed for tests
|
|
48
53
|
async function clearResolvers() {
|
|
49
54
|
resolvers.clear();
|
|
50
55
|
}
|
|
51
|
-
exports.clearResolvers = clearResolvers;
|
|
52
56
|
async function resolveID(viewer, id) {
|
|
53
57
|
for (const [_, resolver] of resolvers) {
|
|
54
58
|
const node = await resolver.decodeObj(viewer, id);
|
|
@@ -58,7 +62,6 @@ async function resolveID(viewer, id) {
|
|
|
58
62
|
}
|
|
59
63
|
return null;
|
|
60
64
|
}
|
|
61
|
-
exports.resolveID = resolveID;
|
|
62
65
|
// this takes an id and uses the default node resolver which
|
|
63
66
|
// should have been registered as part of entcodegen and decodes
|
|
64
67
|
const nodeIDEncoder = (source, _args) => {
|
|
@@ -77,7 +80,6 @@ function mustDecodeIDFromGQLID(id) {
|
|
|
77
80
|
}
|
|
78
81
|
return decoded;
|
|
79
82
|
}
|
|
80
|
-
exports.mustDecodeIDFromGQLID = mustDecodeIDFromGQLID;
|
|
81
83
|
// TODO get the right (non-any) return type here. may need to change codegen to do the right thing here
|
|
82
84
|
function mustDecodeNullableIDFromGQLID(id) {
|
|
83
85
|
// support undefined because fields in action
|
|
@@ -90,10 +92,8 @@ function mustDecodeNullableIDFromGQLID(id) {
|
|
|
90
92
|
}
|
|
91
93
|
return decoded;
|
|
92
94
|
}
|
|
93
|
-
exports.mustDecodeNullableIDFromGQLID = mustDecodeNullableIDFromGQLID;
|
|
94
95
|
// This takes an ent and returns the graphql id
|
|
95
96
|
function encodeGQLID(node) {
|
|
96
97
|
// let's do 3 parts. we take the "node" prefix
|
|
97
98
|
return btoa(`node:${node.nodeType}:${node.id}`);
|
|
98
99
|
}
|
|
99
|
-
exports.encodeGQLID = encodeGQLID;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sharedAssocTests =
|
|
3
|
+
exports.sharedAssocTests = sharedAssocTests;
|
|
4
4
|
const viewer_1 = require("../../core/viewer");
|
|
5
5
|
const jest_date_mock_1 = require("jest-date-mock");
|
|
6
6
|
const edge_connection_1 = require("./edge_connection");
|
|
@@ -200,4 +200,3 @@ function sharedAssocTests() {
|
|
|
200
200
|
]);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
exports.sharedAssocTests = sharedAssocTests;
|
package/graphql/scalars/date.js
CHANGED
|
@@ -17,13 +17,18 @@ function normalizeDate(input, throwErr) {
|
|
|
17
17
|
return dt.toISODate();
|
|
18
18
|
}
|
|
19
19
|
if (input instanceof Date) {
|
|
20
|
-
|
|
20
|
+
const result = luxon_1.DateTime.fromJSDate(input).toISODate();
|
|
21
|
+
if (!result) {
|
|
22
|
+
throw throwErr(`Invalid Date value ${input}`);
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
21
25
|
}
|
|
22
26
|
if (input instanceof luxon_1.DateTime) {
|
|
23
|
-
|
|
27
|
+
const result = input.toISODate();
|
|
28
|
+
if (!result) {
|
|
24
29
|
throw throwErr(`Invalid Date value ${input.toISO()}`);
|
|
25
30
|
}
|
|
26
|
-
return
|
|
31
|
+
return result;
|
|
27
32
|
}
|
|
28
33
|
throw throwErr(`Date cannot represent value: ${input}`);
|
|
29
34
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GraphQLScalarType } from "graphql";
|
|
2
|
-
export declare const GraphQLTime: GraphQLScalarType<Date, string>;
|
|
2
|
+
export declare const GraphQLTime: GraphQLScalarType<Date, string | null>;
|
|
@@ -45,15 +45,17 @@ let UserAuthInput = (() => {
|
|
|
45
45
|
let _classDescriptor;
|
|
46
46
|
let _classExtraInitializers = [];
|
|
47
47
|
let _classThis;
|
|
48
|
-
let _instanceExtraInitializers = [];
|
|
49
48
|
let _emailAddress_decorators;
|
|
50
49
|
let _emailAddress_initializers = [];
|
|
50
|
+
let _emailAddress_extraInitializers = [];
|
|
51
51
|
let _password_decorators;
|
|
52
52
|
let _password_initializers = [];
|
|
53
|
+
let _password_extraInitializers = [];
|
|
53
54
|
var UserAuthInput = _classThis = class {
|
|
54
55
|
constructor() {
|
|
55
|
-
this.emailAddress =
|
|
56
|
-
this.password = __runInitializers(this, _password_initializers, void 0);
|
|
56
|
+
this.emailAddress = __runInitializers(this, _emailAddress_initializers, void 0);
|
|
57
|
+
this.password = (__runInitializers(this, _emailAddress_extraInitializers), __runInitializers(this, _password_initializers, void 0));
|
|
58
|
+
__runInitializers(this, _password_extraInitializers);
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
61
|
__setFunctionName(_classThis, "UserAuthInput");
|
|
@@ -67,8 +69,8 @@ let UserAuthInput = (() => {
|
|
|
67
69
|
class: "UserAuthInput",
|
|
68
70
|
type: graphql_2.GraphQLString,
|
|
69
71
|
})];
|
|
70
|
-
__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; } }, metadata: _metadata }, _emailAddress_initializers,
|
|
71
|
-
__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; } }, metadata: _metadata }, _password_initializers,
|
|
72
|
+
__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; } }, metadata: _metadata }, _emailAddress_initializers, _emailAddress_extraInitializers);
|
|
73
|
+
__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; } }, metadata: _metadata }, _password_initializers, _password_extraInitializers);
|
|
72
74
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
73
75
|
UserAuthInput = _classThis = _classDescriptor.value;
|
|
74
76
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
@@ -81,15 +83,17 @@ let UserAuthResponse = (() => {
|
|
|
81
83
|
let _classDescriptor;
|
|
82
84
|
let _classExtraInitializers = [];
|
|
83
85
|
let _classThis;
|
|
84
|
-
let _instanceExtraInitializers = [];
|
|
85
86
|
let _token_decorators;
|
|
86
87
|
let _token_initializers = [];
|
|
88
|
+
let _token_extraInitializers = [];
|
|
87
89
|
let _viewerID_decorators;
|
|
88
90
|
let _viewerID_initializers = [];
|
|
91
|
+
let _viewerID_extraInitializers = [];
|
|
89
92
|
var UserAuthResponse = _classThis = class {
|
|
90
93
|
constructor() {
|
|
91
|
-
this.token =
|
|
92
|
-
this.viewerID = __runInitializers(this, _viewerID_initializers, void 0);
|
|
94
|
+
this.token = __runInitializers(this, _token_initializers, void 0);
|
|
95
|
+
this.viewerID = (__runInitializers(this, _token_extraInitializers), __runInitializers(this, _viewerID_initializers, void 0));
|
|
96
|
+
__runInitializers(this, _viewerID_extraInitializers);
|
|
93
97
|
}
|
|
94
98
|
};
|
|
95
99
|
__setFunctionName(_classThis, "UserAuthResponse");
|
|
@@ -100,8 +104,8 @@ let UserAuthResponse = (() => {
|
|
|
100
104
|
type: graphql_2.GraphQLString,
|
|
101
105
|
})];
|
|
102
106
|
_viewerID_decorators = [(0, graphql_1.gqlField)({ class: "UserAuthResponses", type: graphql_2.GraphQLID })];
|
|
103
|
-
__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; } }, metadata: _metadata }, _token_initializers,
|
|
104
|
-
__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; } }, metadata: _metadata }, _viewerID_initializers,
|
|
107
|
+
__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; } }, metadata: _metadata }, _token_initializers, _token_extraInitializers);
|
|
108
|
+
__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; } }, metadata: _metadata }, _viewerID_initializers, _viewerID_extraInitializers);
|
|
105
109
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
106
110
|
UserAuthResponse = _classThis = _classDescriptor.value;
|
|
107
111
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
package/imports/index.js
CHANGED
|
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.parseCustomImports =
|
|
39
|
+
exports.parseCustomImports = parseCustomImports;
|
|
30
40
|
const glob = __importStar(require("glob"));
|
|
31
41
|
const typescript_1 = __importDefault(require("typescript"));
|
|
32
42
|
const fs = __importStar(require("fs"));
|
|
@@ -91,7 +101,6 @@ function parseCustomImports(filePath, inputs) {
|
|
|
91
101
|
},
|
|
92
102
|
};
|
|
93
103
|
}
|
|
94
|
-
exports.parseCustomImports = parseCustomImports;
|
|
95
104
|
function traverse(sourceFile, f, classMap) {
|
|
96
105
|
typescript_1.default.forEachChild(sourceFile, function (node) {
|
|
97
106
|
switch (node.kind) {
|
package/index.js
CHANGED
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
40
|
};
|