dn-react-router-toolkit 0.1.1 → 0.1.3

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 (284) hide show
  1. package/dist/auth-kit/apple_auth.d.mts +24 -0
  2. package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
  3. package/dist/auth-kit/apple_auth.js +75 -0
  4. package/dist/auth-kit/apple_auth.mjs +50 -0
  5. package/dist/auth-kit/auth_service.d.mts +73 -0
  6. package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
  7. package/dist/auth-kit/auth_service.js +257 -0
  8. package/dist/auth-kit/auth_service.mjs +218 -0
  9. package/dist/auth-kit/client/google_login_button.d.mts +9 -0
  10. package/dist/auth-kit/client/google_login_button.d.ts +9 -0
  11. package/dist/auth-kit/client/google_login_button.js +67 -0
  12. package/dist/auth-kit/client/google_login_button.mjs +32 -0
  13. package/dist/auth-kit/client/redirect_page.d.mts +5 -0
  14. package/dist/auth-kit/client/redirect_page.d.ts +5 -0
  15. package/dist/auth-kit/client/redirect_page.js +53 -0
  16. package/dist/auth-kit/client/redirect_page.mjs +18 -0
  17. package/dist/auth-kit/google_auth.d.mts +27 -0
  18. package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
  19. package/dist/auth-kit/google_auth.js +144 -0
  20. package/dist/auth-kit/google_auth.mjs +117 -0
  21. package/dist/auth-kit/jwt.d.mts +18 -0
  22. package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
  23. package/dist/auth-kit/jwt.js +76 -0
  24. package/dist/auth-kit/jwt.mjs +51 -0
  25. package/dist/auth-kit/kakao_auth.d.mts +24 -0
  26. package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
  27. package/dist/auth-kit/kakao_auth.js +115 -0
  28. package/dist/auth-kit/kakao_auth.mjs +88 -0
  29. package/dist/auth-kit/repository.d.mts +42 -0
  30. package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
  31. package/dist/auth-kit/repository.js +18 -0
  32. package/dist/auth-kit/repository.mjs +0 -0
  33. package/dist/auth-kit/with_auth.d.mts +17 -0
  34. package/dist/auth-kit/with_auth.d.ts +17 -0
  35. package/dist/auth-kit/with_auth.js +106 -0
  36. package/dist/auth-kit/with_auth.mjs +69 -0
  37. package/dist/cn.d.mts +3 -0
  38. package/dist/cn.d.ts +3 -0
  39. package/dist/cn.js +32 -0
  40. package/dist/cn.mjs +7 -0
  41. package/dist/components/index.d.mts +5 -0
  42. package/dist/components/index.d.ts +5 -0
  43. package/dist/components/index.js +261 -0
  44. package/dist/components/index.mjs +219 -0
  45. package/dist/components/modal/fullscreen_container.d.mts +7 -0
  46. package/dist/components/modal/fullscreen_container.d.ts +7 -0
  47. package/dist/components/modal/fullscreen_container.js +102 -0
  48. package/dist/components/modal/fullscreen_container.mjs +68 -0
  49. package/dist/components/modal/hooks.d.mts +18 -0
  50. package/dist/components/modal/hooks.d.ts +18 -0
  51. package/dist/components/modal/hooks.js +236 -0
  52. package/dist/components/modal/hooks.mjs +204 -0
  53. package/dist/components/modal/index.d.mts +4 -0
  54. package/dist/components/modal/index.d.ts +4 -0
  55. package/dist/components/modal/index.js +238 -0
  56. package/dist/components/modal/index.mjs +203 -0
  57. package/dist/components/modal/modal.d.mts +13 -0
  58. package/dist/components/modal/modal.d.ts +13 -0
  59. package/dist/components/modal/modal.js +155 -0
  60. package/dist/components/modal/modal.mjs +130 -0
  61. package/dist/components/styles.d.mts +9 -0
  62. package/dist/components/styles.d.ts +9 -0
  63. package/dist/components/styles.js +48 -0
  64. package/dist/components/styles.mjs +17 -0
  65. package/dist/date.d.mts +3 -0
  66. package/dist/date.d.ts +3 -0
  67. package/dist/date.js +63 -0
  68. package/dist/date.mjs +28 -0
  69. package/dist/file-kit/cdn.d.mts +5 -0
  70. package/dist/file-kit/cdn.d.ts +5 -0
  71. package/dist/file-kit/cdn.js +34 -0
  72. package/dist/file-kit/cdn.mjs +9 -0
  73. package/dist/file-kit/client/drop_file_input.d.mts +33 -0
  74. package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +10 -8
  75. package/dist/file-kit/client/drop_file_input.js +235 -0
  76. package/dist/file-kit/client/drop_file_input.mjs +205 -0
  77. package/dist/file-kit/client/file_uploader.d.mts +13 -0
  78. package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
  79. package/dist/file-kit/client/file_uploader.js +115 -0
  80. package/dist/file-kit/client/file_uploader.mjs +90 -0
  81. package/dist/file-kit/file_service.d.mts +26 -0
  82. package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
  83. package/dist/file-kit/file_service.js +60 -0
  84. package/dist/file-kit/file_service.mjs +35 -0
  85. package/dist/file-kit/object_storage.d.mts +17 -0
  86. package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
  87. package/dist/file-kit/object_storage.js +78 -0
  88. package/dist/file-kit/object_storage.mjs +57 -0
  89. package/dist/file-kit/repository.d.mts +16 -0
  90. package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
  91. package/dist/file-kit/repository.js +18 -0
  92. package/dist/file-kit/repository.mjs +0 -0
  93. package/dist/file-kit/responsive_image.d.mts +20 -0
  94. package/dist/file-kit/responsive_image.d.ts +20 -0
  95. package/dist/file-kit/responsive_image.js +123 -0
  96. package/dist/file-kit/responsive_image.mjs +87 -0
  97. package/dist/http-kit/index.d.mts +1 -0
  98. package/dist/http-kit/index.d.ts +1 -0
  99. package/dist/http-kit/index.js +111 -0
  100. package/dist/http-kit/index.mjs +68 -0
  101. package/dist/http-kit/response.d.mts +19 -0
  102. package/dist/http-kit/response.d.ts +19 -0
  103. package/dist/http-kit/response.js +109 -0
  104. package/dist/http-kit/response.mjs +68 -0
  105. package/dist/index.d.mts +4 -0
  106. package/dist/index.d.ts +4 -0
  107. package/dist/index.js +91 -0
  108. package/dist/index.mjs +51 -0
  109. package/dist/route/api/auth/login/[provider]/route.js +113 -0
  110. package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
  111. package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
  112. package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
  113. package/dist/route/api/auth/login/route.d.mts +14 -0
  114. package/dist/route/api/auth/login/route.d.ts +14 -0
  115. package/dist/route/api/auth/login/route.js +107 -0
  116. package/dist/route/api/auth/login/route.mjs +80 -0
  117. package/dist/route/api/auth/logout/route.d.mts +14 -0
  118. package/dist/route/api/auth/logout/route.d.ts +14 -0
  119. package/dist/route/api/auth/logout/route.js +98 -0
  120. package/dist/route/api/auth/logout/route.mjs +71 -0
  121. package/dist/route/api/auth/refresh/route.d.mts +13 -0
  122. package/dist/route/api/auth/refresh/route.d.ts +13 -0
  123. package/dist/route/api/auth/refresh/route.js +92 -0
  124. package/dist/route/api/auth/refresh/route.mjs +65 -0
  125. package/dist/route/api/auth/route.d.mts +13 -0
  126. package/dist/route/api/auth/route.d.ts +13 -0
  127. package/dist/route/api/auth/route.js +82 -0
  128. package/dist/route/api/auth/route.mjs +55 -0
  129. package/dist/route/api/files/[fileId]/route.js +99 -0
  130. package/dist/route/api/files/[fileId]/route.mjs +72 -0
  131. package/dist/route/api/files/_fileId_/route.d.mts +17 -0
  132. package/dist/route/api/files/_fileId_/route.d.ts +17 -0
  133. package/dist/route/api/files/route.d.mts +16 -0
  134. package/dist/route/api/files/route.d.ts +16 -0
  135. package/dist/route/api/files/route.js +106 -0
  136. package/dist/route/api/files/route.mjs +79 -0
  137. package/dist/route/api.d.mts +29 -0
  138. package/dist/route/api.d.ts +29 -0
  139. package/dist/route/api.js +395 -0
  140. package/dist/route/api.mjs +368 -0
  141. package/dist/route/auth/callback/[provider]/route.js +120 -0
  142. package/dist/route/auth/callback/[provider]/route.mjs +93 -0
  143. package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
  144. package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
  145. package/dist/seo-kit/index.d.mts +6 -0
  146. package/dist/seo-kit/index.d.ts +6 -0
  147. package/dist/seo-kit/index.js +321 -0
  148. package/dist/seo-kit/index.mjs +282 -0
  149. package/dist/seo-kit/loader.d.mts +7 -0
  150. package/dist/seo-kit/loader.d.ts +7 -0
  151. package/dist/seo-kit/loader.js +43 -0
  152. package/dist/seo-kit/loader.mjs +18 -0
  153. package/dist/seo-kit/seo.d.mts +103 -0
  154. package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +10 -6
  155. package/dist/seo-kit/seo.js +286 -0
  156. package/dist/seo-kit/seo.mjs +251 -0
  157. package/dist/seo-kit/seo_loader.d.mts +16 -0
  158. package/dist/seo-kit/seo_loader.d.ts +16 -0
  159. package/dist/seo-kit/seo_loader.js +68 -0
  160. package/dist/seo-kit/seo_loader.mjs +31 -0
  161. package/dist/singleton.d.mts +3 -0
  162. package/dist/singleton.d.ts +3 -0
  163. package/dist/singleton.js +37 -0
  164. package/dist/singleton.mjs +12 -0
  165. package/dist/slug.d.mts +3 -0
  166. package/dist/slug.d.ts +3 -0
  167. package/dist/slug.js +32 -0
  168. package/dist/slug.mjs +7 -0
  169. package/package.json +36 -34
  170. package/tsup.config.ts +9 -0
  171. package/dist/cjs/auth-kit/apple_auth.js +0 -61
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
  175. package/dist/cjs/auth-kit/google_auth.js +0 -69
  176. package/dist/cjs/auth-kit/jwt.js +0 -54
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -43
  178. package/dist/cjs/auth-kit/repository.js +0 -2
  179. package/dist/cjs/auth-kit/with_auth.js +0 -46
  180. package/dist/cjs/cn.js +0 -6
  181. package/dist/cjs/components/index.js +0 -18
  182. package/dist/cjs/components/modal/fullscreen_container.js +0 -49
  183. package/dist/cjs/components/modal/hooks.js +0 -76
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -79
  186. package/dist/cjs/components/styles.js +0 -10
  187. package/dist/cjs/date.js +0 -31
  188. package/dist/cjs/file-kit/cdn.js +0 -9
  189. package/dist/cjs/file-kit/client/drop_file_input.js +0 -148
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -88
  191. package/dist/cjs/file-kit/file_service.js +0 -32
  192. package/dist/cjs/file-kit/object_storage.js +0 -51
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -63
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -37
  197. package/dist/cjs/index.js +0 -20
  198. package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
  199. package/dist/cjs/route/api/auth/login/route.js +0 -35
  200. package/dist/cjs/route/api/auth/logout/route.js +0 -22
  201. package/dist/cjs/route/api/auth/refresh/route.js +0 -22
  202. package/dist/cjs/route/api/auth/route.js +0 -12
  203. package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
  204. package/dist/cjs/route/api/files/route.js +0 -34
  205. package/dist/cjs/route/auth/callback/[provider]/route.js +0 -38
  206. package/dist/cjs/route/index.js +0 -80
  207. package/dist/cjs/seo-kit/index.js +0 -19
  208. package/dist/cjs/seo-kit/loader.js +0 -17
  209. package/dist/cjs/seo-kit/seo.js +0 -278
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -15
  211. package/dist/cjs/singleton.js +0 -12
  212. package/dist/cjs/slug.js +0 -10
  213. package/dist/esm/auth-kit/apple_auth.js +0 -57
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -16
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -65
  220. package/dist/esm/auth-kit/jwt.js +0 -50
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -39
  222. package/dist/esm/auth-kit/repository.js +0 -1
  223. package/dist/esm/auth-kit/with_auth.d.ts +0 -12
  224. package/dist/esm/auth-kit/with_auth.js +0 -43
  225. package/dist/esm/cn.d.ts +0 -1
  226. package/dist/esm/cn.js +0 -3
  227. package/dist/esm/components/index.d.ts +0 -2
  228. package/dist/esm/components/index.js +0 -2
  229. package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
  230. package/dist/esm/components/modal/fullscreen_container.js +0 -45
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -67
  233. package/dist/esm/components/modal/index.d.ts +0 -3
  234. package/dist/esm/components/modal/index.js +0 -3
  235. package/dist/esm/components/modal/modal.d.ts +0 -10
  236. package/dist/esm/components/modal/modal.js +0 -43
  237. package/dist/esm/components/styles.d.ts +0 -7
  238. package/dist/esm/components/styles.js +0 -7
  239. package/dist/esm/date.d.ts +0 -1
  240. package/dist/esm/date.js +0 -24
  241. package/dist/esm/file-kit/cdn.d.ts +0 -3
  242. package/dist/esm/file-kit/cdn.js +0 -5
  243. package/dist/esm/file-kit/client/drop_file_input.js +0 -144
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -84
  245. package/dist/esm/file-kit/file_service.js +0 -28
  246. package/dist/esm/file-kit/object_storage.js +0 -47
  247. package/dist/esm/file-kit/repository.js +0 -1
  248. package/dist/esm/file-kit/responsive_image.d.ts +0 -17
  249. package/dist/esm/file-kit/responsive_image.js +0 -58
  250. package/dist/esm/http-kit/index.d.ts +0 -1
  251. package/dist/esm/http-kit/index.js +0 -1
  252. package/dist/esm/http-kit/response.d.ts +0 -17
  253. package/dist/esm/http-kit/response.js +0 -31
  254. package/dist/esm/index.d.ts +0 -4
  255. package/dist/esm/index.js +0 -4
  256. package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
  257. package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
  258. package/dist/esm/route/api/auth/login/route.d.ts +0 -6
  259. package/dist/esm/route/api/auth/login/route.js +0 -31
  260. package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
  261. package/dist/esm/route/api/auth/logout/route.js +0 -18
  262. package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
  263. package/dist/esm/route/api/auth/refresh/route.js +0 -18
  264. package/dist/esm/route/api/auth/route.d.ts +0 -4
  265. package/dist/esm/route/api/auth/route.js +0 -8
  266. package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
  267. package/dist/esm/route/api/files/[fileId]/route.js +0 -16
  268. package/dist/esm/route/api/files/route.d.ts +0 -6
  269. package/dist/esm/route/api/files/route.js +0 -30
  270. package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
  271. package/dist/esm/route/auth/callback/[provider]/route.js +0 -34
  272. package/dist/esm/route/index.d.ts +0 -22
  273. package/dist/esm/route/index.js +0 -76
  274. package/dist/esm/seo-kit/index.d.ts +0 -3
  275. package/dist/esm/seo-kit/index.js +0 -3
  276. package/dist/esm/seo-kit/loader.d.ts +0 -5
  277. package/dist/esm/seo-kit/loader.js +0 -14
  278. package/dist/esm/seo-kit/seo.js +0 -275
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -12
  281. package/dist/esm/singleton.d.ts +0 -1
  282. package/dist/esm/singleton.js +0 -9
  283. package/dist/esm/slug.d.ts +0 -1
  284. package/dist/esm/slug.js +0 -6
