lucid-package 0.0.11 → 0.0.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-package",
3
- "version": "0.0.11",
3
+ "version": "0.0.15",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.debugEditorExtension = exports.updateExtensionSDK = exports.buildEditorExtension = exports.createEditorExtension = void 0;
4
4
  const fs = require("fs/promises");
5
+ const oldFs = require("fs");
5
6
  const filesystemutil_1 = require("./filesystemutil");
6
7
  const package_1 = require("./package");
7
8
  const express = require("express");
@@ -62,6 +63,11 @@ async function debugEditorExtension(name) {
62
63
  next();
63
64
  });
64
65
  app.get('/extension.js', async (req, res) => {
66
+ //Give it several seconds for the extension to finish generating before failing.
67
+ const before = Date.now();
68
+ while (!oldFs.existsSync('bin/extension.js') && Date.now() - before < 5000) {
69
+ await new Promise((resolve) => setTimeout(resolve, 50));
70
+ }
65
71
  res.send((await fs.readFile('bin/extension.js')).toString());
66
72
  });
67
73
  app.get('/scopes', async (req, res) => {
@@ -90,7 +96,7 @@ async function debugEditorExtension(name) {
90
96
  codeUrl: 'http://localhost:9900/extension.js',
91
97
  });
92
98
  });
93
- app.listen(9900, () => {
99
+ app.listen(9900, 'localhost', () => {
94
100
  console.log('Listening at http://localhost:9900/extension.js');
95
101
  });
96
102
  (0, shapelibrary_1.debugShapeLibraries)('../..');
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const argparse_1 = require("argparse");
3
4
  const editorextension_1 = require("./editorextension");
4
5
  const package_1 = require("./package");
5
- const argparse_1 = require("argparse");
6
6
  const shapelibrary_1 = require("./shapelibrary");
7
7
  class LucidSuiteExtensionCLI {
8
- run(args) {
8
+ async run(args) {
9
9
  const parser = new argparse_1.ArgumentParser({
10
10
  description: 'Create and manage Lucid extension packages',
11
11
  });
@@ -66,7 +66,7 @@ class LucidSuiteExtensionCLI {
66
66
  break;
67
67
  case 'bundle':
68
68
  if ((0, package_1.currentlyInPackage)()) {
69
- (0, package_1.writePackage)();
69
+ await (0, package_1.writePackage)();
70
70
  }
71
71
  else {
72
72
  console.error('Not currently in a Lucid extension package folder');
@@ -74,7 +74,7 @@ class LucidSuiteExtensionCLI {
74
74
  break;
75
75
  case 'update-sdk':
76
76
  if ((0, package_1.currentlyInPackage)()) {
77
- (0, package_1.updateAllExtensionSDK)();
77
+ await (0, package_1.updateAllExtensionSDK)();
78
78
  }
79
79
  else {
80
80
  console.error('Not currently in a Lucid extension package folder');
@@ -82,7 +82,7 @@ class LucidSuiteExtensionCLI {
82
82
  break;
83
83
  case 'create-editor-extension':
84
84
  if ((0, package_1.currentlyInPackage)()) {
85
- (0, editorextension_1.createEditorExtension)(parsed['name'], isInternalTesting);
85
+ await (0, editorextension_1.createEditorExtension)(parsed['name'], isInternalTesting);
86
86
  }
87
87
  else {
88
88
  console.error('Not currently in a Lucid extension package folder');
@@ -90,7 +90,7 @@ class LucidSuiteExtensionCLI {
90
90
  break;
91
91
  case 'build-editor-extension':
92
92
  if ((0, package_1.currentlyInPackage)()) {
93
- (0, editorextension_1.buildEditorExtension)(parsed['name']);
93
+ await (0, editorextension_1.buildEditorExtension)(parsed['name']);
94
94
  }
95
95
  else {
96
96
  console.error('Not currently in a Lucid extension package folder');
@@ -98,7 +98,7 @@ class LucidSuiteExtensionCLI {
98
98
  break;
99
99
  case 'create-shape-library':
100
100
  if ((0, package_1.currentlyInPackage)()) {
101
- (0, shapelibrary_1.createEmptyShapeLibrary)(parsed['name']);
101
+ await (0, shapelibrary_1.createEmptyShapeLibrary)(parsed['name']);
102
102
  }
103
103
  else {
104
104
  console.error('Not currently in a Lucid extension package folder');
@@ -106,7 +106,7 @@ class LucidSuiteExtensionCLI {
106
106
  break;
107
107
  case 'test-shape-libraries':
108
108
  if ((0, package_1.currentlyInPackage)()) {
109
- (0, shapelibrary_1.debugShapeLibraries)();
109
+ await (0, shapelibrary_1.debugShapeLibraries)();
110
110
  }
111
111
  else {
112
112
  console.error('Not currently in a Lucid extension package folder');
@@ -114,7 +114,7 @@ class LucidSuiteExtensionCLI {
114
114
  break;
115
115
  case 'test-editor-extension':
116
116
  if ((0, package_1.currentlyInPackage)()) {
117
- (0, editorextension_1.debugEditorExtension)(parsed['name']);
117
+ await (0, editorextension_1.debugEditorExtension)(parsed['name']);
118
118
  }
119
119
  else {
120
120
  console.error('Not currently in a Lucid extension package folder');
@@ -125,4 +125,6 @@ class LucidSuiteExtensionCLI {
125
125
  }
126
126
  }
127
127
  }
128
- new LucidSuiteExtensionCLI().run(process.argv.slice(2));
128
+ new LucidSuiteExtensionCLI()
129
+ .run(process.argv.slice(2))
130
+ .catch((reason) => console.error('Error running Lucid Suite Extension CLI', reason));
@@ -85,11 +85,11 @@ function validateManifestOrThrow(manifest) {
85
85
  if (!(0, checks_1.isString)(provider['oauthProviderName'])) {
86
86
  throw new Error('manifest.json: Data connector "oauthProviderName" must be a string');
87
87
  }
88
- if (!(0, checks_1.isString)(provider['callbackUrl'])) {
89
- throw new Error('manifest.json: Data connector "callbackUrl" must be a string');
88
+ if (!(0, checks_1.isString)(provider['callbackBaseUrl'])) {
89
+ throw new Error('manifest.json: Data connector "callbackBaseUrl" must be a string');
90
90
  }
91
- if (!(0, checks_1.isTypedArray)(checks_1.isString)(provider['callbackEvents'])) {
92
- throw new Error('manifest.json: Data connector "callbackEvents" must be a string array');
91
+ if (!(0, checks_1.isRecord)(checks_1.isString)(provider['callbackEvents'])) {
92
+ throw new Error('manifest.json: Data connector "callbackEvents" must be a record from strings to strings');
93
93
  }
94
94
  }
95
95
  }
@@ -38,10 +38,11 @@ const defaultNameMap = new Map([
38
38
  //Produce JSON equivalent to the document service's
39
39
  // /shapeLibraries/:name/shapes endpoint
40
40
  async function getShapeListJson(name, packagePath) {
41
+ const packageManifest = await (0, packagemanifest_1.readManifest)(packagePath + '/');
41
42
  const rawManifest = await fs.readFile(packagePath + `/shapelibraries/${name}/library.manifest`);
42
43
  const manifest = hjson.parse(rawManifest.toString());
43
44
  return JSON.stringify(await Promise.all(manifest['shapes'].map(async (shapeManifest, index) => {
44
- var _a;
45
+ var _a, _b;
45
46
  const rawShapeData = await fs.readFile(packagePath + `/shapelibraries/${name}/shapes/${shapeManifest['shape']}.shape`);
46
47
  const shapeData = hjson.parse(rawShapeData.toString());
47
48
  const properties = {
@@ -61,8 +62,8 @@ async function getShapeListJson(name, packagePath) {
61
62
  'name': shapeManifest['name'],
62
63
  'i18n': {},
63
64
  'sourcePackage': {
64
- 'packageId': '__local__',
65
- 'version': '0.0.0',
65
+ 'packageId': (_a = packageManifest['id']) !== null && _a !== void 0 ? _a : '__local__',
66
+ 'version': packageManifest['version'],
66
67
  'library': name,
67
68
  'shape': shapeManifest['shape'],
68
69
  },
@@ -98,7 +99,7 @@ async function getShapeListJson(name, packagePath) {
98
99
  }
99
100
  for (var key in shapeManifest['defaults']) {
100
101
  if (key !== 'width' && key !== 'height') {
101
- const outName = (_a = defaultNameMap.get(key)) !== null && _a !== void 0 ? _a : key;
102
+ const outName = (_b = defaultNameMap.get(key)) !== null && _b !== void 0 ? _b : key;
102
103
  properties[outName] = shapeManifest['defaults'][key];
103
104
  }
104
105
  }
@@ -199,7 +200,7 @@ async function debugShapeLibraries(packagePath = '.') {
199
200
  socket.send('refresh');
200
201
  }
201
202
  });
202
- server.listen(9901, () => {
203
+ server.listen(9901, 'localhost', () => {
203
204
  console.log('Listening at http://localhost:9901/shapeLibraries');
204
205
  });
205
206
  }
@@ -1,8 +1,12 @@
1
+ /** @ignore */
1
2
  declare namespace lucid {
2
3
  export function executeCommand(name: string, params: any): any;
3
4
  export function listen(msg: any): void;
5
+ export function getPackageId(): string;
6
+ export function getVersion(): string;
4
7
  }
5
8
 
9
+ /** @ignore */
6
10
  declare namespace console {
7
11
  export function log(...args: any[]): void;
8
12
  }