@furystack/rest-service 7.0.12 → 7.0.13

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 (120) hide show
  1. package/esm/actions/error-action.spec.d.ts +2 -0
  2. package/esm/actions/error-action.spec.d.ts.map +1 -0
  3. package/esm/actions/error-action.spec.js +47 -0
  4. package/esm/actions/error-action.spec.js.map +1 -0
  5. package/esm/actions/get-current-user.spec.d.ts +2 -0
  6. package/esm/actions/get-current-user.spec.d.ts.map +1 -0
  7. package/esm/actions/get-current-user.spec.js +19 -0
  8. package/esm/actions/get-current-user.spec.js.map +1 -0
  9. package/esm/actions/is-authenticated.spec.d.ts +2 -0
  10. package/esm/actions/is-authenticated.spec.d.ts.map +1 -0
  11. package/esm/actions/is-authenticated.spec.js +18 -0
  12. package/esm/actions/is-authenticated.spec.js.map +1 -0
  13. package/esm/actions/login-action.spec.d.ts +2 -0
  14. package/esm/actions/login-action.spec.d.ts.map +1 -0
  15. package/esm/actions/login-action.spec.js +34 -0
  16. package/esm/actions/login-action.spec.js.map +1 -0
  17. package/esm/actions/logout-action.spec.d.ts +2 -0
  18. package/esm/actions/logout-action.spec.d.ts.map +1 -0
  19. package/esm/actions/logout-action.spec.js +22 -0
  20. package/esm/actions/logout-action.spec.js.map +1 -0
  21. package/esm/actions/not-found-action.spec.d.ts +2 -0
  22. package/esm/actions/not-found-action.spec.d.ts.map +1 -0
  23. package/esm/actions/not-found-action.spec.js +16 -0
  24. package/esm/actions/not-found-action.spec.js.map +1 -0
  25. package/esm/add-cors-header.spec.d.ts +2 -0
  26. package/esm/add-cors-header.spec.d.ts.map +1 -0
  27. package/esm/add-cors-header.spec.js +98 -0
  28. package/esm/add-cors-header.spec.js.map +1 -0
  29. package/esm/authenticate.spec.d.ts +2 -0
  30. package/esm/authenticate.spec.d.ts.map +1 -0
  31. package/esm/authenticate.spec.js +58 -0
  32. package/esm/authenticate.spec.js.map +1 -0
  33. package/esm/authorize.spec.d.ts +2 -0
  34. package/esm/authorize.spec.d.ts.map +1 -0
  35. package/esm/authorize.spec.js +54 -0
  36. package/esm/authorize.spec.js.map +1 -0
  37. package/esm/endpoint-generators/create-delete-endpoint.spec.d.ts +2 -0
  38. package/esm/endpoint-generators/create-delete-endpoint.spec.d.ts.map +1 -0
  39. package/esm/endpoint-generators/create-delete-endpoint.spec.js +34 -0
  40. package/esm/endpoint-generators/create-delete-endpoint.spec.js.map +1 -0
  41. package/esm/endpoint-generators/create-get-collection-endpoint.spec.d.ts +2 -0
  42. package/esm/endpoint-generators/create-get-collection-endpoint.spec.d.ts.map +1 -0
  43. package/esm/endpoint-generators/create-get-collection-endpoint.spec.js +156 -0
  44. package/esm/endpoint-generators/create-get-collection-endpoint.spec.js.map +1 -0
  45. package/esm/endpoint-generators/create-get-entity-endpoint.spec.d.ts +2 -0
  46. package/esm/endpoint-generators/create-get-entity-endpoint.spec.d.ts.map +1 -0
  47. package/esm/endpoint-generators/create-get-entity-endpoint.spec.js +74 -0
  48. package/esm/endpoint-generators/create-get-entity-endpoint.spec.js.map +1 -0
  49. package/esm/endpoint-generators/create-patch-endpoint.spec.d.ts +2 -0
  50. package/esm/endpoint-generators/create-patch-endpoint.spec.d.ts.map +1 -0
  51. package/esm/endpoint-generators/create-patch-endpoint.spec.js +37 -0
  52. package/esm/endpoint-generators/create-patch-endpoint.spec.js.map +1 -0
  53. package/esm/endpoint-generators/create-post-endpoint.spec.d.ts +2 -0
  54. package/esm/endpoint-generators/create-post-endpoint.spec.d.ts.map +1 -0
  55. package/esm/endpoint-generators/create-post-endpoint.spec.js +35 -0
  56. package/esm/endpoint-generators/create-post-endpoint.spec.js.map +1 -0
  57. package/esm/helpers.spec.d.ts +2 -0
  58. package/esm/helpers.spec.d.ts.map +1 -0
  59. package/esm/helpers.spec.js +34 -0
  60. package/esm/helpers.spec.js.map +1 -0
  61. package/esm/http-user-context.spec.d.ts +3 -0
  62. package/esm/http-user-context.spec.d.ts.map +1 -0
  63. package/esm/http-user-context.spec.js +269 -0
  64. package/esm/http-user-context.spec.js.map +1 -0
  65. package/esm/incoming-message-extensions.spec.d.ts +2 -0
  66. package/esm/incoming-message-extensions.spec.d.ts.map +1 -0
  67. package/esm/incoming-message-extensions.spec.js +38 -0
  68. package/esm/incoming-message-extensions.spec.js.map +1 -0
  69. package/esm/mime-types.spec.d.ts +2 -0
  70. package/esm/mime-types.spec.d.ts.map +1 -0
  71. package/esm/mime-types.spec.js +14 -0
  72. package/esm/mime-types.spec.js.map +1 -0
  73. package/esm/rest-service.integration.spec.d.ts +2 -0
  74. package/esm/rest-service.integration.spec.d.ts.map +1 -0
  75. package/esm/rest-service.integration.spec.js +156 -0
  76. package/esm/rest-service.integration.spec.js.map +1 -0
  77. package/esm/rest.integration.test.d.ts +89 -0
  78. package/esm/rest.integration.test.d.ts.map +1 -0
  79. package/esm/rest.integration.test.js +154 -0
  80. package/esm/rest.integration.test.js.map +1 -0
  81. package/esm/schema-validator/schema-validator.test.d.ts +2 -0
  82. package/esm/schema-validator/schema-validator.test.d.ts.map +1 -0
  83. package/esm/schema-validator/schema-validator.test.js +61 -0
  84. package/esm/schema-validator/schema-validator.test.js.map +1 -0
  85. package/esm/server-response-extensions.spec.d.ts +2 -0
  86. package/esm/server-response-extensions.spec.d.ts.map +1 -0
  87. package/esm/server-response-extensions.spec.js +52 -0
  88. package/esm/server-response-extensions.spec.js.map +1 -0
  89. package/esm/static-server-manager.spec.d.ts +2 -0
  90. package/esm/static-server-manager.spec.d.ts.map +1 -0
  91. package/esm/static-server-manager.spec.js +216 -0
  92. package/esm/static-server-manager.spec.js.map +1 -0
  93. package/esm/validate.integration.spec.d.ts +2 -0
  94. package/esm/validate.integration.spec.d.ts.map +1 -0
  95. package/esm/validate.integration.spec.js +211 -0
  96. package/esm/validate.integration.spec.js.map +1 -0
  97. package/package.json +10 -10
  98. package/src/actions/error-action.spec.ts +1 -1
  99. package/src/actions/get-current-user.spec.ts +1 -1
  100. package/src/actions/is-authenticated.spec.ts +1 -1
  101. package/src/actions/login-action.spec.ts +2 -2
  102. package/src/actions/logout-action.spec.ts +2 -2
  103. package/src/actions/not-found-action.spec.ts +1 -1
  104. package/src/add-cors-header.spec.ts +1 -1
  105. package/src/authenticate.spec.ts +3 -3
  106. package/src/authorize.spec.ts +2 -2
  107. package/src/endpoint-generators/create-delete-endpoint.spec.ts +3 -3
  108. package/src/endpoint-generators/create-get-collection-endpoint.spec.ts +3 -3
  109. package/src/endpoint-generators/create-get-entity-endpoint.spec.ts +3 -3
  110. package/src/endpoint-generators/create-patch-endpoint.spec.ts +3 -3
  111. package/src/endpoint-generators/create-post-endpoint.spec.ts +3 -3
  112. package/src/helpers.spec.ts +4 -4
  113. package/src/http-user-context.spec.ts +3 -3
  114. package/src/mime-types.spec.ts +1 -1
  115. package/src/rest-service.integration.spec.ts +4 -4
  116. package/src/rest.integration.test.ts +2 -3
  117. package/src/schema-validator/schema-validator.test.ts +4 -4
  118. package/src/server-response-extensions.spec.ts +1 -1
  119. package/src/static-server-manager.spec.ts +2 -2
  120. package/src/validate.integration.spec.ts +4 -7
