@typespec/spector 0.1.0-alpha.9 → 0.1.0-dev.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +37 -0
  3. package/dist/generated-defs/TypeSpec.Spector.d.ts +4 -4
  4. package/dist/generated-defs/TypeSpec.Spector.d.ts.map +1 -1
  5. package/dist/generated-defs/TypeSpec.Spector.ts-test.js +6 -3
  6. package/dist/generated-defs/TypeSpec.Spector.ts-test.js.map +1 -1
  7. package/dist/src/actions/helper.d.ts +8 -15
  8. package/dist/src/actions/helper.d.ts.map +1 -1
  9. package/dist/src/actions/helper.js +61 -69
  10. package/dist/src/actions/helper.js.map +1 -1
  11. package/dist/src/actions/serve.d.ts.map +1 -1
  12. package/dist/src/actions/serve.js +0 -1
  13. package/dist/src/actions/serve.js.map +1 -1
  14. package/dist/src/actions/server-test.d.ts +3 -5
  15. package/dist/src/actions/server-test.d.ts.map +1 -1
  16. package/dist/src/actions/server-test.js +108 -132
  17. package/dist/src/actions/server-test.js.map +1 -1
  18. package/dist/src/actions/upload-scenario-manifest.d.ts +4 -3
  19. package/dist/src/actions/upload-scenario-manifest.d.ts.map +1 -1
  20. package/dist/src/actions/upload-scenario-manifest.js +20 -13
  21. package/dist/src/actions/upload-scenario-manifest.js.map +1 -1
  22. package/dist/src/actions/validate-mock-apis.js +1 -1
  23. package/dist/src/actions/validate-mock-apis.js.map +1 -1
  24. package/dist/src/app/app.d.ts +1 -0
  25. package/dist/src/app/app.d.ts.map +1 -1
  26. package/dist/src/app/app.js +48 -54
  27. package/dist/src/app/app.js.map +1 -1
  28. package/dist/src/app/request-processor.d.ts +2 -2
  29. package/dist/src/app/request-processor.d.ts.map +1 -1
  30. package/dist/src/app/request-processor.js +10 -6
  31. package/dist/src/app/request-processor.js.map +1 -1
  32. package/dist/src/cli/cli.js +20 -21
  33. package/dist/src/cli/cli.js.map +1 -1
  34. package/dist/src/config/config.js +2 -2
  35. package/dist/src/config/config.js.map +1 -1
  36. package/dist/src/coverage/coverage-tracker.d.ts.map +1 -1
  37. package/dist/src/coverage/coverage-tracker.js.map +1 -1
  38. package/dist/src/coverage/scenario-manifest.d.ts +3 -2
  39. package/dist/src/coverage/scenario-manifest.d.ts.map +1 -1
  40. package/dist/src/coverage/scenario-manifest.js +17 -5
  41. package/dist/src/coverage/scenario-manifest.js.map +1 -1
  42. package/dist/src/logger.d.ts +16 -2
  43. package/dist/src/logger.d.ts.map +1 -1
  44. package/dist/src/logger.js +27 -8
  45. package/dist/src/logger.js.map +1 -1
  46. package/dist/src/server/server.d.ts +1 -1
  47. package/dist/src/server/server.d.ts.map +1 -1
  48. package/dist/src/server/server.js +17 -4
  49. package/dist/src/server/server.js.map +1 -1
  50. package/dist/src/utils/misc-utils.d.ts +5 -3
  51. package/dist/src/utils/misc-utils.d.ts.map +1 -1
  52. package/dist/src/utils/misc-utils.js +1 -1
  53. package/dist/src/utils/misc-utils.js.map +1 -1
  54. package/generated-defs/TypeSpec.Spector.ts +4 -3
  55. package/generated-defs/TypeSpec.Spector.ts-test.ts +8 -3
  56. package/lib/main.tsp +1 -1
  57. package/package.json +25 -31
  58. package/src/actions/helper.ts +79 -95
  59. package/src/actions/serve.ts +0 -1
  60. package/src/actions/server-test.ts +132 -156
  61. package/src/actions/upload-scenario-manifest.ts +29 -18
  62. package/src/actions/validate-mock-apis.ts +1 -1
  63. package/src/app/app.ts +71 -72
  64. package/src/app/request-processor.ts +16 -4
  65. package/src/cli/cli.ts +21 -21
  66. package/src/config/config.ts +2 -2
  67. package/src/coverage/coverage-tracker.ts +2 -2
  68. package/src/coverage/scenario-manifest.ts +18 -8
  69. package/src/logger.ts +39 -8
  70. package/src/scenarios-resolver.ts +1 -1
  71. package/src/server/server.ts +20 -6
  72. package/src/utils/misc-utils.ts +6 -4
  73. package/temp/.tsbuildinfo +1 -1
  74. package/vitest.config.ts +11 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,132 @@
