@dcl/content-validator 4.0.21-20221220140243.commit-bc03010 → 4.0.22-20221227190540.commit-91581f6
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/content-validator.api.json +37 -3
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validations/access-checker/scenes.d.ts.map +1 -1
- package/dist/validations/access-checker/scenes.js +29 -227
- package/dist/validations/access-checker/scenes.js.map +1 -1
- package/dist/validations/content.d.ts +1 -0
- package/dist/validations/content.d.ts.map +1 -1
- package/dist/validations/content.js +20 -4
- package/dist/validations/content.js.map +1 -1
- package/dist/validations/timestamps.d.ts +10 -5
- package/dist/validations/timestamps.d.ts.map +1 -1
- package/dist/validations/timestamps.js +11 -6
- package/dist/validations/timestamps.js.map +1 -1
- package/dist/validations/validations.d.ts +1 -0
- package/dist/validations/validations.d.ts.map +1 -1
- package/dist/validations/validations.js +5 -1
- package/dist/validations/validations.js.map +1 -1
- package/package.json +3 -3
|
@@ -243,6 +243,40 @@
|
|
|
243
243
|
"endIndex": 8
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
|
+
{
|
|
247
|
+
"kind": "TypeAlias",
|
|
248
|
+
"canonicalReference": "@dcl/content-validator!Checker:type",
|
|
249
|
+
"docComment": "/**\n * @public\n */\n",
|
|
250
|
+
"excerptTokens": [
|
|
251
|
+
{
|
|
252
|
+
"kind": "Content",
|
|
253
|
+
"text": "export declare type Checker = "
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"kind": "Content",
|
|
257
|
+
"text": "{\n checkLAND(ethAddress: string, parcels: [number, number][], block: number): "
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "Reference",
|
|
261
|
+
"text": "Promise",
|
|
262
|
+
"canonicalReference": "!Promise:interface"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"kind": "Content",
|
|
266
|
+
"text": "<boolean[]>;\n}"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"kind": "Content",
|
|
270
|
+
"text": ";"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"releaseTag": "Public",
|
|
274
|
+
"name": "Checker",
|
|
275
|
+
"typeTokenRange": {
|
|
276
|
+
"startIndex": 1,
|
|
277
|
+
"endIndex": 4
|
|
278
|
+
}
|
|
279
|
+
},
|
|
246
280
|
{
|
|
247
281
|
"kind": "TypeAlias",
|
|
248
282
|
"canonicalReference": "@dcl/content-validator!ConditionalValidation:type",
|
|
@@ -943,12 +977,12 @@
|
|
|
943
977
|
},
|
|
944
978
|
{
|
|
945
979
|
"kind": "Content",
|
|
946
|
-
"text": "{\n L1: {\n
|
|
980
|
+
"text": "{\n L1: {\n checker: "
|
|
947
981
|
},
|
|
948
982
|
{
|
|
949
983
|
"kind": "Reference",
|
|
950
|
-
"text": "
|
|
951
|
-
"canonicalReference": "@
|
|
984
|
+
"text": "Checker",
|
|
985
|
+
"canonicalReference": "@dcl/content-validator!Checker:type"
|
|
952
986
|
},
|
|
953
987
|
{
|
|
954
988
|
"kind": "Content",
|
package/dist/types.d.ts
CHANGED
|
@@ -95,13 +95,19 @@ export declare const validationFailed: (...error: string[]) => ValidationRespons
|
|
|
95
95
|
* @public
|
|
96
96
|
*/
|
|
97
97
|
export declare const fromErrors: (...errors: Errors) => ValidationResponse;
|
|
98
|
+
/**
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export declare type Checker = {
|
|
102
|
+
checkLAND(ethAddress: string, parcels: [number, number][], block: number): Promise<boolean[]>;
|
|
103
|
+
};
|
|
98
104
|
/**
|
|
99
105
|
* A list with all sub-graphs used for validations.
|
|
100
106
|
* @public
|
|
101
107
|
*/
|
|
102
108
|
export declare type SubGraphs = {
|
|
103
109
|
L1: {
|
|
104
|
-
|
|
110
|
+
checker: Checker;
|
|
105
111
|
collections: ISubgraphComponent;
|
|
106
112
|
ensOwner: ISubgraphComponent;
|
|
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M,GAAG,SAAS,CAAA;CACvD,CAAA;AAED;;;GAGG;AACH,oBAAY,0BAA0B,GAAG;IACvC,MAAM,EAAE,gBAAgB,CAAA;IACxB,IAAI,EAAE,gBAAgB,CAAA;IACtB,cAAc,EAAE,cAAc,CAAA;IAC9B,aAAa,EAAE,aAAa,CAAA;IAC5B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scenes.d.ts","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,UAAU,EAAE,MAAM,aAAa,CAAA;AAIpD;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,UAyDpB,CAAA"}
|
|
@@ -6,256 +6,58 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.scenes = void 0;
|
|
7
7
|
const ms_1 = __importDefault(require("ms"));
|
|
8
8
|
const types_1 = require("../../types");
|
|
9
|
+
const SCENE_LOOKBACK_TIME = (0, ms_1.default)('5m');
|
|
9
10
|
/**
|
|
10
11
|
* Checks if the given address has access to the given parcel at the given timestamp.
|
|
11
12
|
* @public
|
|
12
13
|
*/
|
|
13
14
|
exports.scenes = {
|
|
14
|
-
validate: async ({ externalCalls,
|
|
15
|
-
const logger = logs.getLogger('scenes access validator');
|
|
16
|
-
const getAuthorizations = async (owner, operator, timestamp) => {
|
|
17
|
-
const query = `
|
|
18
|
-
query GetAuthorizations($owner: String!, $operator: String!, $timestamp: Int!) {
|
|
19
|
-
authorizations(
|
|
20
|
-
where: {
|
|
21
|
-
owner: $owner,
|
|
22
|
-
operator: $operator,
|
|
23
|
-
createdAt_lte: $timestamp
|
|
24
|
-
},
|
|
25
|
-
orderBy: timestamp,
|
|
26
|
-
orderDirection: desc
|
|
27
|
-
) {
|
|
28
|
-
type
|
|
29
|
-
isApproved
|
|
30
|
-
}
|
|
31
|
-
}`;
|
|
32
|
-
const variables = {
|
|
33
|
-
owner,
|
|
34
|
-
operator,
|
|
35
|
-
timestamp: Math.floor(timestamp / 1000) // js(ms) -> UNIX(s)
|
|
36
|
-
};
|
|
37
|
-
try {
|
|
38
|
-
return (await subGraphs.L1.landManager.query(query, variables)).authorizations;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
logger.error(`Error fetching authorizations for ${owner}`);
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const getEstate = async (estateId, timestamp) => {
|
|
46
|
-
/**
|
|
47
|
-
* You can use `owner`, `operator` and `updateOperator` to check the current value for that estate.
|
|
48
|
-
* Keep in mind that each association (owners, operators, etc) is capped to a thousand (1000) results.
|
|
49
|
-
* For more information, you can use the query explorer at https://thegraph.com/explorer/subgraph/decentraland/land-manager
|
|
50
|
-
*/
|
|
51
|
-
const query = `
|
|
52
|
-
query GetEstate($estateId: String!, $timestamp: Int!) {
|
|
53
|
-
estates(where:{ id: $estateId }) {
|
|
54
|
-
id
|
|
55
|
-
owners(
|
|
56
|
-
where: { createdAt_lte: $timestamp },
|
|
57
|
-
orderBy: timestamp,
|
|
58
|
-
orderDirection: desc,
|
|
59
|
-
first: 1
|
|
60
|
-
) {
|
|
61
|
-
address
|
|
62
|
-
}
|
|
63
|
-
operators(
|
|
64
|
-
where: { createdAt_lte: $timestamp },
|
|
65
|
-
orderBy: timestamp,
|
|
66
|
-
orderDirection: desc,
|
|
67
|
-
first: 1
|
|
68
|
-
) {
|
|
69
|
-
address
|
|
70
|
-
}
|
|
71
|
-
updateOperators(
|
|
72
|
-
where: { createdAt_lte: $timestamp },
|
|
73
|
-
orderBy: timestamp,
|
|
74
|
-
orderDirection: desc,
|
|
75
|
-
first: 1
|
|
76
|
-
) {
|
|
77
|
-
address
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}`;
|
|
81
|
-
const variables = {
|
|
82
|
-
estateId,
|
|
83
|
-
timestamp: Math.floor(timestamp / 1000) // UNIX
|
|
84
|
-
};
|
|
85
|
-
try {
|
|
86
|
-
return (await subGraphs.L1.landManager.query(query, variables)).estates[0];
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
logger.error(`Error fetching estate (${estateId})`);
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const getParcel = async (x, y, timestamp) => {
|
|
94
|
-
/**
|
|
95
|
-
* You can use `owner`, `operator` and `updateOperator` to check the current value for that parcel.
|
|
96
|
-
* Keep in mind that each association (owners, operators, etc) is capped to a thousand (1000) results.
|
|
97
|
-
* For more information, you can use the query explorer at https://thegraph.com/explorer/subgraph/decentraland/land-manager
|
|
98
|
-
*/
|
|
99
|
-
const query = `
|
|
100
|
-
query GetParcel($x: Int!, $y: Int!, $timestamp: Int!) {
|
|
101
|
-
parcels(where:{ x: $x, y: $y }) {
|
|
102
|
-
estates(
|
|
103
|
-
where: { createdAt_lte: $timestamp },
|
|
104
|
-
orderBy: createdAt,
|
|
105
|
-
orderDirection: desc,
|
|
106
|
-
first: 1
|
|
107
|
-
) {
|
|
108
|
-
estateId
|
|
109
|
-
}
|
|
110
|
-
owners(
|
|
111
|
-
where: { createdAt_lte: $timestamp },
|
|
112
|
-
orderBy: timestamp,
|
|
113
|
-
orderDirection: desc,
|
|
114
|
-
first: 1
|
|
115
|
-
) {
|
|
116
|
-
address
|
|
117
|
-
}
|
|
118
|
-
operators(
|
|
119
|
-
where: { createdAt_lte: $timestamp },
|
|
120
|
-
orderBy: timestamp,
|
|
121
|
-
orderDirection: desc,
|
|
122
|
-
first: 1
|
|
123
|
-
) {
|
|
124
|
-
address
|
|
125
|
-
}
|
|
126
|
-
updateOperators(
|
|
127
|
-
where: { createdAt_lte: $timestamp },
|
|
128
|
-
orderBy: timestamp,
|
|
129
|
-
orderDirection: desc,
|
|
130
|
-
first: 1
|
|
131
|
-
) {
|
|
132
|
-
address
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}`;
|
|
136
|
-
const variables = {
|
|
137
|
-
x,
|
|
138
|
-
y,
|
|
139
|
-
timestamp: Math.floor(timestamp / 1000) // UNIX
|
|
140
|
-
};
|
|
141
|
-
try {
|
|
142
|
-
const r = await subGraphs.L1.landManager.query(query, variables);
|
|
143
|
-
if (r.parcels && r.parcels.length)
|
|
144
|
-
return r.parcels[0];
|
|
145
|
-
logger.error(`Error fetching parcel (${x}, ${y}, ${timestamp}): ${JSON.stringify(r)}`);
|
|
146
|
-
throw new Error(`Error fetching parcel (${x}, ${y}), ${timestamp}`);
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
logger.error(`Error fetching parcel (${x}, ${y}, ${timestamp})`);
|
|
150
|
-
throw error;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
const hasAccessThroughAuthorizations = async (owner, ethAddress, timestamp) => {
|
|
154
|
-
/* You also get access if you received:
|
|
155
|
-
* - an authorization with isApproved and type Operator, ApprovalForAll or UpdateManager
|
|
156
|
-
* at that time
|
|
157
|
-
*/
|
|
158
|
-
const authorizations = await getAuthorizations(owner.toLowerCase(), ethAddress.toLowerCase(), timestamp);
|
|
159
|
-
const firstOperatorAuthorization = authorizations.find((authorization) => authorization.type === 'Operator');
|
|
160
|
-
const firstApprovalForAllAuthorization = authorizations.find((authorization) => authorization.type === 'ApprovalForAll');
|
|
161
|
-
const firstUpdateManagerAuthorization = authorizations.find((authorization) => authorization.type === 'UpdateManager');
|
|
162
|
-
if (firstOperatorAuthorization?.isApproved ||
|
|
163
|
-
firstApprovalForAllAuthorization?.isApproved ||
|
|
164
|
-
firstUpdateManagerAuthorization?.isApproved) {
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
return false;
|
|
168
|
-
};
|
|
169
|
-
const hasAccessThroughFirstLevelAuthorities = async (target, ethAddress) => {
|
|
170
|
-
const firstLevelAuthorities = [...target.owners, ...target.operators, ...target.updateOperators]
|
|
171
|
-
.filter((addressSnapshot) => addressSnapshot.address)
|
|
172
|
-
.map((addressSnapshot) => addressSnapshot.address.toLowerCase());
|
|
173
|
-
return firstLevelAuthorities.includes(ethAddress.toLowerCase());
|
|
174
|
-
};
|
|
175
|
-
const isEstateUpdateAuthorized = async (estateId, timestamp, ethAddress) => {
|
|
176
|
-
const estate = await getEstate(estateId.toString(), timestamp);
|
|
177
|
-
if (estate) {
|
|
178
|
-
return ((await hasAccessThroughFirstLevelAuthorities(estate, ethAddress)) ||
|
|
179
|
-
(await hasAccessThroughAuthorizations(estate.owners[0].address, ethAddress, timestamp)));
|
|
180
|
-
}
|
|
181
|
-
throw new Error(`Couldn\'t find the state ${estateId}`);
|
|
182
|
-
};
|
|
183
|
-
const isParcelUpdateAuthorized = async (x, y, timestamp, ethAddress, _externalCalls) => {
|
|
184
|
-
/* You get direct access if you were the:
|
|
185
|
-
* - owner
|
|
186
|
-
* - operator
|
|
187
|
-
* - update operator
|
|
188
|
-
* at that time
|
|
189
|
-
*/
|
|
190
|
-
const parcel = await getParcel(x, y, timestamp);
|
|
191
|
-
if (parcel) {
|
|
192
|
-
const belongsToEstate = parcel.estates != undefined && parcel.estates.length > 0 && parcel.estates[0].estateId != undefined;
|
|
193
|
-
return ((await hasAccessThroughFirstLevelAuthorities(parcel, ethAddress)) ||
|
|
194
|
-
(await hasAccessThroughAuthorizations(parcel.owners[0].address, ethAddress, timestamp)) ||
|
|
195
|
-
(belongsToEstate && (await isEstateUpdateAuthorized(parcel.estates[0].estateId, timestamp, ethAddress))));
|
|
196
|
-
}
|
|
197
|
-
throw new Error(`Parcel(${x},${y},${timestamp}) not found`);
|
|
198
|
-
};
|
|
199
|
-
const checkParcelAccess = async (x, y, timestamp, ethAddress, externalCalls) => {
|
|
200
|
-
try {
|
|
201
|
-
return await retry(() => isParcelUpdateAuthorized(x, y, timestamp, ethAddress, externalCalls), 5, '0.1s');
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
logger.error(`Error checking parcel access (${x}, ${y}, ${timestamp}, ${ethAddress}).`);
|
|
205
|
-
throw error;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const SCENE_LOOKBACK_TIME = (0, ms_1.default)('5m');
|
|
15
|
+
validate: async ({ externalCalls, subGraphs, logs }, deployment) => {
|
|
209
16
|
const { entity } = deployment;
|
|
210
17
|
const { pointers, timestamp } = entity;
|
|
18
|
+
const logger = logs.getLogger('scenes-validator');
|
|
19
|
+
let block;
|
|
20
|
+
try {
|
|
21
|
+
// 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)
|
|
22
|
+
const blockInfo = await subGraphs.l1BlockSearch.findBlockForTimestamp(timestamp - SCENE_LOOKBACK_TIME);
|
|
23
|
+
if (blockInfo === undefined) {
|
|
24
|
+
return (0, types_1.fromErrors)('Deployment timestamp is invalid, no matching block found');
|
|
25
|
+
}
|
|
26
|
+
block = blockInfo.block;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return (0, types_1.fromErrors)(`Deployment timestamp is invalid, no matching block found: ${err}`);
|
|
30
|
+
}
|
|
211
31
|
const ethAddress = externalCalls.ownerAddress(deployment.auditInfo);
|
|
212
32
|
const errors = [];
|
|
213
33
|
const lowerCasePointers = pointers.map((pointer) => pointer.toLowerCase());
|
|
34
|
+
const batch = [];
|
|
214
35
|
for (const pointer of lowerCasePointers) {
|
|
215
36
|
const pointerParts = pointer.split(',');
|
|
216
37
|
if (pointerParts.length === 2) {
|
|
217
38
|
const x = parseInt(pointerParts[0], 10);
|
|
218
39
|
const y = parseInt(pointerParts[1], 10);
|
|
219
|
-
|
|
220
|
-
// 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)
|
|
221
|
-
const hasAccess = (await checkParcelAccess(x, y, timestamp, ethAddress, externalCalls)) ||
|
|
222
|
-
(await checkParcelAccess(x, y, timestamp - SCENE_LOOKBACK_TIME, ethAddress, externalCalls));
|
|
223
|
-
if (!hasAccess) {
|
|
224
|
-
errors.push(`The provided Eth Address does not have access to the following parcel: (${x},${y})`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
catch (e) {
|
|
228
|
-
errors.push(`The provided Eth Address does not have access to the following parcel: (${x},${y}). ${e}`);
|
|
229
|
-
}
|
|
40
|
+
batch.push([x, y]);
|
|
230
41
|
}
|
|
231
42
|
else {
|
|
232
43
|
errors.push(`Scene pointers should only contain two integers separated by a comma, for example (10,10) or (120,-45). Invalid pointer: ${pointer}`);
|
|
233
44
|
}
|
|
234
45
|
}
|
|
235
|
-
return (0, types_1.fromErrors)(...errors);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
/** @internal */
|
|
239
|
-
async function retry(execution, attempts, waitTime = '1s', failedAttemptCallback) {
|
|
240
|
-
while (attempts > 0) {
|
|
241
46
|
try {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (attempts > 0) {
|
|
249
|
-
if (failedAttemptCallback) {
|
|
250
|
-
failedAttemptCallback(attempts);
|
|
47
|
+
const access = await subGraphs.L1.checker.checkLAND(ethAddress, batch, block);
|
|
48
|
+
for (let i = 0; i < batch.length; i++) {
|
|
49
|
+
const [x, y] = batch[i];
|
|
50
|
+
const hasAccess = access[i];
|
|
51
|
+
if (!hasAccess) {
|
|
52
|
+
errors.push(`The provided Eth Address does not have access to the following parcel: (${x},${y})`);
|
|
251
53
|
}
|
|
252
|
-
await new Promise((res) => setTimeout(res, (0, ms_1.default)(waitTime)));
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
throw error;
|
|
256
54
|
}
|
|
257
55
|
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
logger.error(err);
|
|
58
|
+
return (0, types_1.fromErrors)(`Cannot validate deployment`);
|
|
59
|
+
}
|
|
60
|
+
return (0, types_1.fromErrors)(...errors);
|
|
258
61
|
}
|
|
259
|
-
|
|
260
|
-
}
|
|
62
|
+
};
|
|
261
63
|
//# sourceMappingURL=scenes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenes.js","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"scenes.js","sourceRoot":"","sources":["../../../src/validations/access-checker/scenes.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAmB;AACnB,uCAAoD;AAEpD,MAAM,mBAAmB,GAAG,IAAA,YAAE,EAAC,IAAI,CAAC,CAAA;AAEpC;;;GAGG;AACU,QAAA,MAAM,GAAe;IAChC,QAAQ,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE;QACjE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;QAC7B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAAA;QAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAA;QAEjD,IAAI,KAAa,CAAA;QACjB,IAAI;YACF,8IAA8I;YAC9I,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,aAAa,CAAC,qBAAqB,CAAC,SAAS,GAAG,mBAAmB,CAAC,CAAA;YACtG,IAAI,SAAS,KAAK,SAAS,EAAE;gBAC3B,OAAO,IAAA,kBAAU,EAAC,0DAA0D,CAAC,CAAA;aAC9E;YAED,KAAK,GAAG,SAAS,CAAC,KAAK,CAAA;SACxB;QAAC,OAAO,GAAQ,EAAE;YACjB,OAAO,IAAA,kBAAU,EAAC,6DAA6D,GAAG,EAAE,CAAC,CAAA;SACtF;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QAEnE,MAAM,MAAM,GAAG,EAAE,CAAA;QACjB,MAAM,iBA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B,CAAC,CAAA;SAChD;QAED,OAAO,IAAA,kBAAU,EAAC,GAAG,MAAM,CAAC,CAAA;IAC9B,CAAC;CACF,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { Validation } from '../types';
|
|
|
2
2
|
export declare const allHashesWereUploadedOrStored: Validation;
|
|
3
3
|
export declare const allHashesInUploadedFilesAreReportedInTheEntity: Validation;
|
|
4
4
|
export declare const allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45: Validation;
|
|
5
|
+
export declare const allMandatoryContentFilesArePresent: Validation;
|
|
5
6
|
/**
|
|
6
7
|
* Validate that uploaded and reported hashes are corrects and files corresponds to snapshots
|
|
7
8
|
* @public
|
|
@@ -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;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,
|
|
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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.content = exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = exports.allHashesInUploadedFilesAreReportedInTheEntity = exports.allHashesWereUploadedOrStored = void 0;
|
|
3
|
+
exports.content = exports.allMandatoryContentFilesArePresent = exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = exports.allHashesInUploadedFilesAreReportedInTheEntity = exports.allHashesWereUploadedOrStored = void 0;
|
|
4
4
|
const schemas_1 = require("@dcl/schemas");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const validations_1 = require("./validations");
|
|
@@ -27,7 +27,7 @@ exports.allHashesWereUploadedOrStored = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
exports.allHashesInUploadedFilesAreReportedInTheEntity = {
|
|
30
|
-
async validate(
|
|
30
|
+
async validate(_components, deployment) {
|
|
31
31
|
const { entity, files } = deployment;
|
|
32
32
|
const errors = [];
|
|
33
33
|
// Validate that all hashes that belong to uploaded files are actually reported on the entity
|
|
@@ -41,7 +41,7 @@ exports.allHashesInUploadedFilesAreReportedInTheEntity = {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = (0, validations_1.validationAfterADR45)({
|
|
44
|
-
async validate(
|
|
44
|
+
async validate(_components, deployment) {
|
|
45
45
|
const { entity } = deployment;
|
|
46
46
|
const errors = [];
|
|
47
47
|
for (const { file, hash } of entity.content ?? []) {
|
|
@@ -55,9 +55,25 @@ exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45 = (0, vali
|
|
|
55
55
|
return (0, types_1.fromErrors)(...errors);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
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
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return (0, types_1.fromErrors)(...errors);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
58
74
|
/**
|
|
59
75
|
* Validate that uploaded and reported hashes are corrects and files corresponds to snapshots
|
|
60
76
|
* @public
|
|
61
77
|
*/
|
|
62
|
-
exports.content = (0, validations_1.validationGroup)(exports.allHashesWereUploadedOrStored, exports.allHashesInUploadedFilesAreReportedInTheEntity, exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45);
|
|
78
|
+
exports.content = (0, validations_1.validationGroup)(exports.allHashesWereUploadedOrStored, exports.allHashesInUploadedFilesAreReportedInTheEntity, exports.allContentFilesCorrespondToAtLeastOneAvatarSnapshotAfterADR45, exports.allMandatoryContentFilesArePresent);
|
|
63
79
|
//# 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,+
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/validations/content.ts"],"names":[],"mappings":";;;AAAA,0CAA0D;AAC1D,oCAAiD;AACjD,+CAA4F;AAE5F,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,QAAiB,EAAE,EAAE;IACnF,MAAM,wBAAwB,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAEjE,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAChD,OA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AA;QAC7B,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,oBAAU,CAAC,OAAO,EAAE;YACtC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;YACjE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;gBACnC,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAA;aACzD;YACD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;gBACtC,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAA;aAC5D;SACF;QACD,OAAO,IAAA,kBAAU,EAAC,GAAG,MAAM,CAAC,CAAA;IAC9B,CAAC;CACF,CAAC,CAAA;AAEF;;;GAGG;AACU,QAAA,OAAO,GAAe,IAAA,6BAAe,EAChD,qCAA6B,EAC7B,sDAA8C,EAC9C,qEAA6D,EAC7D,0CAAkC,CACnC,CAAA"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 1669852800000 = 2022-09-12T13:00:00Z
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export declare const ADR_74_TIMESTAMP: number;
|
|
6
1
|
/**
|
|
7
2
|
* 1652191200000 = 2022-05-10T14:00:00Z
|
|
8
3
|
* @public
|
|
@@ -13,6 +8,16 @@ export declare const ADR_45_TIMESTAMP: number;
|
|
|
13
8
|
* @public
|
|
14
9
|
*/
|
|
15
10
|
export declare const ADR_75_TIMESTAMP: number;
|
|
11
|
+
/**
|
|
12
|
+
* 1669852800000 = 2022-09-12T13:00:00Z
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare const ADR_74_TIMESTAMP: number;
|
|
16
|
+
/**
|
|
17
|
+
* 1673362800000 = 2023-01-10T15:00:00Z
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare const ADR_158_TIMESTAMP: number;
|
|
16
21
|
/**
|
|
17
22
|
* DCL Launch Day
|
|
18
23
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestamps.d.ts","sourceRoot":"","sources":["../../src/validations/timestamps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,kCAAkC,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"timestamps.d.ts","sourceRoot":"","sources":["../../src/validations/timestamps.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAwF,CAAA;AAErH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAA0F,CAAA;AAExH;;;GAGG;AACH,eAAO,MAAM,kCAAkC,gBAAgB,CAAA"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LEGACY_CONTENT_MIGRATION_TIMESTAMP = exports.
|
|
4
|
-
/**
|
|
5
|
-
* 1669852800000 = 2022-09-12T13:00:00Z
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
exports.ADR_74_TIMESTAMP = process.env.ADR_74_TIMESTAMP ? parseInt(process.env.ADR_74_TIMESTAMP) : 1662987600000;
|
|
3
|
+
exports.LEGACY_CONTENT_MIGRATION_TIMESTAMP = exports.ADR_158_TIMESTAMP = exports.ADR_74_TIMESTAMP = exports.ADR_75_TIMESTAMP = exports.ADR_45_TIMESTAMP = void 0;
|
|
9
4
|
/**
|
|
10
5
|
* 1652191200000 = 2022-05-10T14:00:00Z
|
|
11
6
|
* @public
|
|
@@ -16,6 +11,16 @@ exports.ADR_45_TIMESTAMP = process.env.ADR_45_TIMESTAMP ? parseInt(process.env.A
|
|
|
16
11
|
* @public
|
|
17
12
|
*/
|
|
18
13
|
exports.ADR_75_TIMESTAMP = process.env.ADR_75_TIMESTAMP ? parseInt(process.env.ADR_75_TIMESTAMP) : 1658275200000;
|
|
14
|
+
/**
|
|
15
|
+
* 1669852800000 = 2022-09-12T13:00:00Z
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
exports.ADR_74_TIMESTAMP = process.env.ADR_74_TIMESTAMP ? parseInt(process.env.ADR_74_TIMESTAMP) : 1662987600000;
|
|
19
|
+
/**
|
|
20
|
+
* 1673362800000 = 2023-01-10T15:00:00Z
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
exports.ADR_158_TIMESTAMP = process.env.ADR_158_TIMESTAMP ? parseInt(process.env.ADR_158_TIMESTAMP) : 1662987600000;
|
|
19
24
|
/**
|
|
20
25
|
* DCL Launch Day
|
|
21
26
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timestamps.js","sourceRoot":"","sources":["../../src/validations/timestamps.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,kCAAkC,GAAG,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"timestamps.js","sourceRoot":"","sources":["../../src/validations/timestamps.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAErH;;;GAGG;AACU,QAAA,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,aAAa,CAAA;AAExH;;;GAGG;AACU,QAAA,kCAAkC,GAAG,aAAa,CAAA"}
|
|
@@ -5,5 +5,6 @@ export declare function conditionalValidation(condition: (deployment: Deployment
|
|
|
5
5
|
export declare function validationAfterADR45(validation: Validation): Validation;
|
|
6
6
|
export declare function validationAfterADR75(validation: Validation): Validation;
|
|
7
7
|
export declare function validationAfterADR74(validation: Validation): Validation;
|
|
8
|
+
export declare function validationAfterADR158(validation: Validation): Validation;
|
|
8
9
|
export declare function validationForType(entityType: EntityType, validation: Validation): Validation;
|
|
9
10
|
//# sourceMappingURL=validations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../src/validations/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAA8B,oBAAoB,EAAM,UAAU,EAAsB,MAAM,UAAU,CAAA;AAG/G,wBAAgB,eAAe,CAAC,GAAG,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAaxE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3E,UAAU,EAAE,UAAU,GACrB,UAAU,CAUZ;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,cAE/E"}
|
|
1
|
+
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../src/validations/validations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAA8B,oBAAoB,EAAM,UAAU,EAAsB,MAAM,UAAU,CAAA;AAG/G,wBAAgB,eAAe,CAAC,GAAG,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,CAaxE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3E,UAAU,EAAE,UAAU,GACrB,UAAU,CAUZ;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAEvE;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAExE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,cAE/E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validationForType = exports.validationAfterADR74 = exports.validationAfterADR75 = exports.validationAfterADR45 = exports.conditionalValidation = exports.validationGroup = void 0;
|
|
3
|
+
exports.validationForType = exports.validationAfterADR158 = exports.validationAfterADR74 = exports.validationAfterADR75 = exports.validationAfterADR45 = exports.conditionalValidation = exports.validationGroup = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const timestamps_1 = require("./timestamps");
|
|
6
6
|
function validationGroup(...validations) {
|
|
@@ -40,6 +40,10 @@ function validationAfterADR74(validation) {
|
|
|
40
40
|
return conditionalValidation((deployment) => deployment.entity.timestamp >= timestamps_1.ADR_74_TIMESTAMP, validation);
|
|
41
41
|
}
|
|
42
42
|
exports.validationAfterADR74 = validationAfterADR74;
|
|
43
|
+
function validationAfterADR158(validation) {
|
|
44
|
+
return conditionalValidation((deployment) => deployment.entity.timestamp >= timestamps_1.ADR_158_TIMESTAMP, validation);
|
|
45
|
+
}
|
|
46
|
+
exports.validationAfterADR158 = validationAfterADR158;
|
|
43
47
|
function validationForType(entityType, validation) {
|
|
44
48
|
return conditionalValidation((deployment) => deployment.entity.type === entityType, validation);
|
|
45
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.js","sourceRoot":"","sources":["../../src/validations/validations.ts"],"names":[],"mappings":";;;AACA,oCAA+G;AAC/G,
|
|
1
|
+
{"version":3,"file":"validations.js","sourceRoot":"","sources":["../../src/validations/validations.ts"],"names":[],"mappings":";;;AACA,oCAA+G;AAC/G,6CAAsG;AAEtG,SAAgB,eAAe,CAAC,GAAG,WAAyB;IAC1D,OAAO;QACL,KAAK,CAAC,QAAQ,CACZ,UAAsC,EACtC,UAAgC;YAEhC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;gBACpC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;gBAClE,IAAI,CAAC,QAAQ,CAAC,EAAE;oBAAE,OAAO,QAAQ,CAAA;aAClC;YACD,OAAO,UAAE,CAAA;QACX,CAAC;KACF,CAAA;AACH,CAAC;AAbD,0CAaC;AAED,SAAgB,qBAAqB,CACnC,SAA2E,EAC3E,UAAsB;IAEtB,OAAO;QACL,KAAK,CAAC,QAAQ,CAAC,UAAsC,EAAE,UAAgC;YACrF,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,CAAA;YAClD,IAAI,cAAc,EAAE;gBAClB,OAAO,UAAU,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;aACnD;YACD,OAAO,UAAE,CAAA;QACX,CAAC;KACF,CAAA;AACH,CAAC;AAbD,sDAaC;AAED,SAAgB,oBAAoB,CAAC,UAAsB;IACzD,OAAO,qBAAqB,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,6BAAgB,EAAE,UAAU,CAAC,CAAA;AAC3G,CAAC;AAFD,oDAEC;AAED,SAAgB,oBAAoB,CAAC,UAAsB;IACzD,OAAO,qBAAqB,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,6BAAgB,EAAE,UAAU,CAAC,CAAA;AAC3G,CAAC;AAFD,oDAEC;AAED,SAAgB,oBAAoB,CAAC,UAAsB;IACzD,OAAO,qBAAqB,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,6BAAgB,EAAE,UAAU,CAAC,CAAA;AAC3G,CAAC;AAFD,oDAEC;AAED,SAAgB,qBAAqB,CAAC,UAAsB;IAC1D,OAAO,qBAAqB,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,8BAAiB,EAAE,UAAU,CAAC,CAAA;AAC5G,CAAC;AAFD,sDAEC;AAED,SAAgB,iBAAiB,CAAC,UAAsB,EAAE,UAAsB;IAC9E,OAAO,qBAAqB,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,UAAU,CAAC,CAAA;AACjG,CAAC;AAFD,8CAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/content-validator",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.22-20221227190540.commit-91581f6",
|
|
4
4
|
"description": "Catalyst content validations",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"typescript": "^4.7.3"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@dcl/block-indexer": "1.0.0-
|
|
54
|
+
"@dcl/block-indexer": "^1.0.0-20221223191317.commit-2d753e7",
|
|
55
55
|
"@dcl/content-hash-tree": "^1.1.3",
|
|
56
56
|
"@dcl/hashing": "1.1.2",
|
|
57
57
|
"@dcl/schemas": "^5.4.2",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"files": [
|
|
67
67
|
"dist"
|
|
68
68
|
],
|
|
69
|
-
"commit": "
|
|
69
|
+
"commit": "91581f61ac7968388e43da7cc97903166667bb4a"
|
|
70
70
|
}
|