@nestia/editor 0.1.3 → 0.2.1

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.
@@ -1,58 +1,131 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, Switch, } from "@mui/material";
3
- import StackBlitzSDK from "@stackblitz/sdk";
4
- import { useState } from "react";
5
- import { NestiaEditorComposer } from "./internal/NestiaEditorComposer.js";
6
- import { NestiaEditorFileUploader } from "./internal/NestiaEditorFileUploader.js";
7
- export function NestiaEditorUploader(props) {
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __read = (this && this.__read) || function (o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ };
54
+ var __importDefault = (this && this.__importDefault) || function (mod) {
55
+ return (mod && mod.__esModule) ? mod : { "default": mod };
56
+ };
57
+ Object.defineProperty(exports, "__esModule", { value: true });
58
+ exports.NestiaEditorUploader = NestiaEditorUploader;
59
+ var jsx_runtime_1 = require("react/jsx-runtime");
60
+ var material_1 = require("@mui/material");
61
+ var sdk_1 = __importDefault(require("@stackblitz/sdk"));
62
+ var react_1 = __importDefault(require("react"));
63
+ var NestiaEditorComposer_1 = require("./internal/NestiaEditorComposer");
64
+ var NestiaEditorFileUploader_1 = require("./internal/NestiaEditorFileUploader");
65
+ function NestiaEditorUploader(props) {
66
+ var _this = this;
8
67
  // PARAMETERS
9
- const [mode, setMode] = useState("sdk");
10
- const [simulate, setSimulate] = useState(true);
11
- const [e2e, setE2e] = useState(true);
68
+ var _a = __read(react_1.default.useState("sdk"), 2), mode = _a[0], setMode = _a[1];
69
+ var _b = __read(react_1.default.useState(true), 2), simulate = _b[0], setSimulate = _b[1];
70
+ var _c = __read(react_1.default.useState(true), 2), e2e = _c[0], setE2e = _c[1];
12
71
  // RESULT
13
- const [document, setDocument] = useState(null);
14
- const [progress, setProgress] = useState(false);
15
- const handleError = (error) => {
72
+ var _d = __read(react_1.default.useState(null), 2), document = _d[0], setDocument = _d[1];
73
+ var _f = __read(react_1.default.useState(false), 2), progress = _f[0], setProgress = _f[1];
74
+ var handleError = function (error) {
16
75
  if (props.onError)
17
76
  props.onError(error);
18
77
  else
19
78
  alert(error);
20
79
  };
21
- const handleSwagger = (document, error) => {
80
+ var handleSwagger = function (document, error) {
22
81
  setDocument(document);
23
82
  if (error !== null)
24
83
  handleError(error);
25
84
  };
26
- const generate = async () => {
27
- if (document === null)
28
- return;
29
- setProgress(true);
30
- try {
31
- const result = await NestiaEditorComposer[mode]({
32
- document,
33
- e2e,
34
- simulate,
35
- });
36
- if (result.success === true) {
37
- StackBlitzSDK.openProject({
38
- title: document.info?.title ?? "Nestia Editor",
39
- template: "node",
40
- files: result.data.files,
41
- }, {
42
- newWindow: true,
43
- openFile: result.data.openFile,
44
- startScript: result.data.startScript,
45
- });
85
+ var generate = function () { return __awaiter(_this, void 0, void 0, function () {
86
+ var result, exp_1;
87
+ var _a, _b;
88
+ return __generator(this, function (_c) {
89
+ switch (_c.label) {
90
+ case 0:
91
+ if (document === null)
92
+ return [2 /*return*/];
93
+ setProgress(true);
94
+ _c.label = 1;
95
+ case 1:
96
+ _c.trys.push([1, 3, , 4]);
97
+ return [4 /*yield*/, NestiaEditorComposer_1.NestiaEditorComposer[mode]({
98
+ document: document,
99
+ e2e: e2e,
100
+ simulate: simulate,
101
+ })];
102
+ case 2:
103
+ result = _c.sent();
104
+ if (result.success === true) {
105
+ sdk_1.default.openProject({
106
+ title: (_b = (_a = document.info) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : "Nestia Editor",
107
+ template: "node",
108
+ files: result.data.files,
109
+ }, {
110
+ newWindow: true,
111
+ openFile: result.data.openFile,
112
+ startScript: result.data.startScript,
113
+ });
114
+ }
115
+ else {
116
+ handleError(JSON.stringify(result.errors, null, 2));
117
+ }
118
+ return [3 /*break*/, 4];
119
+ case 3:
120
+ exp_1 = _c.sent();
121
+ handleError(exp_1 instanceof Error ? exp_1.message : "unknown error");
122
+ return [3 /*break*/, 4];
123
+ case 4:
124
+ setProgress(false);
125
+ return [2 /*return*/];
46
126
  }
47
- else {
48
- handleError(JSON.stringify(result.errors, null, 2));
49
- }
50
- }
51
- catch (exp) {
52
- handleError(exp instanceof Error ? exp.message : "unknown error");
53
- }
54
- setProgress(false);
55
- };
56
- return (_jsxs(_Fragment, { children: [_jsx(NestiaEditorFileUploader, { onChange: handleSwagger }), _jsx("br", {}), _jsxs(FormControl, { fullWidth: true, style: { paddingLeft: 15 }, children: [_jsx(FormLabel, { children: " Mode " }), _jsxs(RadioGroup, { defaultValue: mode, onChange: (_e, value) => setMode(value), style: { paddingLeft: 15 }, children: [_jsx(FormControlLabel, { value: "sdk", control: _jsx(Radio, {}), label: "Software Development Kit" }), _jsx(FormControlLabel, { value: "nest", control: _jsx(Radio, {}), label: "NestJS Project" })] }), _jsx(FormLabel, { style: { paddingTop: 20 }, children: " Options " }), _jsx(FormControlLabel, { label: "Mockup Simulator", style: { paddingTop: 5, paddingLeft: 15 }, control: _jsx(Switch, { checked: simulate, onChange: () => setSimulate(!simulate) }) }), _jsx(FormControlLabel, { label: "E2E Test Functions", style: { paddingLeft: 15 }, control: _jsx(Switch, { checked: e2e, onChange: () => setE2e(!e2e) }) })] }), _jsx("br", {}), _jsx("br", {}), _jsx(Button, { component: "a", fullWidth: true, variant: "contained", color: "info", size: "large", disabled: progress === true || document === null, onClick: () => generate(), children: progress ? "Generating..." : "Generate Editor" })] }));
127
+ });
128
+ }); };
129
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(NestiaEditorFileUploader_1.NestiaEditorFileUploader, { onChange: handleSwagger }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, style: { paddingLeft: 15 }, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: " Mode " }), (0, jsx_runtime_1.jsxs)(material_1.RadioGroup, { defaultValue: mode, onChange: function (_e, value) { return setMode(value); }, style: { paddingLeft: 15 }, children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: "sdk", control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: "Software Development Kit" }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: "nest", control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: "NestJS Project" })] }), (0, jsx_runtime_1.jsx)(material_1.FormLabel, { style: { paddingTop: 20 }, children: " Options " }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: "Mockup Simulator", style: { paddingTop: 5, paddingLeft: 15 }, control: (0, jsx_runtime_1.jsx)(material_1.Switch, { checked: simulate, onChange: function () { return setSimulate(!simulate); } }) }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: "E2E Test Functions", style: { paddingLeft: 15 }, control: (0, jsx_runtime_1.jsx)(material_1.Switch, { checked: e2e, onChange: function () { return setE2e(!e2e); } }) })] }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(material_1.Button, { component: "a", fullWidth: true, variant: "contained", color: "info", size: "large", disabled: progress === true || document === null, onClick: function () { return generate(); }, children: progress ? "Generating..." : "Generate Editor" })] }));
57
130
  }
