dn-react-router-toolkit 0.2.7 → 0.3.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.
Files changed (279) hide show
  1. package/dist/api/create_handler.d.mts +13 -0
  2. package/dist/api/create_handler.d.ts +13 -0
  3. package/dist/api/create_handler.js +298 -0
  4. package/dist/api/create_handler.mjs +304 -0
  5. package/dist/api/index.d.mts +4 -0
  6. package/dist/api/index.d.ts +4 -0
  7. package/dist/api/index.js +298 -0
  8. package/dist/api/index.mjs +304 -0
  9. package/dist/auth/client/index.d.mts +3 -0
  10. package/dist/auth/client/index.d.ts +3 -0
  11. package/dist/{date.js → auth/client/index.js} +25 -32
  12. package/dist/auth/client/index.mjs +21 -0
  13. package/dist/auth/client/redirect_page.d.mts +1 -0
  14. package/dist/auth/client/redirect_page.d.ts +1 -0
  15. package/dist/auth/cookie_store.d.mts +13 -0
  16. package/dist/auth/cookie_store.d.ts +13 -0
  17. package/dist/{text_editor/plugins/keymap.js → auth/cookie_store.js} +24 -16
  18. package/dist/auth/cookie_store.mjs +23 -0
  19. package/dist/auth/index.d.mts +5 -0
  20. package/dist/auth/index.d.ts +5 -0
  21. package/dist/auth/index.js +139 -0
  22. package/dist/auth/index.mjs +111 -0
  23. package/dist/auth/server/index.d.mts +1 -0
  24. package/dist/auth/server/index.d.ts +1 -0
  25. package/dist/{slug.js → auth/server/index.js} +6 -14
  26. package/dist/auth/server/index.mjs +2 -0
  27. package/dist/auth/with_auth.d.mts +2 -6
  28. package/dist/auth/with_auth.d.ts +2 -6
  29. package/dist/auth/with_auth.js +3 -0
  30. package/dist/auth/with_auth.mjs +3 -0
  31. package/dist/{components → client}/client_env.d.mts +1 -1
  32. package/dist/{components → client}/client_env.d.ts +1 -1
  33. package/dist/{components → client}/client_env.js +6 -2
  34. package/dist/{components → client}/client_env.mjs +2 -2
  35. package/dist/client/index.d.mts +3 -0
  36. package/dist/client/index.d.ts +3 -0
  37. package/dist/{auth/client/google_login_button.js → client/index.js} +30 -33
  38. package/dist/client/index.mjs +31 -0
  39. package/dist/client/use_user_agent.d.mts +8 -0
  40. package/dist/client/use_user_agent.d.ts +8 -0
  41. package/dist/{file/client/format_size.js → client/use_user_agent.js} +14 -14
  42. package/dist/client/use_user_agent.mjs +13 -0
  43. package/dist/file/client/index.d.mts +1 -0
  44. package/dist/file/client/index.d.ts +1 -0
  45. package/dist/file/{cdn.js → client/index.js} +6 -16
  46. package/dist/file/client/index.mjs +2 -0
  47. package/dist/file/index.d.mts +1 -0
  48. package/dist/file/index.d.ts +1 -0
  49. package/dist/{cn.js → file/index.js} +6 -14
  50. package/dist/file/index.mjs +2 -0
  51. package/dist/file/server/index.d.mts +1 -0
  52. package/dist/file/server/index.d.ts +1 -0
  53. package/dist/file/server/index.js +24 -0
  54. package/dist/file/server/index.mjs +2 -0
  55. package/dist/http/index.d.mts +1 -1
  56. package/dist/http/index.d.ts +1 -1
  57. package/dist/http/index.js +3 -90
  58. package/dist/http/index.mjs +2 -68
  59. package/dist/index.d.mts +8 -6
  60. package/dist/index.d.ts +8 -6
  61. package/dist/index.js +3 -79
  62. package/dist/index.mjs +2 -58
  63. package/dist/modal/index.d.mts +1 -0
  64. package/dist/modal/index.d.ts +1 -0
  65. package/dist/{sleep.js → modal/index.js} +6 -14
  66. package/dist/modal/index.mjs +2 -0
  67. package/dist/seo/index.d.mts +4 -0
  68. package/dist/seo/index.d.ts +4 -0
  69. package/dist/seo/index.js +304 -0
  70. package/dist/seo/index.mjs +267 -0
  71. package/dist/text_editor/index.d.mts +1 -0
  72. package/dist/text_editor/index.d.ts +1 -0
  73. package/dist/text_editor/index.js +24 -0
  74. package/dist/text_editor/index.mjs +2 -0
  75. package/package.json +58 -32
  76. package/dist/auth/apple_auth.d.mts +0 -38
  77. package/dist/auth/apple_auth.d.ts +0 -38
  78. package/dist/auth/apple_auth.js +0 -88
  79. package/dist/auth/apple_auth.mjs +0 -63
  80. package/dist/auth/auth_repository.d.mts +0 -41
  81. package/dist/auth/auth_repository.d.ts +0 -41
  82. package/dist/auth/auth_repository.js +0 -18
  83. package/dist/auth/auth_repository.mjs +0 -0
  84. package/dist/auth/auth_service.d.mts +0 -63
  85. package/dist/auth/auth_service.d.ts +0 -63
  86. package/dist/auth/auth_service.js +0 -210
  87. package/dist/auth/auth_service.mjs +0 -171
  88. package/dist/auth/client/google_login_button.d.mts +0 -7
  89. package/dist/auth/client/google_login_button.d.ts +0 -7
  90. package/dist/auth/client/google_login_button.mjs +0 -37
  91. package/dist/auth/client/provider.d.mts +0 -24
  92. package/dist/auth/client/provider.d.ts +0 -24
  93. package/dist/auth/client/provider.js +0 -154
  94. package/dist/auth/client/provider.mjs +0 -118
  95. package/dist/auth/google_auth.d.mts +0 -33
  96. package/dist/auth/google_auth.d.ts +0 -33
  97. package/dist/auth/google_auth.js +0 -135
  98. package/dist/auth/google_auth.mjs +0 -108
  99. package/dist/auth/handlers/find_auth.d.mts +0 -13
  100. package/dist/auth/handlers/find_auth.d.ts +0 -13
  101. package/dist/auth/handlers/find_auth.js +0 -82
  102. package/dist/auth/handlers/find_auth.mjs +0 -55
  103. package/dist/auth/handlers/login.d.mts +0 -13
  104. package/dist/auth/handlers/login.d.ts +0 -13
  105. package/dist/auth/handlers/login.js +0 -107
  106. package/dist/auth/handlers/login.mjs +0 -80
  107. package/dist/auth/handlers/login_with_thirdparty.d.mts +0 -15
  108. package/dist/auth/handlers/login_with_thirdparty.d.ts +0 -15
  109. package/dist/auth/handlers/login_with_thirdparty.js +0 -98
  110. package/dist/auth/handlers/login_with_thirdparty.mjs +0 -71
  111. package/dist/auth/handlers/logout.d.mts +0 -13
  112. package/dist/auth/handlers/logout.d.ts +0 -13
  113. package/dist/auth/handlers/logout.js +0 -102
  114. package/dist/auth/handlers/logout.mjs +0 -75
  115. package/dist/auth/handlers/refresh.d.mts +0 -13
  116. package/dist/auth/handlers/refresh.d.ts +0 -13
  117. package/dist/auth/handlers/refresh.js +0 -92
  118. package/dist/auth/handlers/refresh.mjs +0 -65
  119. package/dist/auth/handlers/request_password_reset.d.mts +0 -10
  120. package/dist/auth/handlers/request_password_reset.d.ts +0 -10
  121. package/dist/auth/handlers/request_password_reset.js +0 -87
  122. package/dist/auth/handlers/request_password_reset.mjs +0 -60
  123. package/dist/auth/handlers/reset_password.d.mts +0 -10
  124. package/dist/auth/handlers/reset_password.d.ts +0 -10
  125. package/dist/auth/handlers/reset_password.js +0 -88
  126. package/dist/auth/handlers/reset_password.mjs +0 -61
  127. package/dist/auth/handlers/signup.d.mts +0 -15
  128. package/dist/auth/handlers/signup.d.ts +0 -15
  129. package/dist/auth/handlers/signup.js +0 -147
  130. package/dist/auth/handlers/signup.mjs +0 -112
  131. package/dist/auth/handlers/signup_with_thirdparty.d.mts +0 -17
  132. package/dist/auth/handlers/signup_with_thirdparty.d.ts +0 -17
  133. package/dist/auth/handlers/signup_with_thirdparty.js +0 -123
  134. package/dist/auth/handlers/signup_with_thirdparty.mjs +0 -98
  135. package/dist/auth/handlers/thirdparty_auth_callback.d.mts +0 -16
  136. package/dist/auth/handlers/thirdparty_auth_callback.d.ts +0 -16
  137. package/dist/auth/handlers/thirdparty_auth_callback.js +0 -129
  138. package/dist/auth/handlers/thirdparty_auth_callback.mjs +0 -102
  139. package/dist/auth/jwt_manager.d.mts +0 -38
  140. package/dist/auth/jwt_manager.d.ts +0 -38
  141. package/dist/auth/jwt_manager.js +0 -90
  142. package/dist/auth/jwt_manager.mjs +0 -65
  143. package/dist/auth/kakao_auth.d.mts +0 -27
  144. package/dist/auth/kakao_auth.d.ts +0 -27
  145. package/dist/auth/kakao_auth.js +0 -56
  146. package/dist/auth/kakao_auth.mjs +0 -31
  147. package/dist/auth/password_recovery.d.mts +0 -34
  148. package/dist/auth/password_recovery.d.ts +0 -34
  149. package/dist/auth/password_recovery.js +0 -169
  150. package/dist/auth/password_recovery.mjs +0 -134
  151. package/dist/auth/thirdparty_auth.d.mts +0 -41
  152. package/dist/auth/thirdparty_auth.d.ts +0 -41
  153. package/dist/auth/thirdparty_auth.js +0 -113
  154. package/dist/auth/thirdparty_auth.mjs +0 -86
  155. package/dist/cn.d.mts +0 -3
  156. package/dist/cn.d.ts +0 -3
  157. package/dist/cn.mjs +0 -7
  158. package/dist/components/index.d.mts +0 -5
  159. package/dist/components/index.d.ts +0 -5
  160. package/dist/components/index.js +0 -261
  161. package/dist/components/index.mjs +0 -219
  162. package/dist/components/modal/fullscreen_container.d.mts +0 -7
  163. package/dist/components/modal/fullscreen_container.d.ts +0 -7
  164. package/dist/components/modal/fullscreen_container.js +0 -102
  165. package/dist/components/modal/fullscreen_container.mjs +0 -68
  166. package/dist/components/modal/hooks.d.mts +0 -18
  167. package/dist/components/modal/hooks.d.ts +0 -18
  168. package/dist/components/modal/hooks.js +0 -236
  169. package/dist/components/modal/hooks.mjs +0 -204
  170. package/dist/components/modal/index.d.mts +0 -4
  171. package/dist/components/modal/index.d.ts +0 -4
  172. package/dist/components/modal/index.js +0 -238
  173. package/dist/components/modal/index.mjs +0 -203
  174. package/dist/components/modal/modal.d.mts +0 -13
  175. package/dist/components/modal/modal.d.ts +0 -13
  176. package/dist/components/modal/modal.js +0 -155
  177. package/dist/components/modal/modal.mjs +0 -130
  178. package/dist/components/styles.d.mts +0 -9
  179. package/dist/components/styles.d.ts +0 -9
  180. package/dist/components/styles.js +0 -48
  181. package/dist/components/styles.mjs +0 -17
  182. package/dist/date.d.mts +0 -5
  183. package/dist/date.d.ts +0 -5
  184. package/dist/date.mjs +0 -29
  185. package/dist/file/cdn.d.mts +0 -6
  186. package/dist/file/cdn.d.ts +0 -6
  187. package/dist/file/cdn.mjs +0 -9
  188. package/dist/file/client/drop_file_input.d.mts +0 -36
  189. package/dist/file/client/drop_file_input.d.ts +0 -36
  190. package/dist/file/client/drop_file_input.js +0 -323
  191. package/dist/file/client/drop_file_input.mjs +0 -294
  192. package/dist/file/client/file_upload_button.d.mts +0 -10
  193. package/dist/file/client/file_upload_button.d.ts +0 -10
  194. package/dist/file/client/file_upload_button.js +0 -89
  195. package/dist/file/client/file_upload_button.mjs +0 -58
  196. package/dist/file/client/file_uploader.d.mts +0 -13
  197. package/dist/file/client/file_uploader.d.ts +0 -13
  198. package/dist/file/client/file_uploader.js +0 -163
  199. package/dist/file/client/file_uploader.mjs +0 -136
  200. package/dist/file/client/format_size.d.mts +0 -3
  201. package/dist/file/client/format_size.d.ts +0 -3
  202. package/dist/file/client/format_size.mjs +0 -13
  203. package/dist/file/client/metadata.d.mts +0 -7
  204. package/dist/file/client/metadata.d.ts +0 -7
  205. package/dist/file/client/metadata.js +0 -85
  206. package/dist/file/client/metadata.mjs +0 -60
  207. package/dist/file/file_repository.d.mts +0 -16
  208. package/dist/file/file_repository.d.ts +0 -16
  209. package/dist/file/file_repository.js +0 -18
  210. package/dist/file/file_repository.mjs +0 -0
  211. package/dist/file/file_service.d.mts +0 -32
  212. package/dist/file/file_service.d.ts +0 -32
  213. package/dist/file/file_service.js +0 -66
  214. package/dist/file/file_service.mjs +0 -41
  215. package/dist/file/handlers/delete_file.d.mts +0 -17
  216. package/dist/file/handlers/delete_file.d.ts +0 -17
  217. package/dist/file/handlers/delete_file.js +0 -99
  218. package/dist/file/handlers/delete_file.mjs +0 -72
  219. package/dist/file/handlers/upload_file.d.mts +0 -16
  220. package/dist/file/handlers/upload_file.d.ts +0 -16
  221. package/dist/file/handlers/upload_file.js +0 -106
  222. package/dist/file/handlers/upload_file.mjs +0 -79
  223. package/dist/file/object_storage.d.mts +0 -20
  224. package/dist/file/object_storage.d.ts +0 -20
  225. package/dist/file/object_storage.js +0 -90
  226. package/dist/file/object_storage.mjs +0 -70
  227. package/dist/file/responsive_image.d.mts +0 -20
  228. package/dist/file/responsive_image.d.ts +0 -20
  229. package/dist/file/responsive_image.js +0 -132
  230. package/dist/file/responsive_image.mjs +0 -96
  231. package/dist/http/response.d.mts +0 -19
  232. package/dist/http/response.d.ts +0 -19
  233. package/dist/http/response.js +0 -109
  234. package/dist/http/response.mjs +0 -68
  235. package/dist/route/api.d.mts +0 -21
  236. package/dist/route/api.d.ts +0 -21
  237. package/dist/route/api.js +0 -584
  238. package/dist/route/api.mjs +0 -547
  239. package/dist/singleton.d.mts +0 -3
  240. package/dist/singleton.d.ts +0 -3
  241. package/dist/singleton.js +0 -37
  242. package/dist/singleton.mjs +0 -12
  243. package/dist/sleep.d.mts +0 -3
  244. package/dist/sleep.d.ts +0 -3
  245. package/dist/sleep.mjs +0 -7
  246. package/dist/slug.d.mts +0 -3
  247. package/dist/slug.d.ts +0 -3
  248. package/dist/slug.mjs +0 -7
  249. package/dist/text_editor/attach_media.d.mts +0 -16
  250. package/dist/text_editor/attach_media.d.ts +0 -16
  251. package/dist/text_editor/attach_media.js +0 -237
  252. package/dist/text_editor/attach_media.mjs +0 -210
  253. package/dist/text_editor/plugins/drag_and_drop.d.mts +0 -13
  254. package/dist/text_editor/plugins/drag_and_drop.d.ts +0 -13
  255. package/dist/text_editor/plugins/drag_and_drop.js +0 -59
  256. package/dist/text_editor/plugins/drag_and_drop.mjs +0 -34
  257. package/dist/text_editor/plugins/keymap.d.mts +0 -5
  258. package/dist/text_editor/plugins/keymap.d.ts +0 -5
  259. package/dist/text_editor/plugins/keymap.mjs +0 -15
  260. package/dist/text_editor/plugins/placehoder.d.mts +0 -5
  261. package/dist/text_editor/plugins/placehoder.d.ts +0 -5
  262. package/dist/text_editor/plugins/placehoder.js +0 -112
  263. package/dist/text_editor/plugins/placehoder.mjs +0 -87
  264. package/dist/text_editor/plugins/trailing_paragraph.d.mts +0 -5
  265. package/dist/text_editor/plugins/trailing_paragraph.d.ts +0 -5
  266. package/dist/text_editor/plugins/trailing_paragraph.js +0 -46
  267. package/dist/text_editor/plugins/trailing_paragraph.mjs +0 -21
  268. package/dist/text_editor/plugins/upload_placeholder.d.mts +0 -7
  269. package/dist/text_editor/plugins/upload_placeholder.d.ts +0 -7
  270. package/dist/text_editor/plugins/upload_placeholder.js +0 -94
  271. package/dist/text_editor/plugins/upload_placeholder.mjs +0 -68
  272. package/dist/text_editor/schema.d.mts +0 -9
  273. package/dist/text_editor/schema.d.ts +0 -9
  274. package/dist/text_editor/schema.js +0 -354
  275. package/dist/text_editor/schema.mjs +0 -319
  276. package/dist/text_editor/text_editor.d.mts +0 -45
  277. package/dist/text_editor/text_editor.d.ts +0 -45
  278. package/dist/text_editor/text_editor.js +0 -834
  279. package/dist/text_editor/text_editor.mjs +0 -806
