@dcl/sdk 7.0.0-2956503917.commit-061e376 → 7.0.0-2966684214.commit-a567432
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/ecs7/index.d.ts +76 -15
- package/dist/ecs7/index.js +4731 -3184
- package/dist/ecs7/index.min.js +1 -1
- package/dist/ecs7/index.min.js.map +1 -1
- package/dist/ecs7/proto-definitions/MeshCollider.proto +35 -0
- package/package.json +4 -4
- package/src/cli/mock-catalyst/index.js +4 -4
- package/src/cli/setupUtils.js +1 -1
- package/src/cli/wearables.js +10 -10
- package/src/setupProxy.js +1 -1
- package/types/ecs7/index.d.ts +75 -14
- package/types/tsconfig.ecs7.json +2 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
import "common/id.proto";
|
4
|
+
option (ecs_component_id) = 1019;
|
5
|
+
|
6
|
+
enum ColliderLayer {
|
7
|
+
None = 0;
|
8
|
+
Pointer = 1;
|
9
|
+
Physics = 2;
|
10
|
+
}
|
11
|
+
|
12
|
+
message PBMeshCollider {
|
13
|
+
message BoxMesh {
|
14
|
+
}
|
15
|
+
|
16
|
+
message CylinderMesh {
|
17
|
+
optional float radius_top = 1; // default=1.0
|
18
|
+
optional float radius_bottom = 2; // default=1.0
|
19
|
+
}
|
20
|
+
|
21
|
+
message PlaneMesh {
|
22
|
+
}
|
23
|
+
|
24
|
+
message SphereMesh {
|
25
|
+
}
|
26
|
+
|
27
|
+
optional int32 collision_mask = 1; // default = ColliderLayer.Physics | ColliderLayer.Pointer
|
28
|
+
|
29
|
+
oneof mesh {
|
30
|
+
BoxMesh box = 2;
|
31
|
+
SphereMesh sphere = 3;
|
32
|
+
CylinderMesh cylinder = 4;
|
33
|
+
PlaneMesh plane = 5;
|
34
|
+
}
|
35
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk",
|
3
|
-
"version": "7.0.0-
|
3
|
+
"version": "7.0.0-2966684214.commit-a567432",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
@@ -27,8 +27,8 @@
|
|
27
27
|
"src/cli/**/*.js"
|
28
28
|
],
|
29
29
|
"dependencies": {
|
30
|
-
"@dcl/amd": "6.11.5-
|
31
|
-
"@dcl/build-ecs": "6.11.5-
|
30
|
+
"@dcl/amd": "6.11.5-2966684214.commit-a567432",
|
31
|
+
"@dcl/build-ecs": "6.11.5-2966684214.commit-a567432",
|
32
32
|
"@dcl/kernel": "1.0.0-2638443584.commit-696a74b",
|
33
33
|
"@dcl/posix": "^1.0.4",
|
34
34
|
"@dcl/schemas": "4.8.0",
|
@@ -38,5 +38,5 @@
|
|
38
38
|
"ignore": "^5.1.8"
|
39
39
|
},
|
40
40
|
"minCliVersion": "3.10.2",
|
41
|
-
"commit": "
|
41
|
+
"commit": "a567432815d98b2eb5bdfd38b44f4439f938c2b3"
|
42
42
|
}
|
@@ -47,7 +47,7 @@ var mockCatalyst = function (app, baseFolders) {
|
|
47
47
|
res.json([
|
48
48
|
{
|
49
49
|
serverName: 'localhost',
|
50
|
-
url: "http://"
|
50
|
+
url: "http://".concat(req.get('host')),
|
51
51
|
layer: 'stub',
|
52
52
|
usersCount: 0,
|
53
53
|
maxUsers: 100,
|
@@ -58,7 +58,7 @@ var mockCatalyst = function (app, baseFolders) {
|
|
58
58
|
app.get('/lambdas/contracts/servers', function (req, res) {
|
59
59
|
res.json([
|
60
60
|
{
|
61
|
-
address: "http://"
|
61
|
+
address: "http://".concat(req.get('host')),
|
62
62
|
owner: '0x0000000000000000000000000000000000000000',
|
63
63
|
id: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
64
64
|
}
|
@@ -70,7 +70,7 @@ var mockCatalyst = function (app, baseFolders) {
|
|
70
70
|
return __generator(this, function (_b) {
|
71
71
|
switch (_b.label) {
|
72
72
|
case 0:
|
73
|
-
baseUrl = req.protocol
|
73
|
+
baseUrl = "".concat(req.protocol, "://").concat(req.get('host'), "/content/contents");
|
74
74
|
_b.label = 1;
|
75
75
|
case 1:
|
76
76
|
_b.trys.push([1, 6, , 7]);
|
@@ -81,7 +81,7 @@ var mockCatalyst = function (app, baseFolders) {
|
|
81
81
|
case 2:
|
82
82
|
previewWearables = _b.sent();
|
83
83
|
if (!(previewWearables.length === 1)) return [3 /*break*/, 5];
|
84
|
-
return [4 /*yield*/, fetch("https://peer.decentraland.org"
|
84
|
+
return [4 /*yield*/, fetch("https://peer.decentraland.org".concat(req.originalUrl))];
|
85
85
|
case 3: return [4 /*yield*/, (_b.sent()).json()];
|
86
86
|
case 4:
|
87
87
|
deployedProfile = _b.sent();
|
package/src/cli/setupUtils.js
CHANGED
@@ -275,7 +275,7 @@ var downloadFile = function (url, path, timeout_seg) {
|
|
275
275
|
setTimeout(function () {
|
276
276
|
if (!finished) {
|
277
277
|
request.destroy();
|
278
|
-
reject(new Error("Timeout "
|
278
|
+
reject(new Error("Timeout ".concat(url)));
|
279
279
|
}
|
280
280
|
}, timeout_seg * 1000);
|
281
281
|
})];
|
package/src/cli/wearables.js
CHANGED
@@ -60,15 +60,15 @@ var serveWearable = function (_a) {
|
|
60
60
|
var wearableJson = JSON.parse(fs.readFileSync(wearableJsonPath).toString());
|
61
61
|
if (!(0, exports.wearableValidator)(wearableJson)) {
|
62
62
|
var errors = (exports.wearableValidator.errors || [])
|
63
|
-
.map(function (a) { return a.dataPath
|
63
|
+
.map(function (a) { return "".concat(a.dataPath, " ").concat(a.message); })
|
64
64
|
.join('');
|
65
65
|
if (errors.length > 0) {
|
66
|
-
console.error("Unable to validate '"
|
66
|
+
console.error("Unable to validate '".concat(wearableJsonPath, "' properly, please check it: ").concat(errors));
|
67
67
|
}
|
68
68
|
else {
|
69
|
-
console.error("Unable to validate '"
|
69
|
+
console.error("Unable to validate '".concat(wearableJsonPath, "' properly, please check it."));
|
70
70
|
}
|
71
|
-
throw new Error("Invalid wearable.json ("
|
71
|
+
throw new Error("Invalid wearable.json (".concat(wearableJson, ")"));
|
72
72
|
}
|
73
73
|
else {
|
74
74
|
}
|
@@ -85,10 +85,10 @@ var serveWearable = function (_a) {
|
|
85
85
|
var thumbnailFiltered = hashedFiles.filter(function ($) { return ($ === null || $ === void 0 ? void 0 : $.file) === wearableJson.thumbnail; });
|
86
86
|
var thumbnail = thumbnailFiltered.length > 0 &&
|
87
87
|
((_b = thumbnailFiltered[0]) === null || _b === void 0 ? void 0 : _b.hash) &&
|
88
|
-
baseUrl
|
88
|
+
"".concat(baseUrl, "/").concat(thumbnailFiltered[0].hash);
|
89
89
|
var wearableJsonWithContents = __assign(__assign({}, wearableJson), { baseUrl: baseUrl, thumbnail: thumbnail, data: __assign(__assign({}, wearableJson.data), { thumbnail: thumbnail, scene: hashedFiles, baseUrl: baseUrl, representations: wearableJson.data.representations.map(function (representation) { return (__assign(__assign({}, representation), { contents: hashedFiles.map(function (file) { return ({
|
90
|
-
key: ""
|
91
|
-
url: baseUrl
|
90
|
+
key: "".concat(file === null || file === void 0 ? void 0 : file.file),
|
91
|
+
url: "".concat(baseUrl, "/").concat(file === null || file === void 0 ? void 0 : file.hash)
|
92
92
|
}); }) })); }) }) });
|
93
93
|
return wearableJsonWithContents;
|
94
94
|
};
|
@@ -109,7 +109,7 @@ var getAllPreviewWearables = function (_a) {
|
|
109
109
|
ret.push(serveWearable({ wearableJsonPath: wearableJsonPath, baseUrl: baseUrl }));
|
110
110
|
}
|
111
111
|
catch (err) {
|
112
|
-
console.error("Couldn't mock the wearable "
|
112
|
+
console.error("Couldn't mock the wearable ".concat(wearableJsonPath, ". Please verify the correct format and scheme."), err);
|
113
113
|
}
|
114
114
|
}
|
115
115
|
return ret;
|
@@ -119,7 +119,7 @@ var mockPreviewWearables = function (app, baseFolders) {
|
|
119
119
|
app.use('/preview-wearables/:id', function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
120
120
|
var baseUrl, wearables, wearableId;
|
121
121
|
return __generator(this, function (_a) {
|
122
|
-
baseUrl = req.protocol
|
122
|
+
baseUrl = "".concat(req.protocol, "://").concat(req.get('host'), "/content/contents");
|
123
123
|
wearables = (0, exports.getAllPreviewWearables)({
|
124
124
|
baseUrl: baseUrl,
|
125
125
|
baseFolders: baseFolders
|
@@ -134,7 +134,7 @@ var mockPreviewWearables = function (app, baseFolders) {
|
|
134
134
|
app.use('/preview-wearables', function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
135
135
|
var baseUrl;
|
136
136
|
return __generator(this, function (_a) {
|
137
|
-
baseUrl = req.protocol
|
137
|
+
baseUrl = "".concat(req.protocol, "://").concat(req.get('host'), "/content/contents");
|
138
138
|
return [2 /*return*/, res.json({
|
139
139
|
ok: true,
|
140
140
|
data: (0, exports.getAllPreviewWearables)({ baseUrl: baseUrl, baseFolders: baseFolders })
|
package/src/setupProxy.js
CHANGED
@@ -151,7 +151,7 @@ var setupProxy = function (dcl, app) {
|
|
151
151
|
var featureFlagResponse, featureFlagBody;
|
152
152
|
return __generator(this, function (_a) {
|
153
153
|
switch (_a.label) {
|
154
|
-
case 0: return [4 /*yield*/, fetch("https://feature-flags.decentraland.zone/"
|
154
|
+
case 0: return [4 /*yield*/, fetch("https://feature-flags.decentraland.zone/".concat(req.params.file))];
|
155
155
|
case 1:
|
156
156
|
featureFlagResponse = _a.sent();
|
157
157
|
return [4 /*yield*/, featureFlagResponse.json()];
|
package/types/ecs7/index.d.ts
CHANGED
@@ -229,6 +229,8 @@ declare namespace Components {
|
|
229
229
|
/** @public */
|
230
230
|
const Material: ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
|
231
231
|
/** @public */
|
232
|
+
const MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
|
233
|
+
/** @public */
|
232
234
|
const MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
|
233
235
|
/** @public */
|
234
236
|
const NFTShape: ComponentDefinition<ISchema<PBNFTShape>, PBNFTShape>;
|
@@ -407,14 +409,36 @@ declare interface CreateByteBufferOptions {
|
|
407
409
|
/** @public */
|
408
410
|
declare const CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
|
409
411
|
|
412
|
+
/**
|
413
|
+
* @public
|
414
|
+
*/
|
415
|
+
declare type DeepReadonly<T> = T extends ReadonlyPrimitive ? T : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : T extends Set<infer M> ? DeepReadonlySet<M> : DeepReadonlyObject<T>;
|
416
|
+
|
410
417
|
/**
|
411
418
|
* Make each field readonly deeply
|
412
419
|
* @public
|
413
420
|
*/
|
414
|
-
declare type
|
415
|
-
readonly [P in keyof T]:
|
421
|
+
declare type DeepReadonly_2<T> = {
|
422
|
+
readonly [P in keyof T]: DeepReadonly_2<T[P]>;
|
416
423
|
};
|
417
424
|
|
425
|
+
/**
|
426
|
+
* @public
|
427
|
+
*/
|
428
|
+
declare type DeepReadonlyMap<K, V> = ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>;
|
429
|
+
|
430
|
+
/**
|
431
|
+
* @public
|
432
|
+
*/
|
433
|
+
declare type DeepReadonlyObject<T> = {
|
434
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
435
|
+
};
|
436
|
+
|
437
|
+
/**
|
438
|
+
* @public
|
439
|
+
*/
|
440
|
+
declare type DeepReadonlySet<T> = ReadonlySet<DeepReadonly<T>>;
|
441
|
+
|
418
442
|
declare function defineSdkComponents(engine: PreEngine): {
|
419
443
|
Transform: ComponentDefinition<ISchema<TransformType>, Partial<TransformType>>;
|
420
444
|
MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
|
@@ -430,6 +454,7 @@ declare function defineSdkComponents(engine: PreEngine): {
|
|
430
454
|
CylinderShape: ComponentDefinition<ISchema<PBCylinderShape>, PBCylinderShape>;
|
431
455
|
GLTFShape: ComponentDefinition<ISchema<PBGLTFShape>, PBGLTFShape>;
|
432
456
|
Material: ComponentDefinition<ISchema<PBMaterial>, PBMaterial>;
|
457
|
+
MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
|
433
458
|
NFTShape: ComponentDefinition<ISchema<PBNFTShape>, PBNFTShape>;
|
434
459
|
OnPointerDown: ComponentDefinition<ISchema<PBOnPointerDown>, PBOnPointerDown>;
|
435
460
|
OnPointerDownResult: ComponentDefinition<ISchema<PBOnPointerDownResult>, PBOnPointerDownResult>;
|
@@ -462,10 +487,6 @@ declare type EcsResult<T extends ISchema> = T extends ISchema ? ReturnType<T['de
|
|
462
487
|
*/
|
463
488
|
declare function Engine({ transports }?: IEngineParams): IEngine;
|
464
489
|
|
465
|
-
/**
|
466
|
-
* @alpha * This file initialization is an alpha one. This is based on the old-ecs
|
467
|
-
* init and it'll be changing.
|
468
|
-
*/
|
469
490
|
declare const engine: IEngine;
|
470
491
|
|
471
492
|
/**
|
@@ -570,7 +591,7 @@ declare type IEngine = {
|
|
570
591
|
*
|
571
592
|
* ```
|
572
593
|
*/
|
573
|
-
defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec:
|
594
|
+
defineComponent<T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: Partial<Result<T>>): ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
|
574
595
|
/**
|
575
596
|
* Define a component and add it to the engine.
|
576
597
|
* @param spec An object with schema fields
|
@@ -601,11 +622,11 @@ declare type IEngine = {
|
|
601
622
|
* Example:
|
602
623
|
* ```ts
|
603
624
|
* for (const [entity, boxShape, transform] of engine.getEntitiesWith(BoxShape, Transform)) {
|
604
|
-
*
|
625
|
+
* // the properties of boxShape and transform are read only
|
605
626
|
* }
|
606
627
|
* ```
|
607
628
|
*/
|
608
|
-
getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...
|
629
|
+
getEntitiesWith<T extends [ComponentDefinition, ...ComponentDefinition[]]>(...components: T): Iterable<[Entity, ...ReadonlyComponentSchema<T>]>;
|
609
630
|
baseComponents: SdkComponents;
|
610
631
|
};
|
611
632
|
|
@@ -701,7 +722,7 @@ declare namespace Matrix {
|
|
701
722
|
_isIdentity3x2Dirty: boolean;
|
702
723
|
_m: Matrix4x4;
|
703
724
|
};
|
704
|
-
type ReadonlyMatrix =
|
725
|
+
type ReadonlyMatrix = DeepReadonly_2<MutableMatrix>;
|
705
726
|
/**
|
706
727
|
* Gets the internal data of the matrix
|
707
728
|
*/
|
@@ -1384,6 +1405,9 @@ declare namespace Matrix {
|
|
1384
1405
|
function toggleProjectionMatrixHandInPlace(self: MutableMatrix): void;
|
1385
1406
|
}
|
1386
1407
|
|
1408
|
+
/** @public */
|
1409
|
+
declare const MeshCollider: ComponentDefinition<ISchema<PBMeshCollider>, PBMeshCollider>;
|
1410
|
+
|
1387
1411
|
/** @public */
|
1388
1412
|
declare const MeshRenderer: ComponentDefinition<ISchema<PBMeshRenderer>, Partial<PBMeshRenderer>>;
|
1389
1413
|
|
@@ -1573,6 +1597,31 @@ declare interface PBMaterial_Texture {
|
|
1573
1597
|
filterMode?: FilterMode | undefined;
|
1574
1598
|
}
|
1575
1599
|
|
1600
|
+
declare interface PBMeshCollider {
|
1601
|
+
/** default = ColliderLayer.Physics | ColliderLayer.Pointer */
|
1602
|
+
collisionMask?: number | undefined;
|
1603
|
+
box: PBMeshCollider_BoxMesh | undefined;
|
1604
|
+
sphere: PBMeshCollider_SphereMesh | undefined;
|
1605
|
+
cylinder: PBMeshCollider_CylinderMesh | undefined;
|
1606
|
+
plane: PBMeshCollider_PlaneMesh | undefined;
|
1607
|
+
}
|
1608
|
+
|
1609
|
+
declare interface PBMeshCollider_BoxMesh {
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
declare interface PBMeshCollider_CylinderMesh {
|
1613
|
+
/** default=1.0 */
|
1614
|
+
radiusTop?: number | undefined;
|
1615
|
+
/** default=1.0 */
|
1616
|
+
radiusBottom?: number | undefined;
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
declare interface PBMeshCollider_PlaneMesh {
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
declare interface PBMeshCollider_SphereMesh {
|
1623
|
+
}
|
1624
|
+
|
1576
1625
|
declare interface PBMeshRenderer {
|
1577
1626
|
box: PBMeshRenderer_BoxMesh | undefined;
|
1578
1627
|
sphere: PBMeshRenderer_SphereMesh | undefined;
|
@@ -1740,7 +1789,7 @@ declare namespace Plane {
|
|
1740
1789
|
*/
|
1741
1790
|
d: number;
|
1742
1791
|
};
|
1743
|
-
type ReadonlyPlane =
|
1792
|
+
type ReadonlyPlane = DeepReadonly_2<MutablePlane>;
|
1744
1793
|
/**
|
1745
1794
|
* Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0
|
1746
1795
|
* @param a - a component of the plane
|
@@ -1860,7 +1909,7 @@ declare function preEngine(): {
|
|
1860
1909
|
removeSystem: (selector: string | Update) => boolean;
|
1861
1910
|
defineComponent: <T extends Spec, ConstructorType = Partial<Result<T>>>(spec: T, componentId: number, constructorDefault?: ConstructorType | undefined) => ComponentDefinition<ISchema<Result<T>>, ConstructorType>;
|
1862
1911
|
defineComponentFromSchema: <T_1 extends ISchema<any>, ConstructorType_1 = EcsResult<T_1>>(spec: T_1, componentId: number, constructorDefault?: ConstructorType_1 | undefined) => ComponentDefinition<T_1, ConstructorType_1>;
|
1863
|
-
getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...
|
1912
|
+
getEntitiesWith: <T_2 extends [ComponentDefinition<ISchema<any>, any>, ...ComponentDefinition<ISchema<any>, any>[]]>(...components: T_2) => Iterable<[Entity, ...ReadonlyComponentSchema<T_2>]>;
|
1864
1913
|
getComponent: <T_3 extends ISchema<any>>(componentId: number) => ComponentDefinition<T_3, EcsResult<T_3>>;
|
1865
1914
|
removeComponentDefinition: (componentId: number) => void;
|
1866
1915
|
};
|
@@ -1881,7 +1930,7 @@ declare namespace Quaternion {
|
|
1881
1930
|
/**
|
1882
1931
|
* @public
|
1883
1932
|
*/
|
1884
|
-
export type ReadonlyQuaternion =
|
1933
|
+
export type ReadonlyQuaternion = DeepReadonly_2<MutableQuaternion>;
|
1885
1934
|
/**
|
1886
1935
|
* Creates a new Quaternion from the given floats
|
1887
1936
|
* @param x - defines the first component (0 by default)
|
@@ -2035,6 +2084,18 @@ declare namespace Quaternion {
|
|
2035
2084
|
*/
|
2036
2085
|
declare const RAD2DEG: number;
|
2037
2086
|
|
2087
|
+
/**
|
2088
|
+
* @public
|
2089
|
+
*/
|
2090
|
+
declare type ReadonlyComponentSchema<T extends [ComponentDefinition, ...ComponentDefinition[]]> = {
|
2091
|
+
[K in keyof T]: T[K] extends ComponentDefinition ? ReturnType<T[K]['get']> : never;
|
2092
|
+
};
|
2093
|
+
|
2094
|
+
/**
|
2095
|
+
* @public
|
2096
|
+
*/
|
2097
|
+
declare type ReadonlyPrimitive = number | string | number[] | string[] | boolean | boolean[];
|
2098
|
+
|
2038
2099
|
declare type ReceiveMessage = {
|
2039
2100
|
type: WireMessage.Enum;
|
2040
2101
|
entity: Entity;
|
@@ -2199,7 +2260,7 @@ declare namespace Vector3 {
|
|
2199
2260
|
/**
|
2200
2261
|
* @public
|
2201
2262
|
*/
|
2202
|
-
export type ReadonlyVector3 =
|
2263
|
+
export type ReadonlyVector3 = DeepReadonly_2<MutableVector3>;
|
2203
2264
|
/**
|
2204
2265
|
* Creates a new Vector3 object from the given x, y, z (floats) coordinates.
|
2205
2266
|
* @param x - defines the first coordinates (on X axis)
|