58
131
  //# sourceMappingURL=NestiaEditorUploader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaEditorUploader.js","sourceRoot":"","sources":["../src/NestiaEditorUploader.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,UAAU,EACV,MAAM,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,MAAM,UAAU,oBAAoB,CAAC,KAAkC;IACrE,aAAa;IACb,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAiB,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAErC,SAAS;IACT,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAEtC,IAAI,CAAC,CAAC;IACR,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;QACpC,IAAI,KAAK,CAAC,OAAO;YAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;;YACnC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,CAAC;IACF,MAAM,aAAa,GAAG,CACpB,QAIQ,EACR,KAAoB,EACpB,EAAE;QACF,WAAW,CAAC,QAAQ,C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QAAQ,EAAE,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,EAChD,OAAO,EAAE,cAAM,OAAA,QAAQ,EAAE,EAAV,CAAU,YAExB,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,GACxC,IACR,CACJ,CAAC;AACJ,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./NestiaEditorIframe.js";
2
- export * from "./NestiaEditorUploader.js";
1
+ export * from "./NestiaEditorIframe";
2
+ export * from "./NestiaEditorUploader";
package/lib/index.js CHANGED
@@ -1,3 +1,19 @@
1
- export * from "./NestiaEditorIframe.js";
2
- export * from "./NestiaEditorUploader.js";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./NestiaEditorIframe"), exports);
18
+ __exportStar(require("./NestiaEditorUploader"), exports);
3
19
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,yDAAuC"}
package/lib/index.mjs ADDED
@@ -0,0 +1,344 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+
3
+ import { Typography, Stepper, Step, StepLabel, StepContent, CircularProgress, Alert, AlertTitle, FormControl, FormLabel, RadioGroup, FormControlLabel, Radio, Switch, Button } from "@mui/material";
4
+
5
+ import StackBlitzSDK from "@stackblitz/sdk";
6
+
7
+ import React from "react";
8
+
9
+ import { MigrateApplication } from "@nestia/migrate";
10
+
11
+ import prettierEsTreePlugin from "prettier/plugins/estree";
12
+
13
+ import prettierTsPlugin from "prettier/plugins/typescript";
14
+
15
+ import { format } from "prettier/standalone";
16
+
17
+ import { load } from "js-yaml";
18
+
19
+ import FileUpload from "react-mui-fileuploader";
20
+
21
+ var NestiaEditorComposer;
22
+
23
+ (function(NestiaEditorComposer) {
24
+ NestiaEditorComposer.nest = props => compose({
25
+ openFile: "README.md,test/start.ts",
26
+ startScript: [ "build:test,test", "" ],
27
+ migrate: app => app.nest(props)
28
+ })(props);
29
+ NestiaEditorComposer.sdk = props => compose({
30
+ openFile: "README.md,test/start.ts",
31
+ startScript: [ "swagger", "hello" ],
32
+ migrate: app => app.sdk(props)
33
+ })(props);
34
+ const compose = config => async props => {
35
+ if (props.files !== undefined) return {
36
+ success: true,
37
+ data: {
38
+ files: props.files,
39
+ openFile: config.openFile,
40
+ startScript: config.startScript
41
+ },
42
+ errors: []
43
+ };
44
+ const result = await MigrateApplication.create(props.document);
45
+ if (result.success === false) return result;
46
+ const app = result.data;
47
+ const {files} = config.migrate(app);
48
+ for (const f of files) if (f.file.substring(f.file.length - 3) === ".ts") f.content = await format(f.content, {
49
+ parser: "typescript",
50
+ plugins: [ prettierEsTreePlugin, prettierTsPlugin ]
51
+ });
52
+ return {
53
+ success: true,
54
+ data: {
55
+ files: Object.fromEntries(files.map((f => [ [ f.location, f.location.length ? "/" : "", f.file ].join(""), f.content ]))),
56
+ openFile: config.openFile,
57
+ startScript: config.startScript
58
+ },
59
+ errors: []
60
+ };
61
+ };
62
+ })(NestiaEditorComposer || (NestiaEditorComposer = {}));
63
+
64
+ function NestiaEditorIframe(props) {
65
+ const [id] = React.useState(`reactia-editor-div-${Math.random().toString().substring(2)}`);
66
+ const [step, setStep] = React.useState(0);
67
+ const [fetchError, setFetchError] = React.useState(null);
68
+ const [operations, setOperationCount] = React.useState({});
69
+ const [composerError, setComposerError] = React.useState(null);
70
+ React.useEffect((() => {
71
+ (async () => {
72
+ setStep(0);
73
+ const document = typeof props.swagger === "string" ? await getDocument(props.swagger) : props.swagger;
74
+ if (typeof document === "string") {
75
+ setFetchError(document);
76
+ return;
77
+ } else setOperationCount(aggregateOperation(document));
78
+ setStep(1);
79
+ const result = await NestiaEditorComposer.sdk({
80
+ document,
81
+ simulate: props.simulate ?? true,
82
+ e2e: props.e2e ?? true
83
+ });
84
+ if (result.success === false) {
85
+ setComposerError(result.errors);
86
+ return;
87
+ }
88
+ setStep(2);
89
+ StackBlitzSDK.embedProject(id, {
90
+ title: document.info?.title ?? "Nestia Editor",
91
+ template: "node",
92
+ files: result.data.files
93
+ }, {
94
+ width: "100%",
95
+ height: "100%",
96
+ openFile: result.data.openFile,
97
+ startScript: result.data.startScript
98
+ });
99
+ })().catch((() => {}));
100
+ }), []);
101
+ return jsx("div", {
102
+ id,
103
+ style: {
104
+ width: "100%",
105
+ height: "100%",
106
+ overflow: "hidden"
107
+ },
108
+ children: jsxs("div", {
109
+ style: {
110
+ padding: 25,
111
+ overflow: "auto"
112
+ },
113
+ children: [ jsx(Typography, {
114
+ variant: "h4",
115
+ children: "Nestia Editor"
116
+ }), jsx("hr", {}), jsx("br", {}), jsxs(Stepper, {
117
+ activeStep: step,
118
+ orientation: "vertical",
119
+ nonLinear: true,
120
+ children: [ jsxs(Step, {
121
+ children: [ jsx(StepLabel, {
122
+ children: jsx(Typography, {
123
+ variant: "h5",
124
+ children: "Loading OpenAPI Document"
125
+ })
126
+ }), jsxs(StepContent, {
127
+ children: [ jsx("br", {}), jsx(CircularProgress, {
128
+ size: 100,
129
+ color: "success"
130
+ }), jsx("br", {}), jsx("br", {}), typeof props.swagger === "string" ? jsxs(Fragment, {
131
+ children: [ jsx("p", {
132
+ children: "Fetching OpenAPI Document from"
133
+ }), jsx("p", {
134
+ children: jsx("a", {
135
+ href: props.swagger,
136
+ target: "_blank",
137
+ children: props.swagger
138
+ })
139
+ }) ]
140
+ }) : "Delivering OpenAPI Document to the composer", fetchError !== null ? jsxs(Alert, {
141
+ severity: "error",
142
+ children: [ jsx(AlertTitle, {
143
+ children: "Fetch Error"
144
+ }), fetchError ]
145
+ }) : null ]
146
+ }) ]
147
+ }, 0), jsxs(Step, {
148
+ children: [ jsx(StepLabel, {
149
+ children: jsx(Typography, {
150
+ variant: "h5",
151
+ children: "Generating Software Development Kit"
152
+ })
153
+ }), jsxs(StepContent, {
154
+ children: [ jsx("br", {}), jsx(CircularProgress, {
155
+ size: 100,
156
+ color: "success"
157
+ }), jsx("br", {}), jsx("br", {}), "Generating SDK funtions...", jsx("br", {}), jsxs("ul", {
158
+ children: [ jsxs("li", {
159
+ children: [ "total operations: #", Object.values(operations).reduce(((a, b) => a + b), 0).toLocaleString() ]
160
+ }), Object.entries(operations).map((([method, count]) => jsxs("li", {
161
+ children: [ method, ": #", count.toLocaleString() ]
162
+ }))) ]
163
+ }), composerError !== null ? jsxs(Fragment, {
164
+ children: [ jsx("br", {}), jsxs(Alert, {
165
+ severity: "error",
166
+ children: [ jsx(AlertTitle, {
167
+ children: "Composition Error"
168
+ }), jsx("pre", {
169
+ children: JSON.stringify(composerError, null, 2)
170
+ }) ]
171
+ }) ]
172
+ }) : null ]
173
+ }) ]
174
+ }, 1), jsxs(Step, {
175
+ children: [ jsx(StepLabel, {
176
+ children: jsx(Typography, {
177
+ variant: "h5",
178
+ children: "Composing TypeScript Project"
179
+ })
180
+ }), jsx(StepContent, {}) ]
181
+ }, 2) ]
182
+ }) ]
183
+ })
184
+ });
185
+ }
186
+
187
+ const getDocument = async url => {
188
+ try {
189
+ const response = await fetch(url);
190
+ if (response.status !== 200) return await response.text();
191
+ return await response.json();
192
+ } catch (error) {
193
+ if (error instanceof Error) return error.message;
194
+ return "Unknown error";
195
+ }
196
+ };
197
+
198
+ const aggregateOperation = document => {
199
+ const map = {};
200
+ if (!(typeof document === "object" && document !== null)) return map;
201
+ for (const collection of Object.values(document.paths ?? {})) if (typeof collection === "object" && collection !== null) for (const [method] of Object.entries(collection)) if (method === "head" || method === "get" || method === "post" || method === "patch" || method === "put" || method === "delete") map[method] = (map[method] ?? 0) + 1;
202
+ return map;
203
+ };
204
+
205
+ function NestiaEditorFileUploader(props) {
206
+ const [elements, setElements] = React.useState([]);
207
+ const onChange = async array => {
208
+ if (array.length === 0) {
209
+ props.onChange(null, null);
210
+ return;
211
+ }
212
+ const file = array[array.length - 1];
213
+ const buffer = await file.arrayBuffer();
214
+ const content = (new TextDecoder).decode(buffer);
215
+ const extension = file.name.split(".").pop();
216
+ try {
217
+ const json = extension === "json" ? JSON.parse(content) : load(content);
218
+ props.onChange(json, null);
219
+ } catch {
220
+ props.onChange(null, extension === "json" ? "Invalid JSON file" : "Invalid YAML file");
221
+ return;
222
+ }
223
+ if (array.length > 1) setElements([ file ]);
224
+ };
225
+ return jsx(FileUpload, {
226
+ defaultFiles: elements,
227
+ onFilesChange: onChange,
228
+ acceptedType: ".json, .yaml",
229
+ getBase64: false,
230
+ multiFile: false,
231
+ maxUploadFiles: 1,
232
+ title: "Swagger file uploader",
233
+ header: "Drag and drop a Swagger file here",
234
+ buttonLabel: "Click Here",
235
+ rightLabel: "to select swagger.json/yaml file",
236
+ buttonRemoveLabel: "Clear"
237
+ });
238
+ }
239
+
240
+ function NestiaEditorUploader(props) {
241
+ const [mode, setMode] = React.useState("sdk");
242
+ const [simulate, setSimulate] = React.useState(true);
243
+ const [e2e, setE2e] = React.useState(true);
244
+ const [document, setDocument] = React.useState(null);
245
+ const [progress, setProgress] = React.useState(false);
246
+ const handleError = error => {
247
+ if (props.onError) props.onError(error); else alert(error);
248
+ };
249
+ const handleSwagger = (document, error) => {
250
+ setDocument(document);
251
+ if (error !== null) handleError(error);
252
+ };
253
+ const generate = async () => {
254
+ if (document === null) return;
255
+ setProgress(true);
256
+ try {
257
+ const result = await NestiaEditorComposer[mode]({
258
+ document,
259
+ e2e,
260
+ simulate
261
+ });
262
+ if (result.success === true) {
263
+ StackBlitzSDK.openProject({
264
+ title: document.info?.title ?? "Nestia Editor",
265
+ template: "node",
266
+ files: result.data.files
267
+ }, {
268
+ newWindow: true,
269
+ openFile: result.data.openFile,
270
+ startScript: result.data.startScript
271
+ });
272
+ } else {
273
+ handleError(JSON.stringify(result.errors, null, 2));
274
+ }
275
+ } catch (exp) {
276
+ handleError(exp instanceof Error ? exp.message : "unknown error");
277
+ }
278
+ setProgress(false);
279
+ };
280
+ return jsxs(Fragment, {
281
+ children: [ jsx(NestiaEditorFileUploader, {
282
+ onChange: handleSwagger
283
+ }), jsx("br", {}), jsxs(FormControl, {
284
+ fullWidth: true,
285
+ style: {
286
+ paddingLeft: 15
287
+ },
288
+ children: [ jsx(FormLabel, {
289
+ children: " Mode "
290
+ }), jsxs(RadioGroup, {
291
+ defaultValue: mode,
292
+ onChange: (_e, value) => setMode(value),
293
+ style: {
294
+ paddingLeft: 15
295
+ },
296
+ children: [ jsx(FormControlLabel, {
297
+ value: "sdk",
298
+ control: jsx(Radio, {}),
299
+ label: "Software Development Kit"
300
+ }), jsx(FormControlLabel, {
301
+ value: "nest",
302
+ control: jsx(Radio, {}),
303
+ label: "NestJS Project"
304
+ }) ]
305
+ }), jsx(FormLabel, {
306
+ style: {
307
+ paddingTop: 20
308
+ },
309
+ children: " Options "
310
+ }), jsx(FormControlLabel, {
311
+ label: "Mockup Simulator",
312
+ style: {
313
+ paddingTop: 5,
314
+ paddingLeft: 15
315
+ },
316
+ control: jsx(Switch, {
317
+ checked: simulate,
318
+ onChange: () => setSimulate(!simulate)
319
+ })
320
+ }), jsx(FormControlLabel, {
321
+ label: "E2E Test Functions",
322
+ style: {
323
+ paddingLeft: 15
324
+ },
325
+ control: jsx(Switch, {
326
+ checked: e2e,
327
+ onChange: () => setE2e(!e2e)
328
+ })
329
+ }) ]
330
+ }), jsx("br", {}), jsx("br", {}), jsx(Button, {
331
+ component: "a",
332
+ fullWidth: true,
333
+ variant: "contained",
334
+ color: "info",
335
+ size: "large",
336
+ disabled: progress === true || document === null,
337
+ onClick: () => generate(),
338
+ children: progress ? "Generating..." : "Generate Editor"
339
+ }) ]
340
+ });
341
+ }
342
+
343
+ export { NestiaEditorIframe, NestiaEditorUploader };
344
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/internal/NestiaEditorComposer.ts","../src/NestiaEditorIframe.tsx","../src/internal/NestiaEditorFileUploader.tsx","../src/NestiaEditorUploader.tsx"],"sourcesContent":[null,null,null,null],"names":["NestiaEditorComposer","nest","props","compose","openFile","startScript","migrate","app","sdk","config","async","files","undefined","success","data","errors","result","MigrateApplication","create","document","f","file","substring","length","content","format","parser","plugins","prettierEsTreePlugin","prettierTsPlugin","Object","fromEntries","map","location","join","NestiaEditorIframe","id","React","useState","Math","random","toString","step","setStep","fetchError","setFetchError","operations","setOperationCount","composerError","setComposerError","useEffect","swagger","getDocument","aggregateOperation","simulate","e2e","StackBlitzSDK","embedProject","title","info","template","width","height","catch","_jsx","style","overflow","children","_jsxs","padding","Typography","variant","Stepper","activeStep","orientation","nonLinear","Step","StepLabel","StepContent","CircularProgress","size","color","href","target","Alert","severity","AlertTitle","values","reduce","a","b","toLocaleString","entries","method","count","_Fragment","JSON","stringify","url","response","fetch","status","text","json","error","Error","message","collection","paths","NestiaEditorFileUploader","elements","setElements","onChange","array","buffer","arrayBuffer","TextDecoder","decode","extension","name","split","pop","parse","load","FileUpload","defaultFiles","onFilesChange","acceptedType","getBase64","multiFile","maxUploadFiles","header","buttonLabel","rightLabel","buttonRemoveLabel","NestiaEditorUploader","mode","setMode","setSimulate","setE2e","setDocument","progress","setProgress","handleError","onError","alert","handleSwagger","generate","openProject","newWindow","exp","FormControl","fullWidth","paddingLeft","FormLabel","RadioGroup","defaultValue","_e","value","FormControlLabel","control","Radio","label","paddingTop","Switch","checked","Button","component","disabled","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;AAOM,IAAWA;;CAAjB,SAAiBA;IAgBFA,qBAAAC,OAAQC,SACnBC,QAAQ;QACNC,UAAU;QACVC,aAAa,EAAC,mBAAmB;QACjCC,SAAUC,OAAQA,IAAIN,KAAKC;MAH7BC,CAIGD;IAEQF,qBAAAQ,MAAON,SAClBC,QAAQ;QACNC,UAAU;QACVC,aAAa,EAAC,WAAW;QACzBC,SAAUC,OAAQA,IAAIC,IAAIN;MAH5BC,CAIGD;IAEL,MAAMC,UACHM,UAKDC,MAAOR;QACL,IAAIA,MAAMS,UAAUC,WAClB,OAAO;YACLC,SAAS;YACTC,MAAM;gBACJH,OAAOT,MAAMS;gBACbP,UAAUK,OAAOL;gBACjBC,aAAaI,OAAOJ;;YAEtBU,QAAQ;;QAEZ,MAAMC,eACEC,mBAAmBC,OAAOhB,MAAMiB;QACxC,IAAIH,OAAOH,YAAY,OAAO,OAAOG;QAErC,MAAMT,MAA0BS,OAAOF;QACvC,OAAMH,SAAYF,OAAOH,QAAQC;QACjC,KAAK,MAAMa,KAAKT,OACd,IAAIS,EAAEC,KAAKC,UAAUF,EAAEC,KAAKE,SAAS,OAAO,OAC1CH,EAAEI,gBAAgBC,OAAOL,EAAEI,SAAS;YAClCE,QAAQ;YACRC,SAAS,EAACC,sBAAsBC;;QAEtC,OAAO;YACLhB,SAAS;YACTC,MAAM;gBACJH,OAAOmB,OAAOC,YACZpB,MAAMqB,KACHZ,KACC,EACE,EAACA,EAAEa,UAAUb,EAAEa,SAASV,SAAS,MAAM,IAAIH,EAAEC,OAAMa,KAAK,KACxDd,EAAEI;gBAIVpB,UAAUK,OAAOL;gBACj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