@snowtop/ent 0.1.21 → 0.1.22
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 +1 -1
- package/action/action.js +4 -4
- package/action/operations.js +2 -2
- package/action/orchestrator.js +1 -1
- package/core/base.d.ts +1 -0
- package/core/base.js +1 -1
- package/core/db.js +1 -1
- package/core/ent.js +11 -1
- package/core/query/shared_assoc_test.js +7 -7
- package/graphql/graphql.js +2 -2
- package/graphql/graphql_field_helpers.js +1 -1
- package/imports/dataz/example1/_auth.js +28 -22
- package/imports/dataz/example1/_viewer.js +13 -8
- package/package.json +14 -14
- package/schema/schema.d.ts +8 -8
- package/schema/schema.js +4 -4
- package/scripts/move_types.js +1 -1
- package/testutils/action/complex_schemas.js +2 -2
- package/testutils/db_mock.js +2 -2
- package/testutils/fake_comms.js +2 -2
- package/testutils/fake_data/const.js +2 -2
- package/testutils/fake_log.js +1 -1
package/action/action.d.ts
CHANGED
|
@@ -91,5 +91,5 @@ interface Orchestrator {
|
|
|
91
91
|
removeOutboundEdge(id2: ID, edgeType: string): void;
|
|
92
92
|
viewer: Viewer;
|
|
93
93
|
}
|
|
94
|
-
export declare function setEdgeTypeInGroup<T extends string>(orchestrator: Orchestrator, inputEnumValue: string, id1: ID, id2: ID,
|
|
94
|
+
export declare function setEdgeTypeInGroup<T extends string>(orchestrator: Orchestrator, inputEnumValue: string, id1: ID, id2: ID, id2NodeType: string, m: Map<T, string>): Promise<void>;
|
|
95
95
|
export declare function clearEdgeTypeInGroup<T extends string>(orchestrator: Orchestrator, id1: ID, id2: ID, m: Map<T, string>): Promise<void>;
|
package/action/action.js
CHANGED
|
@@ -41,7 +41,7 @@ async function saveBuilderImpl(builder, throwErr) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
async function modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, enumValue, edgeType,
|
|
44
|
+
async function modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, enumValue, edgeType, id2NodeType) {
|
|
45
45
|
let edge = await (0, ent_1.loadEdgeForID2)({
|
|
46
46
|
id1: id1,
|
|
47
47
|
id2: id2,
|
|
@@ -54,7 +54,7 @@ async function modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, enumValue,
|
|
|
54
54
|
// TODO: can save a write here by checking in EdgeOperation and not doing this write if nothing
|
|
55
55
|
// has changed.
|
|
56
56
|
if (inputEnumValue === enumValue) {
|
|
57
|
-
orchestrator.addOutboundEdge(id2, edgeType,
|
|
57
|
+
orchestrator.addOutboundEdge(id2, edgeType, id2NodeType);
|
|
58
58
|
}
|
|
59
59
|
if (edge) {
|
|
60
60
|
if (enumValue !== inputEnumValue) {
|
|
@@ -76,10 +76,10 @@ async function modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, enumValue,
|
|
|
76
76
|
// id2: target id
|
|
77
77
|
// nodeType: nodeType of ent in question
|
|
78
78
|
// m: Map<enumType, to EdgeType to check>
|
|
79
|
-
async function setEdgeTypeInGroup(orchestrator, inputEnumValue, id1, id2,
|
|
79
|
+
async function setEdgeTypeInGroup(orchestrator, inputEnumValue, id1, id2, id2NodeType, m) {
|
|
80
80
|
let promises = [];
|
|
81
81
|
for (const [k, v] of m) {
|
|
82
|
-
promises.push(modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, k, v,
|
|
82
|
+
promises.push(modifyEdgeSet(orchestrator, id1, id2, inputEnumValue, k, v, id2NodeType));
|
|
83
83
|
}
|
|
84
84
|
await Promise.all(promises);
|
|
85
85
|
}
|
package/action/operations.js
CHANGED
|
@@ -607,7 +607,7 @@ class EdgeOperation {
|
|
|
607
607
|
id1: id1,
|
|
608
608
|
edgeType: edgeType,
|
|
609
609
|
id2: builder.existingEnt.id,
|
|
610
|
-
id2Type: "",
|
|
610
|
+
id2Type: "", // these 2 shouldn't matter
|
|
611
611
|
id1Type: "",
|
|
612
612
|
disableTransformations: options?.disableTransformations,
|
|
613
613
|
};
|
|
@@ -623,7 +623,7 @@ class EdgeOperation {
|
|
|
623
623
|
id2: id2,
|
|
624
624
|
edgeType: edgeType,
|
|
625
625
|
id1: builder.existingEnt.id,
|
|
626
|
-
id2Type: "",
|
|
626
|
+
id2Type: "", // these 2 shouldn't matter
|
|
627
627
|
id1Type: "",
|
|
628
628
|
disableTransformations: options?.disableTransformations,
|
|
629
629
|
};
|
package/action/orchestrator.js
CHANGED
|
@@ -42,7 +42,7 @@ var edgeDirection;
|
|
|
42
42
|
(function (edgeDirection) {
|
|
43
43
|
edgeDirection[edgeDirection["inboundEdge"] = 0] = "inboundEdge";
|
|
44
44
|
edgeDirection[edgeDirection["outboundEdge"] = 1] = "outboundEdge";
|
|
45
|
-
})(edgeDirection
|
|
45
|
+
})(edgeDirection || (exports.edgeDirection = edgeDirection = {}));
|
|
46
46
|
class edgeInputData {
|
|
47
47
|
constructor(opts) {
|
|
48
48
|
Object.assign(this, opts);
|
package/core/base.d.ts
CHANGED
package/core/base.js
CHANGED
|
@@ -58,4 +58,4 @@ var WriteOperation;
|
|
|
58
58
|
WriteOperation["Insert"] = "insert";
|
|
59
59
|
WriteOperation["Edit"] = "edit";
|
|
60
60
|
WriteOperation["Delete"] = "delete";
|
|
61
|
-
})(WriteOperation
|
|
61
|
+
})(WriteOperation || (exports.WriteOperation = WriteOperation = {}));
|
package/core/db.js
CHANGED
|
@@ -38,7 +38,7 @@ var Dialect;
|
|
|
38
38
|
(function (Dialect) {
|
|
39
39
|
Dialect["Postgres"] = "postgres";
|
|
40
40
|
Dialect["SQLite"] = "sqlite";
|
|
41
|
-
})(Dialect
|
|
41
|
+
})(Dialect || (exports.Dialect = Dialect = {}));
|
|
42
42
|
function parseConnectionString(str, args) {
|
|
43
43
|
if (str.startsWith("sqlite:///")) {
|
|
44
44
|
let filePath = str.substr(10);
|
package/core/ent.js
CHANGED
|
@@ -446,8 +446,18 @@ async function loadCustomDataImpl(options, query, context) {
|
|
|
446
446
|
else {
|
|
447
447
|
// this will have rudimentary caching but nothing crazy
|
|
448
448
|
let cls = query.clause;
|
|
449
|
+
let opts = options.loaderFactory.options;
|
|
450
|
+
if (query.alias) {
|
|
451
|
+
if (opts.alias) {
|
|
452
|
+
throw new Error(`cannot have an alias in LoaderOptions and QueryOptions. can only pass one`);
|
|
453
|
+
}
|
|
454
|
+
opts = {
|
|
455
|
+
...opts,
|
|
456
|
+
alias: query.alias,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
449
459
|
if (!query.disableTransformations) {
|
|
450
|
-
cls = clause.getCombinedClause(
|
|
460
|
+
cls = clause.getCombinedClause(opts, query.clause, true);
|
|
451
461
|
}
|
|
452
462
|
return loadRows({
|
|
453
463
|
...query,
|
|
@@ -1255,9 +1255,9 @@ function assocTests(ml, global = false) {
|
|
|
1255
1255
|
const user4 = users[3];
|
|
1256
1256
|
const query = index_1.UserToFriendsQuery.query(user1.viewer, user1.id).__union(index_1.UserToFriendsQuery.query(user1.viewer, user2.id), index_1.UserToFriendsQuery.query(user1.viewer, user3.id), index_1.UserToFriendsQuery.query(user1.viewer, user4.id));
|
|
1257
1257
|
const candidates = Array.from(new Set([
|
|
1258
|
-
...(friends.get(user1.id) ?? []),
|
|
1259
|
-
...(friends.get(user2.id) ?? []),
|
|
1260
|
-
...(friends.get(user3.id) ?? []),
|
|
1258
|
+
...(friends.get(user1.id) ?? []), // 0-9 (-self) + 5 friends
|
|
1259
|
+
...(friends.get(user2.id) ?? []), // 0-9 (-self) + 6 friends
|
|
1260
|
+
...(friends.get(user3.id) ?? []), // 0-9 (-self) + 7 friends
|
|
1261
1261
|
...(friends.get(user4.id) ?? []), // 0-9 (-self) + 8 friends
|
|
1262
1262
|
]).values());
|
|
1263
1263
|
// user1 can only see self + friends
|
|
@@ -1286,13 +1286,13 @@ function assocTests(ml, global = false) {
|
|
|
1286
1286
|
user2.id,
|
|
1287
1287
|
]).__union(index_1.UserToFriendsQuery.query(user2.viewer, user3.id), index_1.UserToFriendsQuery.query(user2.viewer, user4.id));
|
|
1288
1288
|
const candidates1 = Array.from(new Set([
|
|
1289
|
-
...(friends.get(user1.id) ?? []),
|
|
1290
|
-
...(friends.get(user3.id) ?? []),
|
|
1289
|
+
...(friends.get(user1.id) ?? []), // 0-9 (-self) + 5 friends
|
|
1290
|
+
...(friends.get(user3.id) ?? []), // 0-9 (-self) + 7 friends
|
|
1291
1291
|
...(friends.get(user4.id) ?? []), // 0-9 (-self) + 8 friends
|
|
1292
1292
|
]).values());
|
|
1293
1293
|
const candidates2 = Array.from(new Set([
|
|
1294
|
-
...(friends.get(user2.id) ?? []),
|
|
1295
|
-
...(friends.get(user3.id) ?? []),
|
|
1294
|
+
...(friends.get(user2.id) ?? []), // 0-9 (-self) + 6 friends
|
|
1295
|
+
...(friends.get(user3.id) ?? []), // 0-9 (-self) + 7 friends
|
|
1296
1296
|
...(friends.get(user4.id) ?? []), // 0-9 (-self) + 8 friends
|
|
1297
1297
|
]).values());
|
|
1298
1298
|
const [idsMap, countMap, edgesMap, entsMap] = await Promise.all([
|
package/graphql/graphql.js
CHANGED
|
@@ -9,7 +9,7 @@ var CustomFieldType;
|
|
|
9
9
|
CustomFieldType["Field"] = "FIELD";
|
|
10
10
|
CustomFieldType["Function"] = "FUNCTION";
|
|
11
11
|
CustomFieldType["AsyncFunction"] = "ASYNC_FUNCTION";
|
|
12
|
-
})(CustomFieldType
|
|
12
|
+
})(CustomFieldType || (exports.CustomFieldType = CustomFieldType = {}));
|
|
13
13
|
var NullableResult;
|
|
14
14
|
(function (NullableResult) {
|
|
15
15
|
NullableResult["CONTENTS"] = "contents";
|
|
@@ -534,6 +534,7 @@ class GQLCapture {
|
|
|
534
534
|
resolveFields(GQLCapture.customMutations);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
+
exports.GQLCapture = GQLCapture;
|
|
537
538
|
GQLCapture.enabled = false;
|
|
538
539
|
// map from class name to fields
|
|
539
540
|
GQLCapture.customFields = new Map();
|
|
@@ -545,7 +546,6 @@ GQLCapture.customObjects = new Map();
|
|
|
545
546
|
GQLCapture.customInterfaces = new Map();
|
|
546
547
|
GQLCapture.customUnions = new Map();
|
|
547
548
|
GQLCapture.customTypes = new Map();
|
|
548
|
-
exports.GQLCapture = GQLCapture;
|
|
549
549
|
// why is this a static class lol?
|
|
550
550
|
// TODO make all these just plain functions
|
|
551
551
|
exports.gqlField = GQLCapture.gqlField;
|
|
@@ -152,7 +152,7 @@ var CustomObjectTypes;
|
|
|
152
152
|
CustomObjectTypes[CustomObjectTypes["CustomTypes"] = 64] = "CustomTypes";
|
|
153
153
|
CustomObjectTypes[CustomObjectTypes["Interface"] = 128] = "Interface";
|
|
154
154
|
CustomObjectTypes[CustomObjectTypes["Union"] = 256] = "Union";
|
|
155
|
-
})(CustomObjectTypes
|
|
155
|
+
})(CustomObjectTypes || (exports.CustomObjectTypes = CustomObjectTypes = {}));
|
|
156
156
|
// what's a good name for this instead?
|
|
157
157
|
function validateNoCustom(...exceptions) {
|
|
158
158
|
let bit = 0;
|
|
@@ -16,10 +16,10 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
16
16
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
17
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
18
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.
|
|
19
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
20
|
}
|
|
21
21
|
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.
|
|
22
|
+
if (kind === "field") initializers.unshift(_);
|
|
23
23
|
else descriptor[key] = _;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -58,6 +58,7 @@ let UserAuthInput = (() => {
|
|
|
58
58
|
};
|
|
59
59
|
__setFunctionName(_classThis, "UserAuthInput");
|
|
60
60
|
(() => {
|
|
61
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
61
62
|
_emailAddress_decorators = [(0, graphql_1.gqlField)({
|
|
62
63
|
class: "UserAuthInput",
|
|
63
64
|
type: graphql_2.GraphQLString,
|
|
@@ -66,58 +67,62 @@ let UserAuthInput = (() => {
|
|
|
66
67
|
class: "UserAuthInput",
|
|
67
68
|
type: graphql_2.GraphQLString,
|
|
68
69
|
})];
|
|
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);
|
|
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, _instanceExtraInitializers);
|
|
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, _instanceExtraInitializers);
|
|
72
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
72
73
|
UserAuthInput = _classThis = _classDescriptor.value;
|
|
74
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
73
75
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
74
76
|
})();
|
|
75
77
|
return UserAuthInput = _classThis;
|
|
76
78
|
})();
|
|
77
79
|
let UserAuthResponse = (() => {
|
|
78
|
-
let
|
|
79
|
-
let
|
|
80
|
-
let
|
|
81
|
-
let
|
|
82
|
-
let
|
|
80
|
+
let _classDecorators = [(0, graphql_1.gqlObjectType)()];
|
|
81
|
+
let _classDescriptor;
|
|
82
|
+
let _classExtraInitializers = [];
|
|
83
|
+
let _classThis;
|
|
84
|
+
let _instanceExtraInitializers = [];
|
|
83
85
|
let _token_decorators;
|
|
84
86
|
let _token_initializers = [];
|
|
85
87
|
let _viewerID_decorators;
|
|
86
88
|
let _viewerID_initializers = [];
|
|
87
|
-
var UserAuthResponse =
|
|
89
|
+
var UserAuthResponse = _classThis = class {
|
|
88
90
|
constructor() {
|
|
89
|
-
this.token = (__runInitializers(this,
|
|
91
|
+
this.token = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _token_initializers, void 0));
|
|
90
92
|
this.viewerID = __runInitializers(this, _viewerID_initializers, void 0);
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
|
-
__setFunctionName(
|
|
95
|
+
__setFunctionName(_classThis, "UserAuthResponse");
|
|
94
96
|
(() => {
|
|
97
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
95
98
|
_token_decorators = [(0, graphql_1.gqlField)({
|
|
96
99
|
class: "UserAuthResponse",
|
|
97
100
|
type: graphql_2.GraphQLString,
|
|
98
101
|
})];
|
|
99
102
|
_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,
|
|
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,
|
|
102
|
-
__esDecorate(null,
|
|
103
|
-
UserAuthResponse =
|
|
104
|
-
|
|
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, _instanceExtraInitializers);
|
|
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, _instanceExtraInitializers);
|
|
105
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
106
|
+
UserAuthResponse = _classThis = _classDescriptor.value;
|
|
107
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
108
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
105
109
|
})();
|
|
106
|
-
return UserAuthResponse =
|
|
110
|
+
return UserAuthResponse = _classThis;
|
|
107
111
|
})();
|
|
108
112
|
let AuthResolver = (() => {
|
|
109
113
|
var _a;
|
|
110
|
-
let
|
|
114
|
+
let _instanceExtraInitializers = [];
|
|
111
115
|
let _userAuth_decorators;
|
|
112
116
|
return _a = class AuthResolver {
|
|
113
117
|
async userAuth(input) {
|
|
114
118
|
throw new Error("not implemented");
|
|
115
119
|
}
|
|
116
120
|
constructor() {
|
|
117
|
-
__runInitializers(this,
|
|
121
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
118
122
|
}
|
|
119
123
|
},
|
|
120
124
|
(() => {
|
|
125
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
121
126
|
_userAuth_decorators = [(0, graphql_1.gqlMutation)({
|
|
122
127
|
class: "AuthResolver",
|
|
123
128
|
name: "userAuth",
|
|
@@ -129,7 +134,8 @@ let AuthResolver = (() => {
|
|
|
129
134
|
},
|
|
130
135
|
],
|
|
131
136
|
})];
|
|
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,
|
|
137
|
+
__esDecorate(_a, null, _userAuth_decorators, { kind: "method", name: "userAuth", static: false, private: false, access: { has: obj => "userAuth" in obj, get: obj => obj.userAuth }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
138
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
133
139
|
})(),
|
|
134
140
|
_a;
|
|
135
141
|
})();
|
|
@@ -23,10 +23,10 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
23
23
|
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
24
24
|
if (_ = accept(result.get)) descriptor.get = _;
|
|
25
25
|
if (_ = accept(result.set)) descriptor.set = _;
|
|
26
|
-
if (_ = accept(result.init)) initializers.
|
|
26
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
27
27
|
}
|
|
28
28
|
else if (_ = accept(result)) {
|
|
29
|
-
if (kind === "field") initializers.
|
|
29
|
+
if (kind === "field") initializers.unshift(_);
|
|
30
30
|
else descriptor[key] = _;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -57,38 +57,43 @@ let ViewerType = (() => {
|
|
|
57
57
|
};
|
|
58
58
|
__setFunctionName(_classThis, "ViewerType");
|
|
59
59
|
(() => {
|
|
60
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
60
61
|
_get_viewerID_decorators = [(0, graphql_1.gqlField)({
|
|
61
62
|
class: "ViewerType",
|
|
62
63
|
type: graphql_2.GraphQLID,
|
|
63
64
|
nullable: true,
|
|
64
65
|
})];
|
|
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);
|
|
66
|
+
__esDecorate(_classThis, null, _get_viewerID_decorators, { kind: "getter", name: "viewerID", static: false, private: false, access: { has: obj => "viewerID" in obj, get: obj => obj.viewerID }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
67
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
67
68
|
ViewerType = _classThis = _classDescriptor.value;
|
|
69
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
68
70
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
69
71
|
})();
|
|
70
72
|
return ViewerType = _classThis;
|
|
71
73
|
})();
|
|
72
|
-
|
|
74
|
+
let ViewerResolver = (() => {
|
|
73
75
|
var _a;
|
|
74
|
-
let
|
|
76
|
+
let _instanceExtraInitializers = [];
|
|
75
77
|
let _viewer_decorators;
|
|
76
78
|
return _a = class ViewerResolver {
|
|
77
79
|
viewer(context) {
|
|
78
80
|
return new ViewerType(context.getViewer());
|
|
79
81
|
}
|
|
80
82
|
constructor() {
|
|
81
|
-
__runInitializers(this,
|
|
83
|
+
__runInitializers(this, _instanceExtraInitializers);
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
(() => {
|
|
87
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
85
88
|
_viewer_decorators = [(0, graphql_1.gqlQuery)({
|
|
86
89
|
class: "ViewerResolver",
|
|
87
90
|
name: "viewer",
|
|
88
91
|
type: ViewerType,
|
|
89
92
|
args: [(0, graphql_1.gqlContextType)()],
|
|
90
93
|
})];
|
|
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,
|
|
94
|
+
__esDecorate(_a, null, _viewer_decorators, { kind: "method", name: "viewer", static: false, private: false, access: { has: obj => "viewer" in obj, get: obj => obj.viewer }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
95
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
92
96
|
})(),
|
|
93
97
|
_a;
|
|
94
98
|
})();
|
|
99
|
+
exports.default = ViewerResolver;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowtop/ent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "snowtop ent framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -8,30 +8,30 @@
|
|
|
8
8
|
"example": "examples"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@types/node": "^20.
|
|
11
|
+
"@types/node": "^20.10.4",
|
|
12
12
|
"camel-case": "^4.1.2",
|
|
13
|
-
"cosmiconfig": "^
|
|
13
|
+
"cosmiconfig": "^9.0.0",
|
|
14
14
|
"dataloader": "^2.2.2",
|
|
15
|
-
"glob": "^10.
|
|
16
|
-
"graph-data-structure": "^3.
|
|
15
|
+
"glob": "^10.3.10",
|
|
16
|
+
"graph-data-structure": "^3.5.0",
|
|
17
17
|
"js-yaml": "^4.1.0",
|
|
18
18
|
"json5": "^2.2.3",
|
|
19
|
-
"luxon": "^3.
|
|
19
|
+
"luxon": "^3.4.4",
|
|
20
20
|
"memoizee": "^0.4.15",
|
|
21
21
|
"minimist": "^1.2.8",
|
|
22
22
|
"pascal-case": "^3.1.2",
|
|
23
|
-
"pg": "^8.11.
|
|
24
|
-
"prettier": "^3.0
|
|
23
|
+
"pg": "^8.11.3",
|
|
24
|
+
"prettier": "^3.1.0",
|
|
25
25
|
"snake-case": "^3.0.4",
|
|
26
|
-
"ts-node": "^
|
|
26
|
+
"ts-node": "^11.0.0-beta.1",
|
|
27
27
|
"tsconfig-paths": "^4.2.0",
|
|
28
|
-
"tslib": "^2.
|
|
29
|
-
"typescript": "^5.
|
|
30
|
-
"uuid": "^9.0.
|
|
28
|
+
"tslib": "^2.6.2",
|
|
29
|
+
"typescript": "^5.3.3",
|
|
30
|
+
"uuid": "^9.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@swc-node/register": "^1.6.
|
|
34
|
-
"better-sqlite3": "^
|
|
33
|
+
"@swc-node/register": "^1.6.8",
|
|
34
|
+
"better-sqlite3": "^9.2.2",
|
|
35
35
|
"graphql": "^16.8.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependenciesMeta": {
|
package/schema/schema.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ export interface TransformedUpdateOperation<T extends Ent<TViewer>, TViewer exte
|
|
|
137
137
|
}
|
|
138
138
|
export declare enum DBType {
|
|
139
139
|
UUID = "UUID",
|
|
140
|
-
Int64ID = "Int64ID"
|
|
140
|
+
Int64ID = "Int64ID",// unsupported right now
|
|
141
141
|
Boolean = "Boolean",
|
|
142
142
|
Int = "Int",
|
|
143
143
|
BigInt = "BigInt",
|
|
@@ -145,16 +145,16 @@ export declare enum DBType {
|
|
|
145
145
|
String = "String",
|
|
146
146
|
Timestamp = "Timestamp",
|
|
147
147
|
Timestamptz = "Timestamptz",
|
|
148
|
-
JSON = "JSON"
|
|
149
|
-
JSONB = "JSONB"
|
|
150
|
-
Enum = "Enum"
|
|
151
|
-
StringEnum = "StringEnum"
|
|
152
|
-
IntEnum = "IntEnum"
|
|
148
|
+
JSON = "JSON",//JSON type in the database
|
|
149
|
+
JSONB = "JSONB",// JSONB type in the database Postgres
|
|
150
|
+
Enum = "Enum",// enum type in the database
|
|
151
|
+
StringEnum = "StringEnum",// string type in the database
|
|
152
|
+
IntEnum = "IntEnum",// int type in the database
|
|
153
153
|
Date = "Date",
|
|
154
154
|
Time = "Time",
|
|
155
155
|
Timetz = "Timetz",
|
|
156
|
-
Bytea = "Bytea"
|
|
157
|
-
StringByte = "StringByte"
|
|
156
|
+
Bytea = "Bytea",// bytea type in the database
|
|
157
|
+
StringByte = "StringByte",// string type in the database
|
|
158
158
|
List = "List"
|
|
159
159
|
}
|
|
160
160
|
export interface DeprecatedImportType {
|
package/schema/schema.js
CHANGED
|
@@ -15,7 +15,7 @@ var SQLStatementOperation;
|
|
|
15
15
|
SQLStatementOperation["Update"] = "update";
|
|
16
16
|
// delete -> update theoretically e.g. deleted_at
|
|
17
17
|
SQLStatementOperation["Delete"] = "delete";
|
|
18
|
-
})(SQLStatementOperation
|
|
18
|
+
})(SQLStatementOperation || (exports.SQLStatementOperation = SQLStatementOperation = {}));
|
|
19
19
|
// we want --strictNullChecks flag so nullable is used to type graphql, ts, db
|
|
20
20
|
// should eventually generate (boolean | null) etc
|
|
21
21
|
// supported db types
|
|
@@ -42,7 +42,7 @@ var DBType;
|
|
|
42
42
|
DBType["Bytea"] = "Bytea";
|
|
43
43
|
DBType["StringByte"] = "StringByte";
|
|
44
44
|
DBType["List"] = "List";
|
|
45
|
-
})(DBType
|
|
45
|
+
})(DBType || (exports.DBType = DBType = {}));
|
|
46
46
|
function isSchema(value) {
|
|
47
47
|
return value.fields !== undefined;
|
|
48
48
|
}
|
|
@@ -201,7 +201,7 @@ var ActionOperation;
|
|
|
201
201
|
// you should create a custom action that takes the id as an action only field,
|
|
202
202
|
// and then calls `clearEdgeTypeInGroup` in a trigger to clear
|
|
203
203
|
ActionOperation[ActionOperation["EdgeGroup"] = 64] = "EdgeGroup";
|
|
204
|
-
})(ActionOperation
|
|
204
|
+
})(ActionOperation || (exports.ActionOperation = ActionOperation = {}));
|
|
205
205
|
// sentinel that indicates an action has no fields
|
|
206
206
|
// should be the only field in an action
|
|
207
207
|
// required to differentiate against default value of no fields being set to indicate
|
|
@@ -222,4 +222,4 @@ var ConstraintType;
|
|
|
222
222
|
ConstraintType["Unique"] = "unique";
|
|
223
223
|
ConstraintType["Check"] = "check";
|
|
224
224
|
// index not a constraint and will be its own indices field
|
|
225
|
-
})(ConstraintType
|
|
225
|
+
})(ConstraintType || (exports.ConstraintType = ConstraintType = {}));
|
package/scripts/move_types.js
CHANGED
|
@@ -175,8 +175,8 @@ exports.MessageSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
|
175
175
|
// TODO both id fields
|
|
176
176
|
sender: (0, field_1.StringType)({
|
|
177
177
|
index: true,
|
|
178
|
-
}),
|
|
179
|
-
recipient: (0, field_1.StringType)(),
|
|
178
|
+
}), // can't use from
|
|
179
|
+
recipient: (0, field_1.StringType)(), // can't use to in sqlite
|
|
180
180
|
message: (0, field_1.StringType)(),
|
|
181
181
|
transient: (0, field_1.BooleanType)({ nullable: true }),
|
|
182
182
|
expiresAt: (0, field_1.TimestampType)({ nullable: true }),
|
package/testutils/db_mock.js
CHANGED
|
@@ -30,7 +30,7 @@ var queryType;
|
|
|
30
30
|
queryType[queryType["COMMIT"] = 4] = "COMMIT";
|
|
31
31
|
queryType[queryType["ROLLBACK"] = 5] = "ROLLBACK";
|
|
32
32
|
queryType[queryType["DELETE"] = 6] = "DELETE";
|
|
33
|
-
})(queryType
|
|
33
|
+
})(queryType || (exports.queryType = queryType = {}));
|
|
34
34
|
/**
|
|
35
35
|
* @deprecated
|
|
36
36
|
*/
|
|
@@ -263,8 +263,8 @@ class QueryRecorder {
|
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
+
exports.QueryRecorder = QueryRecorder;
|
|
266
267
|
QueryRecorder.queries = [];
|
|
267
268
|
QueryRecorder.ids = [];
|
|
268
269
|
// we need pkeys when storing...
|
|
269
270
|
QueryRecorder.data = new Map();
|
|
270
|
-
exports.QueryRecorder = QueryRecorder;
|
package/testutils/fake_comms.js
CHANGED
|
@@ -5,7 +5,7 @@ var Mode;
|
|
|
5
5
|
(function (Mode) {
|
|
6
6
|
Mode[Mode["SMS"] = 1] = "SMS";
|
|
7
7
|
Mode[Mode["EMAIL"] = 2] = "EMAIL";
|
|
8
|
-
})(Mode
|
|
8
|
+
})(Mode || (exports.Mode = Mode = {}));
|
|
9
9
|
class FakeComms {
|
|
10
10
|
static send(option) {
|
|
11
11
|
this.sent.push(option);
|
|
@@ -32,5 +32,5 @@ class FakeComms {
|
|
|
32
32
|
this.sent = [];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
FakeComms.sent = [];
|
|
36
35
|
exports.FakeComms = FakeComms;
|
|
36
|
+
FakeComms.sent = [];
|
|
@@ -21,14 +21,14 @@ var EdgeType;
|
|
|
21
21
|
// so a polymorphic edge
|
|
22
22
|
EdgeType["UserToFollowing"] = "userToFollowing";
|
|
23
23
|
EdgeType["ObjectToFollowedUsers"] = "objectToFollowedUsers";
|
|
24
|
-
})(EdgeType
|
|
24
|
+
})(EdgeType || (exports.EdgeType = EdgeType = {}));
|
|
25
25
|
var NodeType;
|
|
26
26
|
(function (NodeType) {
|
|
27
27
|
NodeType["FakeUser"] = "user";
|
|
28
28
|
NodeType["FakeContact"] = "contact";
|
|
29
29
|
NodeType["FakeEvent"] = "event";
|
|
30
30
|
NodeType["FakeTag"] = "tag";
|
|
31
|
-
})(NodeType
|
|
31
|
+
})(NodeType || (exports.NodeType = NodeType = {}));
|
|
32
32
|
exports.SymmetricEdges = new Set();
|
|
33
33
|
exports.SymmetricEdges.add(EdgeType.UserToFriends);
|
|
34
34
|
exports.InverseEdges = new Map([
|
package/testutils/fake_log.js
CHANGED
|
@@ -21,12 +21,12 @@ class FakeLogger {
|
|
|
21
21
|
this.logs = [];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
exports.FakeLogger = FakeLogger;
|
|
24
25
|
// todo this is quick and ideal.
|
|
25
26
|
// more ideal is capturing all console.logs
|
|
26
27
|
// we do it in golang for example
|
|
27
28
|
// and will need this for production launch anyways
|
|
28
29
|
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
|