@dcl/content-validator 1.0.0-20220105210353.commit-baf07b8 → 1.0.0-20220105211425.commit-16d0a79
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/dist/validations/index.d.ts.map +1 -1
- package/dist/validations/index.js +1 -18
- package/dist/validations/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/validations/must-have-failed-before.d.ts +0 -6
- package/dist/validations/must-have-failed-before.d.ts.map +0 -1
- package/dist/validations/must-have-failed-before.js +0 -13
- package/dist/validations/must-have-failed-before.js.map +0 -1
- package/dist/validations/no-newer.d.ts +0 -6
- package/dist/validations/no-newer.d.ts.map +0 -1
- package/dist/validations/no-newer.js +0 -14
- package/dist/validations/no-newer.js.map +0 -1
- package/dist/validations/no-redeploy.d.ts +0 -6
- package/dist/validations/no-redeploy.d.ts.map +0 -1
- package/dist/validations/no-redeploy.js +0 -13
- package/dist/validations/no-redeploy.js.map +0 -1
- package/dist/validations/rate-limit.d.ts +0 -6
- package/dist/validations/rate-limit.d.ts.map +0 -1
- package/dist/validations/rate-limit.js +0 -13
- package/dist/validations/rate-limit.js.map +0 -1
- package/dist/validations/recent.d.ts +0 -7
- package/dist/validations/recent.d.ts.map +0 -1
- package/dist/validations/recent.js +0 -27
- package/dist/validations/recent.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAM,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAM,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAWlH;;GAEG;AACH,eAAO,MAAM,aAAa,mBACR,cAAc,kBACd,UAAU,EAAE,KAC3B,QAAQ,kBAAkB,CAM5B,CAAA;AAGD;;GAEG;AACH,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAE5C;;GAEG;AACH,eAAO,MAAM,uBAAuB,eACtB,oBAAoB,iBACjB,aAAa,KAC3B,QAAQ,MAAM,GAAG,MAAM,CAazB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,cAAoE,CAAA;AAEpG;;GAEG;AACH,eAAO,MAAM,oBAAoB,cAA2C,CAAA"}
|
|
@@ -8,11 +8,6 @@ const decentraland_address_1 = require("./decentraland-address");
|
|
|
8
8
|
const entity_structure_1 = require("./entity-structure");
|
|
9
9
|
const ipfs_hashing_1 = require("./ipfs-hashing");
|
|
10
10
|
const metadata_schema_1 = require("./metadata-schema");
|
|
11
|
-
const must_have_failed_before_1 = require("./must-have-failed-before");
|
|
12
|
-
const no_newer_1 = require("./no-newer");
|
|
13
|
-
const no_redeploy_1 = require("./no-redeploy");
|
|
14
|
-
const rate_limit_1 = require("./rate-limit");
|
|
15
|
-
const recent_1 = require("./recent");
|
|
16
11
|
const signature_1 = require("./signature");
|
|
17
12
|
const size_1 = require("./size");
|
|
18
13
|
const wearable_1 = require("./wearable");
|
|
@@ -56,19 +51,7 @@ exports.calculateDeploymentSize = calculateDeploymentSize;
|
|
|
56
51
|
/**
|
|
57
52
|
* @public
|
|
58
53
|
*/
|
|
59
|
-
exports.statefulValidations = [
|
|
60
|
-
no_redeploy_1.noRedeploy,
|
|
61
|
-
signature_1.signature,
|
|
62
|
-
recent_1.recent,
|
|
63
|
-
no_newer_1.noNewer,
|
|
64
|
-
access_1.access,
|
|
65
|
-
size_1.size,
|
|
66
|
-
must_have_failed_before_1.mustHaveFailedBefore,
|
|
67
|
-
wearable_1.wearable,
|
|
68
|
-
content_1.content,
|
|
69
|
-
decentraland_address_1.decentralandAddress,
|
|
70
|
-
rate_limit_1.rateLimit,
|
|
71
|
-
];
|
|
54
|
+
exports.statefulValidations = [signature_1.signature, access_1.access, size_1.size, wearable_1.wearable, content_1.content, decentraland_address_1.decentralandAddress];
|
|
72
55
|
/**
|
|
73
56
|
* @public
|
|
74
57
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":";;;AAAA,oCAAkH;AAClH,oDAAgD;AAChD,uCAAmC;AACnC,iEAA4D;AAC5D,yDAAoD;AACpD,iDAA4C;AAC5C,uDAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":";;;AAAA,oCAAkH;AAClH,oDAAgD;AAChD,uCAAmC;AACnC,iEAA4D;AAC5D,yDAAoD;AACpD,iDAA4C;AAC5C,uDAA4C;AAC5C,2CAAuC;AACvC,iCAA6B;AAC7B,yCAAqC;AAErC;;GAEG;AACI,MAAM,aAAa,GAAG,KAAK,EAChC,cAA8B,EAC9B,GAAG,WAAyB,EACC,EAAE;IAC/B,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;QAC1D,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,OAAO,QAAQ,CAAA;KAClC;IACD,OAAO,UAAE,CAAA;AACX,CAAC,CAAA;AATY,QAAA,aAAa,iBASzB;AAED,6FAA6F;AAC7F;;GAEG;AACU,QAAA,eAAe,GAAG,aAAa,CAAA;AAE5C;;GAEG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAC1C,UAAgC,EAChC,aAA4B,EACF,EAAE;IAC5B,IAAI,SAAS,GAAG,CAAC,CAAA;IACjB,KAAK,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE;QACrF,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,YAAY,EAAE;YAChB,SAAS,IAAI,YAAY,CAAC,UAAU,CAAA;SACrC;aAAM;YACL,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;YAClE,IAAI,CAAC,WAAW;gBAAE,OAAO,0CAA0C,IAAI,EAAE,CAAA;YACzE,SAAS,IAAI,WAAW,CAAA;SACzB;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA;AAhBY,QAAA,uBAAuB,2BAgBnC;AAED;;GAEG;AACU,QAAA,mBAAmB,GAAG,CAAC,qBAAS,EAAE,eAAM,EAAE,WAAI,EAAE,mBAAQ,EAAE,iBAAO,EAAE,0CAAmB,CAAC,CAAA;AAEpG;;GAEG;AACU,QAAA,oBAAoB,GAAG,CAAC,kCAAe,EAAE,0BAAW,EAAE,0BAAQ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/content-validator",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-20220105211425.commit-16d0a79",
|
|
4
4
|
"description": "Catalyst content validations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"files": [
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
|
-
"commit": "
|
|
46
|
+
"commit": "16d0a794c478073df15137dd661dba3ade521e3b"
|
|
47
47
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"must-have-failed-before.d.ts","sourceRoot":"","sources":["../../src/validations/must-have-failed-before.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+BAI/B,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mustHaveFailedBefore = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
/**
|
|
6
|
-
* Make sure that the deployment actually failed, and that it can be re-deployed
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
exports.mustHaveFailedBefore = (0, types_1.conditionalValidation)({
|
|
10
|
-
predicate: async ({ deployment, externalCalls }) => await externalCalls.isFailedDeployment(deployment.entity.type, deployment.entity.id),
|
|
11
|
-
message: () => "This entity was already marked as failed. You can't fix it",
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=must-have-failed-before.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"must-have-failed-before.js","sourceRoot":"","sources":["../../src/validations/must-have-failed-before.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAEhD;;;GAGG;AACU,QAAA,oBAAoB,GAAG,IAAA,6BAAqB,EAAC;IACxD,SAAS,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE,CACjD,MAAM,aAAa,CAAC,kBAAkB,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;IACtF,OAAO,EAAE,GAAG,EAAE,CAAC,4DAA4D;CAC5E,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-newer.d.ts","sourceRoot":"","sources":["../../src/validations/no-newer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,OAAO,+BAIlB,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noNewer = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
/**
|
|
6
|
-
* Validate that there are no newer deployments on the entity's pointers
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
exports.noNewer = (0, types_1.conditionalValidation)({
|
|
10
|
-
// Validate that pointers aren't referring to an entity with a higher timestamp
|
|
11
|
-
predicate: async ({ deployment, externalCalls }) => await externalCalls.areThereNewerEntities(deployment.entity),
|
|
12
|
-
message: () => 'There is a newer entity pointed by one or more of the pointers you provided.',
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=no-newer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-newer.js","sourceRoot":"","sources":["../../src/validations/no-newer.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAEhD;;;GAGG;AACU,QAAA,OAAO,GAAG,IAAA,6BAAqB,EAAC;IAC3C,+EAA+E;IAC/E,SAAS,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,MAAM,aAAa,CAAC,qBAAqB,CAAC,UAAU,CAAC,MAAM,CAAC;IAChH,OAAO,EAAE,GAAG,EAAE,CAAC,8EAA8E;CAC9F,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-redeploy.d.ts","sourceRoot":"","sources":["../../src/validations/no-redeploy.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,UAAU,+BAGrB,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.noRedeploy = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
/**
|
|
6
|
-
* Validate if the entity can be re deployed or not
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
exports.noRedeploy = (0, types_1.conditionalValidation)({
|
|
10
|
-
predicate: async ({ externalCalls }) => await externalCalls.isEntityDeployedAlready(),
|
|
11
|
-
message: () => "This entity was already deployed. You can't redeploy it",
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=no-redeploy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-redeploy.js","sourceRoot":"","sources":["../../src/validations/no-redeploy.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAEhD;;;GAGG;AACU,QAAA,UAAU,GAAG,IAAA,6BAAqB,EAAC;IAC9C,SAAS,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,MAAM,aAAa,CAAC,uBAAuB,EAAE;IACrF,OAAO,EAAE,GAAG,EAAE,CAAC,yDAAyD;CACzE,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/validations/rate-limit.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,SAAS,+BAIpB,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = void 0;
|
|
4
|
-
const types_1 = require("../types");
|
|
5
|
-
/**
|
|
6
|
-
* Validate the deployment is not rate limited
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
exports.rateLimit = (0, types_1.conditionalValidation)({
|
|
10
|
-
predicate: async ({ deployment, externalCalls }) => !(await externalCalls.isEntityRateLimited(deployment.entity)),
|
|
11
|
-
message: ({ deployment }) => `Entity rate limited (entityId=${deployment.entity.id} pointers=${deployment.entity.pointers.join(',')}).`,
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=rate-limit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/validations/rate-limit.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAEhD;;;GAGG;AACU,QAAA,SAAS,GAAG,IAAA,6BAAqB,EAAC;IAC7C,SAAS,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACjH,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAC1B,iCAAiC,UAAU,CAAC,MAAM,CAAC,EAAE,aAAa,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;CAC7G,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recent.d.ts","sourceRoot":"","sources":["../../src/validations/recent.ts"],"names":[],"mappings":"AACA,OAAO,EAAM,UAAU,EAAoB,MAAM,UAAU,CAAA;AAI3D;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,UAWpB,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.recent = void 0;
|
|
7
|
-
const ms_1 = __importDefault(require("ms"));
|
|
8
|
-
const types_1 = require("../types");
|
|
9
|
-
const REQUEST_TTL_FORWARDS = (0, ms_1.default)('15m');
|
|
10
|
-
/**
|
|
11
|
-
* Validate that the deployment is recent
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
exports.recent = {
|
|
15
|
-
validate: ({ deployment, externalCalls }) => {
|
|
16
|
-
// Verify that the timestamp is recent enough. We need to make sure that the definition of recent works with the synchronization mechanism
|
|
17
|
-
const delta = Date.now() - deployment.entity.timestamp;
|
|
18
|
-
if (delta > externalCalls.requestTtlBackwards) {
|
|
19
|
-
return (0, types_1.validationFailed)('The request is not recent enough, please submit it again with a new timestamp.');
|
|
20
|
-
}
|
|
21
|
-
else if (delta < -REQUEST_TTL_FORWARDS) {
|
|
22
|
-
return (0, types_1.validationFailed)('The request is too far in the future, please submit it again with a new timestamp.');
|
|
23
|
-
}
|
|
24
|
-
return types_1.OK;
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=recent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recent.js","sourceRoot":"","sources":["../../src/validations/recent.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,oCAA2D;AAE3D,MAAM,oBAAoB,GAAW,IAAA,YAAE,EAAC,KAAK,CAAC,CAAA;AAE9C;;;GAGG;AACU,QAAA,MAAM,GAAe;IAChC,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE;QAC1C,0IAA0I;QAC1I,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,SAAS,CAAA;QACtD,IAAI,KAAK,GAAG,aAAa,CAAC,mBAAmB,EAAE;YAC7C,OAAO,IAAA,wBAAgB,EAAC,gFAAgF,CAAC,CAAA;SAC1G;aAAM,IAAI,KAAK,GAAG,CAAC,oBAAoB,EAAE;YACxC,OAAO,IAAA,wBAAgB,EAAC,oFAAoF,CAAC,CAAA;SAC9G;QACD,OAAO,UAAE,CAAA;IACX,CAAC;CACF,CAAA"}
|