@arkyn/server 1.4.50 → 1.4.51

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,8 +1,9 @@
1
1
  declare function created(body: any, init?: ResponseInit): Response;
2
- declare class Created {
3
- body: any;
2
+ declare class Created<T> {
3
+ body: T;
4
4
  init: ResponseInit;
5
- constructor(body: any, init?: ResponseInit);
5
+ constructor(body: T, init?: ResponseInit);
6
+ json(): Response;
6
7
  }
7
8
  export { created, Created };
8
9
  //# sourceMappingURL=created.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../src/httpResponses/created.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO;IACX,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY;CAI3C;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../src/httpResponses/created.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAKxC,IAAI,IAAI,QAAQ;CAOjB;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -12,5 +12,12 @@ class Created {
12
12
  this.body = body;
13
13
  this.init = init || {};
14
14
  }
15
+ json() {
16
+ return new Response(JSON.stringify(this.body), {
17
+ ...this.init,
18
+ status: 201,
19
+ headers: { "Content-Type": "application/json", ...this.init.headers },
20
+ });
21
+ }
15
22
  }
16
23
  export { created, Created };
@@ -2,6 +2,7 @@ declare function noContent(init?: ResponseInit): Response;
2
2
  declare class NoContent {
3
3
  init: ResponseInit;
4
4
  constructor(init?: ResponseInit);
5
+ json(): Response;
5
6
  }
6
7
  export { noContent, NoContent };
7
8
  //# sourceMappingURL=noContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../src/httpResponses/noContent.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMhD;AAED,cAAM,SAAS;IACb,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,CAAC,EAAE,YAAY;CAGhC;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../src/httpResponses/noContent.ts"],"names":[],"mappings":"AAAA,iBAAS,SAAS,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMhD;AAED,cAAM,SAAS;IACb,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,CAAC,EAAE,YAAY;IAI/B,IAAI,IAAI,QAAQ;CAOjB;AAED,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
@@ -10,5 +10,12 @@ class NoContent {
10
10
  constructor(init) {
11
11
  this.init = init || {};
12
12
  }
13
+ json() {
14
+ return new Response(null, {
15
+ ...this.init,
16
+ status: 200,
17
+ headers: { "Content-Type": "application/json", ...this.init.headers },
18
+ });
19
+ }
13
20
  }
14
21
  export { noContent, NoContent };
@@ -1,8 +1,9 @@
1
1
  declare function success(body: any, init?: ResponseInit): Response;
2
- declare class Success {
3
- body: any;
2
+ declare class Success<T> {
3
+ body: T;
4
4
  init: ResponseInit;
5
- constructor(body: any, init?: ResponseInit);
5
+ constructor(body: T, init?: ResponseInit);
6
+ json(): Response;
6
7
  }
7
8
  export { success, Success };
8
9
  //# sourceMappingURL=success.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../src/httpResponses/success.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO;IACX,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY;CAI3C;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../src/httpResponses/success.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAKxC,IAAI,IAAI,QAAQ;CAOjB;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -12,5 +12,12 @@ class Success {
12
12
  this.body = body;
13
13
  this.init = init || {};
14
14
  }
15
+ json() {
16
+ return new Response(JSON.stringify(this.body), {
17
+ ...this.init,
18
+ status: 200,
19
+ headers: { "Content-Type": "application/json", ...this.init.headers },
20
+ });
21
+ }
15
22
  }
16
23
  export { success, Success };
@@ -1,8 +1,9 @@
1
1
  declare function updated(body: any, init?: ResponseInit): Response;
