@ones-open/cli 0.0.17 → 0.0.19

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/dist/index.cjs CHANGED
@@ -19,12 +19,12 @@ const zod = require("zod");
19
19
  const axios = require("axios");
20
20
  const _reduceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/reduce");
21
21
  const ora = require("ora");
22
+ const node_crypto = require("node:crypto");
22
23
  const WebSocket = require("ws");
23
24
  const http = require("node:http");
24
25
  const open = require("open");
25
26
  const uuid = require("uuid");
26
27
  const PKCEChallenge = require("pkce-challenge");
27
- const node_crypto = require("node:crypto");
28
28
  const promises = require("node:stream/promises");
29
29
  const node_os = require("node:os");
30
30
  const boxen = require("boxen");
@@ -410,7 +410,7 @@ const StoreJSONSchema = zod.z.object({
410
410
  backstage_manager: StoreBackstageManagerJSONSchema.optional()
411
411
  });
412
412
  const {
413
- ensureFile,
413
+ ensureFile: ensureFile$1,
414
414
  readJSON,
415
415
  writeJSON
416
416
  } = fse;
@@ -421,7 +421,7 @@ const storePath = node_path.join(storeDir, "config.json");
421
421
  const getStore = async () => {
422
422
  let json = {};
423
423
  try {
424
- await ensureFile(storePath);
424
+ await ensureFile$1(storePath);
425
425
  json = await readJSON(storePath, {
426
426
  encoding: "utf8"
427
427
  });
@@ -445,7 +445,7 @@ const getStore = async () => {
445
445
  };
446
446
  const setStore = async (store) => {
447
447
  try {
448
- await ensureFile(storePath);
448
+ await ensureFile$1(storePath);
449
449
  const version2 = `${getPackageJSON().version}`;
450
450
  const timestamp = Date.now();
451
451
  return await writeJSON(storePath, {
@@ -904,6 +904,74 @@ const normalize$b = async (options) => {
904
904
  clearStorage: (_options$clearStorage = options.clearStorage) !== null && _options$clearStorage !== void 0 ? _options$clearStorage : false
905
905
  };
906
906
  };
907
+ const pad2 = (value) => `${value}`.padStart(2, "0");
908
+ const formatLocalTimestamp = function() {
909
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
910
+ const year = date.getFullYear();
911
+ const month = pad2(date.getMonth() + 1);
912
+ const day = pad2(date.getDate());
913
+ const hour = pad2(date.getHours());
914
+ const minute = pad2(date.getMinutes());
915
+ const second = pad2(date.getSeconds());
916
+ return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
917
+ };
918
+ const formatLogFilename = function() {
919
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
920
+ const year = date.getFullYear();
921
+ const month = pad2(date.getMonth() + 1);
922
+ const day = pad2(date.getDate());
923
+ const hour = pad2(date.getHours());
924
+ const minute = pad2(date.getMinutes());
925
+ const second = pad2(date.getSeconds());
926
+ return `${year}${month}${day}-${hour}${minute}${second}.log`;
927
+ };
928
+ const getLogPath = function() {
929
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
930
+ return node_path.join(process$1.cwd(), ".ones", "logs", formatLogFilename(date));
931
+ };
932
+ const {
933
+ ensureDir,
934
+ ensureFile,
935
+ appendFile
936
+ } = fse;
937
+ const logPath = getLogPath();
938
+ let readyPromise = null;
939
+ let writeQueue = Promise.resolve();
940
+ const ensureReady = async () => {
941
+ if (!readyPromise) {
942
+ readyPromise = (async () => {
943
+ await ensureDir(node_path.dirname(logPath));
944
+ await ensureFile(logPath);
945
+ })().catch((error) => {
946
+ readyPromise = null;
947
+ throw error;
948
+ });
949
+ }
950
+ return readyPromise;
951
+ };
952
+ const enqueueWrite = (task) => {
953
+ const next = writeQueue.then(task, task);
954
+ writeQueue = next.then(() => void 0, () => void 0);
955
+ return next;
956
+ };
957
+ const log = {
958
+ path: logPath,
959
+ write: async (line) => {
960
+ return enqueueWrite(async () => {
961
+ await ensureReady();
962
+ await appendFile(logPath, `${line}
963
+ `, {
964
+ encoding: "utf8"
965
+ });
966
+ });
967
+ }
968
+ };
969
+ const createLogLine = (payload) => {
970
+ return JSON.stringify({
971
+ timestamp: formatLocalTimestamp(),
972
+ ...payload
973
+ });
974
+ };
907
975
  const getTunnelContext = async () => {
908
976
  var _appManifestJSON$app$, _appManifestJSON$app, _store$region_url, _store$ones_token$acc, _store$ones_token;
909
977
  const appManifestJSON = getAppManifestJSON();
@@ -983,6 +1051,11 @@ class TunnelClient {
983
1051
  });
984
1052
  this.ws.on("error", (error) => {
985
1053
  console.error("WebSocket error:", error);
1054
+ this.writeLog({
1055
+ level: "error",
1056
+ seq: node_crypto.randomUUID(),
1057
+ error: this.serializeError(error)
1058
+ });
986
1059
  });
987
1060
  return new Promise((resolve, reject) => {
988
1061
  var _this$ws2, _this$ws3;
@@ -1015,13 +1088,39 @@ class TunnelClient {
1015
1088
  return this.parseJSONEnvelope(buffer.toString());
1016
1089
  }
1017
1090
  async handleMessage(message) {
1091
+ var _request$query, _request$headers;
1018
1092
  const request = this.getRequestPayload(message);
1019
1093
  if (!request) {
1020
1094
  return;
1021
1095
  }
1096
+ const seq = node_crypto.randomUUID();
1097
+ const req = {
1098
+ app_id: this.appID,
1099
+ method: request.method,
1100
+ path: request.path,
1101
+ query: (_request$query = request.query) !== null && _request$query !== void 0 ? _request$query : null,
1102
+ headers: (_request$headers = request.headers) !== null && _request$headers !== void 0 ? _request$headers : null,
1103
+ body_length: this.getBodyLength(request.body)
1104
+ };
1105
+ await this.writeLog({
1106
+ level: "info",
1107
+ seq,
1108
+ req
1109
+ });
1022
1110
  if (this.enableInternalManifestRoute && request.path === ONES_CLI_INTERNAL_MANIFEST_PATH) {
1023
1111
  const appManifest = getAppManifestJSON().app;
1024
1112
  const baseURL = await buildTunnelUrl();
1113
+ const responseBody = {
1114
+ ...appManifest,
1115
+ base_url: baseURL
1116
+ };
1117
+ const res = {
1118
+ status: 200,
1119
+ headers: {
1120
+ "content-type": ["application/json"]
1121
+ },
1122
+ body_length: this.getBodyLength(responseBody)
1123
+ };
1025
1124
  const reply = {
1026
1125
  id: message.id,
1027
1126
  payload: {
@@ -1029,17 +1128,28 @@ class TunnelClient {
1029
1128
  headers: {
1030
1129
  "content-type": ["application/json"]
1031
1130
  },
1032
- body: {
1033
- ...appManifest,
1034
- base_url: baseURL
1035
- }
1131
+ body: responseBody
1036
1132
  }
1037
1133
  };
1134
+ await this.writeLog({
1135
+ level: "info",
1136
+ seq,
1137
+ res
1138
+ });
1038
1139
  this.sendBinaryEnvelope(reply);
1039
1140
  return;
1040
1141
  }
1041
1142
  try {
1042
1143
  const response = await this.forwardRequest(request);
1144
+ await this.writeLog({
1145
+ level: "info",
1146
+ seq,
1147
+ res: {
1148
+ status: response.status,
1149
+ headers: response.headers,
1150
+ body_length: this.getBodyLength(response.body)
1151
+ }
1152
+ });
1043
1153
  const reply = {
1044
1154
  id: message.id,
1045
1155
  payload: response
@@ -1048,6 +1158,12 @@ class TunnelClient {
1048
1158
  } catch (error) {
1049
1159
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
1050
1160
  console.error("Error forwarding request:", errorMessage);
1161
+ await this.writeLog({
1162
+ level: "error",
1163
+ seq,
1164
+ req,
1165
+ error: this.serializeError(error)
1166
+ });
1051
1167
  const reply = {
1052
1168
  id: message.id,
1053
1169
  payload: {
@@ -1203,6 +1319,44 @@ class TunnelClient {
1203
1319
  }
1204
1320
  return null;
1205
1321
  }
1322
+ getBodyLength(body) {
1323
+ if (body === void 0 || body === null) {
1324
+ return 0;
1325
+ }
1326
+ if (Buffer.isBuffer(body)) {
1327
+ return body.length;
1328
+ }
1329
+ if (body instanceof ArrayBuffer) {
1330
+ return body.byteLength;
1331
+ }
1332
+ if (ArrayBuffer.isView(body)) {
1333
+ return body.byteLength;
1334
+ }
1335
+ if (typeof body === "string") {
1336
+ return Buffer.byteLength(body, "utf8");
1337
+ }
1338
+ return Buffer.byteLength(JSON.stringify(body), "utf8");
1339
+ }
1340
+ serializeError(error) {
1341
+ if (error instanceof Error) {
1342
+ var _error$stack;
1343
+ return {
1344
+ name: error.name,
1345
+ message: error.message,
1346
+ stack: (_error$stack = error.stack) !== null && _error$stack !== void 0 ? _error$stack : ""
1347
+ };
1348
+ }
1349
+ return {
1350
+ message: String(error)
1351
+ };
1352
+ }
1353
+ async writeLog(payload) {
1354
+ try {
1355
+ await log.write(createLogLine(payload));
1356
+ } catch (error) {
1357
+ console.error("Write log failed:", error);
1358
+ }
1359
+ }
1206
1360
  }
1207
1361
  const invokeTunnel = async function(port) {
1208
1362
  var _options$rebuildWhenE, _options$enableIntern, _options$clearStorage, _hostedTokenResponse$, _appManifestJSON$ones, _appManifestJSON$ones2;
package/dist/index.js CHANGED
@@ -17,12 +17,12 @@ import { z } from "zod";
17
17
  import axios from "axios";
18
18
  import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
19
19
  import ora from "ora";
20
+ import { randomUUID, createHash } from "node:crypto";
20
21
  import WebSocket from "ws";
21
22
  import http from "node:http";
22
23
  import open from "open";
23
24
  import { v4 } from "uuid";
24
25
  import PKCEChallenge from "pkce-challenge";
25
- import { createHash } from "node:crypto";
26
26
  import { pipeline } from "node:stream/promises";
27
27
  import { homedir } from "node:os";
28
28
  import boxen from "boxen";
@@ -407,7 +407,7 @@ const StoreJSONSchema = z.object({
407
407
  backstage_manager: StoreBackstageManagerJSONSchema.optional()
408
408
  });
409
409
  const {
410
- ensureFile,
410
+ ensureFile: ensureFile$1,
411
411
  readJSON,
412
412
  writeJSON
413
413
  } = fse;
@@ -418,7 +418,7 @@ const storePath = join(storeDir, "config.json");
418
418
  const getStore = async () => {
419
419
  let json = {};
420
420
  try {
421
- await ensureFile(storePath);
421
+ await ensureFile$1(storePath);
422
422
  json = await readJSON(storePath, {
423
423
  encoding: "utf8"
424
424
  });
@@ -442,7 +442,7 @@ const getStore = async () => {
442
442
  };
443
443
  const setStore = async (store) => {
444
444
  try {
445
- await ensureFile(storePath);
445
+ await ensureFile$1(storePath);
446
446
  const version2 = `${getPackageJSON().version}`;
447
447
  const timestamp = Date.now();
448
448
  return await writeJSON(storePath, {
@@ -901,6 +901,74 @@ const normalize$b = async (options) => {
901
901
  clearStorage: (_options$clearStorage = options.clearStorage) !== null && _options$clearStorage !== void 0 ? _options$clearStorage : false
902
902
  };
903
903
  };
904
+ const pad2 = (value) => `${value}`.padStart(2, "0");
905
+ const formatLocalTimestamp = function() {
906
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
907
+ const year = date.getFullYear();
908
+ const month = pad2(date.getMonth() + 1);
909
+ const day = pad2(date.getDate());
910
+ const hour = pad2(date.getHours());
911
+ const minute = pad2(date.getMinutes());
912
+ const second = pad2(date.getSeconds());
913
+ return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
914
+ };
915
+ const formatLogFilename = function() {
916
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
917
+ const year = date.getFullYear();
918
+ const month = pad2(date.getMonth() + 1);
919
+ const day = pad2(date.getDate());
920
+ const hour = pad2(date.getHours());
921
+ const minute = pad2(date.getMinutes());
922
+ const second = pad2(date.getSeconds());
923
+ return `${year}${month}${day}-${hour}${minute}${second}.log`;
924
+ };
925
+ const getLogPath = function() {
926
+ let date = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Date();
927
+ return join(cwd(), ".ones", "logs", formatLogFilename(date));
928
+ };
929
+ const {
930
+ ensureDir,
931
+ ensureFile,
932
+ appendFile
933
+ } = fse;
934
+ const logPath = getLogPath();
935
+ let readyPromise = null;
936
+ let writeQueue = Promise.resolve();
937
+ const ensureReady = async () => {
938
+ if (!readyPromise) {
939
+ readyPromise = (async () => {
940
+ await ensureDir(dirname(logPath));
941
+ await ensureFile(logPath);
942
+ })().catch((error) => {
943
+ readyPromise = null;
944
+ throw error;
945
+ });
946
+ }
947
+ return readyPromise;
948
+ };
949
+ const enqueueWrite = (task) => {
950
+ const next = writeQueue.then(task, task);
951
+ writeQueue = next.then(() => void 0, () => void 0);
952
+ return next;
953
+ };
954
+ const log = {
955
+ path: logPath,
956
+ write: async (line) => {
957
+ return enqueueWrite(async () => {
958
+ await ensureReady();
959
+ await appendFile(logPath, `${line}
960
+ `, {
961
+ encoding: "utf8"
962
+ });
963
+ });
964
+ }
965
+ };
966
+ const createLogLine = (payload) => {
967
+ return JSON.stringify({
968
+ timestamp: formatLocalTimestamp(),
969
+ ...payload
970
+ });
971
+ };
904
972
  const getTunnelContext = async () => {
905
973
  var _appManifestJSON$app$, _appManifestJSON$app, _store$region_url, _store$ones_token$acc, _store$ones_token;
906
974
  const appManifestJSON = getAppManifestJSON();
@@ -980,6 +1048,11 @@ class TunnelClient {
980
1048
  });
981
1049
  this.ws.on("error", (error) => {
982
1050
  console.error("WebSocket error:", error);
1051
+ this.writeLog({
1052
+ level: "error",
1053
+ seq: randomUUID(),
1054
+ error: this.serializeError(error)
1055
+ });
983
1056
  });
984
1057
  return new Promise((resolve2, reject) => {
985
1058
  var _this$ws2, _this$ws3;
@@ -1012,13 +1085,39 @@ class TunnelClient {
1012
1085
  return this.parseJSONEnvelope(buffer.toString());
1013
1086
  }
1014
1087
  async handleMessage(message) {
1088
+ var _request$query, _request$headers;
1015
1089
  const request = this.getRequestPayload(message);
1016
1090
  if (!request) {
1017
1091
  return;
1018
1092
  }
1093
+ const seq = randomUUID();
1094
+ const req = {
1095
+ app_id: this.appID,
1096
+ method: request.method,
1097
+ path: request.path,
1098
+ query: (_request$query = request.query) !== null && _request$query !== void 0 ? _request$query : null,
1099
+ headers: (_request$headers = request.headers) !== null && _request$headers !== void 0 ? _request$headers : null,
1100
+ body_length: this.getBodyLength(request.body)
1101
+ };
1102
+ await this.writeLog({
1103
+ level: "info",
1104
+ seq,
1105
+ req
1106
+ });
1019
1107
  if (this.enableInternalManifestRoute && request.path === ONES_CLI_INTERNAL_MANIFEST_PATH) {
1020
1108
  const appManifest = getAppManifestJSON().app;
1021
1109
  const baseURL = await buildTunnelUrl();
1110
+ const responseBody = {
1111
+ ...appManifest,
1112
+ base_url: baseURL
1113
+ };
1114
+ const res = {
1115
+ status: 200,
1116
+ headers: {
1117
+ "content-type": ["application/json"]
1118
+ },
1119
+ body_length: this.getBodyLength(responseBody)
1120
+ };
1022
1121
  const reply = {
1023
1122
  id: message.id,
1024
1123
  payload: {
@@ -1026,17 +1125,28 @@ class TunnelClient {
1026
1125
  headers: {
1027
1126
  "content-type": ["application/json"]
1028
1127
  },
1029
- body: {
1030
- ...appManifest,
1031
- base_url: baseURL
1032
- }
1128
+ body: responseBody
1033
1129
  }
1034
1130
  };
1131
+ await this.writeLog({
1132
+ level: "info",
1133
+ seq,
1134
+ res
1135
+ });
1035
1136
  this.sendBinaryEnvelope(reply);
1036
1137
  return;
1037
1138
  }
1038
1139
  try {
1039
1140
  const response = await this.forwardRequest(request);
1141
+ await this.writeLog({
1142
+ level: "info",
1143
+ seq,
1144
+ res: {
1145
+ status: response.status,
1146
+ headers: response.headers,
1147
+ body_length: this.getBodyLength(response.body)
1148
+ }
1149
+ });
1040
1150
  const reply = {
1041
1151
  id: message.id,
1042
1152
  payload: response
@@ -1045,6 +1155,12 @@ class TunnelClient {
1045
1155
  } catch (error) {
1046
1156
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
1047
1157
  console.error("Error forwarding request:", errorMessage);
1158
+ await this.writeLog({
1159
+ level: "error",
1160
+ seq,
1161
+ req,
1162
+ error: this.serializeError(error)
1163
+ });
1048
1164
  const reply = {
1049
1165
  id: message.id,
1050
1166
  payload: {
@@ -1200,6 +1316,44 @@ class TunnelClient {
1200
1316
  }
1201
1317
  return null;
1202
1318
  }
1319
+ getBodyLength(body) {
1320
+ if (body === void 0 || body === null) {
1321
+ return 0;
1322
+ }
1323
+ if (Buffer.isBuffer(body)) {
1324
+ return body.length;
1325
+ }
1326
+ if (body instanceof ArrayBuffer) {
1327
+ return body.byteLength;
1328
+ }
1329
+ if (ArrayBuffer.isView(body)) {
1330
+ return body.byteLength;
1331
+ }
1332
+ if (typeof body === "string") {
1333
+ return Buffer.byteLength(body, "utf8");
1334
+ }
1335
+ return Buffer.byteLength(JSON.stringify(body), "utf8");
1336
+ }
1337
+ serializeError(error) {
1338
+ if (error instanceof Error) {
1339
+ var _error$stack;
1340
+ return {
1341
+ name: error.name,
1342
+ message: error.message,
1343
+ stack: (_error$stack = error.stack) !== null && _error$stack !== void 0 ? _error$stack : ""
1344
+ };
1345
+ }
1346
+ return {
1347
+ message: String(error)
1348
+ };
1349
+ }
1350
+ async writeLog(payload) {
1351
+ try {
1352
+ await log.write(createLogLine(payload));
1353
+ } catch (error) {
1354
+ console.error("Write log failed:", error);
1355
+ }
1356
+ }
1203
1357
  }
1204
1358
  const invokeTunnel = async function(port) {
1205
1359
  var _options$rebuildWhenE, _options$enableIntern, _options$clearStorage, _hostedTokenResponse$, _appManifestJSON$ones, _appManifestJSON$ones2;
@@ -21,5 +21,8 @@ export declare class TunnelClient {
21
21
  private parseBinaryEnvelope;
22
22
  private parseJSONEnvelope;
23
23
  private toBuffer;
24
+ private getBodyLength;
25
+ private serializeError;
26
+ private writeLog;
24
27
  }
25
28
  //# sourceMappingURL=tunnel-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-client.d.ts","sourceRoot":"","sources":["../../../../src/actions/tunnel/tunnel-client.ts"],"names":[],"mappings":"AAaA,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAyB;IACnC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,2BAA2B,CAAS;IAC5C,OAAO,CAAC,eAAe,CAAS;gBAG9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,2BAA2B,UAAO,EAClC,eAAe,UAAO;IAUlB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B9B,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;YAcN,aAAa;IA8C3B,OAAO,CAAC,iBAAiB;YAQX,cAAc;IAiC5B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,QAAQ;CAYjB"}
1
+ {"version":3,"file":"tunnel-client.d.ts","sourceRoot":"","sources":["../../../../src/actions/tunnel/tunnel-client.ts"],"names":[],"mappings":"AAeA,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAyB;IACnC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,2BAA2B,CAAS;IAC5C,OAAO,CAAC,eAAe,CAAS;gBAG9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,2BAA2B,UAAO,EAClC,eAAe,UAAO;IAUlB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoC9B,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,YAAY;YAcN,aAAa;IAwF3B,OAAO,CAAC,iBAAiB;YAQX,cAAc;IAiC5B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,mBAAmB;IAyB3B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,cAAc;YAaR,QAAQ;CAOvB"}
@@ -0,0 +1,6 @@
1
+ import type { LogSingleton } from './types';
2
+ export declare const log: LogSingleton;
3
+ export declare const createLogLine: (payload: Record<string, unknown>) => string;
4
+ export * from './types';
5
+ export * from './utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/log/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA8B3C,eAAO,MAAM,GAAG,EAAE,YAUjB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAK7D,CAAA;AAED,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,11 @@
1
+ export type LogLevel = 'info' | 'error';
2
+ export interface LogRecord {
3
+ timestamp: string;
4
+ level: LogLevel;
5
+ message: string;
6
+ }
7
+ export interface LogSingleton {
8
+ path: string;
9
+ write: (line: string) => Promise<void>;
10
+ }
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/log/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvC,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,QAAQ,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACvC"}
@@ -0,0 +1,4 @@
1
+ export declare const formatLocalTimestamp: (date?: Date) => string;
2
+ export declare const formatLogFilename: (date?: Date) => string;
3
+ export declare const getLogPath: (date?: Date) => string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/common/log/utils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,GAAI,WAAiB,WASrD,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,WAAiB,WASlD,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,WAAiB,WAE3C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-open/cli",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -53,7 +53,7 @@
53
53
  "devDependencies": {
54
54
  "@ones-op/node-logger": "^1.0.0",
55
55
  "@ones-op/node-types": "^1.0.0",
56
- "@ones-op/sdk": "1.70.20",
56
+ "@ones-op/sdk": "1.70.27",
57
57
  "@types/archiver": "^7.0.0",
58
58
  "@types/fs-extra": "^11.0.4",
59
59
  "@types/lodash-es": "^4.17.12"
@@ -67,7 +67,7 @@
67
67
  "chalk": "^5.0.1",
68
68
  "commander": "~9.4.0",
69
69
  "cosmiconfig": "^8.3.6",
70
- "create-ones-app": "0.0.17",
70
+ "create-ones-app": "0.0.19",
71
71
  "env-paths": "3.0.0",
72
72
  "execa": "^6.1.0",
73
73
  "fs-extra": "^11.3.0",
@@ -81,5 +81,5 @@
81
81
  "ws": "^8.18.3",
82
82
  "zod": "^3.22.2"
83
83
  },
84
- "gitHead": "05da48f013b94c94f94ce855d61da1ad8b2f22f8"
84
+ "gitHead": "2b9cff60c159b895b3047bf414e2da55708301a9"
85
85
  }
@@ -41,7 +41,7 @@
41
41
  "react-dom": "~17.0.2",
42
42
  "typescript": "~5.1.6",
43
43
  "yaml-eslint-parser": "^1.3.0",
44
- "@ones/cli-plugin": "1.70.20"
44
+ "@ones/cli-plugin": "1.70.27"
45
45
  },
46
46
  "dependencies": {
47
47
  "@ones-op/bridge": "^1.0.0",
@@ -61,9 +61,9 @@
61
61
  "@ones-op/node-utils": "^1.0.0",
62
62
  "@ones-op/router": "^1.0.0",
63
63
  "@ones-op/utils": "^1.0.0",
64
- "@ones-op/fetch": "1.70.20",
65
- "@ones-op/sdk": "1.70.20",
66
- "@ones-op/store": "1.70.20"
64
+ "@ones-op/fetch": "1.70.27",
65
+ "@ones-op/sdk": "1.70.27",
66
+ "@ones-op/store": "1.70.27"
67
67
  },
68
68
  "workspaces": [
69
69
  "web",