@hello.nrfcloud.com/proto-map 5.6.1 → 5.6.3
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/api/Context.ts +1 -1
- package/api/{ResourceUpdate.spec.ts → ObjectUpdate.spec.ts} +5 -5
- package/api/{ResourceUpdate.ts → ObjectUpdate.ts} +6 -6
- package/dist/api/Context.js +1 -1
- package/dist/api/DeviceId.js +7 -7
- package/dist/api/Devices.js +11 -11
- package/dist/api/History.js +10 -10
- package/dist/api/History.spec.js +17 -17
- package/dist/api/LwM2M.js +11 -11
- package/dist/api/ObjectUpdate.js +17 -0
- package/dist/api/ObjectUpdate.spec.js +26 -0
- package/dist/api/ShareDeviceOwnershipConfirmed.js +4 -4
- package/dist/api/ShareDeviceRequest.js +4 -4
- package/dist/api/Timestamp.js +3 -3
- package/dist/api/Timestamp.spec.js +9 -9
- package/dist/api/index.js +8 -8
- package/dist/generator/addDocBlock.js +2 -2
- package/dist/generator/generateLwM2MDefinitions.js +27 -27
- package/dist/generator/generateLwM2MDefinitions.spec.js +32 -32
- package/dist/generator/generateLwm2mTimestampResources.js +7 -7
- package/dist/generator/generateModels.js +37 -37
- package/dist/generator/generateType.js +21 -21
- package/dist/generator/generateValidator.js +29 -29
- package/dist/generator/generateValidators.js +9 -9
- package/dist/generator/isDir.js +1 -1
- package/dist/generator/isDir.spec.js +13 -13
- package/dist/generator/lwm2m.js +23 -23
- package/dist/generator/models.js +23 -23
- package/dist/generator/printNode.js +2 -2
- package/dist/generator/tokenizeName.js +2 -2
- package/dist/generator/tokenizeName.spec.js +20 -20
- package/dist/generator/types.js +37 -37
- package/dist/lwm2m/LWM2MObjectDefinition.js +30 -30
- package/dist/lwm2m/check-lwm2m-rules.js +34 -34
- package/dist/lwm2m/definitions.js +4 -4
- package/dist/lwm2m/fromXML2JSON.js +4 -4
- package/dist/lwm2m/instanceTs.js +2 -2
- package/dist/lwm2m/instanceTs.spec.js +10 -10
- package/dist/lwm2m/isRegisteredLwM2MObject.js +2 -2
- package/dist/lwm2m/isRegisteredLwM2MObject.spec.js +12 -12
- package/dist/lwm2m/parseRangeEnumeration.js +1 -1
- package/dist/lwm2m/parseRangeEnumeration.spec.js +11 -11
- package/dist/lwm2m/unwrapNestedArray.js +2 -2
- package/dist/lwm2m/unwrapNestedArray.spec.js +155 -155
- package/dist/lwm2m/validate.js +1 -1
- package/dist/lwm2m/validation.js +16 -16
- package/dist/markdown/getCodeBlock.js +5 -5
- package/dist/markdown/getFrontMatter.js +6 -6
- package/dist/markdown/parseREADME.js +5 -5
- package/dist/models/asset_tracker_v2+AWS/examples/examples.spec.js +21 -21
- package/dist/models/check-model-rules.js +42 -42
- package/dist/models/models.js +20 -20
- package/dist/models/types.js +3 -3
- package/dist/senml/SenMLSchema.js +16 -16
- package/dist/senml/SenMLSchema.spec.js +11 -11
- package/dist/senml/hasValue.js +2 -2
- package/dist/senml/hasValue.spec.js +4 -4
- package/dist/senml/lwm2mToSenML.js +8 -8
- package/dist/senml/lwm2mToSenML.spec.js +42 -42
- package/dist/senml/parseResourceId.js +1 -1
- package/dist/senml/parseResourceId.spec.js +6 -6
- package/dist/senml/senMLtoLwM2M.js +14 -14
- package/dist/senml/senMLtoLwM2M.spec.js +53 -53
- package/dist/senml/validateSenML.js +2 -2
- package/dist/senml/validateSenML.spec.js +11 -11
- package/package.json +4 -8
- package/dist/api/ResourceUpdate.js +0 -17
- package/dist/api/ResourceUpdate.spec.js +0 -26
|
@@ -261,16 +261,16 @@ function _ts_values(o) {
|
|
|
261
261
|
};
|
|
262
262
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
263
263
|
}
|
|
264
|
-
import chalk from
|
|
265
|
-
import { readFile, readdir, stat } from
|
|
266
|
-
import path, { parse } from
|
|
267
|
-
import assert from
|
|
268
|
-
import xml2js from
|
|
269
|
-
import { exec } from
|
|
270
|
-
import { unwrapNestedArray } from
|
|
271
|
-
import { LWM2MObjectDefinition } from
|
|
272
|
-
import { validate } from
|
|
273
|
-
import { parseRangeEnumeration } from
|
|
264
|
+
import chalk from 'chalk';
|
|
265
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
266
|
+
import path, { parse } from 'node:path';
|
|
267
|
+
import assert from 'node:assert/strict';
|
|
268
|
+
import xml2js from 'xml2js';
|
|
269
|
+
import { exec } from 'node:child_process';
|
|
270
|
+
import { unwrapNestedArray } from './unwrapNestedArray.js';
|
|
271
|
+
import { LWM2MObjectDefinition } from './LWM2MObjectDefinition.js';
|
|
272
|
+
import { validate } from '../validate.js';
|
|
273
|
+
import { parseRangeEnumeration } from './parseRangeEnumeration.js';
|
|
274
274
|
var v = validate(LWM2MObjectDefinition);
|
|
275
275
|
var listLwm2mDefinitions = function() {
|
|
276
276
|
var _ref = _async_to_generator(function(modelDir) {
|
|
@@ -301,13 +301,13 @@ var listLwm2mDefinitions = function() {
|
|
|
301
301
|
case 0:
|
|
302
302
|
_ref = _step.value;
|
|
303
303
|
file = _ref;
|
|
304
|
-
if (!file.endsWith(
|
|
304
|
+
if (!file.endsWith('.xml')) return [
|
|
305
305
|
2,
|
|
306
306
|
"continue"
|
|
307
307
|
];
|
|
308
|
-
console.log(chalk.white(
|
|
309
|
-
assert.match(file, /^[0-9]+\.xml$/,
|
|
310
|
-
console.log(chalk.green(
|
|
308
|
+
console.log(chalk.white('·'), chalk.white.bold(file));
|
|
309
|
+
assert.match(file, /^[0-9]+\.xml$/, 'LwM2M object definition files must only have numbers in their file names');
|
|
310
|
+
console.log(chalk.green('✔'), chalk.gray('File name is correct'));
|
|
311
311
|
objectDefinitionFile = path.join(modelDir, file);
|
|
312
312
|
return [
|
|
313
313
|
4,
|
|
@@ -321,7 +321,7 @@ var listLwm2mDefinitions = function() {
|
|
|
321
321
|
return [
|
|
322
322
|
4,
|
|
323
323
|
new Promise(function(resolve) {
|
|
324
|
-
return exec("xmllint --noout --schema ".concat(path.join(process.cwd(),
|
|
324
|
+
return exec("xmllint --noout --schema ".concat(path.join(process.cwd(), 'lwm2m', 'LWM2M-v1_1.xsd'), " ").concat(objectDefinitionFile), function(error, _, stderr) {
|
|
325
325
|
if (error) {
|
|
326
326
|
console.error(stderr);
|
|
327
327
|
return resolve(false);
|
|
@@ -332,16 +332,16 @@ var listLwm2mDefinitions = function() {
|
|
|
332
332
|
];
|
|
333
333
|
case 2:
|
|
334
334
|
schemaValidated = _state.sent();
|
|
335
|
-
assert.equal(schemaValidated, true,
|
|
336
|
-
console.log(chalk.green(
|
|
335
|
+
assert.equal(schemaValidated, true, '');
|
|
336
|
+
console.log(chalk.green('✔'), chalk.gray('Is a valid LwM2M object definition'));
|
|
337
337
|
ObjectID = parseInt(parse(objectDefinitionFile).name, 10);
|
|
338
|
-
assert.equal(ObjectID > 14200, true,
|
|
339
|
-
assert.equal(ObjectID < 15000, true,
|
|
338
|
+
assert.equal(ObjectID > 14200, true, 'ObjectID must be greater than 14200');
|
|
339
|
+
assert.equal(ObjectID < 15000, true, 'ObjectID must be smaller than 15000');
|
|
340
340
|
ObjectURN = "urn:oma:lwm2m:x:".concat(ObjectID);
|
|
341
341
|
_ = xml2js.parseStringPromise;
|
|
342
342
|
return [
|
|
343
343
|
4,
|
|
344
|
-
readFile(objectDefinitionFile,
|
|
344
|
+
readFile(objectDefinitionFile, 'utf-8')
|
|
345
345
|
];
|
|
346
346
|
case 3:
|
|
347
347
|
return [
|
|
@@ -356,9 +356,9 @@ var listLwm2mDefinitions = function() {
|
|
|
356
356
|
]).LWM2M.Object;
|
|
357
357
|
assert.equal(ObjectID.toString(), definition.ObjectID, "ObjectID must match filename");
|
|
358
358
|
assert.equal(ObjectURN, definition.ObjectURN, "ObjectURN must follow schema");
|
|
359
|
-
console.log(chalk.green(
|
|
359
|
+
console.log(chalk.green('✔'), chalk.blue(ObjectURN), chalk.gray('ObjectID and URN match filename and schema'));
|
|
360
360
|
objectDef = _object_spread_props(_object_spread({}, definition), {
|
|
361
|
-
LWM2MVersion:
|
|
361
|
+
LWM2MVersion: '1.1',
|
|
362
362
|
Resources: definition.Resources.Item.reduce(function(resources, _param) {
|
|
363
363
|
var $ = _param.$, item = _object_without_properties(_param, [
|
|
364
364
|
"$"
|
|
@@ -366,33 +366,33 @@ var listLwm2mDefinitions = function() {
|
|
|
366
366
|
if (resources[$.ID] !== undefined) throw new Error("Duplicate resource ID: ".concat($.ID));
|
|
367
367
|
if (item.RangeEnumeration.length > 0) {
|
|
368
368
|
var maybeRange = parseRangeEnumeration(item.RangeEnumeration);
|
|
369
|
-
if (
|
|
369
|
+
if ('error' in maybeRange) throw maybeRange.error;
|
|
370
370
|
}
|
|
371
371
|
return _object_spread_props(_object_spread({}, resources), _define_property({}, $.ID, item));
|
|
372
372
|
}, {})
|
|
373
373
|
});
|
|
374
374
|
maybeValid = v(objectDef);
|
|
375
|
-
if (
|
|
375
|
+
if ('errors' in maybeValid) {
|
|
376
376
|
console.error(maybeValid.errors);
|
|
377
377
|
throw new Error("The definition should be valid!");
|
|
378
378
|
}
|
|
379
|
-
console.log(chalk.green(
|
|
379
|
+
console.log(chalk.green('✔'), chalk.gray('LwM2M limitations are honored'));
|
|
380
380
|
defs.push(maybeValid.value);
|
|
381
381
|
_maybeValid_value = maybeValid.value, Name = _maybeValid_value.Name, Resources = _maybeValid_value.Resources;
|
|
382
382
|
TimeResources = Object.values(Resources).filter(function(param) {
|
|
383
383
|
var Type = param.Type;
|
|
384
|
-
return Type ===
|
|
384
|
+
return Type === 'Time';
|
|
385
385
|
});
|
|
386
|
-
assert.equal(TimeResources.length, 1,
|
|
387
|
-
assert.equal((_TimeResources_ = TimeResources[0]) === null || _TimeResources_ === void 0 ? void 0 : _TimeResources_.Mandatory,
|
|
388
|
-
console.log(chalk.green(
|
|
386
|
+
assert.equal(TimeResources.length, 1, 'Objects must define one Time resource');
|
|
387
|
+
assert.equal((_TimeResources_ = TimeResources[0]) === null || _TimeResources_ === void 0 ? void 0 : _TimeResources_.Mandatory, 'Mandatory', 'The Time resources must be mandatory.');
|
|
388
|
+
console.log(chalk.green('✔'), chalk.gray("Object has one time resource (".concat((_TimeResources_1 = TimeResources[0]) === null || _TimeResources_1 === void 0 ? void 0 : _TimeResources_1.Name, ")")));
|
|
389
389
|
console.log("".concat(chalk.yellow(ObjectID), ":"), chalk.white(Name));
|
|
390
390
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
391
391
|
try {
|
|
392
392
|
for(_iterator = Object.entries(Resources)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
393
393
|
_step_value = _sliced_to_array(_step1.value, 2), id = _step_value[0], resource = _step_value[1];
|
|
394
394
|
;
|
|
395
|
-
console.log("".concat(chalk.gray(ObjectID), ".").concat(chalk.yellow(id), ":"), chalk.white(resource.Name), "".concat(chalk.gray(resource.Type), " ").concat(chalk.gray("(".concat((_resource_Units = resource.Units) !== null && _resource_Units !== void 0 ? _resource_Units :
|
|
395
|
+
console.log("".concat(chalk.gray(ObjectID), ".").concat(chalk.yellow(id), ":"), chalk.white(resource.Name), "".concat(chalk.gray(resource.Type), " ").concat(chalk.gray("(".concat((_resource_Units = resource.Units) !== null && _resource_Units !== void 0 ? _resource_Units : 'no unit', ")"))));
|
|
396
396
|
}
|
|
397
397
|
} catch (err) {
|
|
398
398
|
_didIteratorError = true;
|
|
@@ -473,8 +473,8 @@ var listLwm2mDefinitions = function() {
|
|
|
473
473
|
};
|
|
474
474
|
}();
|
|
475
475
|
// LwM2M
|
|
476
|
-
console.log(chalk.gray(
|
|
477
|
-
console.log(
|
|
478
|
-
var lwm2mDir = path.join(process.cwd(),
|
|
476
|
+
console.log(chalk.gray('LwM2M rules check'));
|
|
477
|
+
console.log('');
|
|
478
|
+
var lwm2mDir = path.join(process.cwd(), 'lwm2m');
|
|
479
479
|
var lwm2mDefinitions = await listLwm2mDefinitions(lwm2mDir);
|
|
480
|
-
assert.equal(lwm2mDefinitions.length > 0, true,
|
|
480
|
+
assert.equal(lwm2mDefinitions.length > 0, true, 'LwM2M objects must be defined.');
|
|
@@ -32,7 +32,7 @@ var _obj;
|
|
|
32
32
|
min: -90,
|
|
33
33
|
max: 90
|
|
34
34
|
},
|
|
35
|
-
Units: "\
|
|
35
|
+
Units: "\u00B0"
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
38
38
|
* Longitude (Float)
|
|
@@ -51,7 +51,7 @@ var _obj;
|
|
|
51
51
|
min: -180,
|
|
52
52
|
max: 180
|
|
53
53
|
},
|
|
54
|
-
Units: "\
|
|
54
|
+
Units: "\u00B0"
|
|
55
55
|
},
|
|
56
56
|
/**
|
|
57
57
|
* Altitude (Float)
|
|
@@ -106,7 +106,7 @@ var _obj;
|
|
|
106
106
|
min: 0,
|
|
107
107
|
max: 360
|
|
108
108
|
},
|
|
109
|
-
Units: "\
|
|
109
|
+
Units: "\u00B0"
|
|
110
110
|
},
|
|
111
111
|
/**
|
|
112
112
|
* Source (String)
|
|
@@ -432,7 +432,7 @@ var _obj;
|
|
|
432
432
|
Mandatory: false,
|
|
433
433
|
Type: ResourceType.Float,
|
|
434
434
|
Description: "Environmental temperature in Celsius. Examples: 23.5, -10.2.",
|
|
435
|
-
Units: "\
|
|
435
|
+
Units: "\u00B0C"
|
|
436
436
|
},
|
|
437
437
|
/**
|
|
438
438
|
* Humidity (Float)
|
|
@@ -147,9 +147,9 @@ function _ts_generator(thisArg, body) {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
import xml2js from
|
|
151
|
-
import { readFile } from
|
|
152
|
-
import path from
|
|
150
|
+
import xml2js from 'xml2js';
|
|
151
|
+
import { readFile } from 'node:fs/promises';
|
|
152
|
+
import path from 'node:path';
|
|
153
153
|
/**
|
|
154
154
|
* From XML to JSON
|
|
155
155
|
*/ export var fromXML2JSON = function() {
|
|
@@ -170,7 +170,7 @@ import path from "node:path";
|
|
|
170
170
|
_ = xml2js.parseStringPromise;
|
|
171
171
|
return [
|
|
172
172
|
4,
|
|
173
|
-
readFile(subDir(
|
|
173
|
+
readFile(subDir('lwm2m', "".concat(id, ".xml")), 'utf-8')
|
|
174
174
|
];
|
|
175
175
|
case 1:
|
|
176
176
|
return [
|
package/dist/lwm2m/instanceTs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { definitions } from
|
|
2
|
-
import { timestampResources } from
|
|
1
|
+
import { definitions } from './definitions.js';
|
|
2
|
+
import { timestampResources } from './timestampResources.js';
|
|
3
3
|
export var instanceTs = function(instance) {
|
|
4
4
|
var definition = definitions[instance.ObjectID];
|
|
5
5
|
var tsResourceId = timestampResources[definition.ObjectID]// All registered objects must have a timestamp resource
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { describe, it } from
|
|
2
|
-
import assert from
|
|
3
|
-
import { instanceTs } from
|
|
4
|
-
void describe(
|
|
5
|
-
void it(
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { instanceTs } from './instanceTs.js';
|
|
4
|
+
void describe('instanceTs()', function() {
|
|
5
|
+
void it('should return the timestamp of the instance', function() {
|
|
6
6
|
return assert.equal(instanceTs({
|
|
7
7
|
ObjectID: 14210,
|
|
8
|
-
ObjectVersion:
|
|
8
|
+
ObjectVersion: '1.0',
|
|
9
9
|
Resources: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
'0': 3.5399999618530273,
|
|
11
|
+
'1': 4.168000221252441,
|
|
12
|
+
'99': '2024-02-23T10:18:20.474Z'
|
|
13
13
|
}
|
|
14
|
-
}).getTime(), new Date(
|
|
14
|
+
}).getTime(), new Date('2024-02-23T10:18:20.474Z').getTime());
|
|
15
15
|
});
|
|
16
16
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { validators } from
|
|
2
|
-
import { validate } from
|
|
1
|
+
import { validators } from './validators.js';
|
|
2
|
+
import { validate } from './validate.js';
|
|
3
3
|
export var isRegisteredLwM2MObject = validate(validators);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { describe, it } from
|
|
2
|
-
import assert from
|
|
3
|
-
import { isRegisteredLwM2MObject } from
|
|
4
|
-
void describe(
|
|
5
|
-
void it(
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { isRegisteredLwM2MObject } from './isRegisteredLwM2MObject.js';
|
|
4
|
+
void describe('isRegisteredLwM2MObject()', function() {
|
|
5
|
+
void it('should validate a LwM2M object', function() {
|
|
6
6
|
var o = {
|
|
7
7
|
ObjectID: 14201,
|
|
8
|
-
ObjectVersion:
|
|
8
|
+
ObjectVersion: '1.0',
|
|
9
9
|
Resources: {
|
|
10
10
|
0: 33.98771459323253,
|
|
11
11
|
1: -84.50632147267358,
|
|
@@ -13,29 +13,29 @@ void describe("isRegisteredLwM2MObject()", function() {
|
|
|
13
13
|
3: 11.317643165588379,
|
|
14
14
|
4: 0.03478508070111275,
|
|
15
15
|
5: 90.31222534179688,
|
|
16
|
-
6:
|
|
16
|
+
6: 'GNSS',
|
|
17
17
|
99: new Date(1699049744000)
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
assert.equal(isRegisteredLwM2MObject(o), true);
|
|
21
21
|
});
|
|
22
|
-
void it(
|
|
22
|
+
void it('should validate a LwM2M object with optional resources', function() {
|
|
23
23
|
var o = {
|
|
24
24
|
ObjectID: 14201,
|
|
25
|
-
ObjectVersion:
|
|
25
|
+
ObjectVersion: '1.0',
|
|
26
26
|
Resources: {
|
|
27
27
|
0: 33.98771459323253,
|
|
28
28
|
1: -84.50632147267358,
|
|
29
|
-
6:
|
|
29
|
+
6: 'GNSS',
|
|
30
30
|
99: new Date(1699049744000)
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
assert.equal(isRegisteredLwM2MObject(o), true);
|
|
34
34
|
});
|
|
35
|
-
void it(
|
|
35
|
+
void it('should not validate an unknown LwM2M object', function() {
|
|
36
36
|
var o = {
|
|
37
37
|
ObjectID: 666,
|
|
38
|
-
ObjectVersion:
|
|
38
|
+
ObjectVersion: '1.0',
|
|
39
39
|
Resources: {
|
|
40
40
|
0: 42
|
|
41
41
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { describe, it } from
|
|
2
|
-
import assert from
|
|
3
|
-
import { parseRangeEnumeration } from
|
|
4
|
-
import { RangeEnumerationRegExp } from
|
|
5
|
-
void describe(
|
|
6
|
-
void it(
|
|
7
|
-
var result = parseRangeEnumeration(
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { parseRangeEnumeration } from './parseRangeEnumeration.js';
|
|
4
|
+
import { RangeEnumerationRegExp } from './LWM2MObjectDefinition.js';
|
|
5
|
+
void describe('parseRangeEnumeration()', function() {
|
|
6
|
+
void it('should parse valid range enumeration', function() {
|
|
7
|
+
var result = parseRangeEnumeration('1..10');
|
|
8
8
|
assert.deepEqual(result, {
|
|
9
9
|
range: {
|
|
10
10
|
min: 1,
|
|
@@ -12,14 +12,14 @@ void describe("parseRangeEnumeration()", function() {
|
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
void it(
|
|
16
|
-
var result = parseRangeEnumeration(
|
|
15
|
+
void it('should handle invalid range enumeration', function() {
|
|
16
|
+
var result = parseRangeEnumeration('10..1');
|
|
17
17
|
assert.deepEqual(result, {
|
|
18
18
|
error: new Error("'min' must be smaller than 'max' in RangeEnumeration '10..1'!")
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
|
-
void it(
|
|
22
|
-
var result = parseRangeEnumeration(
|
|
21
|
+
void it('should handle invalid input', function() {
|
|
22
|
+
var result = parseRangeEnumeration('invalid');
|
|
23
23
|
assert.deepEqual(result, {
|
|
24
24
|
error: new Error("Could not match 'invalid' against ".concat(RangeEnumerationRegExp, "!"))
|
|
25
25
|
});
|
|
@@ -99,10 +99,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
99
99
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
100
100
|
}
|
|
101
101
|
export var unwrapNestedArray = function(object) {
|
|
102
|
-
if (typeof object ===
|
|
102
|
+
if (typeof object === 'string') return object;
|
|
103
103
|
return Object.entries(object).reduce(function(result, param) {
|
|
104
104
|
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
105
|
-
if (typeof v ===
|
|
105
|
+
if (typeof v === 'string') return _object_spread_props(_object_spread({}, result), _define_property({}, k, v));
|
|
106
106
|
if (Array.isArray(v)) {
|
|
107
107
|
if (v.length === 1) {
|
|
108
108
|
return _object_spread_props(_object_spread({}, result), _define_property({}, k, unwrapNestedArray(v[0])));
|