qualityapi 0.0.1

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.
@@ -0,0 +1,20 @@
1
+ import Response from "./QualityApiResponse.ts";
2
+ import Body from "./QualityApiBody.ts";
3
+ import EndpointBuilder from "./QualityApiEndpointBuilder.ts";
4
+ declare namespace QualityApi {
5
+ function builder(): EndpointBuilder<boolean>;
6
+ namespace Responses {
7
+ function ok<Json extends Body = any>(json?: Json): void;
8
+ function created<Json extends Body = any>(json?: Json): void;
9
+ function noContent(): void;
10
+ function badRequest<Json extends Body = any>(json?: Json): void;
11
+ function unauthorized<Json extends Body = any>(json?: Json): void;
12
+ function forbidden<Json extends Body = any>(json?: Json): void;
13
+ function notFound<Json extends Body = any>(json?: Json): void;
14
+ function conflict<Json extends Body = any>(json?: Json): void;
15
+ function internalServerError<Json extends Body = any>(json: Json): void;
16
+ function _<Json extends Body>(status: number, json?: Json): Response<Json>;
17
+ }
18
+ }
19
+ export default QualityApi;
20
+ //# sourceMappingURL=QualityApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApi.d.ts","sourceRoot":"","sources":["../src/QualityApi.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAE7D,kBAAU,UAAU,CAAC;IAEjB,SAAgB,OAAO,6BAEtB;IAED,UAAiB,SAAS,CAAC;QAIvB,SAAgB,EAAE,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAEtD;QAED,SAAgB,OAAO,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAE3D;QAED,SAAgB,SAAS,SAExB;QAKD,SAAgB,UAAU,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAE9D;QAED,SAAgB,YAAY,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAEhE;QAED,SAAgB,SAAS,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAE7D;QAED,SAAgB,QAAQ,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAE5D;QAED,SAAgB,QAAQ,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,QAE5D;QAKD,SAAgB,mBAAmB,CAAC,IAAI,SAAS,IAAI,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,QAEtE;QAKD,SAAgB,CAAC,CAAC,IAAI,SAAS,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,kBAE/D;KAEJ;CAEJ;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,58 @@
1
+ import Response from "./QualityApiResponse.ts";
2
+ import EndpointBuilder from "./QualityApiEndpointBuilder.ts";
3
+ var QualityApi;
4
+ (function (QualityApi) {
5
+ function builder() {
6
+ return new EndpointBuilder();
7
+ }
8
+ QualityApi.builder = builder;
9
+ let Responses;
10
+ (function (Responses) {
11
+ // 2xx (Success)
12
+ function ok(json) {
13
+ _(200, json);
14
+ }
15
+ Responses.ok = ok;
16
+ function created(json) {
17
+ _(201, json);
18
+ }
19
+ Responses.created = created;
20
+ function noContent() {
21
+ _(204);
22
+ }
23
+ Responses.noContent = noContent;
24
+ // 4xx (Client error)
25
+ function badRequest(json) {
26
+ _(400, json);
27
+ }
28
+ Responses.badRequest = badRequest;
29
+ function unauthorized(json) {
30
+ _(401, json);
31
+ }
32
+ Responses.unauthorized = unauthorized;
33
+ function forbidden(json) {
34
+ _(403, json);
35
+ }
36
+ Responses.forbidden = forbidden;
37
+ function notFound(json) {
38
+ _(404, json);
39
+ }
40
+ Responses.notFound = notFound;
41
+ function conflict(json) {
42
+ _(409, json);
43
+ }
44
+ Responses.conflict = conflict;
45
+ // 5xx (Server error)
46
+ function internalServerError(json) {
47
+ _(500, json);
48
+ }
49
+ Responses.internalServerError = internalServerError;
50
+ // Other
51
+ function _(status, json) {
52
+ return new Response(status, json);
53
+ }
54
+ Responses._ = _;
55
+ })(Responses = QualityApi.Responses || (QualityApi.Responses = {}));
56
+ })(QualityApi || (QualityApi = {}));
57
+ export default QualityApi;
58
+ //# sourceMappingURL=QualityApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApi.js","sourceRoot":"","sources":["../src/QualityApi.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAE/C,OAAO,eAAe,MAAM,gCAAgC,CAAC;AAE7D,IAAU,UAAU,CA6DnB;AA7DD,WAAU,UAAU;IAEhB,SAAgB,OAAO;QACnB,OAAO,IAAI,eAAe,EAAE,CAAC;IACjC,CAAC;IAFe,kBAAO,UAEtB,CAAA;IAED,IAAiB,SAAS,CAqDzB;IArDD,WAAiB,SAAS;QAEtB,gBAAgB;QAEhB,SAAgB,EAAE,CAA0B,IAAW;YACnD,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,YAAE,KAEjB,CAAA;QAED,SAAgB,OAAO,CAA0B,IAAW;YACxD,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,iBAAO,UAEtB,CAAA;QAED,SAAgB,SAAS;YACrB,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,CAAC;QAFe,mBAAS,YAExB,CAAA;QAGD,qBAAqB;QAErB,SAAgB,UAAU,CAA0B,IAAW;YAC3D,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,oBAAU,aAEzB,CAAA;QAED,SAAgB,YAAY,CAA0B,IAAW;YAC7D,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,sBAAY,eAE3B,CAAA;QAED,SAAgB,SAAS,CAA0B,IAAW;YAC1D,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,mBAAS,YAExB,CAAA;QAED,SAAgB,QAAQ,CAA0B,IAAW;YACzD,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,kBAAQ,WAEvB,CAAA;QAED,SAAgB,QAAQ,CAA0B,IAAW;YACzD,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,kBAAQ,WAEvB,CAAA;QAGD,qBAAqB;QAErB,SAAgB,mBAAmB,CAA0B,IAAU;YACnE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjB,CAAC;QAFe,6BAAmB,sBAElC,CAAA;QAGD,QAAQ;QAER,SAAgB,CAAC,CAAoB,MAAc,EAAE,IAAW;YAC5D,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QAFe,WAAC,IAEhB,CAAA;IAEL,CAAC,EArDgB,SAAS,GAAT,oBAAS,KAAT,oBAAS,QAqDzB;AAEL,CAAC,EA7DS,UAAU,KAAV,UAAU,QA6DnB;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ type QualityApiBody = {} | [
2
+ ];
3
+ export default QualityApiBody;
4
+ //# sourceMappingURL=QualityApiBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiBody.d.ts","sourceRoot":"","sources":["../src/QualityApiBody.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GACf,EAAE,GACF;CAAE,CAAC;AAEP,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QualityApiBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiBody.js","sourceRoot":"","sources":["../src/QualityApiBody.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import Middleware from "./QualityApiMiddleware.ts";
2
+ declare class QualityApiEndpointBuilder<Authorized extends boolean> {
3
+ private middlewares;
4
+ middleware(fn: Middleware<Authorized>): this;
5
+ authorize(): QualityApiEndpointBuilder<true>;
6
+ }
7
+ export default QualityApiEndpointBuilder;
8
+ //# sourceMappingURL=QualityApiEndpointBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiEndpointBuilder.d.ts","sourceRoot":"","sources":["../src/QualityApiEndpointBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,cAAM,yBAAyB,CAC3B,UAAU,SAAS,OAAO;IAG1B,OAAO,CAAC,WAAW,CAAyB;IAErC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC;IAMrC,SAAS,IAGG,yBAAyB,CAAC,IAAI,CAAC;CAGrD;AAED,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,13 @@
1
+ class QualityApiEndpointBuilder {
2
+ middlewares = [];
3
+ middleware(fn) {
4
+ this.middlewares.push(fn);
5
+ return this;
6
+ }
7
+ authorize() {
8
+ this.middlewares.push(() => { });
9
+ return this;
10
+ }
11
+ }
12
+ export default QualityApiEndpointBuilder;
13
+ //# sourceMappingURL=QualityApiEndpointBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiEndpointBuilder.js","sourceRoot":"","sources":["../src/QualityApiEndpointBuilder.ts"],"names":[],"mappings":"AAEA,MAAM,yBAAyB;IAInB,WAAW,GAAsB,EAAE,CAAC;IAErC,UAAU,CAAC,EAA0B;QACxC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,SAAS;QACZ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAEhC,OAAO,IAAuC,CAAC;IACnD,CAAC;CAEJ;AAED,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import QualityApiResponse from "./QualityApiResponse.ts";
2
+ import QualityApiRequest from "./QualityApiRequest.ts";
3
+ type QualityApiMiddleware<Authorized extends boolean> = (data: QualityApiRequest<Authorized>) => QualityApiResponse<any> | void;
4
+ export default QualityApiMiddleware;
5
+ //# sourceMappingURL=QualityApiMiddleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiMiddleware.d.ts","sourceRoot":"","sources":["../src/QualityApiMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,KAAK,oBAAoB,CAAC,UAAU,SAAS,OAAO,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,kBAAkB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAEhI,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QualityApiMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiMiddleware.js","sourceRoot":"","sources":["../src/QualityApiMiddleware.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import type { User, Profile } from "next-auth";
2
+ import type { NextApiRequest } from "next";
3
+ type QualityApiRequest<Authorized extends boolean> = {
4
+ user: Authorized extends true ? User : (User | null);
5
+ profile: Authorized extends true ? Profile : (Profile | null);
6
+ _request: NextApiRequest;
7
+ };
8
+ export default QualityApiRequest;
9
+ //# sourceMappingURL=QualityApiRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiRequest.d.ts","sourceRoot":"","sources":["../src/QualityApiRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C,KAAK,iBAAiB,CAClB,UAAU,SAAS,OAAO,IAC1B;IACA,IAAI,EAAE,UAAU,SAAS,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACrD,OAAO,EAAE,UAAU,SAAS,IAAI,GAAG,OAAO,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC9D,QAAQ,EAAE,cAAc,CAAA;CAC3B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=QualityApiRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiRequest.js","sourceRoot":"","sources":["../src/QualityApiRequest.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import QualityApiBody from "./QualityApiBody.ts";
2
+ declare class QualityApiResponse<Body extends QualityApiBody> {
3
+ readonly status: number;
4
+ readonly body: Body | undefined;
5
+ constructor(_status: number, _body?: Body);
6
+ }
7
+ export default QualityApiResponse;
8
+ //# sourceMappingURL=QualityApiResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiResponse.d.ts","sourceRoot":"","sources":["../src/QualityApiResponse.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,cAAM,kBAAkB,CAAC,IAAI,SAAS,cAAc;IAEhD,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;gBAE3B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI;CAK5C;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ class QualityApiResponse {
2
+ status;
3
+ body;
4
+ constructor(_status, _body) {
5
+ this.status = _status;
6
+ this.body = _body;
7
+ }
8
+ }
9
+ export default QualityApiResponse;
10
+ //# sourceMappingURL=QualityApiResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QualityApiResponse.js","sourceRoot":"","sources":["../src/QualityApiResponse.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB;IAEJ,MAAM,CAAS;IACf,IAAI,CAAmB;IAEvC,YAAY,OAAe,EAAE,KAAY;QACrC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACtB,CAAC;CAEJ;AAED,eAAe,kBAAkB,CAAC"}
package/dist/main.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import QualityApi from "./QualityApi.ts";
2
+ export default QualityApi;
3
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,eAAe,UAAU,CAAC"}
package/dist/main.js ADDED
@@ -0,0 +1,3 @@
1
+ import QualityApi from "./QualityApi.ts";
2
+ export default QualityApi;
3
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,eAAe,UAAU,CAAC"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "qualityapi",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "license": "ISC",
6
+ "author": "",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "prepublishOnly": "npm run build"
12
+ },
13
+ "dependencies": {
14
+ "next": "^16.1.6",
15
+ "next-auth": "^4.24.13",
16
+ "zod": "^4.3.6"
17
+ },
18
+ "devDependencies": {
19
+ "@types/next": "^8.0.7",
20
+ "@types/next-auth": "^3.15.0",
21
+ "@types/node": "^25.1.0",
22
+ "ts-node": "^10.9.2",
23
+ "typescript": "^5.9.3"
24
+ },
25
+ "repository": {
26
+ "url": "https://github.com/LarsSK06/qualityapi",
27
+ "type": "git"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ]
32
+ }