@routevn/creator-model 1.1.7 → 1.1.9
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 +1 -1
- package/src/model.js +83 -7
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -1072,11 +1072,8 @@ const validateVideoItems = ({ items, path, errorFactory }) => {
|
|
|
1072
1072
|
};
|
|
1073
1073
|
|
|
1074
1074
|
const validateAnimationKeyframes = ({ keyframes, path, errorFactory }) => {
|
|
1075
|
-
if (!Array.isArray(keyframes)
|
|
1076
|
-
return invalidFromErrorFactory(
|
|
1077
|
-
errorFactory,
|
|
1078
|
-
`${path} must be a non-empty array`,
|
|
1079
|
-
);
|
|
1075
|
+
if (!Array.isArray(keyframes)) {
|
|
1076
|
+
return invalidFromErrorFactory(errorFactory, `${path} must be an array`);
|
|
1080
1077
|
}
|
|
1081
1078
|
|
|
1082
1079
|
for (const [index, keyframe] of keyframes.entries()) {
|
|
@@ -2129,6 +2126,7 @@ const validateCharacterSpriteItems = ({ items, path, errorFactory }) => {
|
|
|
2129
2126
|
"id",
|
|
2130
2127
|
"type",
|
|
2131
2128
|
"name",
|
|
2129
|
+
"thumbnailFileId",
|
|
2132
2130
|
"fileId",
|
|
2133
2131
|
"fileType",
|
|
2134
2132
|
"fileSize",
|
|
@@ -2165,6 +2163,16 @@ const validateCharacterSpriteItems = ({ items, path, errorFactory }) => {
|
|
|
2165
2163
|
}
|
|
2166
2164
|
|
|
2167
2165
|
if (item.type === "image") {
|
|
2166
|
+
if (
|
|
2167
|
+
item.thumbnailFileId !== undefined &&
|
|
2168
|
+
!isNonEmptyString(item.thumbnailFileId)
|
|
2169
|
+
) {
|
|
2170
|
+
return invalidFromErrorFactory(
|
|
2171
|
+
errorFactory,
|
|
2172
|
+
`${itemPath}.thumbnailFileId must be a non-empty string when provided`,
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2168
2176
|
if (!isNonEmptyString(item.fileId)) {
|
|
2169
2177
|
return invalidFromErrorFactory(
|
|
2170
2178
|
errorFactory,
|
|
@@ -4254,6 +4262,25 @@ export const assertInvariants = ({ state }) => {
|
|
|
4254
4262
|
if (!result.valid) {
|
|
4255
4263
|
return result;
|
|
4256
4264
|
}
|
|
4265
|
+
|
|
4266
|
+
if (sprite.thumbnailFileId === undefined) {
|
|
4267
|
+
continue;
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
const thumbnailResult = validateFileReference({
|
|
4271
|
+
state,
|
|
4272
|
+
fileId: sprite.thumbnailFileId,
|
|
4273
|
+
path: "character.sprite.thumbnailFileId",
|
|
4274
|
+
details: {
|
|
4275
|
+
characterId,
|
|
4276
|
+
spriteId,
|
|
4277
|
+
thumbnailFileId: sprite.thumbnailFileId,
|
|
4278
|
+
},
|
|
4279
|
+
errorFactory: createInvariantValidationError,
|
|
4280
|
+
});
|
|
4281
|
+
if (!thumbnailResult.valid) {
|
|
4282
|
+
return thumbnailResult;
|
|
4283
|
+
}
|
|
4257
4284
|
}
|
|
4258
4285
|
}
|
|
4259
4286
|
|
|
@@ -6323,6 +6350,7 @@ const validateCharacterSpriteCreateData = ({ data, errorFactory }) => {
|
|
|
6323
6350
|
"type",
|
|
6324
6351
|
"name",
|
|
6325
6352
|
"fileId",
|
|
6353
|
+
"thumbnailFileId",
|
|
6326
6354
|
"fileType",
|
|
6327
6355
|
"fileSize",
|
|
6328
6356
|
"width",
|
|
@@ -6351,6 +6379,16 @@ const validateCharacterSpriteCreateData = ({ data, errorFactory }) => {
|
|
|
6351
6379
|
);
|
|
6352
6380
|
}
|
|
6353
6381
|
|
|
6382
|
+
if (
|
|
6383
|
+
data.thumbnailFileId !== undefined &&
|
|
6384
|
+
!isNonEmptyString(data.thumbnailFileId)
|
|
6385
|
+
) {
|
|
6386
|
+
return invalidFromErrorFactory(
|
|
6387
|
+
errorFactory,
|
|
6388
|
+
"payload.data.thumbnailFileId must be a non-empty string when provided",
|
|
6389
|
+
);
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6354
6392
|
if (data.fileType !== undefined && !isString(data.fileType)) {
|
|
6355
6393
|
return invalidFromErrorFactory(
|
|
6356
6394
|
errorFactory,
|
|
@@ -6396,6 +6434,7 @@ const validateCharacterSpriteUpdateData = ({ data, errorFactory }) => {
|
|
|
6396
6434
|
"name",
|
|
6397
6435
|
"description",
|
|
6398
6436
|
"fileId",
|
|
6437
|
+
"thumbnailFileId",
|
|
6399
6438
|
"fileType",
|
|
6400
6439
|
"fileSize",
|
|
6401
6440
|
"width",
|
|
@@ -6430,6 +6469,16 @@ const validateCharacterSpriteUpdateData = ({ data, errorFactory }) => {
|
|
|
6430
6469
|
);
|
|
6431
6470
|
}
|
|
6432
6471
|
|
|
6472
|
+
if (
|
|
6473
|
+
data.thumbnailFileId !== undefined &&
|
|
6474
|
+
!isNonEmptyString(data.thumbnailFileId)
|
|
6475
|
+
) {
|
|
6476
|
+
return invalidFromErrorFactory(
|
|
6477
|
+
errorFactory,
|
|
6478
|
+
"payload.data.thumbnailFileId must be a non-empty string when provided",
|
|
6479
|
+
);
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6433
6482
|
if (data.description !== undefined && !isString(data.description)) {
|
|
6434
6483
|
return invalidFromErrorFactory(
|
|
6435
6484
|
errorFactory,
|
|
@@ -7863,6 +7912,15 @@ const findReferencedFileUsage = ({ state, fileId }) => {
|
|
|
7863
7912
|
characterId,
|
|
7864
7913
|
};
|
|
7865
7914
|
}
|
|
7915
|
+
|
|
7916
|
+
if (sprite.thumbnailFileId === fileId) {
|
|
7917
|
+
return {
|
|
7918
|
+
kind: "character.sprite",
|
|
7919
|
+
field: "thumbnailFileId",
|
|
7920
|
+
ownerId: spriteId,
|
|
7921
|
+
characterId,
|
|
7922
|
+
};
|
|
7923
|
+
}
|
|
7866
7924
|
}
|
|
7867
7925
|
}
|
|
7868
7926
|
|
|
@@ -11843,6 +11901,24 @@ const COMMAND_DEFINITIONS = [
|
|
|
11843
11901
|
if (!result.valid) {
|
|
11844
11902
|
return result;
|
|
11845
11903
|
}
|
|
11904
|
+
|
|
11905
|
+
if (sprite.thumbnailFileId === undefined) {
|
|
11906
|
+
continue;
|
|
11907
|
+
}
|
|
11908
|
+
|
|
11909
|
+
const thumbnailResult = validateFileReference({
|
|
11910
|
+
state,
|
|
11911
|
+
fileId: sprite.thumbnailFileId,
|
|
11912
|
+
path: "payload.data.sprites.items.*.thumbnailFileId",
|
|
11913
|
+
details: {
|
|
11914
|
+
characterId: payload.characterId,
|
|
11915
|
+
spriteId,
|
|
11916
|
+
thumbnailFileId: sprite.thumbnailFileId,
|
|
11917
|
+
},
|
|
11918
|
+
});
|
|
11919
|
+
if (!thumbnailResult.valid) {
|
|
11920
|
+
return thumbnailResult;
|
|
11921
|
+
}
|
|
11846
11922
|
}
|
|
11847
11923
|
},
|
|
11848
11924
|
validateUpdateState: ({ state, payload, currentItem }) => {
|
|
@@ -12105,7 +12181,7 @@ const COMMAND_DEFINITIONS = [
|
|
|
12105
12181
|
const result = validateReferencedFilesInData({
|
|
12106
12182
|
state,
|
|
12107
12183
|
data: payload.data,
|
|
12108
|
-
fields: ["fileId"],
|
|
12184
|
+
fields: ["fileId", "thumbnailFileId"],
|
|
12109
12185
|
details: {
|
|
12110
12186
|
characterId: payload.characterId,
|
|
12111
12187
|
spriteId: payload.spriteId,
|
|
@@ -12208,7 +12284,7 @@ const COMMAND_DEFINITIONS = [
|
|
|
12208
12284
|
const result = validateReferencedFilesInData({
|
|
12209
12285
|
state,
|
|
12210
12286
|
data: payload.data,
|
|
12211
|
-
fields: ["fileId"],
|
|
12287
|
+
fields: ["fileId", "thumbnailFileId"],
|
|
12212
12288
|
details: {
|
|
12213
12289
|
characterId: payload.characterId,
|
|
12214
12290
|
spriteId: payload.spriteId,
|