@dcl/content-validator 1.0.0-20220104134007.commit-80072ed

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.
Files changed (84) hide show
  1. package/README.md +29 -0
  2. package/dist/content-validator.api.json +1177 -0
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +32 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/tsdoc-metadata.json +11 -0
  8. package/dist/types.d.ts +114 -0
  9. package/dist/types.d.ts.map +1 -0
  10. package/dist/types.js +36 -0
  11. package/dist/types.js.map +1 -0
  12. package/dist/validations/access-checker/access.d.ts +7 -0
  13. package/dist/validations/access-checker/access.d.ts.map +1 -0
  14. package/dist/validations/access-checker/access.js +28 -0
  15. package/dist/validations/access-checker/access.js.map +1 -0
  16. package/dist/validations/access-checker/profiles.d.ts +7 -0
  17. package/dist/validations/access-checker/profiles.d.ts.map +1 -0
  18. package/dist/validations/access-checker/profiles.js +30 -0
  19. package/dist/validations/access-checker/profiles.js.map +1 -0
  20. package/dist/validations/access-checker/scenes.d.ts +7 -0
  21. package/dist/validations/access-checker/scenes.d.ts.map +1 -0
  22. package/dist/validations/access-checker/scenes.js +246 -0
  23. package/dist/validations/access-checker/scenes.js.map +1 -0
  24. package/dist/validations/access-checker/wearables.d.ts +20 -0
  25. package/dist/validations/access-checker/wearables.d.ts.map +1 -0
  26. package/dist/validations/access-checker/wearables.js +247 -0
  27. package/dist/validations/access-checker/wearables.js.map +1 -0
  28. package/dist/validations/content.d.ts +7 -0
  29. package/dist/validations/content.d.ts.map +1 -0
  30. package/dist/validations/content.js +48 -0
  31. package/dist/validations/content.js.map +1 -0
  32. package/dist/validations/decentraland-address.d.ts +6 -0
  33. package/dist/validations/decentraland-address.d.ts.map +1 -0
  34. package/dist/validations/decentraland-address.js +19 -0
  35. package/dist/validations/decentraland-address.js.map +1 -0
  36. package/dist/validations/entity-structure.d.ts +7 -0
  37. package/dist/validations/entity-structure.d.ts.map +1 -0
  38. package/dist/validations/entity-structure.js +21 -0
  39. package/dist/validations/entity-structure.js.map +1 -0
  40. package/dist/validations/index.d.ts +22 -0
  41. package/dist/validations/index.d.ts.map +1 -0
  42. package/dist/validations/index.js +76 -0
  43. package/dist/validations/index.js.map +1 -0
  44. package/dist/validations/ipfs-hashing.d.ts +7 -0
  45. package/dist/validations/ipfs-hashing.d.ts.map +1 -0
  46. package/dist/validations/ipfs-hashing.js +25 -0
  47. package/dist/validations/ipfs-hashing.js.map +1 -0
  48. package/dist/validations/metadata-schema.d.ts +6 -0
  49. package/dist/validations/metadata-schema.d.ts.map +1 -0
  50. package/dist/validations/metadata-schema.js +26 -0
  51. package/dist/validations/metadata-schema.js.map +1 -0
  52. package/dist/validations/must-have-failed-before.d.ts +6 -0
  53. package/dist/validations/must-have-failed-before.d.ts.map +1 -0
  54. package/dist/validations/must-have-failed-before.js +13 -0
  55. package/dist/validations/must-have-failed-before.js.map +1 -0
  56. package/dist/validations/no-newer.d.ts +6 -0
  57. package/dist/validations/no-newer.d.ts.map +1 -0
  58. package/dist/validations/no-newer.js +14 -0
  59. package/dist/validations/no-newer.js.map +1 -0
  60. package/dist/validations/no-redeploy.d.ts +6 -0
  61. package/dist/validations/no-redeploy.d.ts.map +1 -0
  62. package/dist/validations/no-redeploy.js +13 -0
  63. package/dist/validations/no-redeploy.js.map +1 -0
  64. package/dist/validations/rate-limit.d.ts +6 -0
  65. package/dist/validations/rate-limit.d.ts.map +1 -0
  66. package/dist/validations/rate-limit.js +13 -0
  67. package/dist/validations/rate-limit.js.map +1 -0
  68. package/dist/validations/recent.d.ts +7 -0
  69. package/dist/validations/recent.d.ts.map +1 -0
  70. package/dist/validations/recent.js +27 -0
  71. package/dist/validations/recent.js.map +1 -0
  72. package/dist/validations/signature.d.ts +7 -0
  73. package/dist/validations/signature.d.ts.map +1 -0
  74. package/dist/validations/signature.js +17 -0
  75. package/dist/validations/signature.js.map +1 -0
  76. package/dist/validations/size.d.ts +8 -0
  77. package/dist/validations/size.d.ts.map +1 -0
  78. package/dist/validations/size.js +39 -0
  79. package/dist/validations/size.js.map +1 -0
  80. package/dist/validations/wearable.d.ts +10 -0
  81. package/dist/validations/wearable.d.ts.map +1 -0
  82. package/dist/validations/wearable.js +76 -0
  83. package/dist/validations/wearable.js.map +1 -0
  84. package/package.json +47 -0