2
- declare class Updated {
3
- body: any;
2
+ declare class Updated<T> {
3
+ body: T;
4
4
  init: ResponseInit;
5
- constructor(body: any, init?: ResponseInit);
5
+ constructor(body: T, init?: ResponseInit);
6
+ json(): Response;
6
7
  }
7
8
  export { updated, Updated };
8
9
  //# sourceMappingURL=updated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../src/httpResponses/updated.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO;IACX,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY;CAI3C;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../src/httpResponses/updated.ts"],"names":[],"mappings":"AAAA,iBAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,QAAQ,CAMzD;AAED,cAAM,OAAO,CAAC,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,YAAY,CAAC;gBAEP,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY;IAKxC,IAAI,IAAI,QAAQ;CAOjB;AAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -12,5 +12,12 @@ class Updated {
12
12
  this.body = body;
13
13
  this.init = init || {};
14
14
  }
15
+ json() {
16
+ return new Response(JSON.stringify(this.body), {
17
+ ...this.init,
18
+ status: 200,
19
+ headers: { "Content-Type": "application/json", ...this.init.headers },
20
+ });
21
+ }
15
22
  }
16
23
  export { updated, Updated };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/server",
3
- "version": "1.4.50",
3
+ "version": "1.4.51",
4
4
  "main": "./dist/bundle.js",
5
5
  "module": "./src/index.ts",
6
6
  "type": "module",
@@ -6,14 +6,22 @@ function created(body: any, init?: ResponseInit): Response {
6
6
  });
7
7
  }
8
8
 
9
- class Created {
10
- body: any;
9
+ class Created<T> {
10
+ body: T;
11
11
  init: ResponseInit;
12
12
 
13
- constructor(body: any, init?: ResponseInit) {
13
+ constructor(body: T, init?: ResponseInit) {
14
14
  this.body = body;
15
15
  this.init = init || {};
16
16
  }
17
+
18
+ json(): Response {
19
+ return new Response(JSON.stringify(this.body), {
20
+ ...this.init,
21
+ status: 201,
22
+ headers: { "Content-Type": "application/json", ...this.init.headers },
23
+ });
24
+ }
17
25
  }
18
26
 
19
27
  export { created, Created };
@@ -12,6 +12,14 @@ class NoContent {
12
12
  constructor(init?: ResponseInit) {
13
13
  this.init = init || {};
14
14
  }
15
+
16
+ json(): Response {
17
+ return new Response(null, {
18
+ ...this.init,
19
+ status: 200,
20
+ headers: { "Content-Type": "application/json", ...this.init.headers },
21
+ });
22
+ }
15
23
  }
16
24
 
17
25
  export { noContent, NoContent };
@@ -6,14 +6,22 @@ function success(body: any, init?: ResponseInit): Response {
6
6
  });
7
7
  }
8
8
 
9
- class Success {
10
- body: any;
9
+ class Success<T> {
10
+ body: T;
11
11
  init: ResponseInit;
12
12
 
13
- constructor(body: any, init?: ResponseInit) {
13
+ constructor(body: T, init?: ResponseInit) {
14
14
  this.body = body;
15
15
  this.init = init || {};
16
16
  }
17
+
18
+ json(): Response {
19
+ return new Response(JSON.stringify(this.body), {
20
+ ...this.init,
21
+ status: 200,
22
+ headers: { "Content-Type": "application/json", ...this.init.headers },
23
+ });
24
+ }
17
25
  }
18
26
 
19
27
  export { success, Success };
@@ -6,14 +6,22 @@ function updated(body: any, init?: ResponseInit): Response {
6
6
  });
7
7
  }
8
8
 
9
- class Updated {
10
- body: any;
9
+ class Updated<T> {
10
+ body: T;
11
11
  init: ResponseInit;
12
12
 
13
- constructor(body: any, init?: ResponseInit) {
13
+ constructor(body: T, init?: ResponseInit) {
14
14
  this.body = body;
15
15
  this.init = init || {};
16
16
  }
17
+
18
+ json(): Response {
19
+ return new Response(JSON.stringify(this.body), {
20
+ ...this.init,
21
+ status: 200,
22
+ headers: { "Content-Type": "application/json", ...this.init.headers },
23
+ });
24
+ }
17
25
  }
18
26
 
19
27
  export { updated, Updated };