@digipair/skill-common 0.78.0 → 0.78.2

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/index.cjs.js CHANGED
@@ -73,11 +73,13 @@ let CommonService = class CommonService {
73
73
  var _context_privates_EDITOR_PATH;
74
74
  const path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs';
75
75
  const { digipair } = params;
76
- let content = {};
76
+ let schema;
77
+ const content = await fs.promises.readFile(`${path}/${digipair}/config.json`, 'utf8');
78
+ const config = JSON.parse(content);
77
79
  // check if schema.json exists
78
80
  if (fs.existsSync(`${path}/${digipair}/schema.json`)) {
79
81
  const text = await fs.promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
80
- content = JSON.parse(text);
82
+ schema = JSON.parse(text);
81
83
  }
82
84
  const files = await fs.promises.readdir(`${path}/${digipair}`);
83
85
  const actions = (await Promise.all(files.map((file)=>{
@@ -125,9 +127,18 @@ let CommonService = class CommonService {
125
127
  acc[item.key] = item.value;
126
128
  return acc;
127
129
  }, {});
128
- return _extends({}, content, {
129
- paths: _extends({}, content.paths, actions),
130
- 'x-scene-blocks': _extends({}, content['x-scene-blocks'], triggers)
130
+ return _extends({
131
+ openapi: '3.0.0',
132
+ infos: {
133
+ title: 'digipair:' + digipair,
134
+ summary: config.name,
135
+ description: config.description,
136
+ version: '1.0.0',
137
+ 'x-icon': '🤖'
138
+ }
139
+ }, schema, {
140
+ paths: _extends({}, schema.paths, actions),
141
+ 'x-scene-blocks': _extends({}, schema['x-scene-blocks'], triggers)
131
142
  });
132
143
  }
133
144
  };
package/index.esm.js CHANGED
@@ -69,11 +69,13 @@ let CommonService = class CommonService {
69
69
  var _context_privates_EDITOR_PATH;
70
70
  const path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs';
71
71
  const { digipair } = params;
72
- let content = {};
72
+ let schema;
73
+ const content = await promises.readFile(`${path}/${digipair}/config.json`, 'utf8');
74
+ const config = JSON.parse(content);
73
75
  // check if schema.json exists
74
76
  if (existsSync(`${path}/${digipair}/schema.json`)) {
75
77
  const text = await promises.readFile(`${path}/${digipair}/schema.json`, 'utf8');
76
- content = JSON.parse(text);
78
+ schema = JSON.parse(text);
77
79
  }
78
80
  const files = await promises.readdir(`${path}/${digipair}`);
79
81
  const actions = (await Promise.all(files.map((file)=>{
@@ -121,9 +123,18 @@ let CommonService = class CommonService {
121
123
  acc[item.key] = item.value;
122
124
  return acc;
123
125
  }, {});
124
- return _extends({}, content, {
125
- paths: _extends({}, content.paths, actions),
126
- 'x-scene-blocks': _extends({}, content['x-scene-blocks'], triggers)
126
+ return _extends({
127
+ openapi: '3.0.0',
128
+ infos: {
129
+ title: 'digipair:' + digipair,
130
+ summary: config.name,
131
+ description: config.description,
132
+ version: '1.0.0',
133
+ 'x-icon': '🤖'
134
+ }
135
+ }, schema, {
136
+ paths: _extends({}, schema.paths, actions),
137
+ 'x-scene-blocks': _extends({}, schema['x-scene-blocks'], triggers)
127
138
  });
128
139
  }
129
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-common",
3
- "version": "0.78.0",
3
+ "version": "0.78.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",