@@ -0,0 +1,8 @@
1
+ import { ExternalCalls, Validator } from './types';
2
+ export * from './types';
3
+ export * from './validations';
4
+ /**
5
+ * @public
6
+ */
7
+ export declare const validator: (externalCalls: ExternalCalls) => Validator;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAM,SAAS,EAAE,MAAM,SAAS,CAAA;AAGtD,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,SAAS,kBAAmB,aAAa,KAAG,SAQvD,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.validator = void 0;
14
+ const types_1 = require("./types");
15
+ const validations_1 = require("./validations");
16
+ __exportStar(require("./types"), exports);
17
+ __exportStar(require("./validations"), exports);
18
+ /**
19
+ * @public
20
+ */
21
+ const validator = (externalCalls) => ({
22
+ validate: async (deployment) => {
23
+ for (const validation of [...validations_1.statelessValidations, ...validations_1.statefulValidations]) {
24
+ const result = await validation.validate({ deployment, externalCalls });
25
+ if (!result.ok)
26
+ return result;
27
+ }
28
+ return types_1.OK;
29
+ },
30
+ });
31
+ exports.validator = validator;
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mCAAsD;AACtD,+CAAyE;AAEzE,0CAAuB;AACvB,gDAA6B;AAE7B;;GAEG;AACI,MAAM,SAAS,GAAG,CAAC,aAA4B,EAAa,EAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;QAC7B,KAAK,MAAM,UAAU,IAAI,CAAC,GAAG,kCAAoB,EAAE,GAAG,iCAAmB,CAAC,EAAE;YAC1E,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAA;YACvE,IAAI,CAAC,MAAM,CAAC,EAAE;gBAAE,OAAO,MAAM,CAAA;SAC9B;QACD,OAAO,UAAE,CAAA;IACX,CAAC;CACF,CAAC,CAAA;AARW,QAAA,SAAS,aAQpB"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.19.3"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,114 @@
1
+ import { AuditInfo, ContentFileHash, Entity, EntityId, EntityType, Fetcher } from 'dcl-catalyst-commons';
2
+ /**
3
+ * @public
4
+ */
5
+ export declare type LocalDeploymentAuditInfo = Pick<AuditInfo, 'authChain' | 'migrationData'>;
6
+ /**
7
+ * @public
8
+ */
9
+ export declare type Errors = string[];
10
+ /**
11
+ * @public
12
+ */
13
+ export declare type Warnings = string[];
14
+ /**
15
+ * @public
16
+ */
17
+ export declare type EntityWithEthAddress = Entity & {
18
+ ethAddress: string;
19
+ };
20
+ /**
21
+ * Deployment object to be validated by the validator.
22
+ * @public
23
+ */
24
+ export declare type DeploymentToValidate = {
25
+ entity: Entity;
26
+ files: Map<ContentFileHash, Uint8Array>;
27
+ auditInfo: LocalDeploymentAuditInfo;
28
+ context: 'LOCAL' | 'SYNCED';
29
+ };
30
+ /**
31
+ * External calls interface to be provided by the servers.
32
+ * @public
33
+ */
34
+ export declare type ExternalCalls = {
35
+ areThereNewerEntities: (entity: Entity) => Promise<boolean>;
36
+ isFailedDeployment: (entityType: EntityType, entityId: EntityId) => Promise<boolean>;
37
+ isContentStoredAlready: (hashes: ContentFileHash[]) => Promise<Map<ContentFileHash, boolean>>;
38
+ isEntityDeployedAlready: () => Promise<boolean>;
39
+ isEntityRateLimited: (entity: Entity) => Promise<boolean>;
40
+ fetchContentFileSize: (hash: string) => Promise<number | undefined>;
41
+ validateSignature: (entityId: EntityId, auditInfo: LocalDeploymentAuditInfo, timestamp: number) => Promise<{
42
+ ok: boolean;
43
+ message?: string;
44
+ }>;
45
+ getMaxUploadSizePerTypeInMB: (entityType: EntityType) => number;
46
+ ownerAddress: (auditInfo: LocalDeploymentAuditInfo) => string;
47
+ isAddressOwnedByDecentraland: (address: string) => boolean;
48
+ requestTtlBackwards: number;
49
+ wearableSizeLimitInMB: number;
50
+ queryGraph: Fetcher['queryGraph'];
51
+ subgraphs: {
52
+ L1: {
53
+ landManager: string;
54
+ blocks: string;
55
+ collections: string;
56
+ };
57
+ L2: {
58
+ blocks: string;
59
+ collections: string;
60
+ };
61
+ };
62
+ };
63
+ /**
64
+ * Validator interface to be used by any server.
65
+ * @public
66
+ */
67
+ export interface Validator {
68
+ validate(deployment: DeploymentToValidate, calls: ExternalCalls): Promise<ValidationResponse>;
69
+ }
70
+ /**
71
+ * @public
72
+ */
73
+ export declare type ValidationArgs = {
74
+ deployment: DeploymentToValidate;
75
+ externalCalls: ExternalCalls;
76
+ };
77
+ /**
78
+ * @public
79
+ */
80
+ export declare type ValidationResponse = {
81
+ ok: boolean;
82
+ errors?: Errors;
83
+ warnings?: Warnings;
84
+ };
85
+ /**
86
+ * @public
87
+ */
88
+ export declare type Validation = {
89
+ validate: (args: ValidationArgs) => ValidationResponse | Promise<ValidationResponse>;
90
+ };
91
+ /**
92
+ * @public
93
+ */
94
+ export declare type ConditionalValidation = {
95
+ predicate: (args: ValidationArgs) => boolean | Promise<boolean>;
96
+ message: (args: ValidationArgs) => string;
97
+ };
98
+ /**
99
+ * @public
100
+ */
101
+ export declare const OK: ValidationResponse;
102
+ /**
103
+ * @public
104
+ */
105
+ export declare const validationFailed: (...error: string[]) => ValidationResponse;
106
+ /**
107
+ * @public
108
+ */
109
+ export declare const conditionalValidation: (condition: ConditionalValidation) => Validation;
110
+ /**
111
+ * @public
112
+ */
113
+ export declare const fromErrors: (...errors: Errors) => ValidationResponse;
114
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAExG;;GAEG;AACH,oBAAY,wBAAwB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,eAAe,CAAC,CAAA;AAErF;;GAEG;AACH,oBAAY,MAAM,GAAG,MAAM,EAAE,CAAA;AAE7B;;GAEG;AACH,oBAAY,QAAQ,GAAG,MAAM,EAAE,CAAA;AAE/B;;GAEG;AACH,oBAAY,oBAAoB,GAAG,MAAM,GAAG;IAC1C,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,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AAO,MAAM,UAAU,yBAAwB,kBAG7C,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fromErrors = exports.conditionalValidation = exports.validationFailed = exports.OK = void 0;
4
+ /**
5
+ * @public
6
+ */
7
+ exports.OK = { ok: true };
8
+ /**
9
+ * @public
10
+ */
11
+ const validationFailed = (...error) => ({
12
+ ok: false,
13
+ errors: error,
14
+ });
15
+ exports.validationFailed = validationFailed;
16
+ /**
17
+ * @public
18
+ */
19
+ const conditionalValidation = (condition) => ({
20
+ validate: async (args) => {
21
+ if (!(await condition.predicate(args))) {
22
+ return (0, exports.validationFailed)(condition.message(args));
23
+ }
24
+ return exports.OK;
25
+ },
26
+ });
27
+ exports.conditionalValidation = conditionalValidation;
28
+ /**
29
+ * @public
30
+ */
31
+ const fromErrors = (...errors) => ({
32
+ ok: errors.length === 0,
33
+ errors: errors.length > 0 ? errors : undefined,
34
+ });
35
+ exports.fromErrors = fromErrors;
36
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA8GA;;GAEG;AACU,QAAA,EAAE,GAAuB,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AAElD;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,GAAG,KAAe,EAAsB,EAAE,CAAC,CAAC;IAC3E,EAAE,EAAE,KAAK;IACT,MAAM,EAAE,KAAK;CACd,CAAC,CAAA;AAHW,QAAA,gBAAgB,oBAG3B;AAEF;;GAEG;AACI,MAAM,qBAAqB,GAAG,CAAC,SAAgC,EAAc,EAAE,CAAC,CAAC;IACtF,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACvB,IAAI,CAAC,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;YACtC,OAAO,IAAA,wBAAgB,EAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;SACjD;QACD,OAAO,UAAE,CAAA;IACX,CAAC;CACF,CAAC,CAAA;AAPW,QAAA,qBAAqB,yBAOhC;AAEF;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,GAAG,MAAc,EAAsB,EAAE,CAAC,CAAC;IACpE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;CAC/C,CAAC,CAAA;AAHW,QAAA,UAAU,cAGrB"}
@@ -0,0 +1,7 @@
1
+ import { Validation } from '../../types';
2
+ /**
3
+ * Validate that the pointers are valid, and that the Ethereum address has write access to them
4
+ * @public
5
+ */
6
+ export declare const access: Validation;
7
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/access.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,UAcpB,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.access = void 0;
4
+ const dcl_catalyst_commons_1 = require("dcl-catalyst-commons");
5
+ const __1 = require("../..");
6
+ const profiles_1 = require("./profiles");
7
+ const scenes_1 = require("./scenes");
8
+ const wearables_1 = require("./wearables");
9
+ /**
10
+ * Validate that the pointers are valid, and that the Ethereum address has write access to them
11
+ * @public
12
+ */
13
+ exports.access = {
14
+ validate: async (args) => {
15
+ const type = args.deployment.entity.type;
16
+ switch (type) {
17
+ case dcl_catalyst_commons_1.EntityType.SCENE:
18
+ return scenes_1.scenes.validate(args);
19
+ case dcl_catalyst_commons_1.EntityType.PROFILE:
20
+ return profiles_1.profiles.validate(args);
21
+ case dcl_catalyst_commons_1.EntityType.WEARABLE:
22
+ return wearables_1.wearables.validate(args);
23
+ default:
24
+ return (0, __1.validationFailed)('Unknown type provided');
25
+ }
26
+ },
27
+ };
28
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../../../src/validations/access-checker/access.ts"],"names":[],"mappings":";;;AAAA,+DAAiD;AACjD,6BAAwC;AAExC,yCAAqC;AACrC,qCAAiC;AACjC,2CAAuC;AAEvC;;;GAGG;AACU,QAAA,MAAM,GAAe;IAChC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAA;QACxC,QAAQ,IAAI,EAAE;YACZ,KAAK,iCAAU,CAAC,KAAK;gBACnB,OAAO,eAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YAC9B,KAAK,iCAAU,CAAC,OAAO;gBACrB,OAAO,mBAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YAChC,KAAK,iCAAU,CAAC,QAAQ;gBACtB,OAAO,qBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YACjC;gBACE,OAAO,IAAA,oBAAgB,EAAC,uBAAuB,CAAC,CAAA;SACnD;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { Validation } from '../../types';
2
+ /**
3
+ * Validate that the pointers are valid, and that the Ethereum address has write access to them
4
+ * @public
5
+ */
6
+ export declare const profiles: Validation;
7
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/profiles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAM,UAAU,EAAoB,MAAM,aAAa,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,UAuBtB,CAAA"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.profiles = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const types_1 = require("../../types");
6
+ /**
7
+ * Validate that the pointers are valid, and that the Ethereum address has write access to them
8
+ * @public
9
+ */
10
+ exports.profiles = {
11
+ validate: async ({ deployment, externalCalls }) => {
12
+ const pointers = deployment.entity.pointers;
13
+ const ethAddress = externalCalls.ownerAddress(deployment.auditInfo);
14
+ if (pointers.length !== 1)
15
+ return (0, types_1.validationFailed)(`Only one pointer is allowed when you create a Profile. Received: ${pointers}`);
16
+ const pointer = pointers[0].toLowerCase();
17
+ if (pointer.startsWith('default')) {
18
+ if (!externalCalls.isAddressOwnedByDecentraland(ethAddress))
19
+ return (0, types_1.validationFailed)(`Only Decentraland can add or modify default profiles`);
20
+ }
21
+ else if (!ethers_1.ethers.utils.isAddress(pointer)) {
22
+ return (0, types_1.validationFailed)(`The given pointer is not a valid ethereum address.`);
23
+ }
24
+ else if (pointer !== ethAddress.toLowerCase()) {
25
+ return (0, types_1.validationFailed)(`You can only alter your own profile. The pointer address and the signer address are different (pointer:${pointer} signer: ${ethAddress.toLowerCase()}).`);
26
+ }
27
+ return types_1.OK;
28
+ },
29
+ };
30
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/validations/access-checker/profiles.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAC/B,uCAA8D;AAE9D;;;GAGG;AACU,QAAA,QAAQ,GAAe;IAClC,QAAQ,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAA;QAC3C,MAAM,UAAU,GAAG,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QAEnE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YACvB,OAAO,IAAA,wBAAgB,EAAC,oEAAoE,QAAQ,EAAE,CAAC,CAAA;QAEzG,MAAM,OAAO,GAAY,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;QAElD,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YACjC,IAAI,CAAC,aAAa,CAAC,4BAA4B,CAAC,UAAU,CAAC;gBACzD,OAAO,IAAA,wBAAgB,EAAC,sDAAsD,CAAC,CAAA;SAClF;aAAM,IAAI,CAAC,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;YAC3C,OAAO,IAAA,wBAAgB,EAAC,oDAAoD,CAAC,CAAA;SAC9E;aAAM,IAAI,OAAO,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;YAC/C,OAAO,IAAA,wBAAgB,EACrB,0GAA0G,OAAO,YAAY,UAAU,CAAC,WAAW,EAAE,IAAI,CAC1J,CAAA;SACF;QAED,OAAO,UAAE,CAAA;IACX,CAAC;CACF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { Validation } from '../../types';
2
+ /**
3
+ * Checks if the given address has access to the given parcel at the given timestamp.
4
+ * @public
5
+ */
6
+ export declare const scenes: Validation;
7
+ //# sourceMappingURL=scenes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,UAAU,EAAE,MAAM,aAAa,CAAA;AAoTnE;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,UAwCpB,CAAA"}
@@ -0,0 +1,246 @@
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.scenes = void 0;
7
+ const dcl_catalyst_commons_1 = require("dcl-catalyst-commons");
8
+ const ms_1 = __importDefault(require("ms"));
9
+ const types_1 = require("../../types");
10
+ const getAuthorizations = async (owner, operator, timestamp, externalCalls) => {
11
+ const query = `
12
+ query GetAuthorizations($owner: String!, $operator: String!, $timestamp: Int!) {
13
+ authorizations(
14
+ where: {
15
+ owner: $owner,
16
+ operator: $operator,
17
+ createdAt_lte: $timestamp
18
+ },
19
+ orderBy: timestamp,
20
+ orderDirection: desc
21
+ ) {
22
+ type
23
+ isApproved
24
+ }
25
+ }`;
26
+ const variables = {
27
+ owner,
28
+ operator,
29
+ timestamp: Math.floor(timestamp / 1000), // js(ms) -> UNIX(s)
30
+ };
31
+ try {
32
+ return (await externalCalls.queryGraph(externalCalls.subgraphs.L1.landManager, query, variables)).authorizations;
33
+ }
34
+ catch (error) {
35
+ // this.LOGGER.error(`Error fetching authorizations for ${owner}`, error)
36
+ throw error;
37
+ }
38
+ };
39
+ const getEstate = async (estateId, timestamp, externalCalls) => {
40
+ /**
41
+ * You can use `owner`, `operator` and `updateOperator` to check the current value for that estate.
42
+ * Keep in mind that each association (owners, operators, etc) is capped to a thousand (1000) results.
43
+ * For more information, you can use the query explorer at https://thegraph.com/explorer/subgraph/decentraland/land-manager
44
+ */
45
+ const query = `
46
+ query GetEstate($estateId: String!, $timestamp: Int!) {
47
+ estates(where:{ id: $estateId }) {
48
+ id
49
+ owners(
50
+ where: { createdAt_lte: $timestamp },
51
+ orderBy: timestamp,
52
+ orderDirection: desc,
53
+ first: 1
54
+ ) {
55
+ address
56
+ }
57
+ operators(
58
+ where: { createdAt_lte: $timestamp },
59
+ orderBy: timestamp,
60
+ orderDirection: desc,
61
+ first: 1
62
+ ) {
63
+ address
64
+ }
65
+ updateOperators(
66
+ where: { createdAt_lte: $timestamp },
67
+ orderBy: timestamp,
68
+ orderDirection: desc,
69
+ first: 1
70
+ ) {
71
+ address
72
+ }
73
+ }
74
+ }`;
75
+ const variables = {
76
+ estateId,
77
+ timestamp: Math.floor(timestamp / 1000), // UNIX
78
+ };
79
+ try {
80
+ return (await externalCalls.queryGraph(externalCalls.subgraphs.L1.landManager, query, variables)).estates[0];
81
+ }
82
+ catch (error) {
83
+ // this.LOGGER.error(`Error fetching estate (${estateId})`, error)
84
+ throw error;
85
+ }
86
+ };
87
+ const getParcel = async (x, y, timestamp, externalCalls) => {
88
+ /**
89
+ * You can use `owner`, `operator` and `updateOperator` to check the current value for that parcel.
90
+ * Keep in mind that each association (owners, operators, etc) is capped to a thousand (1000) results.
91
+ * For more information, you can use the query explorer at https://thegraph.com/explorer/subgraph/decentraland/land-manager
92
+ */
93
+ const query = `
94
+ query GetParcel($x: Int!, $y: Int!, $timestamp: Int!) {
95
+ parcels(where:{ x: $x, y: $y }) {
96
+ estates(
97
+ where: { createdAt_lte: $timestamp },
98
+ orderBy: createdAt,
99
+ orderDirection: desc,
100
+ first: 1
101
+ ) {
102
+ estateId
103
+ }
104
+ owners(
105
+ where: { createdAt_lte: $timestamp },
106
+ orderBy: timestamp,
107
+ orderDirection: desc,
108
+ first: 1
109
+ ) {
110
+ address
111
+ }
112
+ operators(
113
+ where: { createdAt_lte: $timestamp },
114
+ orderBy: timestamp,
115
+ orderDirection: desc,
116
+ first: 1
117
+ ) {
118
+ address
119
+ }
120
+ updateOperators(
121
+ where: { createdAt_lte: $timestamp },
122
+ orderBy: timestamp,
123
+ orderDirection: desc,
124
+ first: 1
125
+ ) {
126
+ address
127
+ }
128
+ }
129
+ }`;
130
+ const variables = {
131
+ x,
132
+ y,
133
+ timestamp: Math.floor(timestamp / 1000), // UNIX
134
+ };
135
+ try {
136
+ const r = await externalCalls.queryGraph(externalCalls.subgraphs.L1.landManager, query, variables);
137
+ if (r.parcels && r.parcels.length)
138
+ return r.parcels[0];
139
+ // this.LOGGER.error(`Error fetching parcel (${x}, ${y}, ${timestamp}): ${JSON.stringify(r)}`)
140
+ throw new Error(`Error fetching parcel (${x}, ${y}), ${timestamp}`);
141
+ }
142
+ catch (error) {
143
+ // this.LOGGER.error(`Error fetching parcel (${x}, ${y}, ${timestamp})`, error)
144
+ throw error;
145
+ }
146
+ };
147
+ const hasAccessThroughAuthorizations = async (owner, ethAddress, timestamp, externalCalls) => {
148
+ /* You also get access if you received:
149
+ * - an authorization with isApproved and type Operator, ApprovalForAll or UpdateManager
150
+ * at that time
151
+ */
152
+ const authorizations = await getAuthorizations(owner.toLowerCase(), ethAddress.toLowerCase(), timestamp, externalCalls);
153
+ const firstOperatorAuthorization = authorizations.find((authorization) => authorization.type === 'Operator');
154
+ const firstApprovalForAllAuthorization = authorizations.find((authorization) => authorization.type === 'ApprovalForAll');
155
+ const firstUpdateManagerAuthorization = authorizations.find((authorization) => authorization.type === 'UpdateManager');
156
+ if (firstOperatorAuthorization?.isApproved ||
157
+ firstApprovalForAllAuthorization?.isApproved ||
158
+ firstUpdateManagerAuthorization?.isApproved) {
159
+ return true;
160
+ }
161
+ return false;
162
+ };
163
+ const hasAccessThroughFirstLevelAuthorities = async (target, ethAddress) => {
164
+ const firstLevelAuthorities = [...target.owners, ...target.operators, ...target.updateOperators]
165
+ .filter((addressSnapshot) => addressSnapshot.address)
166
+ .map((addressSnapshot) => addressSnapshot.address.toLowerCase());
167
+ return firstLevelAuthorities.includes(ethAddress.toLowerCase());
168
+ };
169
+ const isEstateUpdateAuthorized = async (estateId, timestamp, ethAddress, externalCalls) => {
170
+ const estate = await getEstate(estateId.toString(), timestamp, externalCalls);
171
+ if (estate) {
172
+ return ((await hasAccessThroughFirstLevelAuthorities(estate, ethAddress)) ||
173
+ (await hasAccessThroughAuthorizations(estate.owners[0].address, ethAddress, timestamp, externalCalls)));
174
+ }
175
+ throw new Error(`Couldn\'t find the state ${estateId}`);
176
+ };
177
+ const isParcelUpdateAuthorized = async (x, y, timestamp, ethAddress, externalCalls) => {
178
+ /* You get direct access if you were the:
179
+ * - owner
180
+ * - operator
181
+ * - update operator
182
+ * at that time
183
+ */
184
+ const parcel = await getParcel(x, y, timestamp, externalCalls);
185
+ if (parcel) {
186
+ const belongsToEstate = parcel.estates != undefined && parcel.estates.length > 0 && parcel.estates[0].estateId != undefined;
187
+ return ((await hasAccessThroughFirstLevelAuthorities(parcel, ethAddress)) ||
188
+ (await hasAccessThroughAuthorizations(parcel.owners[0].address, ethAddress, timestamp, externalCalls)) ||
189
+ (belongsToEstate &&
190
+ (await isEstateUpdateAuthorized(parcel.estates[0].estateId, timestamp, ethAddress, externalCalls))));
191
+ }
192
+ throw new Error(`Parcel(${x},${y},${timestamp}) not found`);
193
+ };
194
+ const checkParcelAccess = async (x, y, timestamp, ethAddress, externalCalls) => {
195
+ try {
196
+ return await (0, dcl_catalyst_commons_1.retry)(() => isParcelUpdateAuthorized(x, y, timestamp, ethAddress, externalCalls), 5, '0.1s');
197
+ }
198
+ catch (error) {
199
+ // this.LOGGER.error(`Error checking parcel access (${x}, ${y}, ${timestamp}, ${ethAddress}).`, error)
200
+ throw error;
201
+ }
202
+ };
203
+ const SCENE_LOOKBACK_TIME = (0, ms_1.default)('5m');
204
+ /**
205
+ * Checks if the given address has access to the given parcel at the given timestamp.
206
+ * @public
207
+ */
208
+ exports.scenes = {
209
+ validate: async ({ deployment, externalCalls }) => {
210
+ const { entity } = deployment;
211
+ const { pointers, timestamp } = entity;
212
+ const ethAddress = externalCalls.ownerAddress(deployment.auditInfo);
213
+ const errors = [];
214
+ const lowerCasePointers = pointers.map((pointer) => pointer.toLowerCase());
215
+ for (const pointer of lowerCasePointers) {
216
+ if (pointer.startsWith('default')) {
217
+ if (!externalCalls.isAddressOwnedByDecentraland(ethAddress)) {
218
+ errors.push(`Only Decentraland can add or modify default scenes`);
219
+ }
220
+ }
221
+ else {
222
+ const pointerParts = pointer.split(',');
223
+ if (pointerParts.length === 2) {
224
+ const x = parseInt(pointerParts[0], 10);
225
+ const y = parseInt(pointerParts[1], 10);
226
+ try {
227
+ // Check that the address has access (we check both the present and the 5 min into the past to avoid synchronization issues in the blockchain)
228
+ const hasAccess = (await checkParcelAccess(x, y, timestamp, ethAddress, externalCalls)) ||
229
+ (await checkParcelAccess(x, y, timestamp - SCENE_LOOKBACK_TIME, ethAddress, externalCalls));
230
+ if (!hasAccess) {
231
+ errors.push(`The provided Eth Address does not have access to the following parcel: (${x},${y})`);
232
+ }
233
+ }
234
+ catch (e) {
235
+ errors.push(`The provided Eth Address does not have access to the following parcel: (${x},${y}). ${e}`);
236
+ }
237
+ }
238
+ else {
239
+ errors.push(`Scene pointers should only contain two integers separated by a comma, for example (10,10) or (120,-45). Invalid pointer: ${pointer}`);
240
+ }
241
+ }
242
+ }
243
+ return (0, types_1.fromErrors)(...errors);
244
+ },
245
+ };
246
+ //# sourceMappingURL=scenes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenes.js","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":";;;;;;AACA,+DAAuD;AACvD,4CAAmB;AACnB,uCAAmE;AA+BnE,MAAM,iBAAiB,GAAG,KAAK,EAC7B,KAAiB,EACjB,QAAoB,EACpB,SAAoB,EACpB,aAA4B,EACF,EAAE;IAC5B,MAAM,KAAK,GAAG;;;;;;;;;;;;;;cAcF,CAAA;IAEZ,MAAM,SAAS,GAAG;QAChB,KAAK;QACL,QAAQ;QACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,oBAAoB;KAC9D,CAAA;IAED,IAAI;QACF,OAAO,CACL,MAAM,aAAa,CAAC,UAAU,CAC5B,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,WAAW,EACtC,KAAK,EACL,SAAS,CACV,CACF,CAAC,cAAc,CAAA;KACjB;IAAC,OAAO,KAAK,EAAE;QACd,yEAAyE;QACzE,MAAM,KAAK,CAAA;KACZ;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,KAAK,EACrB,QAAgB,EAChB,SAAoB,EACpB,aAA4B,EACC,EAAE;IAC/B;;;;OAIG;IAEH,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6BF,CAAA;IAEZ,MAAM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ACL,MAAM,YAAY,GAAa,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBACjD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC7B,MAAM,CAAC,GAAW,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;oBAC/C,MAAM,CAAC,GAAW,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;oBAC/C,IAAI;wBACF,8IAA8I;wBAC9I,MAAM,SAAS,GACb,CAAC,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;4BACrE,CAAC,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,GAAG,mBAAmB,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAA;wBAC7F,IAAI,CAAC,SAAS,EAAE;4BACd,MAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;yBAClG;qBACF;oBAAC,OAAO,CAAC,EAAE;wBACV,MAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;qBACxG;iBACF;qBAAM;oBACL,MAAM,CAAC,IAAI,CACT,4HAA4H,OAAO,EAAE,CACtI,CAAA;iBACF;aACF;SACF;QAED,OAAO,IAAA,kBAAU,EAAC,GAAG,MAAM,CAAC,CAAA;IAC9B,CAAC;CACF,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { Validation } from '../../types';
2
+ export declare type WearableCollection = {
3
+ creator: string;
4
+ managers: string[];
5
+ isApproved: boolean;
6
+ isCompleted: boolean;
7
+ items: WearableCollectionItem[];
8
+ };
9
+ declare type WearableCollectionItem = {
10
+ managers: string[];
11
+ contentHash: string;
12
+ };
13
+ /**
14
+ * Given the pointers (URNs), determine which layer should be used to check the access.
15
+ * Checks if the ethereum address has access to the collection.
16
+ * @public
17
+ */
18
+ export declare const wearables: Validation;
19
+ export {};
20
+ //# sourceMappingURL=wearables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wearables.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/wearables.ts"],"names":[],"mappings":"AAKA,OAAO,EAAM,UAAU,EAAE,MAAM,aAAa,CAAA;AA0B5C,oBAAY,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,sBAAsB,EAAE,CAAA;CAChC,CAAA;AAED,aAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AA4OD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,UAyEvB,CAAA"}