@zuplo/cli 1.98.0 → 1.99.0

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,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="693e8a63-74e3-5e0f-8ccd-e696344947e7")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4a8615df-d2b4-5848-86ad-a1cf7f258048")}catch(e){}}();
3
3
  import { cpSync, existsSync } from "node:fs";
4
4
  import { join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -44,6 +44,7 @@ export async function dev(argv) {
44
44
  let editor;
45
45
  if (argv["start-editor"]) {
46
46
  editor = new ApiServer({
47
+ cliArgs: argv,
47
48
  workingDir: sourceDirectory,
48
49
  port: argv.editorPort,
49
50
  isStandalone: false,
@@ -77,4 +78,4 @@ export async function dev(argv) {
77
78
  });
78
79
  }
79
80
  //# sourceMappingURL=handler.js.map
80
- //# debugId=693e8a63-74e3-5e0f-8ccd-e696344947e7
81
+ //# debugId=4a8615df-d2b4-5848-86ad-a1cf7f258048
@@ -1,10 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fc77d1b3-caea-5c0e-8d5d-3a380bd43f60")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e4106dc-1dc1-522d-9fb8-0657dd99f9f9")}catch(e){}}();
3
3
  import { logger } from "../common/logger.js";
4
4
  import { ApiServer } from "./server/server.js";
