@dcl/schemas 3.13.0 → 4.0.1-20220330162736.commit-7894e6f

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.
@@ -46,4 +46,7 @@ export declare namespace IPFSv2 {
46
46
  const schema: JSONSchema<IPFSv2>;
47
47
  const validate: ValidateFunction<IPFSv2>;
48
48
  }
49
+ export declare type WithRequired<T, K extends keyof T> = T & {
50
+ [P in K]-?: T[P];
51
+ };
49
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/misc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,UAAU,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAEpE;;;GAGG;AACH,oBAAY,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACf,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,CAoBrC,CAAA;IAEM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAEF,CAAA;CAC7C;AACD;;GAEG;AACH,oBAAY,UAAU,GAAG,MAAM,CAAA;AAE/B;;;GAGG;AACH,oBAAY,UAAU,GAAG,MAAM,CAAA;AAE/B;;;GAGG;AACH,yBAAiB,UAAU,CAAC;IACnB,MAAM,MAAM,EAAE,UAAU,CAAC,UAAU,CAGzC,CAAA;IAGM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAEQ,CAAA;CAC3D;AAED;;;GAGG;AACH,oBAAY,MAAM,GAAG,MAAM,CAAA;AAE3B;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACf,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,CAGrC,CAAA;IAEM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAEJ,CAAA;CAC3C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/misc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,UAAU,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AAEpE;;;GAGG;AACH,oBAAY,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACf,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,CAoBrC,CAAA;IAEM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAEF,CAAA;CAC7C;AACD;;GAEG;AACH,oBAAY,UAAU,GAAG,MAAM,CAAA;AAE/B;;;GAGG;AACH,oBAAY,UAAU,GAAG,MAAM,CAAA;AAE/B;;;GAGG;AACH,yBAAiB,UAAU,CAAC;IACnB,MAAM,MAAM,EAAE,UAAU,CAAC,UAAU,CAGzC,CAAA;IAGM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAEQ,CAAA;CAC3D;AAED;;;GAGG;AACH,oBAAY,MAAM,GAAG,MAAM,CAAA;AAE3B;;;GAGG;AACH,yBAAiB,MAAM,CAAC;IACf,MAAM,MAAM,EAAE,UAAU,CAAC,MAAM,CAGrC,CAAA;IAEM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAEJ,CAAA;CAC3C;AAED,oBAAY,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG;KAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA"}
@@ -3,6 +3,5 @@ export { Locale } from './locale';
3
3
  export { Metrics } from './metrics';
4
4
  export { WearableRepresentation } from './representation';
5
5
  export { WearableBodyShape } from './wearable-body-shape';
6
- export { Wearable } from './wearable';
7
- export { TPWearable } from './tp-wearable';
6
+ export { Wearable, ThirdPartyWearable, StandardWearable } from './wearable';
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/wearables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/wearables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TPWearable = exports.Wearable = exports.WearableBodyShape = exports.WearableRepresentation = exports.Metrics = exports.Locale = exports.I18N = void 0;
3
+ exports.Wearable = exports.WearableBodyShape = exports.WearableRepresentation = exports.Metrics = exports.Locale = exports.I18N = void 0;
4
4
  var i18n_1 = require("./i18n");
5
5
  Object.defineProperty(exports, "I18N", { enumerable: true, get: function () { return i18n_1.I18N; } });
6
6
  var locale_1 = require("./locale");
@@ -13,6 +13,4 @@ var wearable_body_shape_1 = require("./wearable-body-shape");
13
13
  Object.defineProperty(exports, "WearableBodyShape", { enumerable: true, get: function () { return wearable_body_shape_1.WearableBodyShape; } });
14
14
  var wearable_1 = require("./wearable");
15
15
  Object.defineProperty(exports, "Wearable", { enumerable: true, get: function () { return wearable_1.Wearable; } });
