@snowtop/ent 0.2.0-alpha.1 → 0.2.0-alpha.2
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/package.json
CHANGED
package/schema/base_schema.js
CHANGED
|
@@ -37,12 +37,12 @@ let nodeField = (0, field_1.UUIDType)({
|
|
|
37
37
|
});
|
|
38
38
|
let nodeFields = {
|
|
39
39
|
// inconsistent naming :(
|
|
40
|
-
|
|
40
|
+
id: nodeField,
|
|
41
41
|
...tsFields,
|
|
42
42
|
};
|
|
43
43
|
let nodeFieldsWithTZ = {
|
|
44
44
|
// inconsistent naming :(
|
|
45
|
-
|
|
45
|
+
id: nodeField,
|
|
46
46
|
createdAt: (0, field_1.TimestampType)({
|
|
47
47
|
hideFromGraphQL: true,
|
|
48
48
|
disableUserEditable: true,
|
package/schema/field.js
CHANGED
|
@@ -57,6 +57,7 @@ class UUIDField extends BaseField {
|
|
|
57
57
|
const polymorphic = this.options?.polymorphic;
|
|
58
58
|
if (polymorphic) {
|
|
59
59
|
let name = "";
|
|
60
|
+
// TODO followup to https://github.com/lolopinto/ent/pull/1757
|
|
60
61
|
if (fieldName.endsWith("_id")) {
|
|
61
62
|
let idx = fieldName.indexOf("_id");
|
|
62
63
|
name = fieldName.substring(0, idx) + "_type";
|
package/testutils/builder.js
CHANGED
|
@@ -211,7 +211,7 @@ class SimpleBuilder {
|
|
|
211
211
|
for (const [name, f] of schemaFields) {
|
|
212
212
|
dbFields.push((0, schema_2.getStorageKey)(f, name));
|
|
213
213
|
}
|
|
214
|
-
if (!schemaFields.has("id")
|
|
214
|
+
if (!schemaFields.has("id")) {
|
|
215
215
|
if (schemaFields.size !== 1) {
|
|
216
216
|
throw new Error(`no id field and multiple fields so can't deduce key. add an id field to schema`);
|
|
217
217
|
}
|
|
@@ -130,7 +130,7 @@ exports.FakeContactSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
|
130
130
|
lastName: (0, schema_1.StringType)(),
|
|
131
131
|
emailAddress: (0, schema_1.StringType)(),
|
|
132
132
|
userID: (0, schema_1.UUIDType)({
|
|
133
|
-
foreignKey: { schema: "User", column: "
|
|
133
|
+
foreignKey: { schema: "User", column: "id" },
|
|
134
134
|
}),
|
|
135
135
|
}, FakeContact);
|
|
136
136
|
exports.FakeContactSchemaWithDeletedAt = (0, builder_1.getBuilderSchemaFromFields)({
|
|
@@ -138,7 +138,7 @@ exports.FakeContactSchemaWithDeletedAt = (0, builder_1.getBuilderSchemaFromField
|
|
|
138
138
|
lastName: (0, schema_1.StringType)(),
|
|
139
139
|
emailAddress: (0, schema_1.StringType)(),
|
|
140
140
|
userID: (0, schema_1.UUIDType)({
|
|
141
|
-
foreignKey: { schema: "User", column: "
|
|
141
|
+
foreignKey: { schema: "User", column: "id" },
|
|
142
142
|
}),
|
|
143
143
|
}, FakeContact, {
|
|
144
144
|
patterns: [new soft_delete_1.DeletedAtPattern()],
|
|
@@ -132,7 +132,7 @@ exports.FakeEventSchema = (0, builder_1.getBuilderSchemaFromFields)({
|
|
|
132
132
|
nullable: true,
|
|
133
133
|
}),
|
|
134
134
|
userID: (0, schema_1.UUIDType)({
|
|
135
|
-
foreignKey: { schema: "User", column: "
|
|
135
|
+
foreignKey: { schema: "User", column: "id" },
|
|
136
136
|
}),
|
|
137
137
|
}, FakeEvent);
|
|
138
138
|
function getEventBuilder(viewer, input) {
|