@skyramp/skyramp 1.3.23 → 1.3.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/skyramp",
3
- "version": "1.3.23",
3
+ "version": "1.3.24",
4
4
  "description": "module for leveraging skyramp cli functionality",
5
5
  "scripts": {
6
6
  "lint": "eslint 'src/**/*.js' 'src/**/*.ts' --fix",
@@ -22,4 +22,11 @@ export declare class ResponseV2 {
22
22
  */
23
23
  constructor(options?: ResponseV2Options);
24
24
  toYaml(): string;
25
+ toJson(): string;
26
+ /**
27
+ * Prints the response status in a formatted way with color coding.
28
+ * Uses the C library function PrintResponseV2Status for output.
29
+ * @param expectedStatusCode - The expected HTTP status code as a string (supports wildcards like "2xx", "20x")
30
+ */
31
+ print(expectedStatusCode: string): void;
25
32
  }
@@ -1,4 +1,8 @@
1
1
  const yaml = require('js-yaml');
2
+ const lib = require('../lib');
3
+
4
+ // C library function binding for PrintResponseV2Status
5
+ const printResponseV2Status = lib.func('PrintResponseV2Status', 'void', ['str', 'str']);
2
6
 
3
7
  /**
4
8
  * Represents a REST response.
@@ -95,6 +99,24 @@ class ResponseV2 {
95
99
  }, {});
96
100
  return JSON.stringify(jsonObject, null, 2);
97
101
  }
102
+
103
+ /**
104
+ * Prints the response status in a formatted way with color coding.
105
+ * Uses the C library function PrintResponseV2Status for output.
106
+ *
107
+ * @param {string} expectedStatusCode - The expected HTTP status code as a string (supports wildcards like "2xx", "20x")
108
+ */
109
+ print(expectedStatusCode) {
110
+ if (!expectedStatusCode || typeof expectedStatusCode !== 'string') {
111
+ throw new Error('Expected status code must be a non-empty string');
112
+ }
113
+
114
+ // Convert ResponseV2 to JSON
115
+ const responseJson = this.toJson();
116
+
117
+ // Call the C library function
118
+ printResponseV2Status(responseJson, expectedStatusCode);
119
+ }
98
120
  }
99
121
 
100
122
 
@@ -16,7 +16,7 @@ export interface ServiceApi {
16
16
  }
17
17
 
18
18
  export interface ServiceRuntimeDetails {
19
- serverStartCommand: string;
19
+ serverStartCommand?: string;
20
20
  runtime: "local" | "docker" | "k8s";
21
21
  dockerNetwork?: string;
22
22
  k8sNamespace?: string;
package/src/workspace.js CHANGED
@@ -41,7 +41,7 @@ const serviceSchema = z.object({
41
41
  .optional(),
42
42
  runtimeDetails: z
43
43
  .object({
44
- serverStartCommand: z.string(),
44
+ serverStartCommand: z.string().optional(),
45
45
  runtime: z.enum(['local', 'docker', 'k8s']),
46
46
  dockerNetwork: z.string().optional(),
47
47
  k8sNamespace: z.string().optional(),