@dcl/content-validator 4.2.4-20230125194827.commit-f90482b → 4.2.4-4135566596.commit-6ae9fb8

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 (107) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +5 -5
  4. package/dist/index.js.map +1 -1
  5. package/dist/the-graph-client/the-graph-client.d.ts +1 -5
  6. package/dist/the-graph-client/the-graph-client.d.ts.map +1 -1
  7. package/dist/the-graph-client/the-graph-client.js +83 -49
  8. package/dist/the-graph-client/the-graph-client.js.map +1 -1
  9. package/dist/types.d.ts +22 -45
  10. package/dist/types.d.ts.map +1 -1
  11. package/dist/types.js.map +1 -1
  12. package/dist/validations/ADR45.d.ts +2 -2
  13. package/dist/validations/ADR45.d.ts.map +1 -1
  14. package/dist/validations/ADR45.js +7 -8
  15. package/dist/validations/ADR45.js.map +1 -1
  16. package/dist/validations/ADR51.d.ts +1 -1
  17. package/dist/validations/ADR51.d.ts.map +1 -1
  18. package/dist/validations/access-checker/access.d.ts +2 -2
  19. package/dist/validations/access-checker/access.d.ts.map +1 -1
  20. package/dist/validations/access-checker/access.js +15 -17
  21. package/dist/validations/access-checker/access.js.map +1 -1
  22. package/dist/validations/access-checker/emotes.d.ts +2 -2
  23. package/dist/validations/access-checker/emotes.d.ts.map +1 -1
  24. package/dist/validations/access-checker/emotes.js +7 -8
  25. package/dist/validations/access-checker/emotes.js.map +1 -1
  26. package/dist/validations/access-checker/items/collection-asset.d.ts +2 -2
  27. package/dist/validations/access-checker/items/collection-asset.d.ts.map +1 -1
  28. package/dist/validations/access-checker/items/collection-asset.js +106 -43
  29. package/dist/validations/access-checker/items/collection-asset.js.map +1 -1
  30. package/dist/validations/access-checker/items/items.d.ts +4 -6
  31. package/dist/validations/access-checker/items/items.d.ts.map +1 -1
  32. package/dist/validations/access-checker/items/items.js +23 -24
  33. package/dist/validations/access-checker/items/items.js.map +1 -1
  34. package/dist/validations/access-checker/items/third-party-asset.d.ts.map +1 -1
  35. package/dist/validations/access-checker/items/third-party-asset.js +80 -21
  36. package/dist/validations/access-checker/items/third-party-asset.js.map +1 -1
  37. package/dist/validations/access-checker/profiles.d.ts +6 -6
  38. package/dist/validations/access-checker/profiles.d.ts.map +1 -1
  39. package/dist/validations/access-checker/profiles.js +59 -61
  40. package/dist/validations/access-checker/profiles.js.map +1 -1
  41. package/dist/validations/access-checker/scenes.d.ts +2 -2
  42. package/dist/validations/access-checker/scenes.d.ts.map +1 -1
  43. package/dist/validations/access-checker/scenes.js +243 -34
  44. package/dist/validations/access-checker/scenes.js.map +1 -1
  45. package/dist/validations/access-checker/stores.d.ts +2 -2
  46. package/dist/validations/access-checker/stores.d.ts.map +1 -1
  47. package/dist/validations/access-checker/stores.js +14 -15
  48. package/dist/validations/access-checker/stores.js.map +1 -1
  49. package/dist/validations/access-checker/wearables.d.ts +2 -2
  50. package/dist/validations/access-checker/wearables.d.ts.map +1 -1
  51. package/dist/validations/access-checker/wearables.js +9 -10
  52. package/dist/validations/access-checker/wearables.js.map +1 -1
  53. package/dist/validations/content.d.ts +6 -6
  54. package/dist/validations/content.d.ts.map +1 -1
  55. package/dist/validations/content.js +44 -50
  56. package/dist/validations/content.js.map +1 -1
  57. package/dist/validations/entity-structure.d.ts +2 -2
  58. package/dist/validations/entity-structure.d.ts.map +1 -1
  59. package/dist/validations/entity-structure.js +10 -11
  60. package/dist/validations/entity-structure.js.map +1 -1
  61. package/dist/validations/index.d.ts +9 -4
  62. package/dist/validations/index.d.ts.map +1 -1
  63. package/dist/validations/index.js +7 -7
  64. package/dist/validations/index.js.map +1 -1
  65. package/dist/validations/ipfs-hashing.d.ts +2 -2
  66. package/dist/validations/ipfs-hashing.d.ts.map +1 -1
  67. package/dist/validations/ipfs-hashing.js +8 -10
  68. package/dist/validations/ipfs-hashing.js.map +1 -1
  69. package/dist/validations/items/emotes.d.ts +4 -4
  70. package/dist/validations/items/emotes.d.ts.map +1 -1
  71. package/dist/validations/items/emotes.js +22 -24
  72. package/dist/validations/items/emotes.js.map +1 -1
  73. package/dist/validations/items/items.d.ts +4 -4
  74. package/dist/validations/items/items.d.ts.map +1 -1
  75. package/dist/validations/items/items.js +54 -55
  76. package/dist/validations/items/items.js.map +1 -1
  77. package/dist/validations/items/wearables.d.ts +4 -3
  78. package/dist/validations/items/wearables.d.ts.map +1 -1
  79. package/dist/validations/items/wearables.js +16 -17
  80. package/dist/validations/items/wearables.js.map +1 -1
  81. package/dist/validations/metadata-schema.d.ts +2 -2
  82. package/dist/validations/metadata-schema.d.ts.map +1 -1
  83. package/dist/validations/metadata-schema.js +17 -21
  84. package/dist/validations/metadata-schema.js.map +1 -1
  85. package/dist/validations/profile.d.ts +6 -6
  86. package/dist/validations/profile.d.ts.map +1 -1
  87. package/dist/validations/profile.js +55 -63
  88. package/dist/validations/profile.js.map +1 -1
  89. package/dist/validations/scene.d.ts +3 -3
  90. package/dist/validations/scene.d.ts.map +1 -1
  91. package/dist/validations/scene.js +5 -7
  92. package/dist/validations/scene.js.map +1 -1
  93. package/dist/validations/signature.d.ts +2 -2
  94. package/dist/validations/signature.d.ts.map +1 -1
  95. package/dist/validations/signature.js +6 -8
  96. package/dist/validations/signature.js.map +1 -1
  97. package/dist/validations/size.d.ts +2 -2
  98. package/dist/validations/size.d.ts.map +1 -1
  99. package/dist/validations/size.js +28 -29
  100. package/dist/validations/size.js.map +1 -1
  101. package/dist/validations/validations.d.ts +9 -9
  102. package/dist/validations/validations.d.ts.map +1 -1
  103. package/dist/validations/validations.js +34 -38
  104. package/dist/validations/validations.js.map +1 -1
  105. package/package.json +5 -10
  106. package/dist/content-validator.api.json +0 -1669
  107. package/dist/tsdoc-metadata.json +0 -11