1
1
  # Change Log - @typespec/spector
2
2
 
3
+ ## 0.1.0-alpha.24
4
+
5
+ ### Bump dependencies
6
+
7
+ - [#9838](https://github.com/microsoft/typespec/pull/9838) Upgrade dependencies
8
+
9
+ ### Bug Fixes
10
+
11
+ - [#9752](https://github.com/microsoft/typespec/pull/9752) Update to how coverage manifest are managed. The manifest upload each individual one as a single file
12
+
13
+
14
+ ## 0.1.0-alpha.23
15
+
16
+ ### Bump dependencies
17
+
18
+ - [#9446](https://github.com/microsoft/typespec/pull/9446) Upgrade dependencies
19
+
20
+
21
+ ## 0.1.0-alpha.22
22
+
23
+ ### Bump dependencies
24
+
25
+ - [#9223](https://github.com/microsoft/typespec/pull/9223) Upgrade dependencies
26
+
27
+
28
+ ## 0.1.0-alpha.21
29
+
30
+ ### Bump dependencies
31
+
32
+ - [#9046](https://github.com/microsoft/typespec/pull/9046) Upgrade dependencies
33
+
34
+ ### Bug Fixes
35
+
36
+ - [#8985](https://github.com/microsoft/typespec/pull/8985) Add new `sourceUrl` handling for the go to source navigation
37
+ - [#9016](https://github.com/microsoft/typespec/pull/9016) Switch `js-yaml` to `yaml` library
38
+
39
+
40
+ ## 0.1.0-alpha.20
41
+
42
+ ### Features
43
+
44
+ - [#8938](https://github.com/microsoft/typespec/pull/8938) Resolve packageName and spec display name from spec set package.json
45
+
46
+ ### Bump dependencies
47
+
48
+ - [#8823](https://github.com/microsoft/typespec/pull/8823) Upgrade dependencies
49
+
50
+
51
+ ## 0.1.0-alpha.19
52
+
53
+ ### Bump dependencies
54
+
55
+ - [#8437](https://github.com/microsoft/typespec/pull/8437) Upgrade dependencies
56
+
57
+
58
+ ## 0.1.0-alpha.18
59
+
60
+ ### Bump dependencies
61
+
62
+ - [#8317](https://github.com/microsoft/typespec/pull/8317) Upgrade dependencies
63
+
64
+
65
+ ## 0.1.0-alpha.17
66
+
67
+ ### Bump dependencies
68
+
69
+ - [#7978](https://github.com/microsoft/typespec/pull/7978) Upgrade dependencies
70
+
71
+
72
+ ## 0.1.0-alpha.16
73
+
74
+ ### Bump dependencies
75
+
76
+ - [#7674](https://github.com/microsoft/typespec/pull/7674) Upgrade dependencies
77
+
78
+
79
+ ## 0.1.0-alpha.15
80
+
81
+ ### Bump dependencies
82
+
83
+ - [#7477](https://github.com/microsoft/typespec/pull/7477) Update multer dependency
84
+ - [#7323](https://github.com/microsoft/typespec/pull/7323) Upgrade dependencies
85
+
86
+
87
+ ## 0.1.0-alpha.14
88
+
89
+ ### Bug Fixes
90
+
91
+ - [#7270](https://github.com/microsoft/typespec/pull/7270) Fix specs using `dyn` when using port `0`
92
+
93
+
94
+ ## 0.1.0-alpha.13
95
+
96
+ ### Features
97
+
98
+ - [#7066](https://github.com/microsoft/typespec/pull/7066) Add dynamic value resolution in spector mock apis with a new `dyn` string template builder
99
+
100
+
101
+ ## 0.1.0-alpha.12
102
+
103
+ ### Features
104
+
105
+ - [#6926](https://github.com/microsoft/typespec/pull/6926) Upgrade to express v5
106
+
107
+
108
+ ## 0.1.0-alpha.10
109
+
110
+ No changes, version bump only.
111
+
112
+ ## 0.1.0-alpha.10
113
+
114
+ ### Features
115
+
116
+ - [#6565](https://github.com/microsoft/typespec/pull/6565) Make handling of request body and response body consistent
117
+ - [#6543](https://github.com/microsoft/typespec/pull/6543) Rename `server-test` command to `knock`
118
+
119
+ ### Bump dependencies
120
+
121
+ - [#6595](https://github.com/microsoft/typespec/pull/6595) Upgrade dependencies
122
+
123
+ ### Bug Fixes
124
+
125
+ - [#6527](https://github.com/microsoft/typespec/pull/6527) Don't throw for scenarios that expect error response
126
+ - [#6562](https://github.com/microsoft/typespec/pull/6562) Updates `tsp-spector knock` to exit with a failure if no scenarios are executed
127
+ - [#6543](https://github.com/microsoft/typespec/pull/6543) Add new `--filter` option to `knock` command
128
+
129
+
3
130
  ## 0.1.0-alpha.9
4
131
 
5
132
  ### Features
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Spector
2
+
3
+ Spector is a tool and typespec library used to describe spec for various protocols and running mock server and mock client based on these specs and some mock apis data.
4
+
5
+ ## Commands
6
+
7
+ ### `serve`
8
+
9
+ ```bash
10
+ tsp serve ./path/to/specs/
11
+ tsp serve ./path/to/specs/ --port 3000
12
+ ```
13
+
14
+ ### `server start` and `server stop`
15
+
16
+ Start the server and stop the server in a separate process.
17
+
18
+ ```bash
19
+ tsp server start ./path/to/specs/
20
+ ... run tests ...
21
+ tsp server stop
22
+ ```
23
+
24
+ ### `knock`
25
+
26
+ ```bash
27
+ tsp knock ./path/to/specs/
28
+ tsp knock ./path/to/specs/ --baseUrl http://localhost:3000
29
+ tsp knock ./path/to/specs/ --filter "payload/multipart/**/*"
30
+ ```
31
+
32
+ ### Options:
33
+
34
+ | Option | Description | Default |
35
+ | ----------- | ---------------------------------------- | ----------------------- |
36
+ | `--baseUrl` | Base url for the server | `http://localhost:3000` |
37
+ | `--filter` | Filters for which scenarios to run(glob) | |
@@ -1,19 +1,19 @@
1
- import type { DecoratorContext, Interface, Model, Namespace, Operation, Type } from "@typespec/compiler";
1
+ import type { DecoratorContext, DecoratorValidatorCallbacks, Interface, Model, Namespace, Operation, Type } from "@typespec/compiler";
2
2
  /**
3
3
  * Setup the boilerplate for a scenario service(server endpoint, etc.)
4
4
  */
5
- export type ScenarioServiceDecorator = (context: DecoratorContext, target: Namespace, route: string, options?: Type) => void;
5
+ export type ScenarioServiceDecorator = (context: DecoratorContext, target: Namespace, route: string, options?: Type) => DecoratorValidatorCallbacks | void;
6
6
  /**
7
7
  * Mark an operation, interface or namespace as a scenario. All containing operations will be part of the same scenario.
8
8
  */
9
- export type ScenarioDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, name?: string) => void;
9
+ export type ScenarioDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, name?: string) => DecoratorValidatorCallbacks | void;
10
10
  /**
11
11
  * Specify documentation on how to implement this scenario.
12
12
  *
13
13
  * @param doc Documentation
14
14
  * @param formatArgs Format arguments
15
15
  */
16
- export type ScenarioDocDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, doc: string, formatArgs?: Model) => void;
16
+ export type ScenarioDocDecorator = (context: DecoratorContext, target: Namespace | Interface | Operation, doc: string, formatArgs?: Model) => DecoratorValidatorCallbacks | void;
17
17
  export type TypeSpecSpectorDecorators = {
18
18
  scenarioService: ScenarioServiceDecorator;
19
19
  scenario: ScenarioDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeSpec.Spector.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,EACT,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,IAAI,KACX,IAAI,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,IAAI,CAAC,EAAE,MAAM,KACV,IAAI,CAAC;AAEV;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,KAAK,KACf,IAAI,CAAC;AAEV,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,WAAW,EAAE,oBAAoB,CAAC;CACnC,CAAC"}
1
+ {"version":3,"file":"TypeSpec.Spector.d.ts","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,EACT,IAAI,EACL,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,IAAI,KACX,2BAA2B,GAAG,IAAI,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,IAAI,CAAC,EAAE,MAAM,KACV,2BAA2B,GAAG,IAAI,CAAC;AAExC;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,EACzC,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,KAAK,KACf,2BAA2B,GAAG,IAAI,CAAC;AAExC,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,WAAW,EAAE,oBAAoB,CAAC;CACnC,CAAC"}
@@ -1,5 +1,8 @@
1
- /** An error here would mean that the decorator is not exported or doesn't have the right name. */
1
+ // An error in the imports would mean that the decorator is not exported or
2
+ // doesn't have the right name.
2
3
  import { $decorators } from "@typespec/spector";
3
- /** An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ... */
4
- const _ = $decorators["TypeSpec.Spector"];
4
+ /**
5
+ * An error here would mean that the exported decorator is not using the same signature. Make sure to have export const $decName: DecNameDecorator = (...) => ...
6
+ */
7
+ const _decs = $decorators["TypeSpec.Spector"];
5
8
  //# sourceMappingURL=TypeSpec.Spector.ts-test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypeSpec.Spector.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts-test.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qKAAqK;AACrK,MAAM,CAAC,GAA8B,WAAW,CAAC,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"TypeSpec.Spector.ts-test.js","sourceRoot":"","sources":["../../generated-defs/TypeSpec.Spector.ts-test.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+BAA+B;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;GAEG;AACH,MAAM,KAAK,GAA8B,WAAW,CAAC,kBAAkB,CAAC,CAAC"}
@@ -1,20 +1,13 @@
1
- import { HttpMethod, ServiceRequestFile } from "@typespec/spec-api";
2
- import { AxiosRequestConfig, AxiosResponse } from "axios";
1
+ import { HttpMethod, MockBody, MockMultipartBody, ResolverConfig } from "@typespec/spec-api";
3
2
  export interface ServiceRequest {
4
- endPoint: string;
5
- options?: {
6
- requestBody?: any;
7
- files?: ServiceRequestFile[];
8
- config?: AxiosRequestConfig<any> | undefined;
9
- };
3
+ method: HttpMethod;
4
+ url: string;
5
+ body?: MockBody | MockMultipartBody;
6
+ headers?: Record<string, unknown>;
7
+ query?: Record<string, unknown>;
8
+ pathParams?: Record<string, unknown>;
10
9
  }
11
- export declare function makeServiceCall(serviceCallType: HttpMethod, request: ServiceRequest): Promise<AxiosResponse<any, any>>;
12
- export declare function makePutCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
13
- export declare function makePostCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
14
- export declare function makeGetCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
15
- export declare function makePatchCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
16
- export declare function makeDeleteCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
17
- export declare function makeHeadCall(request: ServiceRequest): Promise<AxiosResponse<any, any>>;
10
+ export declare function makeServiceCall(request: ServiceRequest, config: ResolverConfig): Promise<Response>;
18
11
  type EncodingType = "utf-8" | "base64" | "base64url" | "hex";
19
12
  export declare function uint8ArrayToString(bytes: Uint8Array, format: EncodingType): string;
20
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,GAAG,CAAC;QAClB,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;QAC7B,MAAM,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;KAC9C,CAAC;CACH;AAmCD,wBAAsB,eAAe,CACnC,eAAe,EAAE,UAAU,EAC3B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAmBlC;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAO3F;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAO5F;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAG3F;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG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- import FormData from "form-data";
3
- function checkAndAddFormDataIfRequired(request) {
4
- if (request.options?.config?.headers?.["Content-Type"] === "multipart/form-data") {
5
- const formData = new FormData();
6
- if (request.options?.requestBody) {
7
- for (const key in request.options.requestBody) {
8
- formData.append(key, JSON.stringify(request.options.requestBody[key]));
9
- }
10
- }
11
- if (request.options.files) {
12
- request.options.files.forEach((file) => {
13
- formData.append(`${file.fieldname}`, file.buffer, {
14
- filename: file.originalname,
15
- contentType: file.mimetype,
16
- });
17
- });
1
+ import { expandDyns, } from "@typespec/spec-api";
2
+ function renderMultipartRequest(body) {
3
+ const formData = new FormData();
4
+ if (body.parts) {
5
+ for (const key in body.parts) {
6
+ formData.append(key, JSON.stringify(body.parts[key]));
18
7
  }
19
- request.options.requestBody = formData;
20
- request.options.config = {
21
- ...request.options.config,
22
- headers: formData.getHeaders(),
23
- };
24
8
  }
25
- }
26
- function checkAndUpdateEndpoint(request) {
27
- if (request.options?.config?.params) {
28
- for (const key in request.options.config.params) {
29
- request.endPoint = request.endPoint.replace(`:${key}`, request.options.config.params[key]);
30
- }
9
+ if (body.files) {
10
+ body.files.forEach((file) => {
11
+ formData.append(`${file.fieldname}`, new Blob([file.buffer], { type: file.mimetype }), file.originalname);
12
+ });
31
13
  }
32
- request.endPoint = request.endPoint.replace(/\[:\]/g, ":");
14
+ return formData;
33
15
  }
34
- export async function makeServiceCall(serviceCallType, request) {
35
- checkAndUpdateEndpoint(request);
36
- checkAndAddFormDataIfRequired(request);
37
- if (serviceCallType === "put") {
38
- return await makePutCall(request);
39
- }
40
- if (serviceCallType === "post") {
41
- return await makePostCall(request);
42
- }
43
- if (serviceCallType === "get") {
44
- return await makeGetCall(request);
45
- }
46
- if (serviceCallType === "delete") {
47
- return await makeDeleteCall(request);
16
+ function resolveUrl(request) {
17
+ let endpoint = request.url;
18
+ if (request.pathParams) {
19
+ for (const [key, value] of Object.entries(request.pathParams)) {
20
+ endpoint = endpoint.replaceAll(`:${key}`, String(value));
21
+ }
48
22
  }
49
- if (serviceCallType === "head") {
50
- return await makeHeadCall(request);
23
+ endpoint = endpoint.replaceAll("\\:", ":");
24
+ if (request.query) {
25
+ const query = new URLSearchParams();
26
+ for (const [key, value] of Object.entries(request.query)) {
27
+ if (Array.isArray(value)) {
28
+ for (const v of value) {
29
+ query.append(key, v);
30
+ }
31
+ }
32
+ else {
33
+ query.append(key, value);
34
+ }
35
+ }
36
+ endpoint = `${endpoint}?${query.toString()}`;
51
37
  }
52
- return await makePatchCall(request);
38
+ return endpoint;
53
39
  }
54
- export async function makePutCall(request) {
55
- const response = await axios.put(request.endPoint, request.options?.requestBody, request.options?.config);
56
- return response;
57
- }
58
- export async function makePostCall(request) {
59
- const response = await axios.post(request.endPoint, request.options?.requestBody, request.options?.config);
60
- return response;
61
- }
62
- export async function makeGetCall(request) {
63
- const response = await axios.get(request.endPoint, request.options?.config);
64
- return response;
65
- }
66
- export async function makePatchCall(request) {
67
- const response = await axios.patch(request.endPoint, request.options?.requestBody, request.options?.config);
68
- return response;
69
- }
70
- export async function makeDeleteCall(request) {
71
- const response = await axios.delete(request.endPoint, request.options?.config);
72
- return response;
73
- }
74
- export async function makeHeadCall(request) {
75
- const response = await axios.head(request.endPoint, request.options?.config);
76
- return response;
40
+ export async function makeServiceCall(request, config) {
41
+ const url = resolveUrl(request);
42
+ let body;
43
+ let headers = expandDyns(request.headers, config);
44
+ if (request.body) {
45
+ if ("kind" in request.body) {
46
+ const formData = renderMultipartRequest(request.body);
47
+ body = formData;
48
+ }
49
+ else {
50
+ if (typeof request.body.rawContent === "string" || Buffer.isBuffer(request.body.rawContent)) {
51
+ body = request.body.rawContent;
52
+ }
53
+ else {
54
+ body = request.body.rawContent?.serialize(config);
55
+ }
56
+ headers = {
57
+ ...headers,
58
+ ...(request.body?.contentType && {
59
+ "Content-Type": request.body.contentType,
60
+ }),
61
+ };
62
+ }
63
+ }
64
+ return await fetch(url, {
65
+ method: request.method.toUpperCase(),
66
+ body,
67
+ headers,
68
+ });
77
69
  }
78
70
  export function uint8ArrayToString(bytes, format) {
79
71
  return Buffer.from(bytes).toString(format);
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../src/actions/helper.ts"],"names":[],"mappings":"AACA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,QAAQ,MAAM,WAAW,CAAC;AAWjC,SAAS,6BAA6B,CAAC,OAAuB;IAC5D,IAAI,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,cAAc,CAAC,KAAK,qBAAqB,EAAE,CAAC;QACjF,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC;YACjC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC9C,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC1B,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE;oBAChD,QAAQ,EAAE,IAAI,CAAC,YAAY;oBAC3B,WAAW,EAAE,IAAI,CAAC,QAAQ;iBAC3B,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC;QACvC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG;YACvB,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM;YACzB,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE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E,MAAM,CAAC;CACd;AAED,wBAAsB,KAAK,CAAC,MAAM,EAAE,WAAW,iBAgB9C;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,iBAmC1D;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,iBAc5C"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,KAAK,CAAC,MAAM,EAAE,WAAW,iBAgB9C;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,iBAmC1D;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,iBAc5C"}
@@ -1,5 +1,4 @@
1
1
  import { spawn } from "child_process";
2
- import fetch from "node-fetch";
3
2
  import { resolve } from "path";
4
3
  import { MockApiApp } from "../app/app.js";
5
4
  import { AdminUrls } from "../constants.js";
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/actions/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAY9D,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAmB;IAC7C,IAAI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I,EAAE,EAAE;YAC9D,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,mCAAmC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IACjE,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,12 +1,10 @@
1
1
  export interface ServerTestDiagnostics {
2
- scenario_name: string;
3
- status: "success" | "failure";
4
- message: any;
2
+ scenarioName: string;
3
+ message: string;
5
4
  }
6
5
  export interface ServerTestOptions {
7
6
  baseUrl?: string;
8
- runSingleScenario?: string;
9
- runScenariosFromFile?: string;
7
+ filter?: string;
10
8
  }
11
9
  export declare function serverTest(scenariosPath: string, options?: ServerTestOptions): Promise<void>;
12
10
  //# sourceMappingURL=server-test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-test.d.ts","sourceRoot":"","sources":["../../../src/actions/server-test.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,GAAG,CAAC;CACd;AAwID,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAuBD,wBAAsB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,iBA6DtF"}
1
+ {"version":3,"file":"server-test.d.ts","sourceRoot":"","sources":["../../../src/actions/server-test.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAwFD,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAuBD,wBAAsB,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,iBA2EtF"}