@routevn/creator-model 1.1.7 → 1.1.8
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 +81 -2
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -2129,6 +2129,7 @@ const validateCharacterSpriteItems = ({ items, path, errorFactory }) => {
|
|
|
2129
2129
|
"id",
|
|
2130
2130
|
"type",
|
|
2131
2131
|
"name",
|
|
2132
|
+
"thumbnailFileId",
|
|
2132
2133
|
"fileId",
|
|
2133
2134
|
"fileType",
|
|
2134
2135
|
"fileSize",
|
|
@@ -2165,6 +2166,16 @@ const validateCharacterSpriteItems = ({ items, path, errorFactory }) => {
|
|
|
2165
2166
|
}
|
|
2166
2167
|
|
|
2167
2168
|
if (item.type === "image") {
|
|
2169
|
+
if (
|
|
2170
|
+
item.thumbnailFileId !== undefined &&
|
|
2171
|
+
!isNonEmptyString(item.thumbnailFileId)
|
|
2172
|
+
) {
|
|
2173
|
+
return invalidFromErrorFactory(
|
|
2174
|
+
errorFactory,
|
|
2175
|
+
`${itemPath}.thumbnailFileId must be a non-empty string when provided`,
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2168
2179
|
if (!isNonEmptyString(item.fileId)) {
|
|
2169
2180
|
return invalidFromErrorFactory(
|
|
2170
2181
|
errorFactory,
|
|
@@ -4254,6 +4265,25 @@ export const assertInvariants = ({ state }) => {
|
|
|
4254
4265
|
if (!result.valid) {
|
|
4255
4266
|
return result;
|
|
4256
4267
|
}
|
|
4268
|
+
|
|
4269
|
+
if (sprite.thumbnailFileId === undefined) {
|
|
4270
|
+
continue;
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4273
|
+
const thumbnailResult = validateFileReference({
|
|
4274
|
+
state,
|
|
4275
|
+
fileId: sprite.thumbnailFileId,
|
|
4276
|
+
path: "character.sprite.thumbnailFileId",
|
|
4277
|
+
details: {
|
|
4278
|
+
characterId,
|
|
4279
|
+
spriteId,
|
|
4280
|
+
thumbnailFileId: sprite.thumbnailFileId,
|
|
4281
|
+
},
|
|
4282
|
+
errorFactory: createInvariantValidationError,
|
|
4283
|
+
});
|
|
4284
|
+
if (!thumbnailResult.valid) {
|
|
4285
|
+
return thumbnailResult;
|
|
4286
|
+
}
|
|
4257
4287
|
}
|
|
4258
4288
|
}
|
|
4259
4289
|
|
|
@@ -6323,6 +6353,7 @@ const validateCharacterSpriteCreateData = ({ data, errorFactory }) => {
|
|
|
6323
6353
|
"type",
|
|
6324
6354
|
"name",
|
|
6325
6355
|
"fileId",
|
|
6356
|
+
"thumbnailFileId",
|
|
6326
6357
|
"fileType",
|
|
6327
6358
|
"fileSize",
|
|
6328
6359
|
"width",
|
|
@@ -6351,6 +6382,16 @@ const validateCharacterSpriteCreateData = ({ data, errorFactory }) => {
|
|
|
6351
6382
|
);
|
|
6352
6383
|
}
|
|
6353
6384
|
|
|
6385
|
+
if (
|
|
6386
|
+
data.thumbnailFileId !== undefined &&
|
|
6387
|
+
!isNonEmptyString(data.thumbnailFileId)
|
|
6388
|
+
) {
|
|
6389
|
+
return invalidFromErrorFactory(
|
|
6390
|
+
errorFactory,
|
|
6391
|
+
"payload.data.thumbnailFileId must be a non-empty string when provided",
|
|
6392
|
+
);
|
|
6393
|
+
}
|
|
6394
|
+
|
|
6354
6395
|
if (data.fileType !== undefined && !isString(data.fileType)) {
|
|
6355
6396
|
return invalidFromErrorFactory(
|
|
6356
6397
|
errorFactory,
|
|
@@ -6396,6 +6437,7 @@ const validateCharacterSpriteUpdateData = ({ data, errorFactory }) => {
|
|
|
6396
6437
|
"name",
|
|
6397
6438
|
"description",
|
|
6398
6439
|
"fileId",
|
|
6440
|
+
"thumbnailFileId",
|
|
6399
6441
|
"fileType",
|
|
6400
6442
|
"fileSize",
|
|
6401
6443
|
"width",
|
|
@@ -6430,6 +6472,16 @@ const validateCharacterSpriteUpdateData = ({ data, errorFactory }) => {
|
|
|
6430
6472
|
);
|
|
6431
6473
|
}
|
|
6432
6474
|
|
|
6475
|
+
if (
|
|
6476
|
+
data.thumbnailFileId !== undefined &&
|
|
6477
|
+
!isNonEmptyString(data.thumbnailFileId)
|
|
6478
|
+
) {
|
|
6479
|
+
return invalidFromErrorFactory(
|
|
6480
|
+
errorFactory,
|
|
6481
|
+
"payload.data.thumbnailFileId must be a non-empty string when provided",
|
|
6482
|
+
);
|
|
6483
|
+
}
|
|
6484
|
+
|
|
6433
6485
|
if (data.description !== undefined && !isString(data.description)) {
|
|
6434
6486
|
return invalidFromErrorFactory(
|
|
6435
6487
|
errorFactory,
|
|
@@ -7863,6 +7915,15 @@ const findReferencedFileUsage = ({ state, fileId }) => {
|
|
|
7863
7915
|
characterId,
|
|
7864
7916
|
};
|
|
7865
7917
|
}
|
|
7918
|
+
|
|
7919
|
+
if (sprite.thumbnailFileId === fileId) {
|
|
7920
|
+
return {
|
|
7921
|
+
kind: "character.sprite",
|
|
7922
|
+
field: "thumbnailFileId",
|
|
7923
|
+
ownerId: spriteId,
|
|
7924
|
+
characterId,
|
|
7925
|
+
};
|
|
7926
|
+
}
|
|
7866
7927
|
}
|
|
7867
7928
|
}
|
|
7868
7929
|
|
|
@@ -11843,6 +11904,24 @@ const COMMAND_DEFINITIONS = [
|
|
|
11843
11904
|
if (!result.valid) {
|
|
11844
11905
|
return result;
|
|
11845
11906
|
}
|
|
11907
|
+
|
|
11908
|
+
if (sprite.thumbnailFileId === undefined) {
|
|
11909
|
+
continue;
|
|
11910
|
+
}
|
|
11911
|
+
|
|
11912
|
+
const thumbnailResult = validateFileReference({
|
|
11913
|
+
state,
|
|
11914
|
+
fileId: sprite.thumbnailFileId,
|
|
11915
|
+
path: "payload.data.sprites.items.*.thumbnailFileId",
|
|
11916
|
+
details: {
|
|
11917
|
+
characterId: payload.characterId,
|
|
11918
|
+
spriteId,
|
|
11919
|
+
thumbnailFileId: sprite.thumbnailFileId,
|
|
11920
|
+
},
|
|
11921
|
+
});
|
|
11922
|
+
if (!thumbnailResult.valid) {
|
|
11923
|
+
return thumbnailResult;
|
|
11924
|
+
}
|
|
11846
11925
|
}
|
|
11847
11926
|
},
|
|
11848
11927
|
validateUpdateState: ({ state, payload, currentItem }) => {
|
|
@@ -12105,7 +12184,7 @@ const COMMAND_DEFINITIONS = [
|
|
|
12105
12184
|
const result = validateReferencedFilesInData({
|
|
12106
12185
|
state,
|
|
12107
12186
|
data: payload.data,
|
|
12108
|
-
fields: ["fileId"],
|
|
12187
|
+
fields: ["fileId", "thumbnailFileId"],
|
|
12109
12188
|
details: {
|
|
12110
12189
|
characterId: payload.characterId,
|
|
12111
12190
|
spriteId: payload.spriteId,
|
|
@@ -12208,7 +12287,7 @@ const COMMAND_DEFINITIONS = [
|
|
|
12208
12287
|
const result = validateReferencedFilesInData({
|
|
12209
12288
|
state,
|
|
12210
12289
|
data: payload.data,
|
|
12211
|
-
fields: ["fileId"],
|
|
12290
|
+
fields: ["fileId", "thumbnailFileId"],
|
|
12212
12291
|
details: {
|
|
12213
12292
|
characterId: payload.characterId,
|
|
12214
12293
|
spriteId: payload.spriteId,
|