5
5
  export async function editor(argv) {
6
6
  const workingDir = argv.dir || process.cwd();
7
7
  const server = new ApiServer({
8
+ cliArgs: argv,
8
9
  workingDir,
9
10
  port: argv.port,
10
11
  isStandalone: true,
@@ -22,4 +23,4 @@ export async function editor(argv) {
22
23
  });
23
24
  }
24
25
  //# sourceMappingURL=handler.js.map
25
- //# debugId=fc77d1b3-caea-5c0e-8d5d-3a380bd43f60
26
+ //# debugId=9e4106dc-1dc1-522d-9fb8-0657dd99f9f9
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5ab9ac05-f559-54b5-b7df-cad35032f993")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="421dfa2f-b392-5e9d-9e07-f810a3e4295f")}catch(e){}}();
3
3
  import fastifyStatic from "@fastify/static";
4
4
  import chokidar from "chokidar";
5
5
  import Fastify from "fastify";
@@ -7,6 +7,7 @@ import { FastifySSEPlugin } from "fastify-sse-v2";
7
7
  import fs, { readFile, readdir } from "node:fs/promises";
8
8
  import path from "node:path";
9
9
  import { fileURLToPath } from "node:url";
10
+ import { captureEvent, shutdownAnalytics } from "../../common/analytics/lib.js";
10
11
  import { logger } from "../../common/logger.js";
11
12
  import { printDiagnosticsToConsole } from "../../common/output.js";
12
13
  import { corsPlugin } from "./cors-plugin.js";
@@ -15,17 +16,20 @@ const POLICIES_FILENAME = "policies.json";
15
16
  const CONFIG_DIR = "config";
16
17
  export class ApiServer {
17
18
  fastify;
18
- listenerPort;
19
- isStandalone;
20
19
  listenerHost;
21
- workingDir;
22
20
  watcher;
23
21
  sseContext;
22
+ cliArgs;
23
+ workingDir;
24
+ listenerPort;
25
+ isStandalone;
24
26
  constructor(options = {
27
+ cliArgs: {},
25
28
  workingDir: ".",
26
29
  port: 9100,
27
30
  isStandalone: true,
28
31
  }) {
32
+ this.cliArgs = options.cliArgs;
29
33
  this.workingDir = options.workingDir;
30
34
  this.listenerPort = options.port;
31
35
  this.isStandalone = options.isStandalone;
@@ -38,6 +42,7 @@ export class ApiServer {
38
42
  });
39
43
  }
40
44
  init = async () => {
45
+ const cliArgs = this.cliArgs;
41
46
  this.fastify.register(corsPlugin, { origin: true });
42
47
  this.fastify.register(FastifySSEPlugin);
43
48
  const editorRootPath = fileURLToPath(new URL("../", import.meta.url));
@@ -47,6 +52,7 @@ export class ApiServer {
47
52
  this.fastify.register((instance, _options, done) => {
48
53
  instance.get("/", {
49
54
  handler: async (_request, reply) => {
55
+ await captureEvent({ argv: cliArgs, event: "route-designer: /" });
50
56
  let html = await readFile(path.join(editorRootPath, "index.html"), "utf-8");
51
57
  html = html.replace("__SERVER_DATA__", JSON.stringify({
52
58
  server_address: this.listenerHost,
@@ -57,6 +63,10 @@ export class ApiServer {
57
63
  });
58
64
  instance.get("/open-api-content", {
59
65
  handler: async (request, reply) => {
66
+ await captureEvent({
67
+ argv: cliArgs,
68
+ event: "route-designer: /open-api-content",
69
+ });
60
70
  const { path: filePath } = request.query;
61
71
  if (filePath === null || filePath === undefined) {
62
72
  return reply.code(404).send("You must select a file to work with");
@@ -90,6 +100,10 @@ export class ApiServer {
90
100
  });
91
101
  instance.get("/open-api-files", {
92
102
  handler: async (request, reply) => {
103
+ await captureEvent({
104
+ argv: cliArgs,
105
+ event: "route-designer: /open-api-files",
106
+ });
93
107
  const projectConfigPath = path.join(this.workingDir, CONFIG_DIR);
94
108
  if (!(await dirExists(projectConfigPath))) {
95
109
  request.log.warn(`Cannot find the project '${CONFIG_DIR}' folder. Make sure '${this.workingDir}' has a '${CONFIG_DIR}' folder.`);
@@ -106,6 +120,10 @@ export class ApiServer {
106
120
  method: "POST",
107
121
  url: "/save-open-api-updates",
108
122
  handler: async (request, reply) => {
123
+ await captureEvent({
124
+ argv: cliArgs,
125
+ event: "route-designer: /save-open-api-updates",
126
+ });
109
127
  const bodyContent = request.body;
110
128
  bodyContent.forEach(async (fileData) => {
111
129
  const openApiFilePath = path.join(this.workingDir, "config", fileData.filePath);
@@ -121,6 +139,10 @@ export class ApiServer {
121
139
  });
122
140
  instance.get("/updates", {
123
141
  handler: async (request, reply) => {
142
+ await captureEvent({
143
+ argv: cliArgs,
144
+ event: "route-designer: /updates",
145
+ });
124
146
  if (this.watcher && this.watcher.closed === true) {
125
147
  this.watcher = chokidar.watch(path.join(this.workingDir, CONFIG_DIR));
126
148
  }
@@ -141,6 +163,10 @@ export class ApiServer {
141
163
  });
142
164
  instance.get("/modules-data", {
143
165
  handler: async (request, reply) => {
166
+ await captureEvent({
167
+ argv: cliArgs,
168
+ event: "route-designer: /modules-data",
169
+ });
144
170
  const projectModulesPath = path.join(this.workingDir, "modules");
145
171
  if (!(await dirExists(projectModulesPath))) {
146
172
  request.log.warn(`Cannot find the project 'modules' folder. Make sure '${this.workingDir}' has a 'modules' folder.`);
@@ -211,6 +237,7 @@ export class ApiServer {
211
237
  printDiagnosticsToConsole("Closing route designer");
212
238
  }
213
239
  try {
240
+ shutdownAnalytics();
214
241
  if (this.sseContext) {
215
242
  this.sseContext.source.end();
216
243
  }
@@ -226,4 +253,4 @@ export class ApiServer {
226
253
  };
227
254
  }
228
255
  //# sourceMappingURL=server.js.map
229
- //# debugId=5ab9ac05-f559-54b5-b7df-cad35032f993
256
+ //# debugId=421dfa2f-b392-5e9d-9e07-f810a3e4295f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "1.98.0",
3
+ "version": "1.99.0",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",