@dcl/playground-assets 7.1.4-4671625513.commit-bfff9b1 → 7.1.4-4672664161.commit-7ba5d40

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/sdk",
3
3
  "description": "",
4
- "version": "7.1.4-4671625513.commit-bfff9b1",
4
+ "version": "7.1.4-4672664161.commit-7ba5d40",
5
5
  "author": "Decentraland",
6
6
  "dependencies": {
7
7
  "@dcl/ecs": "file:../ecs",
@@ -30,5 +30,5 @@
30
30
  },
31
31
  "types": "./index.d.ts",
32
32
  "typings": "./index.d.ts",
33
- "commit": "bfff9b1815c70f7f3a90fa6d8fa5dfd2934f3db1"
33
+ "commit": "7ba5d4034c725e90e5c8ca8e37275bbb5e20b297"
34
34
  }
@@ -2255,6 +2255,13 @@ export declare interface LastWriteWinElementSetComponentDefinition<T> extends Ba
2255
2255
  * @param entity - Entity to get the component from
2256
2256
  */
2257
2257
  getMutableOrNull(entity: Entity): T | null;
2258
+ /**
2259
+ * Get the mutable component of the entity. If the entity doesn't have the component, it's created.
2260
+ * - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame
2261
+ * @param entity - Entity to get the component from
2262
+ * @param val - The initial value if it doesn't exist
2263
+ */
2264
+ getOrCreateMutable(entity: Entity, initialValue?: T): T;
2258
2265
  }
2259
2266
 
2260
2267
  /**
@@ -5112,6 +5119,23 @@ export declare namespace Schemas {
5112
5119
  * @returns a ISchema or fail for unsupported json-schema
5113
5120
  */
5114
5121
  const fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
5122
+ /**
5123
+ * @public
5124
+ *
5125
+ * Traverses and mutates values in a JSON schema-based structure, applying the given mutation function to each value.
5126
+ * The function is designed to work with nested maps and arrays, recursively processing each element.
5127
+ *
5128
+ * @param jsonSchema - The JSON schema object that describes the structure of the value.
5129
+ * It must have a serializationType of 'map', 'array', or other custom types like 'entity'.
5130
+ * @param value - The value to be mutated, which should conform to the provided JSON schema.
5131
+ * @param mutateFn - A function that takes a value and its corresponding valueType (JsonSchemaExtended) as arguments
5132
+ * and returns a tuple [boolean, any]. The boolean indicates whether the mutation should be applied,
5133
+ * and the second element is the mutated value.
5134
+ */
5135
+ const mutateNestedValues: (jsonSchema: JsonSchemaExtended, value: unknown, mutateFn: (value: unknown, valueType: JsonSchemaExtended) => {
5136
+ changed: boolean;
5137
+ value?: any;
5138
+ }) => void;
5115
5139
  }
5116
5140
 
5117
5141
  /**
@@ -19349,6 +19349,68 @@
19349
19349
  ],
19350
19350
  "name": "getMutableOrNull"
19351
19351
  },
19352
+ {
19353
+ "kind": "MethodSignature",
19354
+ "canonicalReference": "@dcl/playground-assets!LastWriteWinElementSetComponentDefinition#getOrCreateMutable:member(1)",
19355
+ "docComment": "/**\n * Get the mutable component of the entity. If the entity doesn't have the component, it's created. - Internal comment: This method adds the &lt;entity,component&gt; to the list to be reviewed next frame\n *\n * @param entity - Entity to get the component from\n *\n * @param val - The initial value if it doesn't exist\n */\n",
19356
+ "excerptTokens": [
19357
+ {
19358
+ "kind": "Content",
19359
+ "text": "getOrCreateMutable(entity: "
19360
+ },
19361
+ {
19362
+ "kind": "Reference",
19363
+ "text": "Entity",
19364
+ "canonicalReference": "@dcl/playground-assets!Entity:type"
19365
+ },
19366
+ {
19367
+ "kind": "Content",
19368
+ "text": ", initialValue?: "
19369
+ },
19370
+ {
19371
+ "kind": "Content",
19372
+ "text": "T"
19373
+ },
19374
+ {
19375
+ "kind": "Content",
19376
+ "text": "): "
19377
+ },
19378
+ {
19379
+ "kind": "Content",
19380
+ "text": "T"
19381
+ },
19382
+ {
19383
+ "kind": "Content",
19384
+ "text": ";"
19385
+ }
19386
+ ],
19387
+ "isOptional": false,
19388
+ "returnTypeTokenRange": {
19389
+ "startIndex": 5,
19390
+ "endIndex": 6
19391
+ },
19392
+ "releaseTag": "Public",
19393
+ "overloadIndex": 1,
19394
+ "parameters": [
19395
+ {
19396
+ "parameterName": "entity",
19397
+ "parameterTypeTokenRange": {
19398
+ "startIndex": 1,
19399
+ "endIndex": 2
19400
+ },
19401
+ "isOptional": false
19402
+ },
19403
+ {
19404
+ "parameterName": "initialValue",
19405
+ "parameterTypeTokenRange": {
19406
+ "startIndex": 3,
19407
+ "endIndex": 4
19408
+ },
19409
+ "isOptional": true
19410
+ }
19411
+ ],
19412
+ "name": "getOrCreateMutable"
19413
+ },
19352
19414
  {
19353
19415
  "kind": "MethodSignature",
19354
19416
  "canonicalReference": "@dcl/playground-assets!LastWriteWinElementSetComponentDefinition#getOrNull:member(1)",
@@ -44810,6 +44872,46 @@
44810
44872
  "endIndex": 12
44811
44873
  }
