@digipair/skill-editor 0.4.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.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src/index";
package/index.cjs.js ADDED
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+
8
+ let EditorService = class EditorService {
9
+ async read(params, _pinsSettingsList, _context) {
10
+ let text;
11
+ const { digipair, reasoning } = params;
12
+ text = await fs.promises.readFile(path.join(__dirname, `/assets/digipairs/${digipair}/config.json`), 'utf8');
13
+ const config = JSON.parse(text);
14
+ text = await fs.promises.readFile(path.join(__dirname, `/assets/digipairs/${digipair}/${reasoning}.json`), 'utf8');
15
+ const content = JSON.parse(text);
16
+ return {
17
+ libraries: config.libraries,
18
+ content
19
+ };
20
+ }
21
+ async save(params, _pinsSettingsList, _context) {
22
+ const { digipair, reasoning, value } = params;
23
+ await fs.promises.writeFile(path.join(__dirname, `/assets/digipairs/${digipair}/${reasoning}.json`), JSON.stringify(value));
24
+ return {};
25
+ }
26
+ };
27
+ const read = (params, pinsSettingsList, context)=>new EditorService().read(params, pinsSettingsList, context);
28
+ const save = (params, pinsSettingsList, context)=>new EditorService().save(params, pinsSettingsList, context);
29
+
30
+ exports.read = read;
31
+ exports.save = save;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './libs/skill-editor/src/index';
@@ -0,0 +1 @@
1
+ export * from './lib/skill-editor';
@@ -0,0 +1,6 @@
1
+ import { PinsSettings } from '@digipair/engine';
2
+ export declare const read: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
3
+ libraries: any;
4
+ content: any;
5
+ }>;
6
+ export declare const save: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{}>;
package/package.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@digipair/skill-editor",
3
+ "version": "0.4.2",
4
+ "dependencies": {},
5
+ "type": "commonjs",
6
+ "main": "./index.cjs.js",
7
+ "module": "./index.esm.js"
8
+ }