@@ -1,11 +1,11 @@
1
- import { Validation } from '../types';
2
- export declare const allHashesWereUploadedOrStored: Validation;
3
- export declare const allHashesInUploadedFilesAreReportedInTheEntity: Validation;
4
- export declare const allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45: Validation;
5
- export declare const allMandatoryContentFilesArePresent: Validation;
1
+ import { ContentValidatorComponents, DeploymentToValidate, ValidateFn } from '../types';
2
+ export declare function allHashesWereUploadedOrStored(components: ContentValidatorComponents, deployment: DeploymentToValidate): Promise<import("../types").ValidationResponse>;
3
+ export declare function allHashesInUploadedFilesAreReportedInTheEntity(components: ContentValidatorComponents, deployment: DeploymentToValidate): Promise<import("../types").ValidationResponse>;
4
+ export declare const allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45: ValidateFn;
5
+ export declare const allMandatoryContentFilesArePresent: ValidateFn;
6
6
  /**
7
7
  * Validate that uploaded and reported hashes are corrects and files corresponds to snapshots
8
8
  * @public
9
9
  */
10
- export declare const content: Validation;
10
+ export declare const content: ValidateFn;
11
11
  //# sourceMappingURL=content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/validations/content.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAA;AAYjD,eAAO,MAAM,6BAA6B,EAAE,UAkB3C,CAAA;AAED,eAAO,MAAM,8CAA8C,EAAE,UAa5D,CAAA;AAED,eAAO,MAAM,6DAA6D,EAAE,UAgB1E,CAAA;AAEF,eAAO,MAAM,kCAAkC,EAAE,UAe/C,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,UAKrB,CAAA"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/validations/content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAc,UAAU,EAAE,MAAM,UAAU,CAAA;AAYnG,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,0BAA0B,EACtC,UAAU,EAAE,oBAAoB,kDAiBjC;AAED,wBAAsB,8CAA8C,CAClE,UAAU,EAAE,0BAA0B,EACtC,UAAU,EAAE,oBAAoB,kDAYjC;AAED,eAAO,MAAM,6DAA6D,EAAE,UAgB3E,CAAA;AAED,eAAO,MAAM,kCAAkC,EAAE,UAehD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,UAKrB,CAAA"}
@@ -10,70 +10,64 @@ const correspondsToASnapshot = (fileName, hash, metadata) => {
10
10
  return false;
11
11
  return metadata.avatars.some((avatar) => Object.entries(avatar.avatar.snapshots).some((key) => key[0] === fileNameWithoutExtension && key[1] === hash));
12
12
  };
