@dcl/content-validator 6.1.0 → 6.1.1-19274872361.commit-3eda162
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/README.md +4 -0
- package/dist/validations/items/emotes.d.ts +1 -0
- package/dist/validations/items/emotes.d.ts.map +1 -1
- package/dist/validations/items/emotes.js +42 -2
- package/dist/validations/items/emotes.js.map +1 -1
- package/dist/validations/metadata-schema.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,3 +32,7 @@ To make Catalysts accept deployments of new entity types, they must have defined
|
|
|
32
32
|
2. Add entity type and schema on [catalyst-commons](https://github.com/decentraland/catalyst-commons/).
|
|
33
33
|
3. Add entity type and access checker in [access.ts](./src/validations/access-checker/access.ts).
|
|
34
34
|
a. Verify entity pointers can be resolved. If required add a new resolver in [@dcl/urn-resolver](https://github.com/decentraland/urn-resolver).
|
|
35
|
+
|
|
36
|
+
## AI Agent Context
|
|
37
|
+
|
|
38
|
+
For detailed AI Agent context, see [docs/ai-agent-context.md](docs/ai-agent-context.md).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DeploymentToValidate, ValidationResponse } from '../../types';
|
|
2
2
|
export declare function wasCreatedAfterADR74ValidateFn(deployment: DeploymentToValidate): Promise<ValidationResponse>;
|
|
3
3
|
export declare function emoteRepresentationContentValidateFn(deployment: DeploymentToValidate): Promise<ValidationResponse>;
|
|
4
|
+
export declare function emoteADR287ValidateFn(deployment: DeploymentToValidate): Promise<ValidationResponse>;
|
|
4
5
|
export declare const emoteValidateFn: import("../../types").ValidateFn;
|
|
5
6
|
//# sourceMappingURL=emotes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emotes.d.ts","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAwB,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"emotes.d.ts","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAwB,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAM5F,wBAAsB,8BAA8B,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAMlH;AAED,wBAAsB,oCAAoC,CAAC,UAAU,EAAE,oBAAoB,+BAe1F;AAED,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,oBAAoB,+BAiD3E;AAED,eAAO,MAAM,eAAe,kCAG3B,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emoteValidateFn = exports.emoteRepresentationContentValidateFn = exports.wasCreatedAfterADR74ValidateFn = void 0;
|
|
3
|
+
exports.emoteValidateFn = exports.emoteADR287ValidateFn = exports.emoteRepresentationContentValidateFn = exports.wasCreatedAfterADR74ValidateFn = void 0;
|
|
4
4
|
const schemas_1 = require("@dcl/schemas");
|
|
5
5
|
const types_1 = require("../../types");
|
|
6
6
|
const timestamps_1 = require("../timestamps");
|
|
7
7
|
const validations_1 = require("../validations");
|
|
8
|
+
const MAX_SOCIAL_EMOTE_OUTCOMES = 3;
|
|
8
9
|
async function wasCreatedAfterADR74ValidateFn(deployment) {
|
|
9
10
|
return deployment.entity.timestamp < timestamps_1.ADR_74_TIMESTAMP
|
|
10
11
|
? (0, types_1.validationFailed)(`The emote timestamp ${deployment.entity.timestamp} is before ADR 74. Emotes did not exist before ADR 74.`)
|
|
@@ -29,5 +30,44 @@ async function emoteRepresentationContentValidateFn(deployment) {
|
|
|
29
30
|
return types_1.OK;
|
|
30
31
|
}
|
|
31
32
|
exports.emoteRepresentationContentValidateFn = emoteRepresentationContentValidateFn;
|
|
32
|
-
|
|
33
|
+
async function emoteADR287ValidateFn(deployment) {
|
|
34
|
+
const { entity } = deployment;
|
|
35
|
+
const metadata = entity.metadata;
|
|
36
|
+
const data = metadata?.emoteDataADR74;
|
|
37
|
+
if (!data) {
|
|
38
|
+
return (0, types_1.validationFailed)('No emote data found');
|
|
39
|
+
}
|
|
40
|
+
// Check for social emote properties
|
|
41
|
+
const requiredProperties = ['startAnimation', 'randomizeOutcomes', 'outcomes'];
|
|
42
|
+
const presentProperties = requiredProperties.filter((prop) => data[prop] !== undefined);
|
|
43
|
+
// Not a social emote if no properties are present
|
|
44
|
+
if (presentProperties.length === 0) {
|
|
45
|
+
return types_1.OK;
|
|
46
|
+
}
|
|
47
|
+
if (presentProperties.length < requiredProperties.length) {
|
|
48
|
+
const missingProperties = requiredProperties.filter((prop) => data[prop] === undefined);
|
|
49
|
+
return (0, types_1.validationFailed)(`For social emote definition, all properties must be present. Missing: ${missingProperties.join(', ')}`);
|
|
50
|
+
}
|
|
51
|
+
const { startAnimation, outcomes } = data;
|
|
52
|
+
// Validate startAnimation
|
|
53
|
+
if (!schemas_1.StartAnimation.validate(startAnimation)) {
|
|
54
|
+
return (0, types_1.validationFailed)('Some properties of StartAnimation are not valid');
|
|
55
|
+
}
|
|
56
|
+
// Validate outcomes length
|
|
57
|
+
if (!outcomes || outcomes.length === 0) {
|
|
58
|
+
return (0, types_1.validationFailed)('Outcomes array cannot be empty');
|
|
59
|
+
}
|
|
60
|
+
if (outcomes.length > MAX_SOCIAL_EMOTE_OUTCOMES) {
|
|
61
|
+
return (0, types_1.validationFailed)(`Outcomes array can contain up to ${MAX_SOCIAL_EMOTE_OUTCOMES} items`);
|
|
62
|
+
}
|
|
63
|
+
// Validate each outcome
|
|
64
|
+
for (const outcome of outcomes) {
|
|
65
|
+
if (!schemas_1.OutcomeGroup.validate(outcome)) {
|
|
66
|
+
return (0, types_1.validationFailed)('Some properties of Outcome are not valid');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return types_1.OK;
|
|
70
|
+
}
|
|
71
|
+
exports.emoteADR287ValidateFn = emoteADR287ValidateFn;
|
|
72
|
+
exports.emoteValidateFn = (0, validations_1.validateIfTypeMatches)(schemas_1.EntityType.EMOTE, (0, validations_1.validateAll)(wasCreatedAfterADR74ValidateFn, emoteRepresentationContentValidateFn, emoteADR287ValidateFn));
|
|
33
73
|
//# sourceMappingURL=emotes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emotes.js","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"emotes.js","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":";;;AAAA,0CAA8E;AAC9E,uCAA4F;AAC5F,8CAAgD;AAChD,gDAAmE;AAEnE,MAAM,yBAAyB,GAAG,CAAC,CAAA;AAE5B,KAAK,UAAU,8BAA8B,CAAC,UAAgC;IACnF,OAAO,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,6BAAgB;QACnD,CAAC,CAAC,IAAA,wBAAgB,EACd,uBAAuB,UAAU,CAAC,MAAM,CAAC,SAAS,wDAAwD,CAC3G;QACH,CAAC,CAAC,UAAE,CAAA;AACR,CAAC;AAND,wEAMC;AAEM,KAAK,UAAU,oCAAoC,CAAC,UAAgC;IACzF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAiB,CAAA;IACzC,MAAM,eAAe,GAAG,QAAQ,EAAE,cAAc,EAAE,eAAe,CAAA;IACjE,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAA,wBAAgB,EAAC,gCAAgC,CAAC,CAAA;IAC/G,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAA,wBAAgB,EAAC,kBAAkB,CAAC,CAAA;IAE/F,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;QAC5C,KAAK,MAA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QAAQ,EAAE,GAAG,IAAI,CAAA;IAEzC,0BAA0B;IAC1B,IAAI,CAAC,wBAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;QAC5C,OAAO,IAAA,wBAAgB,EAAC,iDAAiD,CAAC,CAAA;KAC3E;IAED,2BAA2B;IAC3B,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACtC,OAAO,IAAA,wBAAgB,EAAC,gCAAgC,CAAC,CAAA;KAC1D;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,yBAAyB,EAAE;QAC/C,OAAO,IAAA,wBAAgB,EAAC,oCAAoC,yBAAyB,QAAQ,CAAC,CAAA;KAC/F;IAED,wBAAwB;IACxB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,IAAI,CAAC,sBAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YACnC,OAAO,IAAA,wBAAgB,EAAC,0CAA0C,CAAC,CAAA;SACpE;KACF;IAED,OAAO,UAAE,CAAA;AACX,CAAC;AAjDD,sDAiDC;AAEY,QAAA,eAAe,GAAG,IAAA,mCAAqB,EAClD,oBAAU,CAAC,KAAK,EAChB,IAAA,yBAAW,EAAC,8BAA8B,EAAE,oCAAoC,EAAE,qBAAqB,CAAC,CACzG,CAAA"}
|
|
@@ -25,7 +25,7 @@ exports.metadataSchemaValidateFn = (0, validations_1.validateAfterADR45)(async f
|
|
|
25
25
|
* to the creation of that ADR. Each timeline is sorted by timestamp.
|
|
26
26
|
* The idea behind this is the ability to version schemas over the time, but run validations
|
|
27
27
|
* according with the deployment original time. (Imagining starting a Content Server from scratch,
|
|
28
|
-
* it will have to sync deployments since the
|
|
28
|
+
* it will have to sync deployments since the launch date).
|
|
29
29
|
* See ADR 74 for more details of schema versioning.
|
|
30
30
|
*/
|
|
31
31
|
const ADRMetadataVersionTimelines = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/content-validator",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1-19274872361.commit-3eda162",
|
|
4
4
|
"description": "Catalyst content validations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@dcl/block-indexer": "^1.1.2",
|
|
43
43
|
"@dcl/content-hash-tree": "^1.1.4",
|
|
44
44
|
"@dcl/hashing": "^3.0.4",
|
|
45
|
-
"@dcl/schemas": "^
|
|
45
|
+
"@dcl/schemas": "^19.8.0",
|
|
46
46
|
"@dcl/urn-resolver": "^3.6.0",
|
|
47
47
|
"@well-known-components/interfaces": "^1.4.3",
|
|
48
48
|
"@well-known-components/thegraph-component": "^1.6.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"files": [
|
|
54
54
|
"dist"
|
|
55
55
|
],
|
|
56
|
-
"commit": "
|
|
56
|
+
"commit": "3eda1629e7adc21fa69b20d953820452ffc489a2"
|
|
57
57
|
}
|