@darco2903/cdn-api 1.1.0 → 1.1.2

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/dist/client.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare function createClient(origin: string): {
50
50
  } | undefined) => Promise<{
51
51
  status: 200;
52
52
  body: {
53
- type: "user" | "service" | "system";
53
+ type: "user" | "system" | "service";
54
54
  filename: string;
55
55
  active: boolean;
56
56
  visible: boolean;
@@ -115,7 +115,7 @@ export declare function createClient(origin: string): {
115
115
  }) => Promise<{
116
116
  status: 200;
117
117
  body: {
118
- type: "user" | "service" | "system";
118
+ type: "user" | "system" | "service";
119
119
  filename: string;
120
120
  active: boolean;
121
121
  visible: boolean;
package/dist/consts.d.ts CHANGED
@@ -2,4 +2,5 @@ import type { Algorithm } from "jsonwebtoken";
2
2
  export declare const API_VERSION = "v2";
3
3
  export declare const API_PATH_PREFIX = "/api/v2";
4
4
  export declare const JWT_ALGORITHM: Algorithm;
5
+ export declare const JWT_ALGORITHMS: Algorithm[];
5
6
  export declare const STORAGE_PUBLIC_ID_LENGTH = 8;
package/dist/consts.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const API_VERSION = "v2";
2
2
  export const API_PATH_PREFIX = `/api/${API_VERSION}`;
3
3
  export const JWT_ALGORITHM = "ES256";
4
+ export const JWT_ALGORITHMS = [JWT_ALGORITHM, "RS256"];
4
5
  export const STORAGE_PUBLIC_ID_LENGTH = 8;
@@ -55,7 +55,7 @@ declare const _default: {
55
55
  }>;
56
56
  responses: {
57
57
  200: import("zod").ZodType<{
58
- type: "user" | "service" | "system";
58
+ type: "user" | "system" | "service";
59
59
  filename: string;
60
60
  active: boolean;
61
61
  visible: boolean;
@@ -72,7 +72,7 @@ declare const _default: {
72
72
  }[];
73
73
  user_id: string | null;
74
74
  }[], import("zod").ZodTypeDef, {
75
- type: "user" | "service" | "system";
75
+ type: "user" | "system" | "service";
76
76
  filename: string;
77
77
  active: boolean;
78
78
  visible: boolean;
@@ -144,7 +144,7 @@ declare const _default: {
144
144
  }>;
145
145
  responses: {
146
146
  200: import("zod").ZodType<{
147
- type: "user" | "service" | "system";
147
+ type: "user" | "system" | "service";
148
148
  filename: string;
149
149
  active: boolean;
150
150
  visible: boolean;
@@ -161,7 +161,7 @@ declare const _default: {
161
161
  }[];
162
162
  user_id: string | null;
163
163
  }, import("zod").ZodTypeDef, {
164
- type: "user" | "service" | "system";
164
+ type: "user" | "system" | "service";
165
165
  filename: string;
166
166
  active: boolean;
167
167
  visible: boolean;
@@ -55,7 +55,7 @@ declare const _default: {
55
55
  }>;
56
56
  responses: {
57
57
  200: z.ZodType<{
58
- type: "user" | "service" | "system";
58
+ type: "user" | "system" | "service";
59
59
  filename: string;
60
60
  active: boolean;
61
61
  visible: boolean;
@@ -72,7 +72,7 @@ declare const _default: {
72
72
  }[];
73
73
  user_id: string | null;
74
74
  }[], z.ZodTypeDef, {
75
- type: "user" | "service" | "system";
75
+ type: "user" | "system" | "service";
76
76
  filename: string;
77
77
  active: boolean;
78
78
  visible: boolean;
@@ -12,7 +12,7 @@ declare const _default: {
12
12
  }>;
13
13
  responses: {
14
14
  200: z.ZodType<{
15
- type: "user" | "service" | "system";
15
+ type: "user" | "system" | "service";
16
16
  filename: string;
17
17
  active: boolean;
18
18
  visible: boolean;
@@ -29,7 +29,7 @@ declare const _default: {
29
29
  }[];
30
30
  user_id: string | null;
31
31
  }, z.ZodTypeDef, {
32
- type: "user" | "service" | "system";
32
+ type: "user" | "system" | "service";
33
33
  filename: string;
34
34
  active: boolean;
35
35
  visible: boolean;
package/dist/server.js CHANGED
@@ -2,10 +2,10 @@ export * from "./common.js";
2
2
  import jwt from "jsonwebtoken";
3
3
  import { ResultAsync } from "neverthrow";
4
4
  import { cdnAssetTokenDataDecodedSchema, } from "./common.js";
5
- import { JWT_ALGORITHM } from "./consts.js";
5
+ import { JWT_ALGORITHM, JWT_ALGORITHMS } from "./consts.js";
6
6
  export function JWTVerify(token, pubKey) {
7
7
  return ResultAsync.fromPromise(new Promise((resolve, reject) => {
8
- jwt.verify(token, pubKey, { algorithms: [JWT_ALGORITHM] }, (e, decoded) => {
8
+ jwt.verify(token, pubKey, { algorithms: JWT_ALGORITHMS }, (e, decoded) => {
9
9
  if (e) {
10
10
  reject({
11
11
  name: e.name,
@@ -60,7 +60,7 @@ export declare const recordSchema: z.ZodObject<{
60
60
  created_at: z.ZodDate;
61
61
  updated_at: z.ZodDate;
62
62
  }, "strip", z.ZodTypeAny, {
63
- type: "user" | "service" | "system";
63
+ type: "user" | "system" | "service";
64
64
  filename: string;
65
65
  active: boolean;
66
66
  visible: boolean;
@@ -77,7 +77,7 @@ export declare const recordSchema: z.ZodObject<{
77
77
  }[];
78
78
  user_id: string | null;
79
79
  }, {
80
- type: "user" | "service" | "system";
80
+ type: "user" | "system" | "service";
81
81
  filename: string;
82
82
  active: boolean;
83
83
  visible: boolean;
@@ -52,7 +52,7 @@ export default class Uploader {
52
52
  } | undefined) => Promise<{
53
53
  status: 200;
54
54
  body: {
55
- type: "user" | "service" | "system";
55
+ type: "user" | "system" | "service";
56
56
  filename: string;
57
57
  active: boolean;
58
58
  visible: boolean;
@@ -117,7 +117,7 @@ export default class Uploader {
117
117
  }) => Promise<{
118
118
  status: 200;
119
119
  body: {
120
- type: "user" | "service" | "system";
120
+ type: "user" | "system" | "service";
121
121
  filename: string;
122
122
  active: boolean;
123
123
  visible: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darco2903/cdn-api",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "./server": "./dist/server.js"
20
20
  },
21
21
  "dependencies": {
22
- "@darco2903/auth-api": "2.1.0",
22
+ "@darco2903/auth-api": "2.1.1",
23
23
  "@ts-rest/core": "^3.52.1",
24
24
  "@ts-rest/open-api": "^3.52.1",
25
25
  "axios": "^1.12.2",
@@ -1,25 +1,25 @@
1
- import fs from "fs";
2
- import { generateOpenApi } from "@ts-rest/open-api";
3
- import { contract } from "../src/";
4
-
5
- import { version } from "../package.json";
6
-
7
- console.log("Generating OpenAPI documentation...");
8
- console.log(`API version: ${version}`);
9
-
10
- const openApiDocument = generateOpenApi(contract, {
11
- info: {
12
- title: "CDN API",
13
- version,
14
- },
15
- servers: [
16
- {
17
- url: "https://cdn.darco2903.fr",
18
- },
19
- {
20
- url: "https://dev-cdn.darco2903.fr",
21
- },
22
- ],
23
- });
24
-
25
- fs.writeFileSync("openapi.json", JSON.stringify(openApiDocument, null, 2));
1
+ import fs from "fs";
2
+ import { generateOpenApi } from "@ts-rest/open-api";
3
+ import { contract } from "../src/";
4
+
5
+ import { version } from "../package.json";
6
+
7
+ console.log("Generating OpenAPI documentation...");
8
+ console.log(`API version: ${version}`);
9
+
10
+ const openApiDocument = generateOpenApi(contract, {
11
+ info: {
12
+ title: "CDN API",
13
+ version,
14
+ },
15
+ servers: [
16
+ {
17
+ url: "https://cdn.darco2903.fr",
18
+ },
19
+ {
20
+ url: "https://dev-cdn.darco2903.fr",
21
+ },
22
+ ],
23
+ });
24
+
25
+ fs.writeFileSync("openapi.json", JSON.stringify(openApiDocument, null, 2));