44812
44874
  },
44875
+ {
44876
+ "kind": "Variable",
44877
+ "canonicalReference": "@dcl/playground-assets!Schemas.mutateNestedValues:var",
44878
+ "docComment": "/**\n * Traverses and mutates values in a JSON schema-based structure, applying the given mutation function to each value. The function is designed to work with nested maps and arrays, recursively processing each element.\n *\n * @param jsonSchema - The JSON schema object that describes the structure of the value. It must have a serializationType of 'map', 'array', or other custom types like 'entity'.\n *\n * @param value - The value to be mutated, which should conform to the provided JSON schema.\n *\n * @param mutateFn - A function that takes a value and its corresponding valueType (JsonSchemaExtended) as arguments and returns a tuple [boolean, any]. The boolean indicates whether the mutation should be applied, and the second element is the mutated value.\n *\n * @public\n */\n",
44879
+ "excerptTokens": [
44880
+ {
44881
+ "kind": "Content",
44882
+ "text": "mutateNestedValues: "
44883
+ },
44884
+ {
44885
+ "kind": "Content",
44886
+ "text": "(jsonSchema: "
44887
+ },
44888
+ {
44889
+ "kind": "Reference",
44890
+ "text": "JsonSchemaExtended",
44891
+ "canonicalReference": "@dcl/playground-assets!JsonSchemaExtended:type"
44892
+ },
44893
+ {
44894
+ "kind": "Content",
44895
+ "text": ", value: unknown, mutateFn: (value: unknown, valueType: "
44896
+ },
44897
+ {
44898
+ "kind": "Reference",
44899
+ "text": "JsonSchemaExtended",
44900
+ "canonicalReference": "@dcl/playground-assets!JsonSchemaExtended:type"
44901
+ },
44902
+ {
44903
+ "kind": "Content",
44904
+ "text": ") => {\n changed: boolean;\n value?: any;\n }) => void"
44905
+ }
44906
+ ],
44907
+ "isReadonly": true,
44908
+ "releaseTag": "Public",
44909
+ "name": "mutateNestedValues",
44910
+ "variableTypeTokenRange": {
44911
+ "startIndex": 1,
44912
+ "endIndex": 6
44913
+ }
44914
+ },
44813
44915
  {
44814
44916
  "kind": "Variable",
44815
44917
  "canonicalReference": "@dcl/playground-assets!Schemas.Number:var",
@@ -1284,6 +1284,7 @@ export interface LastWriteWinElementSetComponentDefinition<T> extends BaseCompon
1284
1284
  get(entity: Entity): DeepReadonly<T>;
1285
1285
  getMutable(entity: Entity): T;
1286
1286
  getMutableOrNull(entity: Entity): T | null;
1287
+ getOrCreateMutable(entity: Entity, initialValue?: T): T;
1287
1288
  getOrNull(entity: Entity): DeepReadonly<T> | null;
1288
1289
  }
1289
1290
 
@@ -2607,6 +2608,10 @@ export namespace Schemas {
2607
2608
  Optional: <T>(spec: ISchema<T>) => ISchema<T | undefined>;
2608
2609
  const // Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
2609
2610
  fromJson: (json: JsonSchemaExtended) => ISchema<unknown>;
2611
+ const mutateNestedValues: (jsonSchema: JsonSchemaExtended, value: unknown, mutateFn: (value: unknown, valueType: JsonSchemaExtended) => {
2612
+ changed: boolean;
2613
+ value?: any;
2614
+ }) => void;
2610
2615
  }
2611
2616
 
2612
2617
  // @public (undocumented)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dcl/playground-assets",
3
3
  "description": "",
4
- "version": "7.1.4-4671625513.commit-bfff9b1",
4
+ "version": "7.1.4-4672664161.commit-7ba5d40",
5
5
  "author": "Decentraland",
6
6
  "dependencies": {
7
- "@dcl/js-runtime": "7.1.4-4671625513.commit-bfff9b1",
8
- "@dcl/sdk": "7.1.4-4671625513.commit-bfff9b1"
7
+ "@dcl/js-runtime": "7.1.4-4672664161.commit-7ba5d40",
8
+ "@dcl/sdk": "7.1.4-4672664161.commit-7ba5d40"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@microsoft/api-extractor": "^7.33.8"
@@ -28,5 +28,5 @@
28
28
  },
29
29
  "types": "./dist/index.d.ts",
30
30
  "typings": "./dist/index.d.ts",
31
- "commit": "bfff9b1815c70f7f3a90fa6d8fa5dfd2934f3db1"
31
+ "commit": "7ba5d4034c725e90e5c8ca8e37275bbb5e20b297"
32
32
  }