lucid-package 0.0.19 → 0.0.22
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/package.json +1 -1
- package/src/packagemanifest.js +4 -0
- package/src/shapelibrary.js +14 -2
package/package.json
CHANGED
package/src/packagemanifest.js
CHANGED
|
@@ -72,6 +72,10 @@ function validateManifestOrThrow(manifest) {
|
|
|
72
72
|
if (!(0, checks_1.isTypedArray)(checks_1.isString)(provider['domainWhitelist'])) {
|
|
73
73
|
throw new Error('manifest.json: OAuth provider "domainWhitelist" must be a string array');
|
|
74
74
|
}
|
|
75
|
+
if (provider['clientAuthentication'] !== 'basic' &&
|
|
76
|
+
provider['clientAuthentication'] !== 'clientParameters') {
|
|
77
|
+
throw new Error('manifest.json: OAuth provider "clientAuthentication" must be "basic" or "clientParameters"');
|
|
78
|
+
}
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
if (manifest['dataConnectors']) {
|
package/src/shapelibrary.js
CHANGED
|
@@ -41,10 +41,21 @@ async function getShapeListJson(name, packagePath) {
|
|
|
41
41
|
const packageManifest = await (0, packagemanifest_1.readManifest)(packagePath + '/');
|
|
42
42
|
const rawManifest = await fs.readFile(packagePath + `/shapelibraries/${name}/library.manifest`);
|
|
43
43
|
const manifest = hjson.parse(rawManifest.toString());
|
|
44
|
+
const usedNames = new Set(manifest['shapes'].map((shape) => shape['key']).filter((key) => key !== undefined));
|
|
44
45
|
return JSON.stringify(await Promise.all(manifest['shapes'].map(async (shapeManifest, index) => {
|
|
45
46
|
var _a, _b;
|
|
46
47
|
const rawShapeData = await fs.readFile(packagePath + `/shapelibraries/${name}/shapes/${shapeManifest['shape']}.shape`);
|
|
47
48
|
const shapeData = hjson.parse(rawShapeData.toString());
|
|
49
|
+
let shapeName = shapeManifest['key'];
|
|
50
|
+
if (shapeName === undefined) {
|
|
51
|
+
shapeName = shapeManifest['shape'];
|
|
52
|
+
let suffixNumber = 1;
|
|
53
|
+
while (usedNames.has(shapeName)) {
|
|
54
|
+
suffixNumber++;
|
|
55
|
+
shapeName = shapeManifest['shape'] + '_' + suffixNumber;
|
|
56
|
+
}
|
|
57
|
+
usedNames.add(shapeName);
|
|
58
|
+
}
|
|
48
59
|
const properties = {
|
|
49
60
|
'Base': { 'x': shapeManifest['defaults']['width'] / 2, 'y': shapeManifest['defaults']['height'] / 2 },
|
|
50
61
|
'BoundingBox': {
|
|
@@ -59,13 +70,14 @@ async function getShapeListJson(name, packagePath) {
|
|
|
59
70
|
},
|
|
60
71
|
'Stencil': {
|
|
61
72
|
'lcszVersion': '1',
|
|
62
|
-
'name':
|
|
73
|
+
'name': shapeName,
|
|
63
74
|
'i18n': {},
|
|
64
75
|
'sourcePackage': {
|
|
65
76
|
'packageId': (_a = packageManifest['id']) !== null && _a !== void 0 ? _a : '__local__',
|
|
66
77
|
'version': packageManifest['version'],
|
|
67
78
|
'library': name,
|
|
68
79
|
'shape': shapeManifest['shape'],
|
|
80
|
+
'name': shapeName,
|
|
69
81
|
},
|
|
70
82
|
},
|
|
71
83
|
};
|
|
@@ -110,7 +122,7 @@ async function getShapeListJson(name, packagePath) {
|
|
|
110
122
|
'order': index,
|
|
111
123
|
'properties': JSON.stringify(properties),
|
|
112
124
|
'shapeLibrary': 'http://localhost:9901/shapeLibraries/' + encodeURIComponent(name),
|
|
113
|
-
'uri': `http://localhost:9901/shapeLibraries/${encodeURIComponent(name)}/shapes/${encodeURIComponent(
|
|
125
|
+
'uri': `http://localhost:9901/shapeLibraries/${encodeURIComponent(name)}/shapes/${encodeURIComponent(shapeName)}`,
|
|
114
126
|
};
|
|
115
127
|
})));
|
|
116
128
|
}
|