@@ -1,5 +1,7 @@
1
- import { ObjectStorage } from "./object_storage";
2
- import { type FileRepository } from "./repository";
1
+ import { ObjectStorage } from './object_storage.js';
2
+ import { FileRepository } from './repository.js';
3
+ import '@aws-sdk/client-s3';
4
+
3
5
  type Params = {
4
6
  userId?: string;
5
7
  name: string;
@@ -7,7 +9,7 @@ type Params = {
7
9
  size: number;
8
10
  metadata?: Record<string, any>;
9
11
  };
10
- export declare class FileService<TFile> {
12
+ declare class FileService<TFile> {
11
13
  prefix: string;
12
14
  repository: FileRepository<TFile>;
13
15
  OBJECT_STORAGE: ObjectStorage;
@@ -20,4 +22,5 @@ export declare class FileService<TFile> {
20
22
  signedUrl: string;
21
23
  }>;
22
24
  }
23
- export {};
25
+
26
+ export { FileService };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/file-kit/file_service.ts
21
+ var file_service_exports = {};
22
+ __export(file_service_exports, {
23
+ FileService: () => FileService
24
+ });
25
+ module.exports = __toCommonJS(file_service_exports);
26
+ var import_uuid = require("uuid");
27
+ var FileService = class {
28
+ prefix;
29
+ repository;
30
+ OBJECT_STORAGE;
31
+ constructor(prefix = "user", {
32
+ repository,
33
+ OBJECT_STORAGE
34
+ }) {
35
+ this.prefix = prefix;
36
+ this.repository = repository;
37
+ this.OBJECT_STORAGE = OBJECT_STORAGE;
38
+ }
39
+ async generateSignedUrl({ userId, name, type, size, metadata = {} }) {
40
+ const id = (0, import_uuid.v4)();
41
+ const key = `${this.prefix}/${id}/${name}`;
42
+ const file = await this.repository.createFile({
43
+ id,
44
+ userId,
45
+ name,
46
+ type,
47
+ size,
48
+ metadata,
49
+ key
50
+ });
51
+ const signedUrl = await this.OBJECT_STORAGE.generateSignedUrl(key, {
52
+ contentType: type
53
+ });
54
+ return { file, signedUrl };
55
+ }
56
+ };
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ FileService
60
+ });
@@ -0,0 +1,35 @@
1
+ // src/file-kit/file_service.ts
2
+ import { v4 } from "uuid";
3
+ var FileService = class {
4
+ prefix;
5
+ repository;
6
+ OBJECT_STORAGE;
7
+ constructor(prefix = "user", {
8
+ repository,
9
+ OBJECT_STORAGE
10
+ }) {
11
+ this.prefix = prefix;
12
+ this.repository = repository;
13
+ this.OBJECT_STORAGE = OBJECT_STORAGE;
14
+ }
15
+ async generateSignedUrl({ userId, name, type, size, metadata = {} }) {
16
+ const id = v4();
17
+ const key = `${this.prefix}/${id}/${name}`;
18
+ const file = await this.repository.createFile({
19
+ id,
20
+ userId,
21
+ name,
22
+ type,
23
+ size,
24
+ metadata,
25
+ key
26
+ });
27
+ const signedUrl = await this.OBJECT_STORAGE.generateSignedUrl(key, {
28
+ contentType: type
29
+ });
30
+ return { file, signedUrl };
31
+ }
32
+ };
33
+ export {
34
+ FileService
35
+ };
@@ -0,0 +1,17 @@
1
+ import * as _aws_sdk_client_s3 from '@aws-sdk/client-s3';
2
+
3
+ declare class ObjectStorage {
4
+ private client;
5
+ private bucketName;
6
+ constructor(bucketName: string);
7
+ generateSignedUrl(key: string, { contentType, expiresIn, }?: {
8
+ contentType?: string;
9
+ expiresIn?: number;
10
+ }): Promise<string>;
11
+ find(key: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
12
+ put(key: string, buffer: Buffer, { contentType }?: {
13
+ contentType?: string;
14
+ }): Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
15
+ }
16
+
17
+ export { ObjectStorage };
@@ -1,4 +1,6 @@
1
- export declare class ObjectStorage {
1
+ import * as _aws_sdk_client_s3 from '@aws-sdk/client-s3';
2
+
3
+ declare class ObjectStorage {
2
4
  private client;
3
5
  private bucketName;
4
6
  constructor(bucketName: string);
@@ -9,5 +11,7 @@ export declare class ObjectStorage {
9
11
  find(key: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
10
12
  put(key: string, buffer: Buffer, { contentType }?: {
11
13
  contentType?: string;
12
- }): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
14
+ }): Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
13
15
  }
16
+
17
+ export { ObjectStorage };
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/file-kit/object_storage.ts
21
+ var object_storage_exports = {};
22
+ __export(object_storage_exports, {
23
+ ObjectStorage: () => ObjectStorage
24
+ });
25
+ module.exports = __toCommonJS(object_storage_exports);
26
+ var import_client_s3 = require("@aws-sdk/client-s3");
27
+ var import_s3_request_presigner = require("@aws-sdk/s3-request-presigner");
28
+ var ObjectStorage = class {
29
+ client = new import_client_s3.S3Client({
30
+ region: "ap-northeast-2"
31
+ });
32
+ bucketName;
33
+ constructor(bucketName) {
34
+ this.bucketName = bucketName;
35
+ }
36
+ async generateSignedUrl(key, {
37
+ contentType,
38
+ expiresIn = 3600
39
+ } = {}) {
40
+ const command = new import_client_s3.PutObjectCommand({
41
+ Bucket: this.bucketName,
42
+ Key: key,
43
+ ContentType: contentType
44
+ });
45
+ const signedUrl = await (0, import_s3_request_presigner.getSignedUrl)(this.client, command, {
46
+ expiresIn
47
+ });
48
+ return signedUrl;
49
+ }
50
+ async find(key) {
51
+ try {
52
+ const command = new import_client_s3.GetObjectCommand({
53
+ Bucket: this.bucketName,
54
+ Key: key
55
+ });
56
+ const { Body } = await this.client.send(command);
57
+ if (!Body) {
58
+ return;
59
+ }
60
+ return Body.transformToByteArray();
61
+ } catch (error) {
62
+ return;
63
+ }
64
+ }
65
+ async put(key, buffer, { contentType } = {}) {
66
+ const command = new import_client_s3.PutObjectCommand({
67
+ Bucket: this.bucketName,
68
+ Key: key,
69
+ ContentType: contentType,
70
+ Body: buffer
71
+ });
72
+ return await this.client.send(command);
73
+ }
74
+ };
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ ObjectStorage
78
+ });
@@ -0,0 +1,57 @@
1
+ // src/file-kit/object_storage.ts
2
+ import {
3
+ GetObjectCommand,
4
+ PutObjectCommand,
5
+ S3Client
6
+ } from "@aws-sdk/client-s3";
7
+ import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
8
+ var ObjectStorage = class {
9
+ client = new S3Client({
10
+ region: "ap-northeast-2"
11
+ });
12
+ bucketName;
13
+ constructor(bucketName) {
14
+ this.bucketName = bucketName;
15
+ }
16
+ async generateSignedUrl(key, {
17
+ contentType,
18
+ expiresIn = 3600
19
+ } = {}) {
20
+ const command = new PutObjectCommand({
21
+ Bucket: this.bucketName,
22
+ Key: key,
23
+ ContentType: contentType
24
+ });
25
+ const signedUrl = await getSignedUrl(this.client, command, {
26
+ expiresIn
27
+ });
28
+ return signedUrl;
29
+ }
30
+ async find(key) {
31
+ try {
32
+ const command = new GetObjectCommand({
33
+ Bucket: this.bucketName,
34
+ Key: key
35
+ });
36
+ const { Body } = await this.client.send(command);
37
+ if (!Body) {
38
+ return;
39
+ }
40
+ return Body.transformToByteArray();
41
+ } catch (error) {
42
+ return;
43
+ }
44
+ }
45
+ async put(key, buffer, { contentType } = {}) {
46
+ const command = new PutObjectCommand({
47
+ Bucket: this.bucketName,
48
+ Key: key,
49
+ ContentType: contentType,
50
+ Body: buffer
51
+ });
52
+ return await this.client.send(command);
53
+ }
54
+ };
55
+ export {
56
+ ObjectStorage
57
+ };
@@ -0,0 +1,16 @@
1
+ interface FileRepository<TFile> {
2
+ findFileById(fileId: string): Promise<TFile | undefined>;
3
+ hasPermission(file: TFile, userId?: string): boolean;
4
+ createFile(fileData: {
5
+ id: string;
6
+ userId?: string;
7
+ name: string;
8
+ type: string;
9
+ size: number;
10
+ metadata: Record<string, any>;
11
+ key: string;
12
+ }): Promise<TFile>;
13
+ deleteFile(fileId: string): Promise<void>;
14
+ }
15
+
16
+ export type { FileRepository };
@@ -1,4 +1,4 @@
1
- export interface FileRepository<TFile> {
1
+ interface FileRepository<TFile> {
2
2
  findFileById(fileId: string): Promise<TFile | undefined>;
3
3
  hasPermission(file: TFile, userId?: string): boolean;
4
4
  createFile(fileData: {
@@ -12,3 +12,5 @@ export interface FileRepository<TFile> {
12
12
  }): Promise<TFile>;
13
13
  deleteFile(fileId: string): Promise<void>;
14
14
  }
15
+
16
+ export type { FileRepository };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/file-kit/repository.ts
17
+ var repository_exports = {};
18
+ module.exports = __toCommonJS(repository_exports);
File without changes
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ type ResponsiveImageProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "alt"> & {
4
+ alt: string;
5
+ src?: string;
6
+ file?: {
7
+ key: string;
8
+ };
9
+ ratio?: number;
10
+ };
11
+ declare const createResponsiveImage: (cdn: (key: string | undefined, options?: {
12
+ width?: number;
13
+ }) => string | undefined) => React.FC<ResponsiveImageProps>;
14
+
15
+ declare function generateSrcSet(image: HTMLImageElement | string, ratio?: number, props?: {
16
+ width?: string | number;
17
+ height?: string | number;
18
+ }): string | undefined;
19
+
20
+ export { type ResponsiveImageProps, createResponsiveImage, createResponsiveImage as default, generateSrcSet };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ type ResponsiveImageProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "srcSet" | "alt"> & {
4
+ alt: string;
5
+ src?: string;
6
+ file?: {
7
+ key: string;
8
+ };
9
+ ratio?: number;
10
+ };
11
+ declare const createResponsiveImage: (cdn: (key: string | undefined, options?: {
12
+ width?: number;
13
+ }) => string | undefined) => React.FC<ResponsiveImageProps>;
14
+
15
+ declare function generateSrcSet(image: HTMLImageElement | string, ratio?: number, props?: {
16
+ width?: string | number;
17
+ height?: string | number;
18
+ }): string | undefined;
19
+
20
+ export { type ResponsiveImageProps, createResponsiveImage, createResponsiveImage as default, generateSrcSet };
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/file-kit/responsive_image.tsx
31
+ var responsive_image_exports = {};
32
+ __export(responsive_image_exports, {
33
+ createResponsiveImage: () => createResponsiveImage,
34
+ default: () => responsive_image_default,
35
+ generateSrcSet: () => generateSrcSet
36
+ });
37
+ module.exports = __toCommonJS(responsive_image_exports);
38
+ var import_react = __toESM(require("react"));
39
+ var sizes = [
40
+ 64,
41
+ 128,
42
+ 256,
43
+ 320,
44
+ 480,
45
+ 640,
46
+ 768,
47
+ 1080,
48
+ 1200,
49
+ 1536,
50
+ 1920,
51
+ 2560,
52
+ 3840
53
+ ];
54
+ var createResponsiveImage = (cdn) => {
55
+ const Component = ({
56
+ alt,
57
+ file,
58
+ ratio,
59
+ ...props
60
+ }) => {
61
+ const src = cdn(file?.key) || props.src || "#";
62
+ return /* @__PURE__ */ import_react.default.createElement(
63
+ "img",
64
+ {
65
+ ...props,
66
+ src,
67
+ alt,
68
+ srcSet: generateSrcSet(src, ratio, props)
69
+ }
70
+ );
71
+ };
72
+ return Component;
73
+ };
74
+ var responsive_image_default = createResponsiveImage;
75
+ var generateSrc = (src, width, height, ratio, image = {}) => {
76
+ const searchParams = new URLSearchParams();
77
+ if (image.width) {
78
+ searchParams.set("w", image.width.toString());
79
+ }
80
+ if (width) {
81
+ searchParams.set("w", width.toString());
82
+ if (ratio) {
83
+ searchParams.set("h", Math.round(width / ratio).toString());
84
+ }
85
+ }
86
+ if (image.height) {
87
+ searchParams.set("h", image.height.toString());
88
+ }
89
+ if (height) {
90
+ searchParams.set("h", height.toString());
91
+ }
92
+ const search = searchParams.toString() ? `?${searchParams.toString()}` : "";
93
+ const origin = process.env.NEXT_PUBLIC_CDN_ORIGIN || "";
94
+ if (!src.includes(origin)) {
95
+ return src;
96
+ }
97
+ return `${encodeURI(decodeURI(src))}${search}`;
98
+ };
99
+ function generateSrcSet(image, ratio, props = {}) {
100
+ const src = typeof image === "string" ? image : image.src;
101
+ const isGif = src.endsWith(".gif");
102
+ if (isGif) {
103
+ return void 0;
104
+ }
105
+ if (props.width) {
106
+ return [1, 2, 3].map((scale) => {
107
+ const genWidth = Number(props.width) * scale;
108
+ return `${generateSrc(
109
+ src,
110
+ genWidth,
111
+ props.height ? Number(props.height) * scale : ratio ? Math.round(genWidth / ratio) : void 0
112
+ )} ${scale}x`;
113
+ }).join(", ");
114
+ }
115
+ return sizes.map(
116
+ (size) => `${generateSrc(src, size, void 0, ratio, props)} ${size}w`
117
+ ).join(", ");
118
+ }
119
+ // Annotate the CommonJS export names for ESM import in node:
120
+ 0 && (module.exports = {
121
+ createResponsiveImage,
122
+ generateSrcSet
123
+ });
@@ -0,0 +1,87 @@
1
+ // src/file-kit/responsive_image.tsx
2
+ import React from "react";
3
+ var sizes = [
4
+ 64,
5
+ 128,
6
+ 256,
7
+ 320,
8
+ 480,
9
+ 640,
10
+ 768,
11
+ 1080,
12
+ 1200,
13
+ 1536,
14
+ 1920,
15
+ 2560,
16
+ 3840
17
+ ];
18
+ var createResponsiveImage = (cdn) => {
19
+ const Component = ({
20
+ alt,
21
+ file,
22
+ ratio,
23
+ ...props
24
+ }) => {
25
+ const src = cdn(file?.key) || props.src || "#";
26
+ return /* @__PURE__ */ React.createElement(
27
+ "img",
28
+ {
29
+ ...props,
30
+ src,
31
+ alt,
32
+ srcSet: generateSrcSet(src, ratio, props)
33
+ }
34
+ );
35
+ };
36
+ return Component;
37
+ };
38
+ var responsive_image_default = createResponsiveImage;
39
+ var generateSrc = (src, width, height, ratio, image = {}) => {
40
+ const searchParams = new URLSearchParams();
41
+ if (image.width) {
42
+ searchParams.set("w", image.width.toString());
43
+ }
44
+ if (width) {
45
+ searchParams.set("w", width.toString());
46
+ if (ratio) {
47
+ searchParams.set("h", Math.round(width / ratio).toString());
48
+ }
49
+ }
50
+ if (image.height) {
51
+ searchParams.set("h", image.height.toString());
52
+ }
53
+ if (height) {
54
+ searchParams.set("h", height.toString());
55
+ }
56
+ const search = searchParams.toString() ? `?${searchParams.toString()}` : "";
57
+ const origin = process.env.NEXT_PUBLIC_CDN_ORIGIN || "";
58
+ if (!src.includes(origin)) {
59
+ return src;
60
+ }
61
+ return `${encodeURI(decodeURI(src))}${search}`;
62
+ };
63
+ function generateSrcSet(image, ratio, props = {}) {
64
+ const src = typeof image === "string" ? image : image.src;
65
+ const isGif = src.endsWith(".gif");
66
+ if (isGif) {
67
+ return void 0;
68
+ }
69
+ if (props.width) {
70
+ return [1, 2, 3].map((scale) => {
71
+ const genWidth = Number(props.width) * scale;
72
+ return `${generateSrc(
73
+ src,
74
+ genWidth,
75
+ props.height ? Number(props.height) * scale : ratio ? Math.round(genWidth / ratio) : void 0
76
+ )} ${scale}x`;
77
+ }).join(", ");
78
+ }
79
+ return sizes.map(
80
+ (size) => `${generateSrc(src, size, void 0, ratio, props)} ${size}w`
81
+ ).join(", ");
82
+ }
83
+ export {
84
+ createResponsiveImage,
85
+ responsive_image_default as default,
86
+ generateSrcSet
87
+ };
@@ -0,0 +1 @@
1
+ export { ACCEPTED, BAD_REQUEST, CONFLICT, CREATED, FORBIDDEN, INTERNAL_SERVER_ERROR, METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND, NO_CONTENT, OK, REQUEST_TIMEOUT, TOO_MANY_REQUESTS, UNAUTHORIZED, UNPROCESSABLE_ENTITY, createException, createJsonResponse } from './response.mjs';
@@ -0,0 +1 @@
1
+ export { ACCEPTED, BAD_REQUEST, CONFLICT, CREATED, FORBIDDEN, INTERNAL_SERVER_ERROR, METHOD_NOT_ALLOWED, NOT_ACCEPTABLE, NOT_FOUND, NO_CONTENT, OK, REQUEST_TIMEOUT, TOO_MANY_REQUESTS, UNAUTHORIZED, UNPROCESSABLE_ENTITY, createException, createJsonResponse } from './response.js';