16
- var tp_wearable_1 = require("./tp-wearable");
17
- Object.defineProperty(exports, "TPWearable", { enumerable: true, get: function () { return tp_wearable_1.TPWearable; } });
18
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/wearables/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,mDAAyD;AAAhD,wHAAA,sBAAsB,OAAA;AAC/B,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,6CAA0C;AAAjC,yGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/wearables/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,mDAAyD;AAAhD,wHAAA,sBAAsB,OAAA;AAC/B,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,uCAA2E;AAAlE,oGAAA,QAAQ,OAAA"}
@@ -1,14 +1,50 @@
1
1
  import { JSONSchema, ValidateFunction } from '../../validation';
2
2
  import { Rarity } from '../../dapps/rarity';
3
- import { BaseWearable } from './base-wearable';
3
+ import { WearableCategory } from '../../dapps/wearable-category';
4
+ import { I18N } from './i18n';
5
+ import { WearableRepresentation } from './representation';
6
+ import { Metrics } from './metrics';
7
+ import { DisplayableDeployment } from '../shared/displayable';
8
+ import { MerkleProof } from '../merkle-tree';
9
+ import { WithRequired } from '../../misc';
4
10
  /** @alpha */
5
- export declare type Wearable = BaseWearable & {
6
- rarity: Rarity;
7
- collectionAddress: string;
11
+ export declare type Wearable = DisplayableDeployment & {
12
+ id: string;
13
+ name: string;
14
+ description: string;
15
+ data: {
16
+ replaces: WearableCategory[];
17
+ hides: WearableCategory[];
18
+ tags: string[];
19
+ representations: WearableRepresentation[];
20
+ category: WearableCategory;
21
+ };
22
+ i18n: I18N[];
23
+ thumbnail: string;
24
+ image: string;
25
+ rarity?: Rarity;
26
+ collectionAddress?: string;
27
+ metrics?: Metrics;
28
+ content?: Record<string, string>;
29
+ merkleProof?: MerkleProof;
8
30
  };
9
31
  /** @alpha */
32
+ export declare type StandardWearable = Omit<WithRequired<Wearable, 'collectionAddress' | 'rarity'>, 'merkleProof' | 'content'>;
33
+ export declare type ThirdPartyWearable = Omit<WithRequired<Wearable, 'merkleProof'>, 'rarity' | 'collectionAddress'>;
34
+ export declare const isStandard: (wearable: Wearable) => wearable is StandardWearable;
35
+ export declare const isThirdParty: (wearable: Wearable) => wearable is ThirdPartyWearable;
36
+ /** @alpha */
10
37
  export declare namespace Wearable {
11
38
  const schema: JSONSchema<Wearable>;
39
+ /**
40
+ * Validates that the wearable metadata complies with the standard or third party wearable, and doesn't have repeated locales.
41
+ * Some fields are defined as optional but those are validated to be present as standard XOR third party:
42
+ * Standard Wearables should contain:
43
+ * - collectionAddress
44
+ * - rarity
45
+ * Third Party Wearables should contain:
46
+ * - merkleProof
47
+ */
12
48
  const validate: ValidateFunction<Wearable>;
13
49
  }
14
50
  //# sourceMappingURL=wearable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wearable.d.ts","sourceRoot":"","sources":["../../../src/platform/wearables/wearable.ts"],"names":[],"mappings":"AAAA,O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AE,CAAA;QACzB,IAAI,EAAE,MAAM,EAAE,CAAA;QACd,eAAe,EAAE,sBAAsB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;KAC3B,CAAA;IACD,IAAI,EAAE,IAAI,EAAE,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,aAAa;AACb,oBAAY,gBAAgB,GAAG,IAAI,CACjC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,QAAQ,CAAC,EACtD,aAAa,GAAG,SAAS,CAC1B,CAAA;AAED,oBAAY,kBAAkB,GAAG,IAAI,CACnC,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,EACrC,QAAQ,GAAG,mBAAmB,CAC/B,CAAA;AAmBD,eAAO,MAAM,UAAU,aAAc,QAAQ,iCAC0B,CAAA;AAEvE,eAAO,MAAM,YAAY,aACb,QAAQ,mCAC6C,CAAA;AAEjE,aAAa;AACb,yBAAiB,QAAQ,CAAC;IACjB,MAAM,MAAM,EAAE,UAAU,CAAC,QAAQ,CAqFvC,CAAA;IAID;;;;;;;;OAQG;IACI,MAAM,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAQ7C,CAAA;CAUJ"}
@@ -1,26 +1,132 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Wearable = void 0;
3
+ exports.Wearable = exports.isThirdParty = exports.isStandard = void 0;
4
4
  const validation_1 = require("../../validation");
5
5
  const rarity_1 = require("../../dapps/rarity");
6
- const base_wearable_1 = require("./base-wearable");
6
+ const wearable_category_1 = require("../../dapps/wearable-category");
7
+ const i18n_1 = require("./i18n");
8
+ const representation_1 = require("./representation");
9
+ const metrics_1 = require("./metrics");
10
+ const displayable_1 = require("../shared/displayable");
11
+ const merkle_tree_1 = require("../merkle-tree");
12
+ const validateThirdParty = (wearable) => {
13
+ if (!merkle_tree_1.MerkleProof.validate(wearable.merkleProof))
14
+ return false;
15
+ if (wearable.merkleProof.hashingKeys.length === 0)
16
+ return false;
17
+ const containsAllKeys = wearable.merkleProof.hashingKeys.every((key) => wearable.hasOwnProperty(key));
18
+ const proofIsNotEmpty = wearable.merkleProof.proof.length > 0;
19
+ return containsAllKeys && proofIsNotEmpty;
20
+ };
21
+ const validateStandardWearable = (rarity, collectionAddress) => rarity_1.Rarity.validate(rarity) && !!collectionAddress;
22
+ const isStandard = (wearable) => validateStandardWearable(wearable.rarity, wearable.collectionAddress);
23
+ exports.isStandard = isStandard;
24
+ const isThirdParty = (wearable) => validateThirdParty(wearable);
25
+ exports.isThirdParty = isThirdParty;
7
26
  /** @alpha */
8
27
  var Wearable;
9
28
  (function (Wearable) {
10
29
  Wearable.schema = {
11
- ...base_wearable_1.BaseWearable.schema,
30
+ type: 'object',
12
31
  properties: {
13
- ...base_wearable_1.BaseWearable.schema.properties,
32
+ ...displayable_1.displayableProperties,
33
+ id: {
34
+ type: 'string'
35
+ },
36
+ description: {
37
+ type: 'string'
38
+ },
14
39
  collectionAddress: {
40
+ type: 'string',
41
+ nullable: true
42
+ },
43
+ rarity: {
44
+ ...rarity_1.Rarity.schema,
45
+ nullable: true
46
+ },
47
+ name: {
48
+ type: 'string'
49
+ },
50
+ i18n: {
51
+ type: 'array',
52
+ items: i18n_1.I18N.schema,
53
+ minItems: 1
54
+ },
55
+ data: {
56
+ type: 'object',
57
+ properties: {
58
+ replaces: {
59
+ type: 'array',
60
+ items: wearable_category_1.WearableCategory.schema
61
+ },
62
+ hides: {
63
+ type: 'array',
64
+ items: wearable_category_1.WearableCategory.schema
65
+ },
66
+ tags: {
67
+ type: 'array',
68
+ items: {
69
+ type: 'string',
70
+ minLength: 1
71
+ }
72
+ },
73
+ representations: {
74
+ type: 'array',
75
+ items: representation_1.WearableRepresentation.schema,
76
+ minItems: 1
77
+ },
78
+ category: wearable_category_1.WearableCategory.schema
79
+ },
80
+ additionalProperties: false,
81
+ required: ['replaces', 'hides', 'tags', 'representations', 'category']
82
+ },
83
+ thumbnail: {
15
84
  type: 'string'
16
85
  },
17
- rarity: rarity_1.Rarity.schema
86
+ image: {
87
+ type: 'string'
88
+ },
89
+ metrics: {
90
+ ...metrics_1.Metrics.schema,
91
+ nullable: true
92
+ },
93
+ merkleProof: {
94
+ ...merkle_tree_1.MerkleProof.schema,
95
+ nullable: true
96
+ },
97
+ content: {
98
+ type: 'object',
99
+ nullable: true,
100
+ additionalProperties: { type: 'string' },
101
+ required: []
102
+ }
18
103
  },
19
- required: [...base_wearable_1.BaseWearable.schema.required, 'collectionAddress', 'rarity']
104
+ additionalProperties: true,
105
+ required: [
106
+ 'id',
107
+ 'description',
108
+ 'name',
109
+ 'data',
110
+ 'thumbnail',
111
+ 'image',
112
+ 'i18n'
113
+ ]
20
114
  };
21
115
  const schemaValidator = (0, validation_1.generateValidator)(Wearable.schema);
116
+ /**
117
+ * Validates that the wearable metadata complies with the standard or third party wearable, and doesn't have repeated locales.
118
+ * Some fields are defined as optional but those are validated to be present as standard XOR third party:
119
+ * Standard Wearables should contain:
120
+ * - collectionAddress
121
+ * - rarity
122
+ * Third Party Wearables should contain:
123
+ * - merkleProof
124
+ */
22
125
  Wearable.validate = (wearable) => schemaValidator(wearable) &&
23
- base_wearable_1.BaseWearable.validateDuplicatedLocales(wearable.descriptions) &&
24
- base_wearable_1.BaseWearable.validateDuplicatedLocales(wearable.names);
126
+ validateDuplicatedLocales(wearable.i18n) &&
127
+ XOR(validateStandardWearable(wearable.rarity, wearable.collectionAddress), validateThirdParty(wearable));
128
+ const XOR = (b1, b2) => (b1 && !b2) || (b2 && !b1);
129
+ // Returns true only if there are no entries with the same locale
130
+ const validateDuplicatedLocales = (i18ns) => i18ns.every(({ code }, index) => i18ns.findIndex((i18n) => i18n.code === code) === index);
25
131
  })(Wearable = exports.Wearable || (exports.Wearable = {}));
26
132
  //# sourceMappingURL=wearable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wearable.js","sourceRoot":"","sources":["../../../src/platform/wearables/wearable.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AACzB,+CAA2C;AAC3C,mDAA8C;AAQ9C,aAAa;AACb,IAAiB,QAAQ,CAoBxB;AApBD,WAAiB,QAAQ;IACV,eAAM,GAAyB;QAC1C,GAAG,4BAAY,CAAC,MAAM;QACtB,UAAU,EAAE;YACV,GAAG,4BAAY,CAAC,MAAM,CAAC,UAAW;YAClC,iBAAiB,EAAE;gBACjB,IAAI,EAAE,QAAQ;aACf;YACD,MAAM,EAAE,eAAM,CAAC,MAAM;SACtB;QACD,QAAQ,EAAE,CAAC,GAAG,4BAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,CAAC;KAC3E,CAAA;IAED,MAAM,eAAe,GAA+B,IAAA,8BAAiB,EAAC,SAAA,MAAM,CAAC,CAAA;IAChE,iBAAQ,GAA+B,CAClD,QAAa,EACS,EAAE,CACxB,eAAe,CAAC,QAAQ,CAAC;QACzB,4BAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC7D,4BAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC1D,CAAC,EApBgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAoBxB"}
1
+ {"version":3,"file":"wearable.js","sourceRoot":"","sources":["../../../src/platform/wearables/wearable.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AACzB,+CAA2C;AAC3C,qEAAgE;AAChE,iCAA6B;AAC7B,qDAAyD;AACzD,uCAAmC;AACnC,uDAG8B;AAC9B,gDAA4C;AAoC5C,MAAM,kBAAkB,GAAG,CAAC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AAI,EAAE,QAAQ,EAAE;gBACxC,QAAQ,EAAE,EAAE;aACb;SACF;QACD,oBAAoB,EAAE,IAAI;QAC1B,QAAQ,EAAE;YACR,IAAI;YACJ,aAAa;YACb,MAAM;YACN,MAAM;YACN,WAAW;YACX,OAAO;YACP,MAAM;SACP;KACF,CAAA;IAED,MAAM,eAAe,GAA+B,IAAA,8BAAiB,EAAC,SAAA,MAAM,CAAC,CAAA;IAE7E;;;;;;;;OAQG;IACU,iBAAQ,GAA+B,CAClD,QAAa,EACS,EAAE,CACxB,eAAe,CAAC,QAAQ,CAAC;QACzB,yBAAyB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACxC,GAAG,CACD,wBAAwB,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EACrE,kBAAkB,CAAC,QAAQ,CAAC,CAC7B,CAAA;IAEH,MAAM,GAAG,GAAG,CAAC,EAAW,EAAE,EAAW,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAEpE,iEAAiE;IACjE,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAE,EAAE,CAClD,KAAK,CAAC,KAAK,CACT,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,CAC1D,CAAA;AACL,CAAC,EArHgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAqHxB"}
package/dist/schemas.d.ts CHANGED
@@ -134,30 +134,6 @@ export declare namespace AvatarInfo {
134
134
  const validate: ValidateFunction<AvatarInfo>;
135
135
  }
136
136
 
137
- /** @alpha */
138
- declare type BaseWearable = DisplayableDeployment & {
139
- id: string;
140
- descriptions: I18N[];
141
- names: I18N[];
142
- data: {
143
- replaces: WearableCategory[];
144
- hides: WearableCategory[];
145
- tags: string[];
146
- representations: WearableRepresentation[];
147
- category: WearableCategory;
148
- };
149
- thumbnail: string;
150
- image: string;
151
- metrics?: Metrics;
152
- };
153
-
154
- /** @alpha */
155
- declare namespace BaseWearable {
156
- const schema: JSONSchema<BaseWearable>;
157
- const validateDuplicatedLocales: (i18ns: I18N[]) => boolean;
158
- const validate: ValidateFunction<BaseWearable>;
159
- }
160
-
161
137
  export declare type Bid = {
162
138
  id: string;
163
139
  bidAddress: string;
@@ -1051,6 +1027,9 @@ export declare namespace SpawnPoint {
1051
1027
  const validate: ValidateFunction<SpawnPoint>;
1052
1028
  }
1053
1029
 
1030
+ /** @alpha */
1031
+ export declare type StandardWearable = Omit<WithRequired<Wearable, 'collectionAddress' | 'rarity'>, 'merkleProof' | 'content'>;
1032
+
1054
1033
  export declare type Store = {
1055
1034
  id: string;
1056
1035
  owner: string;
@@ -1071,17 +1050,7 @@ export declare namespace Store {
1071
1050
  const validate: ValidateFunction<Store>;
1072
1051
  }
1073
1052
 
1074
- /** @alpha */
1075
- export declare type TPWearable = BaseWearable & {
1076
- content: Record<string, string>;
1077
- merkleProof: MerkleProof;
1078
- };
1079
-
1080
- /** @alpha */
1081
- export declare namespace TPWearable {
1082
- const schema: JSONSchema<TPWearable>;
1083
- const validate: ValidateFunction<TPWearable>;
1084
- }
1053
+ export declare type ThirdPartyWearable = Omit<WithRequired<Wearable, 'merkleProof'>, 'rarity' | 'collectionAddress'>;
1085
1054
 
1086
1055
  /** @public @deprecated */
1087
1056
  declare const UPDATE = "update";
@@ -1126,14 +1095,39 @@ export declare type ValidWorldRange = {
1126
1095
  };
1127
1096
 
1128
1097
  /** @alpha */
1129
- export declare type Wearable = BaseWearable & {
1130
- rarity: Rarity;
1131
- collectionAddress: string;
1098
+ export declare type Wearable = DisplayableDeployment & {
1099
+ id: string;
1100
+ name: string;
1101
+ description: string;
1102
+ data: {
1103
+ replaces: WearableCategory[];
1104
+ hides: WearableCategory[];
1105
+ tags: string[];
1106
+ representations: WearableRepresentation[];
1107
+ category: WearableCategory;
1108
+ };
1109
+ i18n: I18N[];
1110
+ thumbnail: string;
1111
+ image: string;
1112
+ rarity?: Rarity;
1113
+ collectionAddress?: string;
1114
+ metrics?: Metrics;
1115
+ content?: Record<string, string>;
1116
+ merkleProof?: MerkleProof;
1132
1117
  };
1133
1118
 
1134
1119
  /** @alpha */
1135
1120
  export declare namespace Wearable {
1136
1121
  const schema: JSONSchema<Wearable>;
1122
+ /**
1123
+ * Validates that the wearable metadata complies with the standard or third party wearable, and doesn't have repeated locales.
1124
+ * Some fields are defined as optional but those are validated to be present as standard XOR third party:
1125
+ * Standard Wearables should contain:
1126
+ * - collectionAddress
1127
+ * - rarity
1128
+ * Third Party Wearables should contain:
1129
+ * - merkleProof
1130
+ */
1137
1131
  const validate: ValidateFunction<Wearable>;
1138
1132
  }
1139
1133
 
@@ -1203,6 +1197,10 @@ export declare namespace WearableRepresentation {
1203
1197
  const validate: ValidateFunction<WearableRepresentation>;
1204
1198
  }
1205
1199
 
1200
+ export declare type WithRequired<T, K extends keyof T> = T & {
1201
+ [P in K]-?: T[P];
1202
+ };
1203
+
1206
1204
  /**
1207
1205
  * World
1208
1206
  * @alpha
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.13.0",
2
+ "version": "4.0.1-20220330162736.commit-7894e6f",
3
3
  "name": "@dcl/schemas",
4
4
  "main": "./dist/index.js",
5
5
  "typings": "./dist/index.d.ts",
@@ -28,5 +28,5 @@
28
28
  "files": [
29
29
  "dist"
30
30
  ],
31
- "commit": "a85e64ab631474d55a3032992dcca57e0d5af9f8"
31
+ "commit": "7894e6f9ac0cf5c14ce854976f1e018c9b267bb5"
32
32
  }
@@ -1,29 +0,0 @@
1
- import { JSONSchema, ValidateFunction } from '../../validation';
2
- import { WearableCategory } from '../../dapps/wearable-category';
3
- import { I18N } from './i18n';
4
- import { WearableRepresentation } from './representation';
5
- import { Metrics } from './metrics';
6
- import { DisplayableDeployment } from '../shared/displayable';
7
- /** @alpha */
8
- export declare type BaseWearable = DisplayableDeployment & {
9
- id: string;
10
- descriptions: I18N[];
11
- names: I18N[];
12
- data: {
13
- replaces: WearableCategory[];
14
- hides: WearableCategory[];
15
- tags: string[];
16
- representations: WearableRepresentation[];
17
- category: WearableCategory;
18
- };
19
- thumbnail: string;
20
- image: string;
21
- metrics?: Metrics;
22
- };
23
- /** @alpha */
24
- export declare namespace BaseWearable {
25
- const schema: JSONSchema<BaseWearable>;
26
- const validateDuplicatedLocales: (i18ns: I18N[]) => boolean;
27
- const validate: ValidateFunction<BaseWearable>;
28
- }
29
- //# sourceMappingURL=base-wearable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-wearable.d.ts","sourceRoot":"","sources":["../../../src/platform/wearables/base-wearable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EACL,qBAAqB,EAEtB,MAAM,uBAAuB,CAAA;AAE9B,aAAa;AACb,oBAAY,YAAY,GAAG,qBAAqB,GAAG;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,IAAI,EAAE,CAAA;IACpB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,IAAI,EAAE;QACJ,QAAQ,EAAE,gBAAgB,EAAE,CAAA;QAC5B,KAAK,EAAE,gBAAgB,EAAE,CAAA;QACzB,IAAI,EAAE,MAAM,EAAE,CAAA;QACd,eAAe,EAAE,sBAAsB,EAAE,CAAA;QACzC,QAAQ,EAAE,gBAAgB,CAAA;KAC3B,CAAA;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,aAAa;AACb,yBAAiB,YAAY,CAAC;IACrB,MAAM,MAAM,EAAE,UAAU,CAAC,YAAY,CA0D3C,CAAA;IAGM,MAAM,yBAAyB,UAAW,IAAI,EAAE,YAIpD,CAAA;IAII,MAAM,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAKT,CAAA;CAC5C"}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseWearable = void 0;
4
- const validation_1 = require("../../validation");
5
- const wearable_category_1 = require("../../dapps/wearable-category");
6
- const i18n_1 = require("./i18n");
7
- const representation_1 = require("./representation");
8
- const metrics_1 = require("./metrics");
9
- const displayable_1 = require("../shared/displayable");
10
- /** @alpha */
11
- var BaseWearable;
12
- (function (BaseWearable) {
13
- BaseWearable.schema = {
14
- type: 'object',
15
- properties: {
16
- ...displayable_1.displayableProperties,
17
- id: {
18
- type: 'string'
19
- },
20
- descriptions: {
21
- type: 'array',
22
- items: i18n_1.I18N.schema,
23
- minItems: 1
24
- },
25
- names: {
26
- type: 'array',
27
- items: i18n_1.I18N.schema,
28
- minItems: 1
29
- },
30
- data: {
31
- type: 'object',
32
- properties: {
33
- replaces: {
34
- type: 'array',
35
- items: wearable_category_1.WearableCategory.schema
36
- },
37
- hides: {
38
- type: 'array',
39
- items: wearable_category_1.WearableCategory.schema
40
- },
41
- tags: {
42
- type: 'array',
43
- items: {
44
- type: 'string',
45
- minLength: 1
46
- }
47
- },
48
- representations: {
49
- type: 'array',
50
- items: representation_1.WearableRepresentation.schema,
51
- minItems: 1
52
- },
53
- category: wearable_category_1.WearableCategory.schema
54
- },
55
- additionalProperties: false,
56
- required: ['replaces', 'hides', 'tags', 'representations', 'category']
57
- },
58
- thumbnail: {
59
- type: 'string'
60
- },
61
- image: {
62
- type: 'string'
63
- },
64
- metrics: {
65
- ...metrics_1.Metrics.schema,
66
- nullable: true
67
- }
68
- },
69
- additionalProperties: false,
70
- required: ['id', 'descriptions', 'names', 'data', 'thumbnail', 'image']
71
- };
72
- // Returns true only if there are no entries with the same locale
73
- BaseWearable.validateDuplicatedLocales = (i18ns) => i18ns.every(({ code }, index) => i18ns.findIndex((i18n) => i18n.code === code) === index);
74
- const schemaValidator = (0, validation_1.generateValidator)(BaseWearable.schema);
75
- BaseWearable.validate = (wearable) => schemaValidator(wearable) &&
76
- BaseWearable.validateDuplicatedLocales(wearable.descriptions) &&
77
- BaseWearable.validateDuplicatedLocales(wearable.names);
78
- })(BaseWearable = exports.BaseWearable || (exports.BaseWearable = {}));
79
- //# sourceMappingURL=base-wearable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-wearable.js","sourceRoot":"","sources":["../../../src/platform/wearables/base-wearable.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AACzB,qEAAgE;AAChE,iCAA6B;AAC7B,qDAAyD;AACzD,uCAAmC;AACnC,uDAG8B;AAmB9B,aAAa;AACb,IAAiB,YAAY,CA4E5B;AA5ED,WAAiB,YAAY;IACd,mBAAM,GAA6B;QAC9C,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,mCAAqB;YACxB,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;aACf;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,WAAI,CAAC,MAAM;gBAClB,QAAQ,EAAE,CAAC;aACZ;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,WAAI,CAAC,MAAM;gBAClB,QAAQ,EAAE,CAAC;aACZ;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,oCAAgB,CAAC,MAAM;qBAC/B;oBACD,KAAK,EAAE;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YAAY,CAAC;QAChD,aAAA,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC7C,CAAC,EA5EgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA4E5B"}
@@ -1,14 +0,0 @@
1
- import { JSONSchema, ValidateFunction } from '../../validation';
2
- import { MerkleProof } from '../merkle-tree';
3
- import { BaseWearable } from './base-wearable';
4
- /** @alpha */
5
- export declare type TPWearable = BaseWearable & {
6
- content: Record<string, string>;
7
- merkleProof: MerkleProof;
8
- };
9
- /** @alpha */
10
- export declare namespace TPWearable {
11
- const schema: JSONSchema<TPWearable>;
12
- const validate: ValidateFunction<TPWearable>;
13
- }
14
- //# sourceMappingURL=tp-wearable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tp-wearable.d.ts","sourceRoot":"","sources":["../../../src/platform/wearables/tp-wearable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,aAAa;AACb,oBAAY,UAAU,GAAG,YAAY,GAAG;IACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,aAAa;AACb,yBAAiB,UAAU,CAAC;IACnB,MAAM,MAAM,EAAE,UAAU,CAAC,UAAU,CAYzC,CAAA;IAIM,MAAM,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAKM,CAAA;CACzD"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TPWearable = void 0;
4
- const validation_1 = require("../../validation");
5
- const merkle_tree_1 = require("../merkle-tree");
6
- const base_wearable_1 = require("./base-wearable");
7
- /** @alpha */
8
- var TPWearable;
9
- (function (TPWearable) {
10
- TPWearable.schema = {
11
- ...base_wearable_1.BaseWearable.schema,
12
- properties: {
13
- ...base_wearable_1.BaseWearable.schema.properties,
14
- content: {
15
- type: 'object',
16
- additionalProperties: { type: 'string' },
17
- required: []
18
- },
19
- merkleProof: merkle_tree_1.MerkleProof.schema
20
- },
21
- required: [...base_wearable_1.BaseWearable.schema.required, 'content']
22
- };
23
- const schemaValidator = (0, validation_1.generateValidator)(TPWearable.schema);
24
- TPWearable.validate = (wearable) => schemaValidator(wearable) &&
25
- base_wearable_1.BaseWearable.validateDuplicatedLocales(wearable.descriptions) &&
26
- base_wearable_1.BaseWearable.validateDuplicatedLocales(wearable.names);
27
- })(TPWearable = exports.TPWearable || (exports.TPWearable = {}));
28
- //# sourceMappingURL=tp-wearable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tp-wearable.js","sourceRoot":"","sources":["../../../src/platform/wearables/tp-wearable.ts"],"names":[],"mappings":";;;AAAA,iDAIyB;AACzB,gDAA4C;AAC5C,mDAA8C;AAQ9C,aAAa;AACb,IAAiB,UAAU,CAuB1B;AAvBD,WAAiB,UAAU;IACZ,iBAAM,GAA2B;QAC5C,GAAG,4BAAY,CAAC,MAAM;QACtB,UAAU,EAAE;YACV,GAAG,4BAAY,CAAC,MAAM,CAAC,UAAW;YAClC,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACxC,QAAQ,EAAE,EAAE;aACb;YACD,WAAW,EAAE,yBAAW,CAAC,MAAM;SAChC;QACD,QAAQ,EAAE,CAAC,GAAG,4BAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;KACvD,CAAA;IAED,MAAM,eAAe,GACnB,IAAA,8BAAiB,EAAC,WAAA,MAAM,CAAC,CAAA;IACd,mBAAQ,GAAiC,CACpD,QAAa,EACW,EAAE,CAC1B,eAAe,CAAC,QAAQ,CAAC;QACzB,4BAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC7D,4BAAY,CAAC,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC1D,CAAC,EAvBgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAuB1B"}