2017-11-26 23:42:27 +02:00
|
|
|
import {Match} from 'meteor/check';
|
|
|
|
import {Mongo} from 'meteor/mongo';
|
2017-11-26 17:03:43 +02:00
|
|
|
|
2017-11-28 17:38:51 +02:00
|
|
|
export const DenormalizeSchema = {
|
2017-11-26 23:42:27 +02:00
|
|
|
field: String,
|
|
|
|
body: Object,
|
|
|
|
bypassSchema: Match.Maybe(Boolean)
|
|
|
|
};
|
2016-09-14 16:04:08 +03:00
|
|
|
|
2017-11-26 23:42:27 +02:00
|
|
|
export const LinkConfigDefaults = {
|
|
|
|
type: 'one',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LinkConfigSchema = {
|
|
|
|
type: Match.Maybe(Match.OneOf('one', 'many', '1', '*')),
|
|
|
|
collection: Match.Maybe(
|
2017-12-21 18:58:34 +02:00
|
|
|
Match.Where(collection => {
|
|
|
|
// We do like this so it works with other types of collections
|
|
|
|
// like FS.Collection
|
|
|
|
return _.isObject(collection) && (
|
|
|
|
collection instanceof Mongo.Collection
|
|
|
|
||
|
|
|
|
!!collection._collection
|
|
|
|
);
|
|
|
|
})
|
2017-11-26 23:42:27 +02:00
|
|
|
),
|
|
|
|
field: Match.Maybe(String),
|
|
|
|
metadata: Match.Maybe(Boolean),
|
|
|
|
inversedBy: Match.Maybe(String),
|
|
|
|
index: Match.Maybe(Boolean),
|
|
|
|
unique: Match.Maybe(Boolean),
|
|
|
|
autoremove: Match.Maybe(Boolean),
|
2017-11-28 17:38:51 +02:00
|
|
|
denormalize: Match.Maybe(Match.ObjectIncluding(DenormalizeSchema)),
|
2017-11-26 23:42:27 +02:00
|
|
|
};
|