13
- exports.allHashesWereUploadedOrStored = {
14
- async validate(components, deployment) {
15
- const { entity, files } = deployment;
16
- const errors = [];
17
- if (entity.content) {
18
- const alreadyStoredHashes = await components.externalCalls.isContentStoredAlready(entity.content?.map((file) => file.hash) ?? []);
19
- for (const { hash } of entity.content) {
20
- // Validate that all hashes in entity were uploaded, or were already stored on the service
21
- if (!(files.has(hash) || alreadyStoredHashes.get(hash))) {
22
- errors.push(`This hash is referenced in the entity but was not uploaded or previously available: ${hash}`);
23
- }
13
+ async function allHashesWereUploadedOrStored(components, deployment) {
14
+ const { entity, files } = deployment;
15
+ const errors = [];
16
+ if (entity.content) {
17
+ const alreadyStoredHashes = await components.externalCalls.isContentStoredAlready(entity.content?.map((file) => file.hash) ?? []);
18
+ for (const { hash } of entity.content) {
19
+ // Validate that all hashes in entity were uploaded, or were already stored on the service
20
+ if (!(files.has(hash) || alreadyStoredHashes.get(hash))) {
21
+ errors.push(`This hash is referenced in the entity but was not uploaded or previously available: ${hash}`);
24
22
  }
25
23
  }
26
- return (0, types_1.fromErrors)(...errors);
27
24
  }
28
- };
29
- exports.allHashesInUploadedFilesAreReportedInTheEntity = {
30
- async validate(_components, deployment) {
31
- const { entity, files } = deployment;
32
- const errors = [];
33
- // Validate that all hashes that belong to uploaded files are actually reported on the entity
34
- const entityHashes = new Set(entity.content?.map(({ hash }) => hash) ?? []);
35
- for (const [hash] of files) {
36
- if (!entityHashes.has(hash) && hash !== entity.id) {
37
- errors.push(`This hash was uploaded but is not referenced in the entity: ${hash}`);
38
- }
25
+ return (0, types_1.fromErrors)(...errors);
26
+ }
27
+ exports.allHashesWereUploadedOrStored = allHashesWereUploadedOrStored;
28
+ async function allHashesInUploadedFilesAreReportedInTheEntity(components, deployment) {
29
+ const { entity, files } = deployment;
30
+ const errors = [];
31
+ // Validate that all hashes that belong to uploaded files are actually reported on the entity
32
+ const entityHashes = new Set(entity.content?.map(({ hash }) => hash) ?? []);
33
+ for (const [hash] of files) {
34
+ if (!entityHashes.has(hash) && hash !== entity.id) {
35
+ errors.push(`This hash was uploaded but is not referenced in the entity: ${hash}`);
39
36
  }
40
- return (0, types_1.fromErrors)(...errors);
41
37
  }
42
- };
43
- exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = (0, validations_1.validationAfterADR45)({
44
- async validate(_components, deployment) {
45
- const { entity } = deployment;
46
- const errors = [];
47
- for (const { file, hash } of entity.content ?? []) {
48
- // Validate all content files correspond to at least one avatar snapshot
49
- if (entity.type === schemas_1.EntityType.PROFILE) {
50
- if (!correspondsToASnapshot(file, hash, entity.metadata)) {
51
- errors.push(`This file is not expected: '${file}' or its hash is invalid: '${hash}'. Please, include only valid snapshot files.`);
52
- }
38
+ return (0, types_1.fromErrors)(...errors);
39
+ }
40
+ exports.allHashesInUploadedFilesAreReportedInTheEntity = allHashesInUploadedFilesAreReportedInTheEntity;
41
+ exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = (0, validations_1.validateAfterADR45)(async (components, deployment) => {
42
+ const { entity } = deployment;
43
+ const errors = [];
44
+ for (const { file, hash } of entity.content ?? []) {
45
+ // Validate all content files correspond to at least one avatar snapshot
46
+ if (entity.type === schemas_1.EntityType.PROFILE) {
47
+ if (!correspondsToASnapshot(file, hash, entity.metadata)) {
48
+ errors.push(`This file is not expected: '${file}' or its hash is invalid: '${hash}'. Please, include only valid snapshot files.`);
53
49
  }
54
50
  }
55
- return (0, types_1.fromErrors)(...errors);
56
51
  }
52
+ return (0, types_1.fromErrors)(...errors);
57
53
  });
58
- exports.allMandatoryContentFilesArePresent = (0, validations_1.validationAfterADR158)({
59
- async validate(_components, deployment) {
60
- const { entity } = deployment;
61
- const errors = [];
62
- if (entity.type === schemas_1.EntityType.PROFILE) {
63
- const fileNames = entity.content.map((a) => a.file.toLowerCase());
64
- if (!fileNames.includes('body.png')) {
65
- errors.push(`Profile entity is missing file 'body.png'`);
66
- }
67
- if (!fileNames.includes('face256.png')) {
68
- errors.push(`Profile entity is missing file 'face256.png'`);
69
- }
54
+ exports.allMandatoryContentFilesArePresent = (0, validations_1.validateAfterADR158)(async (components, deployment) => {
55
+ const { entity } = deployment;
56
+ const errors = [];
57
+ if (entity.type === schemas_1.EntityType.PROFILE) {
58
+ const fileNames = entity.content.map((a) => a.file.toLowerCase());
59
+ if (!fileNames.includes('body.png')) {
60
+ errors.push(`Profile entity is missing file 'body.png'`);
61
+ }
62
+ if (!fileNames.includes('face256.png')) {
63
+ errors.push(`Profile entity is missing file 'face256.png'`);
70
64
  }
71
- return (0, types_1.fromErrors)(...errors);
72
65
  }
66
+ return (0, types_1.fromErrors)(...errors);
73
67
  });
74
68
  /**
75
69
  * Validate that uploaded and reported hashes are corrects and files corresponds to snapshots
76
70
  * @public
77
71
  */
78
- exports.content = (0, validations_1.validationGroup)(exports.allHashesWereUploadedOrStored, exports.allHashesInUploadedFilesAreReportedInTheEntity, exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45, exports.allMandatoryContentFilesArePresent);
72
+ exports.content = (0, validations_1.validateAll)(allHashesWereUploadedOrStored, allHashesInUploadedFilesAreReportedInTheEntity, exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45, exports.allMandatoryContentFilesArePresent);
79
73
  //# sourceMappingURL=content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/validations/content.ts"],"names":[],"mappings":";;;AAAA,0CAA0D;AAC1D,oCAAiD;AACjD,+CAA4F;AAE5F,MAAM,sBAAsB,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IAC7B,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,oBAAU,CAAC,OAAO,EAAE;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QACjE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAA;SACzD;QACD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;YACtC,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAA;SAC5D;KACF;IACD,OAAO,IAAA,kBAAU,EAAC,GAAG,MAAM,CAAC,CAAA;AAC9B,CAAC,CACF,CAAA;AAED;;;GAGG;AACU,QAAA,OAAO,GAAe,IAAA,yBAAW,EAC5C,6BAA6B,EAC7B,8CAA8C,EAC9C,qEAA6D,EAC7D,0CAAkC,CACnC,CAAA"}
@@ -1,7 +1,7 @@
1
- import { Validation } from '../types';
1
+ import { ContentValidatorComponents, DeploymentToValidate } from '../types';
2
2
  /**
3
3
  * Validate that entity is actually ok
4
4
  * @public
5
5
  */
6
- export declare const entityStructure: Validation;
6
+ export declare function entityStructure(components: ContentValidatorComponents, deployment: DeploymentToValidate): Promise<import("../types").ValidationResponse>;
7
7
  //# sourceMappingURL=entity-structure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity-structure.d.ts","sourceRoot":"","sources":["../../src/validations/entity-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,UAAU,EAAoB,MAAM,UAAU,CAAA;AAEvF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,UAU7B,CAAA"}
1
+ {"version":3,"file":"entity-structure.d.ts","sourceRoot":"","sources":["../../src/validations/entity-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAA;AAEjG;;;GAGG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,0BAA0B,EAAE,UAAU,EAAE,oBAAoB,kDAQ7G"}
@@ -6,16 +6,15 @@ const types_1 = require("../types");
6
6
  * Validate that entity is actually ok
7
7
  * @public
8
8
  */
9
- exports.entityStructure = {
10
- validate: async (components, deployment) => {
11
- const { entity } = deployment;
12
- if (new Set(entity.pointers).size != entity.pointers.length) {
13
- return (0, types_1.validationFailed)('There are repeated pointers in your request.');
14
- }
15
- else if (!entity.pointers || entity.pointers.length <= 0) {
16
- return (0, types_1.validationFailed)('The entity needs to be pointed by one or more pointers.');
17
- }
18
- return types_1.OK;
9
+ async function entityStructure(components, deployment) {
10
+ const { entity } = deployment;
11
+ if (new Set(entity.pointers).size != entity.pointers.length) {
12
+ return (0, types_1.validationFailed)('There are repeated pointers in your request.');
19
13
  }
20
- };
14
+ else if (!entity.pointers || entity.pointers.length <= 0) {
15
+ return (0, types_1.validationFailed)('The entity needs to be pointed by one or more pointers.');
16
+ }
17
+ return types_1.OK;
18
+ }
19
+ exports.entityStructure = entityStructure;
21
20
  //# sourceMappingURL=entity-structure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity-structure.js","sourceRoot":"","sources":["../../src/validations/entity-structure.ts"],"names":[],"mappings":";;;AAAA,oCAAuF;AAEvF;;;GAGG;AACU,QAAA,eAAe,GAAe;IACzC,QAAQ,EAAE,KAAK,EAAE,UAAsC,EAAE,UAAU,EAAE,EAAE;QACrE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;QAC7B,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;YAC3D,OAAO,IAAA,wBAAgB,EAAC,8CAA8C,CAAC,CAAA;SACxE;aAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1D,OAAO,IAAA,wBAAgB,EAAC,yDAAyD,CAAC,CAAA;SACnF;QACD,OAAO,UAAE,CAAA;IACX,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"entity-structure.js","sourceRoot":"","sources":["../../src/validations/entity-structure.ts"],"names":[],"mappings":";;;AAAA,oCAAiG;AAEjG;;;GAGG;AACI,KAAK,UAAU,eAAe,CAAC,UAAsC,EAAE,UAAgC;IAC5G,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IAC7B,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE;QAC3D,OAAO,IAAA,wBAAgB,EAAC,8CAA8C,CAAC,CAAA;KACxE;SAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE;QAC1D,OAAO,IAAA,wBAAgB,EAAC,yDAAyD,CAAC,CAAA;KACnF;IACD,OAAO,UAAE,CAAA;AACX,CAAC;AARD,0CAQC"}
@@ -1,21 +1,26 @@
1
1
  import { DeploymentToValidate, ExternalCalls } from '../types';
2
+ import { access } from './access-checker/access';
3
+ import { adr45 } from './ADR45';
4
+ import { entityStructure } from './entity-structure';
5
+ import { signature } from './signature';
6
+ import { size } from './size';
2
7
  /**
3
8
  * @public
4
9
  */
5
- export declare const calculateDeploymentSize: (deployment: DeploymentToValidate, externalCalls: ExternalCalls) => Promise<number | string>;
10
+ export declare function calculateDeploymentSize(deployment: DeploymentToValidate, externalCalls: ExternalCalls): Promise<number | string>;
6
11
  /**
7
12
  * Stateful validations that are run on a deployment.
8
13
  * @public
9
14
  */
10
- export declare const statefulValidations: readonly [import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation];
15
+ export declare const statefulValidateFns: readonly [typeof signature, typeof access, typeof size, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn];
11
16
  /**
12
17
  * Stateless validations that are run on a deployment.
13
18
  * @public
14
19
  */
15
- export declare const statelessValidations: readonly [import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation];
20
+ export declare const statelessValidateFns: readonly [typeof entityStructure, import("../types").ValidateFn, import("../types").ValidateFn, typeof adr45];
16
21
  /**
17
22
  * All validations that are run on a deployment.
18
23
  * @public
19
24
  */
20
- export declare const validations: readonly [import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation, import("../types").Validation];
25
+ export declare const validateFns: readonly [typeof entityStructure, import("../types").ValidateFn, import("../types").ValidateFn, typeof adr45, typeof signature, typeof access, typeof size, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn, import("../types").ValidateFn];
21
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAc9D;;GAEG;AACH,eAAO,MAAM,uBAAuB,eACtB,oBAAoB,iBACjB,aAAa,KAC3B,QAAQ,MAAM,GAAG,MAAM,CAazB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,mQAA+E,CAAA;AAE/G;;;GAGG;AACH,eAAO,MAAM,oBAAoB,uIAA2D,CAAA;AAE5F;;;GAGG;AACH,eAAO,MAAM,WAAW,+XAA6D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAMpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAG7B;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAa1B;AAED;;;GAGG;AAEH,eAAO,MAAM,mBAAmB,oNAA+E,CAAA;AAE/G;;;GAGG;AACH,eAAO,MAAM,oBAAoB,+GAA2D,CAAA;AAE5F;;;GAGG;AACH,eAAO,MAAM,WAAW,wTAA6D,CAAA"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validations = exports.statelessValidations = exports.statefulValidations = exports.calculateDeploymentSize = void 0;
4
- const ADR45_1 = require("./ADR45");
3
+ exports.validateFns = exports.statelessValidateFns = exports.statefulValidateFns = exports.calculateDeploymentSize = void 0;
5
4
  const access_1 = require("./access-checker/access");
5
+ const ADR45_1 = require("./ADR45");
6
6
  const content_1 = require("./content");
7
7
  const entity_structure_1 = require("./entity-structure");
8
8
  const ipfs_hashing_1 = require("./ipfs-hashing");
@@ -16,7 +16,7 @@ const scene_1 = require("./scene");
16
16
  /**
17
17
  * @public
18
18
  */
19
- const calculateDeploymentSize = async (deployment, externalCalls) => {
19
+ async function calculateDeploymentSize(deployment, externalCalls) {
20
20
  let totalSize = 0;
21
21
  for (const hash of new Set(deployment.entity.content?.map((item) => item.hash) ?? [])) {
22
22
  const uploadedFile = deployment.files.get(hash);
@@ -31,21 +31,21 @@ const calculateDeploymentSize = async (deployment, externalCalls) => {
31
31
  }
32
32
  }
33
33
  return totalSize;
34
- };
34
+ }
35
35
  exports.calculateDeploymentSize = calculateDeploymentSize;
36
36
  /**
37
37
  * Stateful validations that are run on a deployment.
38
38
  * @public
39
39
  */
40
- exports.statefulValidations = [signature_1.signature, access_1.access, size_1.size, wearables_1.wearable, emotes_1.emote, profile_1.profile, scene_1.scene, content_1.content];
40
+ exports.statefulValidateFns = [signature_1.signature, access_1.access, size_1.size, wearables_1.wearable, emotes_1.emote, profile_1.profile, scene_1.scene, content_1.content];
41
41
  /**
42
42
  * Stateless validations that are run on a deployment.
43
43
  * @public
44
44
  */
45
- exports.statelessValidations = [entity_structure_1.entityStructure, ipfs_hashing_1.ipfsHashing, metadata_schema_1.metadata, ADR45_1.adr45];
45
+ exports.statelessValidateFns = [entity_structure_1.entityStructure, ipfs_hashing_1.ipfsHashing, metadata_schema_1.metadata, ADR45_1.adr45];
46
46
  /**
47
47
  * All validations that are run on a deployment.
48
48
  * @public
49
49
  */
50
- exports.validations = [...exports.statelessValidations, ...exports.statefulValidations];
50
+ exports.validateFns = [...exports.statelessValidateFns, ...exports.statefulValidateFns];
51
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validations/index.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAC/B,oDAAgD;AAChD,uCAAmC;AACnC,yDAAoD;AACpD,iDAA4C;AAC5C,2CAAsC;AACtC,iDAA4C;AAC5C,uDAA4C;AAC5C,uCAAmC;AACnC,2CAAuC;AACvC,iCAA6B;AAC7B,mCAA+B;AAE/B;;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,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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,WAAW,KAAK,SAAS;gBAAE,OAAO,0CAA0C,IAAI,EAAE,CAAA;YACtF,SAAS,IAAI,WAAW,CAAA;SACzB;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAhBD,0DAgBC;AAED;;;GAGG;AAEU,QAAA,mBAAmB,GAAG,CAAC,qBAAS,EAAE,eAAM,EAAE,WAAI,EAAE,oBAAQ,EAAE,cAAK,EAAE,iBAAO,EAAE,aAAK,EAAE,iBAAO,CAAU,CAAA;AAE/G;;;GAGG;AACU,QAAA,oBAAoB,GAAG,CAAC,kCAAe,EAAE,0BAAW,EAAE,0BAAQ,EAAE,aAAK,CAAU,CAAA;AAE5F;;;GAGG;AACU,QAAA,WAAW,GAAG,CAAC,GAAG,4BAAoB,EAAE,GAAG,2BAAmB,CAAU,CAAA"}
@@ -1,7 +1,7 @@
1
- import { Validation } from '../types';
1
+ import { ValidateFn } from '../types';
2
2
  /**
3
3
  * Validate that all hashes used by the entity were actually IPFS hashes
4
4
  * @public
5
5
  */
6
- export declare const ipfsHashing: Validation;
6
+ export declare const ipfsHashing: ValidateFn;
7
7
  //# sourceMappingURL=ipfs-hashing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ipfs-hashing.d.ts","sourceRoot":"","sources":["../../src/validations/ipfs-hashing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,UAAU,EAAE,MAAM,UAAU,CAAA;AAGjD;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,UAaxB,CAAA"}
1
+ {"version":3,"file":"ipfs-hashing.d.ts","sourceRoot":"","sources":["../../src/validations/ipfs-hashing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoC,UAAU,EAAE,MAAM,UAAU,CAAA;AAGvE;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,UAazB,CAAA"}
@@ -8,15 +8,13 @@ const validations_1 = require("./validations");
8
8
  * Validate that all hashes used by the entity were actually IPFS hashes
9
9
  * @public
10
10
  */
11
- exports.ipfsHashing = (0, validations_1.validationAfterADR45)({
12
- validate: (components, deployment) => {
13
- const { entity } = deployment;
14
- const hashesInContent = entity.content?.map(({ hash }) => hash) ?? [];
15
- const allHashes = [entity.id, ...hashesInContent];
16
- const errors = allHashes
17
- .filter((hash) => !schemas_1.IPFSv2.validate(hash))
18
- .map((hash) => `This hash '${hash}' is not valid. It should be IPFS v2 format.`);
19
- return (0, types_1.fromErrors)(...errors);
20
- }
11
+ exports.ipfsHashing = (0, validations_1.validateAfterADR45)((components, deployment) => {
12
+ const { entity } = deployment;
13
+ const hashesInContent = entity.content?.map(({ hash }) => hash) ?? [];
14
+ const allHashes = [entity.id, ...hashesInContent];
15
+ const errors = allHashes
16
+ .filter((hash) => !schemas_1.IPFSv2.validate(hash))
17
+ .map((hash) => `This hash '${hash}' is not valid. It should be IPFS v2 format.`);
18
+ return (0, types_1.fromErrors)(...errors);
21
19
  });
22
20
  //# sourceMappingURL=ipfs-hashing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ipfs-hashing.js","sourceRoot":"","sources":["../../src/validations/ipfs-hashing.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AAErC,oCAAiD;AACjD,+CAAoD;AAEpD;;;GAGG;AACU,QAAA,WAAW,GAAe,IAAA,kCAAoB,EAAC;IAC1D,QAAQ,EAAE,CAAC,UAAsC,EAAE,UAAU,EAAE,EAAE;QAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,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BAAU,EAAC,GAAG,MAAM,CAAC,CAAA;AAC9B,CAAC,CACF,CAAA"}
@@ -1,5 +1,5 @@
1
- import { Validation } from '../../types';
2
- export declare const wasCreatedAfterADR74: Validation;
3
- export declare const emoteRepresentationContent: Validation;
4
- export declare const emote: Validation;
1
+ import { ContentValidatorComponents, DeploymentToValidate, ValidateFn } from '../../types';
2
+ export declare function wasCreatedAfterADR74(components: ContentValidatorComponents, deployment: DeploymentToValidate): Promise<import("../../types").ValidationResponse>;
3
+ export declare function emoteRepresentationContent(components: ContentValidatorComponents, deployment: DeploymentToValidate): Promise<import("../../types").ValidationResponse>;
4
+ export declare const emote: ValidateFn;
5
5
  //# 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,EAAwD,UAAU,EAAoB,MAAM,aAAa,CAAA;AAIhH,eAAO,MAAM,oBAAoB,EAAE,UAQlC,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,UAiBxC,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,UAGnB,CAAA"}
1
+ {"version":3,"file":"emotes.d.ts","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAM,UAAU,EAAoB,MAAM,aAAa,CAAA;AAIhH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,0BAA0B,EAAE,UAAU,EAAE,oBAAoB,qDAMlH;AAED,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,0BAA0B,EACtC,UAAU,EAAE,oBAAoB,qDAgBjC;AAED,eAAO,MAAM,KAAK,EAAE,UAGnB,CAAA"}
@@ -5,31 +5,29 @@ 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
- exports.wasCreatedAfterADR74 = {
9
- validate(components, deployment) {
10
- return deployment.entity.timestamp < timestamps_1.ADR_74_TIMESTAMP
11
- ? (0, types_1.validationFailed)(`The emote timestamp ${deployment.entity.timestamp} is before ADR 74. Emotes did not exist before ADR 74.`)
12
- : types_1.OK;
13
- }
14
- };
15
- exports.emoteRepresentationContent = {
16
- validate: async (components, deployment) => {
17
- const { entity } = deployment;
18
- const metadata = entity.metadata;
19
- const representations = metadata?.emoteDataADR74?.representations;
20
- if (!representations || representations.length === 0)
21
- return (0, types_1.validationFailed)('No emote representations found');
22
- if (!entity.content || entity.content.length === 0)
23
- return (0, types_1.validationFailed)('No content found');
24
- for (const representation of representations) {
25
- for (const representationContent of representation.contents) {
26
- if (!entity.content.find((content) => content.file === representationContent)) {
27
- return (0, types_1.validationFailed)(`Representation content: '${representationContent}' is not one of the content files`);
28
- }
8
+ async function wasCreatedAfterADR74(components, deployment) {
9
+ return deployment.entity.timestamp < timestamps_1.ADR_74_TIMESTAMP
10
+ ? (0, types_1.validationFailed)(`The emote timestamp ${deployment.entity.timestamp} is before ADR 74. Emotes did not exist before ADR 74.`)
11
+ : types_1.OK;
12
+ }
13
+ exports.wasCreatedAfterADR74 = wasCreatedAfterADR74;
14
+ async function emoteRepresentationContent(components, deployment) {
15
+ const { entity } = deployment;
16
+ const metadata = entity.metadata;
17
+ const representations = metadata?.emoteDataADR74?.representations;
18
+ if (!representations || representations.length === 0)
19
+ return (0, types_1.validationFailed)('No emote representations found');
20
+ if (!entity.content || entity.content.length === 0)
21
+ return (0, types_1.validationFailed)('No content found');
22
+ for (const representation of representations) {
23
+ for (const representationContent of representation.contents) {
24
+ if (!entity.content.find((content) => content.file === representationContent)) {
25
+ return (0, types_1.validationFailed)(`Representation content: '${representationContent}' is not one of the content files`);
29
26
  }
30
27
  }
31
- return types_1.OK;
32
28
  }
33
- };
34
- exports.emote = (0, validations_1.validationForType)(schemas_1.EntityType.EMOTE, (0, validations_1.validationGroup)(exports.wasCreatedAfterADR74, exports.emoteRepresentationContent));
29
+ return types_1.OK;
30
+ }
31
+ exports.emoteRepresentationContent = emoteRepresentationContent;
32
+ exports.emote = (0, validations_1.validateIfTypeMatches)(schemas_1.EntityType.EMOTE, (0, validations_1.validateAll)(wasCreatedAfterADR74, emoteRepresentationContent));
35
33
  //# sourceMappingURL=emotes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"emotes.js","sourceRoot":"","sources":["../../../src/validations/items/emotes.ts"],"names":[],"mappings":";;;AAAA,0CAAgD;AAChD,uCAAgH;AAChH,8CAAgD;AAChD,gDAAmE;AAEtD,QAAA,oBAAoB,GAAe;IAC9C,QAAQ,CAAC,UAAsC,EAAE,UAAgC;QAC/E,OAAO,UAAU,CAAC,MAAM,CAAC,SAAS,GAAG,6BAAgB;YACnD,CAAC,CAAC,IAAA,wBAAgB,EACd,uBAAuB,UAAU,CAAC,MAAM,CAAC,SAAS,wDAAwD,CAC3G;YACH,CAAC,CAAC,UAAE,CAAA;IACR,CAAC;CACF,CAAA;AAEY,QAAA,0BAA0B,GAAe;IACpD,QAAQ,EAAE,KAAK,EAAE,UAAsC,EAAE,UAAU,EAAE,EAAE;QACrE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;QAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAiB,CAAA;QACzC,MAAM,eAAe,GAAG,QAAQ,EAAE,cAAc,EAAE,eAAe,CAAA;QACjE,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAA,wBAAgB,EAAC,gCAAgC,CAAC,CAAA;QAC/G,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAA,wBAAgB,EAAC,kBAAkB,CAAC,CAAA;QAE/F,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;YAC5C,KAAK,MAAM,qBAAqB,IAAI,cAAc,CAAC,QAAQ,EAAE;gBAC3D,IAAI,CA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CAAA;IAE/F,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE;QAC5C,KAAK,MAAM,qBAAqB,IAAI,cAAc,CAAC,QAAQ,EAAE;YAC3D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAqB,CAAC,EAAE;gBAC7E,OAAO,IAAA,wBAAgB,EAAC,4BAA4B,qBAAqB,mCAAmC,CAAC,CAAA;aAC9G;SACF;KACF;IACD,OAAO,UAAE,CAAA;AACX,CAAC;AAlBD,gEAkBC;AAEY,QAAA,KAAK,GAAe,IAAA,mCAAqB,EACpD,oBAAU,CAAC,KAAK,EAChB,IAAA,yBAAW,EAAC,oBAAoB,EAAE,0BAA0B,CAAC,CAC9D,CAAA"}
@@ -1,10 +1,10 @@
1
- import { Validation } from '../../types';
1
+ import { ContentValidatorComponents, DeploymentToValidate, ValidateFn } from '../../types';
2
2
  /** Validate item files size, excluding thumbnail, is less than expected */
3
- export declare const deploymentMaxSizeExcludingThumbnailIsNotExceeded: Validation;
4
- export declare const thumbnailMaxSizeIsNotExceeded: Validation;
3
+ export declare function deploymentMaxSizeExcludingThumbnailIsNotExceeded(components: Pick<ContentValidatorComponents, 'externalCalls'>, deployment: DeploymentToValidate): Promise<import("../../types").ValidationResponse>;
4
+ export declare function thumbnailMaxSizeIsNotExceeded(components: Pick<ContentValidatorComponents, 'externalCalls' | 'logs'>, deployment: DeploymentToValidate): Promise<import("../../types").ValidationResponse>;
5
5
  /**
6
6
  * Validate that given item deployment includes the thumbnail and doesn't exceed file sizes
7
7
  * * @public
8
8
  */
9
- export declare const items: Validation;
9
+ export declare const items: ValidateFn;
10
10
  //# sourceMappingURL=items.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/validations/items/items.ts"],"names":[],"mappings":"AAIA,OAAO,EAAM,UAAU,EAAoB,MAAM,aAAa,CAAA;AAI9D,2EAA2E;AAC3E,eAAO,MAAM,gDAAgD,EAAE,UA0B9D,CAAA;AAID,eAAO,MAAM,6BAA6B,EAAE,UAkC3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,UAGnB,CAAA"}
1
+ {"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/validations/items/items.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAM,UAAU,EAAoB,MAAM,aAAa,CAAA;AAIhH,2EAA2E;AAC3E,wBAAsB,gDAAgD,CACpE,UAAU,EAAE,IAAI,CAAC,0BAA0B,EAAE,eAAe,CAAC,EAC7D,UAAU,EAAE,oBAAoB,qDAyBjC;AAID,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,IAAI,CAAC,0BAA0B,EAAE,eAAe,GAAG,MAAM,CAAC,EACtE,UAAU,EAAE,oBAAoB,qDAkCjC;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,UAGnB,CAAA"}