@@ -0,0 +1,154 @@
1
+ import { Injector } from '@furystack/inject';
2
+ import { createClient } from '@furystack/rest-client-fetch';
3
+ import { usingAsync } from '@furystack/utils';
4
+ import { JsonResult } from './request-action-implementation.js';
5
+ import { useRestService } from './helpers.js';
6
+ import { describe, it, expect } from 'vitest';
7
+ const createEchoApiServer = async () => {
8
+ const port = Math.round(Math.random() * 1000) + 10000;
9
+ const root = '/api';
10
+ const injector = new Injector();
11
+ await useRestService({
12
+ injector,
13
+ port,
14
+ root,
15
+ api: {
16
+ GET: {
17
+ '/plain': async () => JsonResult({}),
18
+ '/headers': async ({ headers }) => JsonResult({ headers }),
19
+ '/query': async ({ getQuery }) => JsonResult({ query: getQuery() }),
20
+ '/urlParams/:id': async ({ getUrlParams }) => JsonResult({ url: getUrlParams() }),
21
+ '/segment': async () => JsonResult({ name: 'segment' }),
22
+ '/segment/subsegment': async () => JsonResult({ name: 'segment-subsegment' }),
23
+ '/segment/:id/subsegment': async ({ getUrlParams }) => JsonResult({ url: { ...getUrlParams(), name: 'segment-subsegment' } }),
24
+ '/segment/:optionalId?/optionalSubsegment/': async ({ getUrlParams }) => JsonResult({ url: getUrlParams(), name: 'optional-id' }),
25
+ },
26
+ POST: {
27
+ '/body': async ({ getBody }) => JsonResult({ body: await getBody() }),
28
+ },
29
+ },
30
+ });
31
+ const client = createClient({
32
+ endpointUrl: `http://localhost:${port}/api`,
33
+ });
34
+ return {
35
+ dispose: injector.dispose.bind(injector),
36
+ root,
37
+ port,
38
+ client,
39
+ };
40
+ };
41
+ describe('REST Integration tests with FETCH client', () => {
42
+ it('Should execute a single parameterless GET query', async () => {
43
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
44
+ const result = await client({
45
+ method: 'GET',
46
+ action: '/plain',
47
+ });
48
+ expect(result.response.status).toBe(200);
49
+ expect(result.result).toEqual({});
50
+ });
51
+ });
52
+ it('Should execute a request with headers', async () => {
53
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
54
+ const value = 'value';
55
+ const result = await client({
56
+ method: 'GET',
57
+ action: '/headers',
58
+ headers: {
59
+ value,
60
+ },
61
+ });
62
+ expect(result.response.status).toBe(200);
63
+ expect(result.result.headers.value).toEqual(value);
64
+ });
65
+ });
66
+ it('Should execute a request with query', async () => {
67
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
68
+ const value = 'value2';
69
+ const result = await client({
70
+ method: 'GET',
71
+ action: '/query',
72
+ query: {
73
+ someObject: {
74
+ foo: value,
75
+ },
76
+ },
77
+ });
78
+ expect(result.response.status).toBe(200);
79
+ expect(result.result.query.someObject.foo).toEqual(value);
80
+ });
81
+ });
82
+ it('Should execute a request with URL parameters', async () => {
83
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
84
+ const value = 'value3';
85
+ const result = await client({
86
+ method: 'GET',
87
+ action: '/urlParams/:id',
88
+ url: {
89
+ id: value,
90
+ },
91
+ });
92
+ expect(result.response.status).toBe(200);
93
+ expect(result.result.url.id).toEqual(value);
94
+ });
95
+ });
96
+ it('should execute a request for a segment', async () => {
97
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
98
+ const result = await client({
99
+ method: 'GET',
100
+ action: '/segment',
101
+ });
102
+ expect(result.response.status).toBe(200);
103
+ expect(result.result.name).toEqual('segment');
104
+ });
105
+ });
106
+ it('should execute a request for a subsegment', async () => {
107
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
108
+ const result = await client({
109
+ method: 'GET',
110
+ action: '/segment/subsegment',
111
+ });
112
+ expect(result.response.status).toBe(200);
113
+ expect(result.result.name).toEqual('segment-subsegment');
114
+ });
115
+ });
116
+ it('should execute a request for a subsegment with URL parameters', async () => {
117
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
118
+ const value = 'value4';
119
+ const result = await client({
120
+ method: 'GET',
121
+ action: '/segment/:id/subsegment',
122
+ url: {
123
+ id: value,
124
+ },
125
+ });
126
+ expect(result.response.status).toBe(200);
127
+ expect(result.result.url.id).toEqual(value);
128
+ expect(result.result.url.name).toEqual('segment-subsegment');
129
+ });
130
+ });
131
+ it('should evaluate optional parameters in the URL', async () => {
132
+ await usingAsync(await createEchoApiServer(), async ({ client }) => {
133
+ const result = await client({
134
+ method: 'GET',
135
+ action: '/segment/:optionalId?/optionalSubsegment/',
136
+ url: {},
137
+ });
138
+ expect(result.response.status).toBe(200);
139
+ expect(result.result.url.optionalId).toBeUndefined();
140
+ expect(result.result.name).toEqual('optional-id');
141
+ const result2 = await client({
142
+ method: 'GET',
143
+ action: '/segment/:optionalId?/optionalSubsegment/',
144
+ url: {
145
+ optionalId: 'value',
146
+ },
147
+ });
148
+ expect(result2.response.status).toBe(200);
149
+ expect(result2.result.url.optionalId).toEqual('value');
150
+ expect(result2.result.name).toEqual('optional-id');
151
+ });
152
+ });
153
+ });
154
+ //# sourceMappingURL=rest.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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AAE;YACjE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;gBAC1B,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,2CAA2C;gBACnD,GAAG,EAAE,EAAE;aACR,CAAC,CAAA;YACF,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACxC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAA;YACpD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;YAEjD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC;gBAC3B,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,2CAA2C;gBACnD,GAAG,EAAE;oBACH,UAAU,EAAE,OAAO;iBACpB;aACF,CAAC,CAAA;YACF,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACzC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACtD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QACpD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=schema-validator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-validator.test.d.ts","sourceRoot":"","sources":["../../src/schema-validator/schema-validator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { SchemaValidator } from './schema-validator.js';
2
+ import { exampleSchema } from './validate-examples.js';
3
+ import { SchemaValidationError } from './schema-validation-error.js';
4
+ import { describe, it, expect } from 'vitest';
5
+ describe('ValidateSchema', () => {
6
+ describe('String Literal checks', () => {
7
+ it('Should pass on valid string literal parameters', () => {
8
+ expect(new SchemaValidator(exampleSchema).isValid('en', { schemaName: 'Language' })).toBeTruthy();
9
+ });
10
+ it('Should throw a ValidationError on Age parameters', () => {
11
+ try {
12
+ const result = new SchemaValidator(exampleSchema).isValid('foo', { schemaName: 'Language' });
13
+ expect(result).toBeFalsy(); // should not hit
14
+ }
15
+ catch (error) {
16
+ expect(error).toBeInstanceOf(SchemaValidationError);
17
+ const { errors } = error;
18
+ expect(errors).toHaveLength(1);
19
+ expect(errors[0].message).toEqual('must be equal to one of the allowed values');
20
+ }
21
+ });
22
+ });
23
+ describe('Object checks', () => {
24
+ it('Should fail when string is passed instead of object', () => {
25
+ try {
26
+ new SchemaValidator(exampleSchema).isValid('foo', { schemaName: 'BodyParameters' });
27
+ }
28
+ catch (error) {
29
+ expect(error).toBeInstanceOf(SchemaValidationError);
30
+ const { errors } = error;
31
+ expect(errors).toHaveLength(1);
32
+ expect(errors[0].message).toEqual('must be object');
33
+ }
34
+ });
35
+ it('Should fail when an additional property is present', () => {
36
+ try {
37
+ new SchemaValidator(exampleSchema).isValid({ age: '3', foo: 2 }, { schemaName: 'BodyParameters' });
38
+ }
39
+ catch (error) {
40
+ expect(error).toBeInstanceOf(SchemaValidationError);
41
+ const { errors } = error;
42
+ expect(errors).toHaveLength(1);
43
+ expect(errors[0].message).toEqual('must NOT have additional properties');
44
+ }
45
+ });
46
+ it('Should pass with empty objects', () => {
47
+ expect(new SchemaValidator(exampleSchema).isValid({}, { schemaName: 'BodyParameters' })).toBeTruthy();
48
+ });
49
+ it('Should pass with valid partial objects', () => {
50
+ expect(new SchemaValidator(exampleSchema).isValid({ age: '3' }, { schemaName: 'BodyParameters' })).toBeTruthy();
51
+ });
52
+ });
53
+ describe('Multiple checks per validator instance', () => {
54
+ it('Should pass with multiple types from schema per validator instance', () => {
55
+ const validator = new SchemaValidator(exampleSchema);
56
+ expect(validator.isValid('en', { schemaName: 'Language' })).toBeTruthy();
57
+ expect(new SchemaValidator(exampleSchema).isValid({}, { schemaName: 'BodyParameters' })).toBeTruthy();
58
+ });
59
+ });
60
+ });
61
+ //# sourceMappingURL=schema-validator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-validator.test.js","sourceRoot":"","sources":["../../src/schema-validator/schema-validator.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE7C,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACrC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,CAAC,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAW,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;QAC7G,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,IAAI;gBACF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAW,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAA;gBACtG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAA,CAAC,iBAAiB;aAC7C;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAA;gBACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAA8B,CAAA;gBACjD,MAAM,CAAC,MAAM,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,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAA;aACzE;QACH,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;YACxC,MAAM,CACJ,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAiB,EAAE,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CACjG,CAAC,UAAU,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,CACJ,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAiB,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAC3G,CAAC,UAAU,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACtD,EAAE,CAAC,oEAAoE,EAAE,GAAG,EAAE;YAC5E,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAA;YACpD,MAAM,CAAC,SAAS,CAAC,OAAO,CAAW,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAA;YAClF,MAAM,CACJ,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC,OAAO,CAAiB,EAAE,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CACjG,CAAC,UAAU,EAAE,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import './server-response-extensions';
2
+ //# sourceMappingURL=server-response-extensions.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-response-extensions.spec.d.ts","sourceRoot":"","sources":["../src/server-response-extensions.spec.ts"],"names":[],"mappings":"AAEA,OAAO,8BAA8B,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { Socket } from 'net';
2
+ import { IncomingMessage, ServerResponse } from 'http';
3
+ import './server-response-extensions';
4
+ import { BypassResult, JsonResult, PlainTextResult } from './request-action-implementation.js';
5
+ import { describe, it, expect, vi } from 'vitest';
6
+ describe('ServerResponse extensions', () => {
7
+ describe('sendActionResult', () => {
8
+ it('Should be extended', () => {
9
+ const socket = new Socket();
10
+ const msg = new ServerResponse(new IncomingMessage(socket));
11
+ expect(typeof msg.sendActionResult).toBe('function');
12
+ });
13
+ it('Should send the JSON response with the correct Content Type header and default status', async () => {
14
+ const jsonValue = { value: Math.random() };
15
+ const socket = new Socket();
16
+ const msg = new ServerResponse(new IncomingMessage(socket));
17
+ msg.writeHead = vi.fn();
18
+ await new Promise((done) => {
19
+ msg.end = ((chunk) => {
20
+ expect(chunk).toBe(JSON.stringify(jsonValue));
21
+ expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'application/json' });
22
+ done();
23
+ });
24
+ msg.sendActionResult(JsonResult(jsonValue));
25
+ });
26
+ });
27
+ it('Should send the plain TEXT response with the correct Content Type header and default status', async () => {
28
+ const textValue = `${Math.random()}`;
29
+ const socket = new Socket();
30
+ const msg = new ServerResponse(new IncomingMessage(socket));
31
+ await new Promise((done) => {
32
+ msg.writeHead = vi.fn();
33
+ msg.end = ((chunk) => {
34
+ expect(chunk).toBe(textValue);
35
+ expect(msg.writeHead).toBeCalledWith(200, { 'Content-Type': 'plain/text' });
36
+ done();
37
+ });
38
+ msg.sendActionResult(PlainTextResult(textValue));
39
+ });
40
+ });
41
+ it('Should skip sending on BypassResult', () => {
42
+ const socket = new Socket();
43
+ const msg = new ServerResponse(new IncomingMessage(socket));
44
+ msg.writeHead = vi.fn();
45
+ msg.end = vi.fn();
46
+ msg.sendActionResult(BypassResult());
47
+ expect(msg.writeHead).not.toBeCalled();
48
+ expect(msg.end).not.toBeCalled();
49
+ });
50
+ });
51
+ });
52
+ //# sourceMappingURL=server-response-extensions.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-response-extensions.spec.js","sourceRoot":"","sources":["../src/server-response-extensions.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AACtD,OAAO,8BAA8B,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAC9F,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;YAC3B,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3D,MAAM,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;YACrG,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAA;YAC1C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;YAC3B,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3D,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,EAAS,CAAA;YAC9B,MAAM,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,EAAE;gBAC/B,GAAG,CAAC,GAAG,G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qC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;YAC3B,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;YAC3D,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,EAAS,CAAA;YAC9B,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAS,CAAA;YAExB,GAAG,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAA;YACpC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;YACtC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=static-server-manager.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-server-manager.spec.d.ts","sourceRoot":"","sources":["../src/static-server-manager.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,216 @@
1
+ import { Injector } from '@furystack/inject';
2
+ import { sleepAsync, usingAsync } from '@furystack/utils';
3
+ import { ServerManager } from './server-manager.js';
4
+ import { StaticServerManager } from './static-server-manager.js';
5
+ import { describe, it, expect, vi } from 'vitest';
6
+ /**
7
+ * Generator for an incremental port number
8
+ * @param initialPort The initial port number
9
+ * @yields a port for testing
10
+ * @returns The Port number
11
+ */
12
+ function* portGenerator(initialPort = 1234) {
13
+ let port = initialPort;
14
+ while (true) {
15
+ yield port++;
16
+ }
17
+ return port;
18
+ }
19
+ const getPort = () => portGenerator().next().value;
20
+ describe('StaticServerManager', () => {
21
+ describe('Top level routing', () => {
22
+ it('Should return a 404 without fallback', async () => {
23
+ await usingAsync(new Injector(), async (injector) => {
24
+ const staticServerManager = injector.getInstance(StaticServerManager);
25
+ const port = getPort();
26
+ await staticServerManager.addStaticSite({
27
+ baseUrl: '/',
28
+ path: '.',
29
+ port,
30
+ });
31
+ const result = await fetch(`http://localhost:${port}/not-found.html`);
32
+ expect(result.ok).toBe(false);
33
+ expect(result.status).toBe(404);
34
+ expect(result?.headers.get('content-type')).toBe('text/plain');
35
+ const body = await result.text();
36
+ expect(body).toBe('Not found');
37
+ });
38
+ });
39
+ it('Should return a fallback', async () => {
40
+ await usingAsync(new Injector(), async (injector) => {
41
+ const staticServerManager = injector.getInstance(StaticServerManager);
42
+ const port = getPort();
43
+ await staticServerManager.addStaticSite({
44
+ baseUrl: '/',
45
+ path: '.',
46
+ fallback: 'package.json',
47
+ port,
48
+ headers: {
49
+ 'custom-header': 'custom-value',
50
+ },
51
+ });
52
+ const result = await fetch(`http://localhost:${port}/not-found.html`);
53
+ expect(result.headers.get('content-type')).toBe('application/json');
54
+ expect(result.headers.get('custom-header')).toBe('custom-value');
55
+ });
56
+ });
57
+ it('Should return a fallback for root files', async () => {
58
+ await usingAsync(new Injector(), async (injector) => {
59
+ const staticServerManager = injector.getInstance(StaticServerManager);
60
+ const port = getPort();
61
+ await staticServerManager.addStaticSite({
62
+ baseUrl: '/',
63
+ path: '.',
64
+ fallback: 'package.json',
65
+ port,
66
+ headers: {
67
+ 'custom-header': 'custom-value',
68
+ },
69
+ });
70
+ const result = await fetch(`http://localhost:${port}`);
71
+ expect(result.headers.get('content-type')).toBe('application/json');
72
+ expect(result.headers.get('custom-header')).toBe('custom-value');
73
+ });
74
+ });
75
+ it('Should return a defined file from a root directory', async () => {
76
+ await usingAsync(new Injector(), async (injector) => {
77
+ const staticServerManager = injector.getInstance(StaticServerManager);
78
+ const port = getPort();
79
+ await staticServerManager.addStaticSite({
80
+ baseUrl: '/',
81
+ path: '.',
82
+ port,
83
+ headers: {
84
+ 'custom-header': 'custom-value',
85
+ },
86
+ });
87
+ const result = await fetch(`http://localhost:${port}/README.md`);
88
+ expect(result.headers.get('content-type')).toBe('text/markdown');
89
+ expect(result.headers.get('custom-header')).toBe('custom-value');
90
+ });
91
+ });
92
+ it('Should return a defined file from a subdirectory', async () => {
93
+ await usingAsync(new Injector(), async (injector) => {
94
+ const staticServerManager = injector.getInstance(StaticServerManager);
95
+ const port = getPort();
96
+ await staticServerManager.addStaticSite({
97
+ baseUrl: '/',
98
+ path: '.',
99
+ port,
100
+ });
101
+ const result = await fetch(`http://localhost:${port}/packages/utils/README.md`);
102
+ expect(result.headers.get('content-type')).toBe('text/markdown');
103
+ });
104
+ });
105
+ });
106
+ describe('Non-top level routing', () => {
107
+ it('Should not handle a request when the path is not matching', async () => {
108
+ await usingAsync(new Injector(), async (injector) => {
109
+ const staticServerManager = injector.getInstance(StaticServerManager);
110
+ const port = getPort();
111
+ await staticServerManager.addStaticSite({
112
+ baseUrl: '/bundle',
113
+ path: '.',
114
+ port,
115
+ });
116
+ const server = [...injector.getInstance(ServerManager).servers.values()][0];
117
+ server.apis[0].onRequest = vi.fn();
118
+ fetch(`http://localhost:${port}/bundleToAnotherFolder/not-found.html`).catch(() => {
119
+ /** should fall, ignore */
120
+ });
121
+ await sleepAsync(100);
122
+ expect(server.apis[0].onRequest).not.toHaveBeenCalled();
123
+ });
124
+ });
125
+ it('Should return a 404 without fallback', async () => {
126
+ await usingAsync(new Injector(), async (injector) => {
127
+ const staticServerManager = injector.getInstance(StaticServerManager);
128
+ const port = getPort();
129
+ await staticServerManager.addStaticSite({
130
+ baseUrl: '/bundle',
131
+ path: '.',
132
+ port,
133
+ });
134
+ const result = await fetch(`http://localhost:${port}/bundle/not-found.html`);
135
+ expect(result.ok).toBe(false);
136
+ expect(result.status).toBe(404);
137
+ expect(result.headers.get('content-type')).toBe('text/plain');
138
+ const body = await result.text();
139
+ expect(body).toBe('Not found');
140
+ });
141
+ });
142
+ it('Should return a fallback', async () => {
143
+ await usingAsync(new Injector(), async (injector) => {
144
+ const staticServerManager = injector.getInstance(StaticServerManager);
145
+ const port = getPort();
146
+ await staticServerManager.addStaticSite({
147
+ baseUrl: '/bundle',
148
+ path: '.',
149
+ fallback: 'package.json',
150
+ port,
151
+ });
152
+ const result = await fetch(`http://localhost:${port}/bundle/not-found.html`);
153
+ expect(result.headers.get('content-type')).toBe('application/json');
154
+ });
155
+ });
156
+ it('Should return a defined file from a root directory', async () => {
157
+ await usingAsync(new Injector(), async (injector) => {
158
+ const staticServerManager = injector.getInstance(StaticServerManager);
159
+ const port = getPort();
160
+ await staticServerManager.addStaticSite({
161
+ baseUrl: '/',
162
+ path: '.',
163
+ port,
164
+ });
165
+ const result = await fetch(`http://localhost:${port}/README.md`);
166
+ expect(result.headers.get('content-type')).toBe('text/markdown');
167
+ });
168
+ });
169
+ it('Should return a defined file from a subdirectory', async () => {
170
+ await usingAsync(new Injector(), async (injector) => {
171
+ const staticServerManager = injector.getInstance(StaticServerManager);
172
+ const port = getPort();
173
+ await staticServerManager.addStaticSite({
174
+ baseUrl: '/',
175
+ path: '.',
176
+ port,
177
+ });
178
+ const result = await fetch(`http://localhost:${port}/packages/utils/README.md`);
179
+ expect(result.headers.get('content-type')).toBe('text/markdown');
180
+ });
181
+ });
182
+ });
183
+ describe('shouldExec', () => {
184
+ it('Should NOT match for requests with not defined method', () => {
185
+ const staticServerManager = new StaticServerManager();
186
+ expect(staticServerManager.shouldExec('/')({ req: { url: '/' } })).toBe(false);
187
+ });
188
+ it('Should NOT match for non-GET requests', () => {
189
+ const staticServerManager = new StaticServerManager();
190
+ expect(staticServerManager.shouldExec('/')({ req: { method: 'POST', url: '/' } })).toBe(false);
191
+ });
192
+ [
193
+ ['/', '/'],
194
+ ['/', '/index.html'],
195
+ ['/', '/subdir'],
196
+ ['/', '/subdir/'],
197
+ ['/', '/subdir/file.js'],
198
+ ['/subdir', '/subdir'],
199
+ ['/subdir', '/subdir/'],
200
+ ['/subdir', '/subdir/file.js'],
201
+ ['/subdir', '/subdir/s2/file.js'],
202
+ ].forEach(([root, url]) => it(`Should match for '${root}' root and '${url}' url`, () => {
203
+ const staticServerManager = new StaticServerManager();
204
+ const shouldExec = staticServerManager.shouldExec(root)({ req: { method: 'GET', url } });
205
+ expect(shouldExec).toBe(true);
206
+ }));
207
+ it('Should not exec different paths for non-top level root directory', () => {
208
+ const staticServerManager = new StaticServerManager();
209
+ expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/' } })).toBe(false);
210
+ expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/other/index.html' } })).toBe(false);
211
+ expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/subdir2' } })).toBe(false);
212
+ expect(staticServerManager.shouldExec('/subdir')({ req: { method: 'GET', url: '/subdir2/index.html' } })).toBe(false);
213
+ });
214
+ });
215
+ });
216
+ //# sourceMappingURL=static-server-manager.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-server-manager.spec.js","sourceRoot":"","sources":["../src/static-server-manager.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAEjD;;;;;GAKG;AACH,QAAQ,CAAC,CAAC,aAAa,CAAC,WAAW,GAAG,IAAI;IACxC,IAAI,IAAI,GAAG,WAAW,CAAA;IAEtB,OAAO,IAAI,EAAE;QACX,MAAM,IAAI,EAAE,CAAA;KACb;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;AAElD,QAAQ,CAAC,qBAAqB,EAAE,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EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC5G,KAAK,CACN,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=validate.integration.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.integration.spec.d.ts","sourceRoot":"","sources":["../src/validate.integration.spec.ts"],"names":[],"mappings":""}