@live-change/content-service 0.3.1 → 0.3.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/index.js +1 -0
- package/metadata.js +227 -0
- package/model.js +2 -2
- package/package.json +4 -4
package/index.js
CHANGED
package/metadata.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
const App = require("@live-change/framework")
|
|
2
|
+
const app = App.app()
|
|
3
|
+
const definition = require('./definition.js')
|
|
4
|
+
|
|
5
|
+
const config = definition.config
|
|
6
|
+
const {
|
|
7
|
+
contentReaderRoles = ['reader'],
|
|
8
|
+
contentWriterRoles = ['writer']
|
|
9
|
+
} = config
|
|
10
|
+
|
|
11
|
+
const urlType = {
|
|
12
|
+
type: String,
|
|
13
|
+
softValidation: ['nonEmpty', 'url']
|
|
14
|
+
}
|
|
15
|
+
const urlArrayType = {
|
|
16
|
+
type: Array,
|
|
17
|
+
of: urlType
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const musicSongsType = {
|
|
21
|
+
type: Array,
|
|
22
|
+
of: {
|
|
23
|
+
type: Object,
|
|
24
|
+
properties: {
|
|
25
|
+
url: urlType,
|
|
26
|
+
disc: {
|
|
27
|
+
type: Number,
|
|
28
|
+
input: 'integer',
|
|
29
|
+
softValidation: ['integer']
|
|
30
|
+
},
|
|
31
|
+
track: {
|
|
32
|
+
type: Number,
|
|
33
|
+
input: 'integer',
|
|
34
|
+
softValidation: ['integer']
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const durationType = {
|
|
41
|
+
type: Number,
|
|
42
|
+
input: 'duration',
|
|
43
|
+
unit: 'seconds',
|
|
44
|
+
softValidation: ['nonEmpty', 'integer']
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const tagsType = {
|
|
48
|
+
type: Array,
|
|
49
|
+
of: {
|
|
50
|
+
type: String
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const Metadata = definition.model({
|
|
55
|
+
name: 'Metadata',
|
|
56
|
+
propertyOfAny: {
|
|
57
|
+
to: 'object',
|
|
58
|
+
readAccessControl: {
|
|
59
|
+
roles: contentReaderRoles
|
|
60
|
+
},
|
|
61
|
+
writeAccessControl: {
|
|
62
|
+
roles: contentWriterRoles
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
properties: {
|
|
66
|
+
title: {
|
|
67
|
+
type: String,
|
|
68
|
+
softValidation: ['nonEmpty', { name: 'maxLength', params: { maxLength: 64 } }]
|
|
69
|
+
},
|
|
70
|
+
description: {
|
|
71
|
+
type: String,
|
|
72
|
+
softValidation: ['nonEmpty', { name: 'maxLength', params: { maxLength: 155 } }]
|
|
73
|
+
},
|
|
74
|
+
og: {
|
|
75
|
+
type: Object,
|
|
76
|
+
properties: {
|
|
77
|
+
title: {
|
|
78
|
+
type: String,
|
|
79
|
+
softValidation: ['nonEmpty', { name: 'maxLength', params: { maxLength: 60 } }]
|
|
80
|
+
},
|
|
81
|
+
description: {
|
|
82
|
+
type: String,
|
|
83
|
+
input: 'textarea',
|
|
84
|
+
softValidation: ['nonEmpty', { name: 'maxLength', params: { maxLength: 65 } }]
|
|
85
|
+
},
|
|
86
|
+
image: {
|
|
87
|
+
type: 'Image',
|
|
88
|
+
softValidation: ['nonEmpty'],
|
|
89
|
+
},
|
|
90
|
+
determiner: {
|
|
91
|
+
type: String
|
|
92
|
+
},
|
|
93
|
+
locale: {
|
|
94
|
+
type: String
|
|
95
|
+
},
|
|
96
|
+
localeAlternate: {
|
|
97
|
+
type: Array,
|
|
98
|
+
of: {
|
|
99
|
+
type: String
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
/* audio: { /// TODO: add audio
|
|
104
|
+
type: 'Audio',
|
|
105
|
+
},*/
|
|
106
|
+
/* video: { /// TODO: add video
|
|
107
|
+
type: 'Video',
|
|
108
|
+
},*/
|
|
109
|
+
type: {
|
|
110
|
+
type: String,
|
|
111
|
+
softValidation: ['nonEmpty'],
|
|
112
|
+
options: [
|
|
113
|
+
'music.song', 'music.album', 'music.playlist', 'music.radio_station',
|
|
114
|
+
'video.movie', 'video.episode', 'video.tv_show', 'video.other',
|
|
115
|
+
'article',
|
|
116
|
+
'book',
|
|
117
|
+
'profile',
|
|
118
|
+
'website'
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
music: {
|
|
122
|
+
if: App.isomorphic(({ props }) => props.og.type.split('.')[0] === 'music'),
|
|
123
|
+
type: Object,
|
|
124
|
+
properties: {
|
|
125
|
+
duration: {
|
|
126
|
+
if: App.isomorphic(({ props }) => ['music.album', 'music.song'].includes(props.og.type)),
|
|
127
|
+
...durationType
|
|
128
|
+
},
|
|
129
|
+
song: {
|
|
130
|
+
if: App.isomorphic(({ props }) => ['music.album', 'music.playlist'].includes(props.og.type)),
|
|
131
|
+
...musicSongsType
|
|
132
|
+
},
|
|
133
|
+
album: {
|
|
134
|
+
if: App.isomorphic(({ props }) => props.og.type === 'music.song'),
|
|
135
|
+
...musicSongsType /// music.song list is compatible with music.album list
|
|
136
|
+
},
|
|
137
|
+
musician: {
|
|
138
|
+
if: App.isomorphic(({ props }) => ['music.album', 'music.song'].includes(props.og.type)),
|
|
139
|
+
...urlArrayType
|
|
140
|
+
},
|
|
141
|
+
releaseDate: {
|
|
142
|
+
if: App.isomorphic(({ props }) => props.og.type === 'music.album'),
|
|
143
|
+
type: Date,
|
|
144
|
+
},
|
|
145
|
+
creator: {
|
|
146
|
+
if: App.isomorphic(({ props }) => ['music.radio_station', 'music.playlist'].includes(props.og.type)),
|
|
147
|
+
...urlArrayType
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
softValidation: ['nonEmpty']
|
|
151
|
+
},
|
|
152
|
+
video: {
|
|
153
|
+
if: App.isomorphic(({ props }) => props.og.type.split('.')[0] === 'video'),
|
|
154
|
+
type: Object,
|
|
155
|
+
properties: {
|
|
156
|
+
actor: {
|
|
157
|
+
type: Array,
|
|
158
|
+
of: {
|
|
159
|
+
type: Object,
|
|
160
|
+
properties: {
|
|
161
|
+
url: urlType,
|
|
162
|
+
role: {
|
|
163
|
+
type: Number,
|
|
164
|
+
softValidation: ['integer']
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
director: urlArrayType,
|
|
170
|
+
writer: urlArrayType,
|
|
171
|
+
durationType: durationType,
|
|
172
|
+
releaseDate: {
|
|
173
|
+
type: Date,
|
|
174
|
+
},
|
|
175
|
+
tag: tagsType,
|
|
176
|
+
series: {
|
|
177
|
+
if: App.isomorphic(({ props }) => props.og.type === 'video.tv_show'),
|
|
178
|
+
...urlType
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
article: {
|
|
183
|
+
if: App.isomorphic(({ props }) => props.og.type === 'article'),
|
|
184
|
+
type: Object,
|
|
185
|
+
properties: {
|
|
186
|
+
publishedTime: {
|
|
187
|
+
type: Date,
|
|
188
|
+
},
|
|
189
|
+
modifiedTime: {
|
|
190
|
+
type: Date,
|
|
191
|
+
},
|
|
192
|
+
expirationTime: {
|
|
193
|
+
type: Date,
|
|
194
|
+
},
|
|
195
|
+
author: urlType,
|
|
196
|
+
section: {
|
|
197
|
+
type: String
|
|
198
|
+
},
|
|
199
|
+
tag: tagsType
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
profile: {
|
|
203
|
+
if: App.isomorphic(({ props }) => props.og.type === 'profile'),
|
|
204
|
+
type: Object,
|
|
205
|
+
properties: {
|
|
206
|
+
firstName: {
|
|
207
|
+
type: String
|
|
208
|
+
},
|
|
209
|
+
lastName: {
|
|
210
|
+
type: String
|
|
211
|
+
},
|
|
212
|
+
username: {
|
|
213
|
+
type: String
|
|
214
|
+
},
|
|
215
|
+
gender: {
|
|
216
|
+
type: String,
|
|
217
|
+
options: ['male', 'female']
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
lastUpdate: {
|
|
224
|
+
type: Date
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
})
|
package/model.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/content-service",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"url": "https://www.viamage.com/"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/framework": "0.7.
|
|
25
|
-
"@live-change/relations-plugin": "0.7.
|
|
24
|
+
"@live-change/framework": "0.7.4",
|
|
25
|
+
"@live-change/relations-plugin": "0.7.4",
|
|
26
26
|
"lru-cache": "^7.12.0",
|
|
27
27
|
"pluralize": "8.0.0",
|
|
28
28
|
"progress-stream": "^2.0.0",
|
|
29
29
|
"prosemirror-model": "^1.18.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "bc5b4a025949ef0ee18730d69ac2edf204f40317"
|
|
32
32
|
}
|