@@ -1,20 +0,0 @@
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 }: {
7
- bucketName: string;
8
- });
9
- generateSignedUrl(key: string, { contentType, expiresIn, }?: {
10
- contentType?: string;
11
- expiresIn?: number;
12
- }): Promise<string>;
13
- head(key: string): Promise<boolean>;
14
- find(key: string): Promise<Uint8Array<ArrayBufferLike> | undefined>;
15
- put(key: string, buffer: Buffer, { contentType }?: {
16
- contentType?: string;
17
- }): Promise<_aws_sdk_client_s3.PutObjectCommandOutput>;
18
- }
19
-
20
- export { ObjectStorage };
@@ -1,90 +0,0 @@
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/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 head(key) {
51
- try {
52
- const command = new import_client_s3.HeadObjectCommand({
53
- Bucket: this.bucketName,
54
- Key: key
55
- });
56
- await this.client.send(command);
57
- return true;
58
- } catch (error) {
59
- return false;
60
- }
61
- }
62
- async find(key) {
63
- try {
64
- const command = new import_client_s3.GetObjectCommand({
65
- Bucket: this.bucketName,
66
- Key: key
67
- });
68
- const { Body } = await this.client.send(command);
69
- if (!Body) {
70
- return;
71
- }
72
- return Body.transformToByteArray();
73
- } catch (error) {
74
- return;
75
- }
76
- }
77
- async put(key, buffer, { contentType } = {}) {
78
- const command = new import_client_s3.PutObjectCommand({
79
- Bucket: this.bucketName,
80
- Key: key,
81
- ContentType: contentType,
82
- Body: buffer
83
- });
84
- return await this.client.send(command);
85
- }
86
- };
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- ObjectStorage
90
- });
@@ -1,70 +0,0 @@
1
- // src/file/object_storage.ts
2
- import {
3
- GetObjectCommand,
4
- HeadObjectCommand,
5
- PutObjectCommand,
6
- S3Client
7
- } from "@aws-sdk/client-s3";
8
- import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
9
- var ObjectStorage = class {
10
- client = new S3Client({
11
- region: "ap-northeast-2"
12
- });
13
- bucketName;
14
- constructor({ bucketName }) {
15
- this.bucketName = bucketName;
16
- }
17
- async generateSignedUrl(key, {
18
- contentType,
19
- expiresIn = 3600
20
- } = {}) {
21
- const command = new PutObjectCommand({
22
- Bucket: this.bucketName,
23
- Key: key,
24
- ContentType: contentType
25
- });
26
- const signedUrl = await getSignedUrl(this.client, command, {
27
- expiresIn
28
- });
29
- return signedUrl;
30
- }
31
- async head(key) {
32
- try {
33
- const command = new HeadObjectCommand({
34
- Bucket: this.bucketName,
35
- Key: key
36
- });
37
- await this.client.send(command);
38
- return true;
39
- } catch (error) {
40
- return false;
41
- }
42
- }
43
- async find(key) {
44
- try {
45
- const command = new GetObjectCommand({
46
- Bucket: this.bucketName,
47
- Key: key
48
- });
49
- const { Body } = await this.client.send(command);
50
- if (!Body) {
51
- return;
52
- }
53
- return Body.transformToByteArray();
54
- } catch (error) {
55
- return;
56
- }
57
- }
58
- async put(key, buffer, { contentType } = {}) {
59
- const command = new PutObjectCommand({
60
- Bucket: this.bucketName,
61
- Key: key,
62
- ContentType: contentType,
63
- Body: buffer
64
- });
65
- return await this.client.send(command);
66
- }
67
- };
68
- export {
69
- ObjectStorage
70
- };
@@ -1,20 +0,0 @@
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: ({ cdnOrigin }: {
12
- cdnOrigin: string;
13
- }) => React.FC<ResponsiveImageProps>;
14
-
15
- declare function generateSrcSet(cdnOrigin: string, 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 };
@@ -1,20 +0,0 @@
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: ({ cdnOrigin }: {
12
- cdnOrigin: string;
13
- }) => React.FC<ResponsiveImageProps>;
14
-
15
- declare function generateSrcSet(cdnOrigin: string, 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 };
@@ -1,132 +0,0 @@
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/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
-
40
- // src/file/cdn.ts
41
- var createCDN = (origin) => {
42
- return (key, { width } = {}) => {
43
- return key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : void 0;
44
- };
45
- };
46
-
47
- // src/file/responsive_image.tsx
48
- var sizes = [
49
- 64,
50
- 128,
51
- 256,
52
- 320,
53
- 480,
54
- 640,
55
- 768,
56
- 1080,
57
- 1200,
58
- 1536,
59
- 1920,
60
- 2560,
61
- 3840
62
- ];
63
- var createResponsiveImage = ({ cdnOrigin }) => {
64
- const Component = ({
65
- alt,
66
- file,
67
- ratio,
68
- ...props
69
- }) => {
70
- const src = createCDN(cdnOrigin)(file?.key) || props.src || "#";
71
- return /* @__PURE__ */ import_react.default.createElement(
72
- "img",
73
- {
74
- ...props,
75
- src,
76
- alt,
77
- srcSet: generateSrcSet(cdnOrigin, src, ratio, props)
78
- }
79
- );
80
- };
81
- return Component;
82
- };
83
- var responsive_image_default = createResponsiveImage;
84
- var generateSrc = (cdnOrigin, src, width, height, ratio, image = {}) => {
85
- const searchParams = new URLSearchParams();
86
- if (image.width) {
87
- searchParams.set("w", image.width.toString());
88
- }
89
- if (width) {
90
- searchParams.set("w", width.toString());
91
- if (ratio) {
92
- searchParams.set("h", Math.round(width / ratio).toString());
93
- }
94
- }
95
- if (image.height) {
96
- searchParams.set("h", image.height.toString());
97
- }
98
- if (height) {
99
- searchParams.set("h", height.toString());
100
- }
101
- const search = searchParams.toString() ? `?${searchParams.toString()}` : "";
102
- if (!src.includes(cdnOrigin)) {
103
- return src;
104
- }
105
- return `${encodeURI(decodeURI(src))}${search}`;
106
- };
107
- function generateSrcSet(cdnOrigin, image, ratio, props = {}) {
108
- const src = typeof image === "string" ? image : image.src;
109
- const isGif = src.endsWith(".gif");
110
- if (isGif) {
111
- return void 0;
112
- }
113
- if (props.width) {
114
- return [1, 2, 3].map((scale) => {
115
- const genWidth = Number(props.width) * scale;
116
- return `${generateSrc(
117
- cdnOrigin,
118
- src,
119
- genWidth,
120
- props.height ? Number(props.height) * scale : ratio ? Math.round(genWidth / ratio) : void 0
121
- )} ${scale}x`;
122
- }).join(", ");
123
- }
124
- return sizes.map(
125
- (size) => `${generateSrc(cdnOrigin, src, size, void 0, ratio, props)} ${size}w`
126
- ).join(", ");
127
- }
128
- // Annotate the CommonJS export names for ESM import in node:
129
- 0 && (module.exports = {
130
- createResponsiveImage,
131
- generateSrcSet
132
- });
@@ -1,96 +0,0 @@
1
- // src/file/responsive_image.tsx
2
- import React from "react";
3
-
4
- // src/file/cdn.ts
5
- var createCDN = (origin) => {
6
- return (key, { width } = {}) => {
7
- return key ? `${origin}/${key}${width ? `?w=${width}` : ""}` : void 0;
8
- };
9
- };
10
-
11
- // src/file/responsive_image.tsx
12
- var sizes = [
13
- 64,
14
- 128,
15
- 256,
16
- 320,
17
- 480,
18
- 640,
19
- 768,
20
- 1080,
21
- 1200,
22
- 1536,
23
- 1920,
24
- 2560,
25
- 3840
26
- ];
27
- var createResponsiveImage = ({ cdnOrigin }) => {
28
- const Component = ({
29
- alt,
30
- file,
31
- ratio,
32
- ...props
33
- }) => {
34
- const src = createCDN(cdnOrigin)(file?.key) || props.src || "#";
35
- return /* @__PURE__ */ React.createElement(
36
- "img",
37
- {
38
- ...props,
39
- src,
40
- alt,
41
- srcSet: generateSrcSet(cdnOrigin, src, ratio, props)
42
- }
43
- );
44
- };
45
- return Component;
46
- };
47
- var responsive_image_default = createResponsiveImage;
48
- var generateSrc = (cdnOrigin, src, width, height, ratio, image = {}) => {
49
- const searchParams = new URLSearchParams();
50
- if (image.width) {
51
- searchParams.set("w", image.width.toString());
52
- }
53
- if (width) {
54
- searchParams.set("w", width.toString());
55
- if (ratio) {
56
- searchParams.set("h", Math.round(width / ratio).toString());
57
- }
58
- }
59
- if (image.height) {
60
- searchParams.set("h", image.height.toString());
61
- }
62
- if (height) {
63
- searchParams.set("h", height.toString());
64
- }
65
- const search = searchParams.toString() ? `?${searchParams.toString()}` : "";
66
- if (!src.includes(cdnOrigin)) {
67
- return src;
68
- }
69
- return `${encodeURI(decodeURI(src))}${search}`;
70
- };
71
- function generateSrcSet(cdnOrigin, image, ratio, props = {}) {
72
- const src = typeof image === "string" ? image : image.src;
73
- const isGif = src.endsWith(".gif");
74
- if (isGif) {
75
- return void 0;
76
- }
77
- if (props.width) {
78
- return [1, 2, 3].map((scale) => {
79
- const genWidth = Number(props.width) * scale;
80
- return `${generateSrc(
81
- cdnOrigin,
82
- src,
83
- genWidth,
84
- props.height ? Number(props.height) * scale : ratio ? Math.round(genWidth / ratio) : void 0
85
- )} ${scale}x`;
86
- }).join(", ");
87
- }
88
- return sizes.map(
89
- (size) => `${generateSrc(cdnOrigin, src, size, void 0, ratio, props)} ${size}w`
90
- ).join(", ");
91
- }
92
- export {
93
- createResponsiveImage,
94
- responsive_image_default as default,
95
- generateSrcSet
96
- };
@@ -1,19 +0,0 @@
1
- declare const createJsonResponse: (status: number) => (data?: unknown, init?: ResponseInit) => Response;
2
- declare const OK: (data?: unknown, init?: ResponseInit) => Response;
3
- declare const CREATED: (data?: unknown, init?: ResponseInit) => Response;
4
- declare const ACCEPTED: (data?: unknown, init?: ResponseInit) => Response;
5
- declare const NO_CONTENT: (init?: ResponseInit) => Response;
6
- declare const createException: (status: number, defaultMessage?: unknown) => (message?: unknown, init?: ResponseInit) => Response;
7
- declare const BAD_REQUEST: (message?: unknown, init?: ResponseInit) => Response;
8
- declare const UNAUTHORIZED: (message?: unknown, init?: ResponseInit) => Response;
9
- declare const FORBIDDEN: (message?: unknown, init?: ResponseInit) => Response;
10
- declare const NOT_FOUND: (message?: unknown, init?: ResponseInit) => Response;
11
- declare const METHOD_NOT_ALLOWED: (message?: unknown, init?: ResponseInit) => Response;
12
- declare const NOT_ACCEPTABLE: (message?: unknown, init?: ResponseInit) => Response;
13
- declare const REQUEST_TIMEOUT: (message?: unknown, init?: ResponseInit) => Response;
14
- declare const CONFLICT: (message?: unknown, init?: ResponseInit) => Response;
15
- declare const UNPROCESSABLE_ENTITY: (message?: unknown, init?: ResponseInit) => Response;
16
- declare const TOO_MANY_REQUESTS: (message?: unknown, init?: ResponseInit) => Response;
17
- declare const INTERNAL_SERVER_ERROR: (message?: unknown, init?: ResponseInit) => Response;
18
-
19
- 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 };
@@ -1,19 +0,0 @@
1
- declare const createJsonResponse: (status: number) => (data?: unknown, init?: ResponseInit) => Response;
2
- declare const OK: (data?: unknown, init?: ResponseInit) => Response;
3
- declare const CREATED: (data?: unknown, init?: ResponseInit) => Response;
4
- declare const ACCEPTED: (data?: unknown, init?: ResponseInit) => Response;
5
- declare const NO_CONTENT: (init?: ResponseInit) => Response;
6
- declare const createException: (status: number, defaultMessage?: unknown) => (message?: unknown, init?: ResponseInit) => Response;
7
- declare const BAD_REQUEST: (message?: unknown, init?: ResponseInit) => Response;
8
- declare const UNAUTHORIZED: (message?: unknown, init?: ResponseInit) => Response;
9
- declare const FORBIDDEN: (message?: unknown, init?: ResponseInit) => Response;
10
- declare const NOT_FOUND: (message?: unknown, init?: ResponseInit) => Response;
11
- declare const METHOD_NOT_ALLOWED: (message?: unknown, init?: ResponseInit) => Response;
12
- declare const NOT_ACCEPTABLE: (message?: unknown, init?: ResponseInit) => Response;
13
- declare const REQUEST_TIMEOUT: (message?: unknown, init?: ResponseInit) => Response;
14
- declare const CONFLICT: (message?: unknown, init?: ResponseInit) => Response;
15
- declare const UNPROCESSABLE_ENTITY: (message?: unknown, init?: ResponseInit) => Response;
16
- declare const TOO_MANY_REQUESTS: (message?: unknown, init?: ResponseInit) => Response;
17
- declare const INTERNAL_SERVER_ERROR: (message?: unknown, init?: ResponseInit) => Response;
18
-
19
- 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 };
@@ -1,109 +0,0 @@
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/http/response.ts
21
- var response_exports = {};
22
- __export(response_exports, {
23
- ACCEPTED: () => ACCEPTED,
24
- BAD_REQUEST: () => BAD_REQUEST,
25
- CONFLICT: () => CONFLICT,
26
- CREATED: () => CREATED,
27
- FORBIDDEN: () => FORBIDDEN,
28
- INTERNAL_SERVER_ERROR: () => INTERNAL_SERVER_ERROR,
29
- METHOD_NOT_ALLOWED: () => METHOD_NOT_ALLOWED,
30
- NOT_ACCEPTABLE: () => NOT_ACCEPTABLE,
31
- NOT_FOUND: () => NOT_FOUND,
32
- NO_CONTENT: () => NO_CONTENT,
33
- OK: () => OK,
34
- REQUEST_TIMEOUT: () => REQUEST_TIMEOUT,
35
- TOO_MANY_REQUESTS: () => TOO_MANY_REQUESTS,
36
- UNAUTHORIZED: () => UNAUTHORIZED,
37
- UNPROCESSABLE_ENTITY: () => UNPROCESSABLE_ENTITY,
38
- createException: () => createException,
39
- createJsonResponse: () => createJsonResponse
40
- });
41
- module.exports = __toCommonJS(response_exports);
42
- var createJsonResponse = (status) => {
43
- return (data = {}, init) => {
44
- return Response.json(data, { status, ...init });
45
- };
46
- };
47
- var OK = createJsonResponse(200);
48
- var CREATED = createJsonResponse(201);
49
- var ACCEPTED = createJsonResponse(202);
50
- var NO_CONTENT = (init) => {
51
- return new Response(null, {
52
- ...init,
53
- status: 204
54
- });
55
- };
56
- var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
57
- return (message = defaultMessage, init) => {
58
- return createJsonResponse(status)({ message }, init);
59
- };
60
- };
61
- var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
62
- var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
63
- var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
64
- var NOT_FOUND = createException(
65
- 404,
66
- "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
67
- );
68
- var METHOD_NOT_ALLOWED = createException(
69
- 405,
70
- "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
71
- );
72
- var NOT_ACCEPTABLE = createException(
73
- 406,
74
- "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
75
- );
76
- var REQUEST_TIMEOUT = createException(
77
- 408,
78
- "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
79
- );
80
- var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
81
- var UNPROCESSABLE_ENTITY = createException(
82
- 422,
83
- "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
84
- );
85
- var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
86
- var INTERNAL_SERVER_ERROR = createException(
87
- 500,
88
- "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
89
- );
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- ACCEPTED,
93
- BAD_REQUEST,
94
- CONFLICT,
95
- CREATED,
96
- FORBIDDEN,
97
- INTERNAL_SERVER_ERROR,
98
- METHOD_NOT_ALLOWED,
99
- NOT_ACCEPTABLE,
100
- NOT_FOUND,
101
- NO_CONTENT,
102
- OK,
103
- REQUEST_TIMEOUT,
104
- TOO_MANY_REQUESTS,
105
- UNAUTHORIZED,
106
- UNPROCESSABLE_ENTITY,
107
- createException,
108
- createJsonResponse
109
- });
@@ -1,68 +0,0 @@
1
- // src/http/response.ts
2
- var createJsonResponse = (status) => {
3
- return (data = {}, init) => {
4
- return Response.json(data, { status, ...init });
5
- };
6
- };
7
- var OK = createJsonResponse(200);
8
- var CREATED = createJsonResponse(201);
9
- var ACCEPTED = createJsonResponse(202);
10
- var NO_CONTENT = (init) => {
11
- return new Response(null, {
12
- ...init,
13
- status: 204
14
- });
15
- };
16
- var createException = (status, defaultMessage = "\uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.") => {
17
- return (message = defaultMessage, init) => {
18
- return createJsonResponse(status)({ message }, init);
19
- };
20
- };
21
- var BAD_REQUEST = createException(400, "\uC694\uCCAD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.");
22
- var UNAUTHORIZED = createException(401, "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.");
23
- var FORBIDDEN = createException(403, "\uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.");
24
- var NOT_FOUND = createException(
25
- 404,
26
- "\uC694\uCCAD\uD55C \uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
27
- );
28
- var METHOD_NOT_ALLOWED = createException(
29
- 405,
30
- "\uBA54\uC11C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
31
- );
32
- var NOT_ACCEPTABLE = createException(
33
- 406,
34
- "\uC694\uCCAD\uD55C \uD615\uC2DD\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
35
- );
36
- var REQUEST_TIMEOUT = createException(
37
- 408,
38
- "\uC694\uCCAD \uC2DC\uAC04\uC774 \uCD08\uACFC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."
39
- );
40
- var CONFLICT = createException(409, "\uC694\uCCAD\uC774 \uCDA9\uB3CC\uD588\uC2B5\uB2C8\uB2E4.");
41
- var UNPROCESSABLE_ENTITY = createException(
42
- 422,
43
- "\uCC98\uB9AC\uD560 \uC218 \uC5C6\uB294 \uC5D4\uD2F0\uD2F0\uC785\uB2C8\uB2E4."
44
- );
45
- var TOO_MANY_REQUESTS = createException(429, "\uC694\uCCAD\uC774 \uB108\uBB34 \uB9CE\uC2B5\uB2C8\uB2E4.");
46
- var INTERNAL_SERVER_ERROR = createException(
47
- 500,
48
- "\uC608\uAE30\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."
49
- );
50
- export {
51
- ACCEPTED,
52
- BAD_REQUEST,
53
- CONFLICT,
54
- CREATED,
55
- FORBIDDEN,
56
- INTERNAL_SERVER_ERROR,
57
- METHOD_NOT_ALLOWED,
58
- NOT_ACCEPTABLE,
59
- NOT_FOUND,
60
- NO_CONTENT,
61
- OK,
62
- REQUEST_TIMEOUT,
63
- TOO_MANY_REQUESTS,
64
- UNAUTHORIZED,
65
- UNPROCESSABLE_ENTITY,
66
- createException,
67
- createJsonResponse
68
- };
@@ -1,21 +0,0 @@
1
- import { AuthService } from '../auth/auth_service.mjs';
2
- import { FileService } from '../file/file_service.mjs';
3
- import { ThirdpartyAuth } from '../auth/thirdparty_auth.mjs';
4
- import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
5
- import { PasswordRecoveryService } from '../auth/password_recovery.mjs';
6
- import 'jose';
7
- import '../auth/jwt_manager.mjs';
8
- import '../file/object_storage.mjs';
9
- import '@aws-sdk/client-s3';
10
- import '../auth/auth_repository.mjs';
11
- import '../file/file_repository.mjs';
12
-
13
- declare const createAPIHandler: <TFile>({ authService, fileService, passwordRecoveryService, getThirdPartyAuth, signupTokenSecret, }: {
14
- authService: AuthService<TFile>;
15
- fileService: FileService<TFile>;
16
- passwordRecoveryService: PasswordRecoveryService;
17
- getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
18
- signupTokenSecret: string;
19
- }) => ({ request, params }: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response>;
20
-
21
- export { createAPIHandler };