dn-react-router-toolkit 0.1.1 → 0.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/auth-kit/apple_auth.d.mts +24 -0
- package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
- package/dist/auth-kit/apple_auth.js +75 -0
- package/dist/auth-kit/apple_auth.mjs +50 -0
- package/dist/auth-kit/auth_service.d.mts +73 -0
- package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
- package/dist/auth-kit/auth_service.js +257 -0
- package/dist/auth-kit/auth_service.mjs +218 -0
- package/dist/auth-kit/client/google_login_button.d.mts +9 -0
- package/dist/auth-kit/client/google_login_button.d.ts +9 -0
- package/dist/auth-kit/client/google_login_button.js +67 -0
- package/dist/auth-kit/client/google_login_button.mjs +32 -0
- package/dist/auth-kit/client/redirect_page.d.mts +5 -0
- package/dist/auth-kit/client/redirect_page.d.ts +5 -0
- package/dist/auth-kit/client/redirect_page.js +53 -0
- package/dist/auth-kit/client/redirect_page.mjs +18 -0
- package/dist/auth-kit/google_auth.d.mts +27 -0
- package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
- package/dist/auth-kit/google_auth.js +144 -0
- package/dist/auth-kit/google_auth.mjs +117 -0
- package/dist/auth-kit/jwt.d.mts +18 -0
- package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
- package/dist/auth-kit/jwt.js +76 -0
- package/dist/auth-kit/jwt.mjs +51 -0
- package/dist/auth-kit/kakao_auth.d.mts +24 -0
- package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
- package/dist/auth-kit/kakao_auth.js +115 -0
- package/dist/auth-kit/kakao_auth.mjs +88 -0
- package/dist/auth-kit/repository.d.mts +42 -0
- package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
- package/dist/auth-kit/repository.js +18 -0
- package/dist/auth-kit/repository.mjs +0 -0
- package/dist/auth-kit/with_auth.d.mts +17 -0
- package/dist/auth-kit/with_auth.d.ts +17 -0
- package/dist/auth-kit/with_auth.js +108 -0
- package/dist/auth-kit/with_auth.mjs +71 -0
- package/dist/cn.d.mts +3 -0
- package/dist/cn.d.ts +3 -0
- package/dist/cn.js +32 -0
- package/dist/cn.mjs +7 -0
- package/dist/components/index.d.mts +5 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +261 -0
- package/dist/components/index.mjs +219 -0
- package/dist/components/modal/fullscreen_container.d.mts +7 -0
- package/dist/components/modal/fullscreen_container.d.ts +7 -0
- package/dist/components/modal/fullscreen_container.js +102 -0
- package/dist/components/modal/fullscreen_container.mjs +68 -0
- package/dist/components/modal/hooks.d.mts +18 -0
- package/dist/components/modal/hooks.d.ts +18 -0
- package/dist/components/modal/hooks.js +236 -0
- package/dist/components/modal/hooks.mjs +204 -0
- package/dist/components/modal/index.d.mts +4 -0
- package/dist/components/modal/index.d.ts +4 -0
- package/dist/components/modal/index.js +238 -0
- package/dist/components/modal/index.mjs +203 -0
- package/dist/components/modal/modal.d.mts +13 -0
- package/dist/components/modal/modal.d.ts +13 -0
- package/dist/components/modal/modal.js +155 -0
- package/dist/components/modal/modal.mjs +130 -0
- package/dist/components/styles.d.mts +9 -0
- package/dist/components/styles.d.ts +9 -0
- package/dist/components/styles.js +48 -0
- package/dist/components/styles.mjs +17 -0
- package/dist/date.d.mts +3 -0
- package/dist/date.d.ts +3 -0
- package/dist/date.js +63 -0
- package/dist/date.mjs +28 -0
- package/dist/file-kit/cdn.d.mts +5 -0
- package/dist/file-kit/cdn.d.ts +5 -0
- package/dist/file-kit/cdn.js +34 -0
- package/dist/file-kit/cdn.mjs +9 -0
- package/dist/file-kit/client/drop_file_input.d.mts +33 -0
- package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +10 -8
- package/dist/file-kit/client/drop_file_input.js +235 -0
- package/dist/file-kit/client/drop_file_input.mjs +205 -0
- package/dist/file-kit/client/file_uploader.d.mts +13 -0
- package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
- package/dist/file-kit/client/file_uploader.js +115 -0
- package/dist/file-kit/client/file_uploader.mjs +90 -0
- package/dist/file-kit/file_service.d.mts +26 -0
- package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
- package/dist/file-kit/file_service.js +60 -0
- package/dist/file-kit/file_service.mjs +35 -0
- package/dist/file-kit/object_storage.d.mts +17 -0
- package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
- package/dist/file-kit/object_storage.js +78 -0
- package/dist/file-kit/object_storage.mjs +57 -0
- package/dist/file-kit/repository.d.mts +16 -0
- package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
- package/dist/file-kit/repository.js +18 -0
- package/dist/file-kit/repository.mjs +0 -0
- package/dist/file-kit/responsive_image.d.mts +20 -0
- package/dist/file-kit/responsive_image.d.ts +20 -0
- package/dist/file-kit/responsive_image.js +123 -0
- package/dist/file-kit/responsive_image.mjs +87 -0
- package/dist/http-kit/index.d.mts +1 -0
- package/dist/http-kit/index.d.ts +1 -0
- package/dist/http-kit/index.js +111 -0
- package/dist/http-kit/index.mjs +68 -0
- package/dist/http-kit/response.d.mts +19 -0
- package/dist/http-kit/response.d.ts +19 -0
- package/dist/http-kit/response.js +109 -0
- package/dist/http-kit/response.mjs +68 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +91 -0
- package/dist/index.mjs +51 -0
- package/dist/route/api/auth/login/[provider]/route.js +113 -0
- package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
- package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
- package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
- package/dist/route/api/auth/login/route.d.mts +14 -0
- package/dist/route/api/auth/login/route.d.ts +14 -0
- package/dist/route/api/auth/login/route.js +107 -0
- package/dist/route/api/auth/login/route.mjs +80 -0
- package/dist/route/api/auth/logout/route.d.mts +14 -0
- package/dist/route/api/auth/logout/route.d.ts +14 -0
- package/dist/route/api/auth/logout/route.js +98 -0
- package/dist/route/api/auth/logout/route.mjs +71 -0
- package/dist/route/api/auth/refresh/route.d.mts +13 -0
- package/dist/route/api/auth/refresh/route.d.ts +13 -0
- package/dist/route/api/auth/refresh/route.js +92 -0
- package/dist/route/api/auth/refresh/route.mjs +65 -0
- package/dist/route/api/auth/route.d.mts +13 -0
- package/dist/route/api/auth/route.d.ts +13 -0
- package/dist/route/api/auth/route.js +82 -0
- package/dist/route/api/auth/route.mjs +55 -0
- package/dist/route/api/files/[fileId]/route.js +99 -0
- package/dist/route/api/files/[fileId]/route.mjs +72 -0
- package/dist/route/api/files/_fileId_/route.d.mts +17 -0
- package/dist/route/api/files/_fileId_/route.d.ts +17 -0
- package/dist/route/api/files/route.d.mts +16 -0
- package/dist/route/api/files/route.d.ts +16 -0
- package/dist/route/api/files/route.js +106 -0
- package/dist/route/api/files/route.mjs +79 -0
- package/dist/route/api.d.mts +29 -0
- package/dist/route/api.d.ts +29 -0
- package/dist/route/api.js +395 -0
- package/dist/route/api.mjs +368 -0
- package/dist/route/auth/callback/[provider]/route.js +120 -0
- package/dist/route/auth/callback/[provider]/route.mjs +93 -0
- package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
- package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
- package/dist/seo-kit/index.d.mts +6 -0
- package/dist/seo-kit/index.d.ts +6 -0
- package/dist/seo-kit/index.js +321 -0
- package/dist/seo-kit/index.mjs +282 -0
- package/dist/seo-kit/loader.d.mts +7 -0
- package/dist/seo-kit/loader.d.ts +7 -0
- package/dist/seo-kit/loader.js +43 -0
- package/dist/seo-kit/loader.mjs +18 -0
- package/dist/seo-kit/seo.d.mts +103 -0
- package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +10 -6
- package/dist/seo-kit/seo.js +286 -0
- package/dist/seo-kit/seo.mjs +251 -0
- package/dist/seo-kit/seo_loader.d.mts +16 -0
- package/dist/seo-kit/seo_loader.d.ts +16 -0
- package/dist/seo-kit/seo_loader.js +68 -0
- package/dist/seo-kit/seo_loader.mjs +31 -0
- package/dist/singleton.d.mts +3 -0
- package/dist/singleton.d.ts +3 -0
- package/dist/singleton.js +37 -0
- package/dist/singleton.mjs +12 -0
- package/dist/slug.d.mts +3 -0
- package/dist/slug.d.ts +3 -0
- package/dist/slug.js +32 -0
- package/dist/slug.mjs +7 -0
- package/package.json +36 -34
- package/tsup.config.ts +9 -0
- package/dist/cjs/auth-kit/apple_auth.js +0 -61
- package/dist/cjs/auth-kit/auth_service.js +0 -204
- package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
- package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
- package/dist/cjs/auth-kit/google_auth.js +0 -69
- package/dist/cjs/auth-kit/jwt.js +0 -54
- package/dist/cjs/auth-kit/kakao_auth.js +0 -43
- package/dist/cjs/auth-kit/repository.js +0 -2
- package/dist/cjs/auth-kit/with_auth.js +0 -46
- package/dist/cjs/cn.js +0 -6
- package/dist/cjs/components/index.js +0 -18
- package/dist/cjs/components/modal/fullscreen_container.js +0 -49
- package/dist/cjs/components/modal/hooks.js +0 -76
- package/dist/cjs/components/modal/index.js +0 -19
- package/dist/cjs/components/modal/modal.js +0 -79
- package/dist/cjs/components/styles.js +0 -10
- package/dist/cjs/date.js +0 -31
- package/dist/cjs/file-kit/cdn.js +0 -9
- package/dist/cjs/file-kit/client/drop_file_input.js +0 -148
- package/dist/cjs/file-kit/client/file_uploader.js +0 -88
- package/dist/cjs/file-kit/file_service.js +0 -32
- package/dist/cjs/file-kit/object_storage.js +0 -51
- package/dist/cjs/file-kit/repository.js +0 -2
- package/dist/cjs/file-kit/responsive_image.js +0 -63
- package/dist/cjs/http-kit/index.js +0 -17
- package/dist/cjs/http-kit/response.js +0 -37
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
- package/dist/cjs/route/api/auth/login/route.js +0 -35
- package/dist/cjs/route/api/auth/logout/route.js +0 -22
- package/dist/cjs/route/api/auth/refresh/route.js +0 -22
- package/dist/cjs/route/api/auth/route.js +0 -12
- package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
- package/dist/cjs/route/api/files/route.js +0 -34
- package/dist/cjs/route/auth/callback/[provider]/route.js +0 -38
- package/dist/cjs/route/index.js +0 -80
- package/dist/cjs/seo-kit/index.js +0 -19
- package/dist/cjs/seo-kit/loader.js +0 -17
- package/dist/cjs/seo-kit/seo.js +0 -278
- package/dist/cjs/seo-kit/seo_loader.js +0 -15
- package/dist/cjs/singleton.js +0 -12
- package/dist/cjs/slug.js +0 -10
- package/dist/esm/auth-kit/apple_auth.js +0 -57
- package/dist/esm/auth-kit/auth_service.js +0 -197
- package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
- package/dist/esm/auth-kit/client/google_login_button.js +0 -16
- package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
- package/dist/esm/auth-kit/client/redirect_page.js +0 -15
- package/dist/esm/auth-kit/google_auth.js +0 -65
- package/dist/esm/auth-kit/jwt.js +0 -50
- package/dist/esm/auth-kit/kakao_auth.js +0 -39
- package/dist/esm/auth-kit/repository.js +0 -1
- package/dist/esm/auth-kit/with_auth.d.ts +0 -12
- package/dist/esm/auth-kit/with_auth.js +0 -43
- package/dist/esm/cn.d.ts +0 -1
- package/dist/esm/cn.js +0 -3
- package/dist/esm/components/index.d.ts +0 -2
- package/dist/esm/components/index.js +0 -2
- package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
- package/dist/esm/components/modal/fullscreen_container.js +0 -45
- package/dist/esm/components/modal/hooks.d.ts +0 -15
- package/dist/esm/components/modal/hooks.js +0 -67
- package/dist/esm/components/modal/index.d.ts +0 -3
- package/dist/esm/components/modal/index.js +0 -3
- package/dist/esm/components/modal/modal.d.ts +0 -10
- package/dist/esm/components/modal/modal.js +0 -43
- package/dist/esm/components/styles.d.ts +0 -7
- package/dist/esm/components/styles.js +0 -7
- package/dist/esm/date.d.ts +0 -1
- package/dist/esm/date.js +0 -24
- package/dist/esm/file-kit/cdn.d.ts +0 -3
- package/dist/esm/file-kit/cdn.js +0 -5
- package/dist/esm/file-kit/client/drop_file_input.js +0 -144
- package/dist/esm/file-kit/client/file_uploader.js +0 -84
- package/dist/esm/file-kit/file_service.js +0 -28
- package/dist/esm/file-kit/object_storage.js +0 -47
- package/dist/esm/file-kit/repository.js +0 -1
- package/dist/esm/file-kit/responsive_image.d.ts +0 -17
- package/dist/esm/file-kit/responsive_image.js +0 -58
- package/dist/esm/http-kit/index.d.ts +0 -1
- package/dist/esm/http-kit/index.js +0 -1
- package/dist/esm/http-kit/response.d.ts +0 -17
- package/dist/esm/http-kit/response.js +0 -31
- package/dist/esm/index.d.ts +0 -4
- package/dist/esm/index.js +0 -4
- package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
- package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
- package/dist/esm/route/api/auth/login/route.d.ts +0 -6
- package/dist/esm/route/api/auth/login/route.js +0 -31
- package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
- package/dist/esm/route/api/auth/logout/route.js +0 -18
- package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
- package/dist/esm/route/api/auth/refresh/route.js +0 -18
- package/dist/esm/route/api/auth/route.d.ts +0 -4
- package/dist/esm/route/api/auth/route.js +0 -8
- package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
- package/dist/esm/route/api/files/[fileId]/route.js +0 -16
- package/dist/esm/route/api/files/route.d.ts +0 -6
- package/dist/esm/route/api/files/route.js +0 -30
- package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
- package/dist/esm/route/auth/callback/[provider]/route.js +0 -34
- package/dist/esm/route/index.d.ts +0 -22
- package/dist/esm/route/index.js +0 -76
- package/dist/esm/seo-kit/index.d.ts +0 -3
- package/dist/esm/seo-kit/index.js +0 -3
- package/dist/esm/seo-kit/loader.d.ts +0 -5
- package/dist/esm/seo-kit/loader.js +0 -14
- package/dist/esm/seo-kit/seo.js +0 -275
- package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
- package/dist/esm/seo-kit/seo_loader.js +0 -12
- package/dist/esm/singleton.d.ts +0 -1
- package/dist/esm/singleton.js +0 -9
- package/dist/esm/slug.d.ts +0 -1
- package/dist/esm/slug.js +0 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LoaderFn } from './loader.js';
|
|
2
|
+
import * as react_router from 'react-router';
|
|
3
|
+
import React, { JSX } from 'react';
|
|
4
|
+
import { SEO } from './seo.js';
|
|
5
|
+
import 'schema-dts';
|
|
6
|
+
|
|
7
|
+
declare function createSEOLoader<T, U extends JSX.IntrinsicAttributes & {
|
|
8
|
+
seo: SEO;
|
|
9
|
+
}>(fn?: LoaderFn<T, U>): {
|
|
10
|
+
meta: (props: T) => Promise<react_router.MetaFunction<unknown, Record<string, unknown>>>;
|
|
11
|
+
Page(Fc: React.FC<U>): (props: T) => Promise<JSX.Element>;
|
|
12
|
+
getData(): U;
|
|
13
|
+
wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { createSEOLoader };
|
|
@@ -0,0 +1,68 @@
|
|
|
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/seo-kit/seo_loader.tsx
|
|
31
|
+
var seo_loader_exports = {};
|
|
32
|
+
__export(seo_loader_exports, {
|
|
33
|
+
createSEOLoader: () => createSEOLoader
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(seo_loader_exports);
|
|
36
|
+
|
|
37
|
+
// src/seo-kit/loader.ts
|
|
38
|
+
function createLoader(fn = () => ({})) {
|
|
39
|
+
let loadedData;
|
|
40
|
+
return {
|
|
41
|
+
getData() {
|
|
42
|
+
return loadedData;
|
|
43
|
+
},
|
|
44
|
+
wrap(mapper) {
|
|
45
|
+
return async function Thing(props) {
|
|
46
|
+
loadedData = await fn(props);
|
|
47
|
+
return mapper(loadedData);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/seo-kit/seo_loader.tsx
|
|
54
|
+
var import_react = __toESM(require("react"));
|
|
55
|
+
function createSEOLoader(fn = () => ({})) {
|
|
56
|
+
const loader = createLoader(fn);
|
|
57
|
+
return {
|
|
58
|
+
...loader,
|
|
59
|
+
meta: loader.wrap((data) => data.seo.meta),
|
|
60
|
+
Page(Fc) {
|
|
61
|
+
return loader.wrap((data) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.seo?.generateJSONLD(), /* @__PURE__ */ import_react.default.createElement(Fc, { ...data })));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
createSEOLoader
|
|
68
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/seo-kit/loader.ts
|
|
2
|
+
function createLoader(fn = () => ({})) {
|
|
3
|
+
let loadedData;
|
|
4
|
+
return {
|
|
5
|
+
getData() {
|
|
6
|
+
return loadedData;
|
|
7
|
+
},
|
|
8
|
+
wrap(mapper) {
|
|
9
|
+
return async function Thing(props) {
|
|
10
|
+
loadedData = await fn(props);
|
|
11
|
+
return mapper(loadedData);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/seo-kit/seo_loader.tsx
|
|
18
|
+
import React from "react";
|
|
19
|
+
function createSEOLoader(fn = () => ({})) {
|
|
20
|
+
const loader = createLoader(fn);
|
|
21
|
+
return {
|
|
22
|
+
...loader,
|
|
23
|
+
meta: loader.wrap((data) => data.seo.meta),
|
|
24
|
+
Page(Fc) {
|
|
25
|
+
return loader.wrap((data) => /* @__PURE__ */ React.createElement(React.Fragment, null, data.seo?.generateJSONLD(), /* @__PURE__ */ React.createElement(Fc, { ...data })));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
createSEOLoader
|
|
31
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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/singleton.ts
|
|
21
|
+
var singleton_exports = {};
|
|
22
|
+
__export(singleton_exports, {
|
|
23
|
+
singleton: () => singleton
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(singleton_exports);
|
|
26
|
+
function singleton(name, fn) {
|
|
27
|
+
const globalAny = globalThis;
|
|
28
|
+
globalAny.__singletons = globalAny.__singletons || {};
|
|
29
|
+
if (!globalAny.__singletons[name]) {
|
|
30
|
+
globalAny.__singletons[name] = fn();
|
|
31
|
+
}
|
|
32
|
+
return globalAny.__singletons[name];
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
singleton
|
|
37
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/singleton.ts
|
|
2
|
+
function singleton(name, fn) {
|
|
3
|
+
const globalAny = globalThis;
|
|
4
|
+
globalAny.__singletons = globalAny.__singletons || {};
|
|
5
|
+
if (!globalAny.__singletons[name]) {
|
|
6
|
+
globalAny.__singletons[name] = fn();
|
|
7
|
+
}
|
|
8
|
+
return globalAny.__singletons[name];
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
singleton
|
|
12
|
+
};
|
package/dist/slug.d.mts
ADDED
package/dist/slug.d.ts
ADDED
package/dist/slug.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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/slug.ts
|
|
21
|
+
var slug_exports = {};
|
|
22
|
+
__export(slug_exports, {
|
|
23
|
+
toSlug: () => toSlug
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(slug_exports);
|
|
26
|
+
var toSlug = (str) => {
|
|
27
|
+
return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
toSlug
|
|
32
|
+
});
|
package/dist/slug.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dn-react-router-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"types": "./dist/
|
|
5
|
-
"main": "./dist/
|
|
6
|
-
"module": "./dist/
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.mjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
"require": "./dist/
|
|
12
|
-
},
|
|
13
|
-
"./route": {
|
|
14
|
-
"types": "./dist/esm/route/index.d.ts",
|
|
15
|
-
"import": "./dist/esm/route/index.js",
|
|
16
|
-
"require": "./dist/cjs/route/index.js"
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.js"
|
|
17
12
|
},
|
|
18
13
|
"./auth-kit/*": {
|
|
19
|
-
"types": "./dist/
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"require": "./dist/
|
|
14
|
+
"types": "./dist/auth-kit/*.d.ts",
|
|
15
|
+
"import": "./dist/auth-kit/*.mjs",
|
|
16
|
+
"require": "./dist/auth-kit/*.js"
|
|
17
|
+
},
|
|
18
|
+
"./file-kit/*": {
|
|
19
|
+
"types": "./dist/file-kit/*.d.ts",
|
|
20
|
+
"import": "./dist/file-kit/*.mjs",
|
|
21
|
+
"require": "./dist/file-kit/*.js"
|
|
22
22
|
},
|
|
23
|
-
"./
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"import": "./dist/
|
|
26
|
-
"require": "./dist/
|
|
23
|
+
"./route/*": {
|
|
24
|
+
"types": "./dist/route/*.d.ts",
|
|
25
|
+
"import": "./dist/route/*.mjs",
|
|
26
|
+
"require": "./dist/route/*.js"
|
|
27
27
|
},
|
|
28
|
-
"./
|
|
29
|
-
"types": "./dist/
|
|
30
|
-
"import": "./dist/
|
|
31
|
-
"require": "./dist/
|
|
28
|
+
"./components/*": {
|
|
29
|
+
"types": "./dist/components/*.d.ts",
|
|
30
|
+
"import": "./dist/components/*.mjs",
|
|
31
|
+
"require": "./dist/components/*.js"
|
|
32
32
|
},
|
|
33
|
-
"./
|
|
34
|
-
"types": "./dist/
|
|
35
|
-
"import": "./dist/
|
|
36
|
-
"require": "./dist/
|
|
33
|
+
"./http-kit/*": {
|
|
34
|
+
"types": "./dist/http-kit/*.d.ts",
|
|
35
|
+
"import": "./dist/http-kit/*.mjs",
|
|
36
|
+
"require": "./dist/http-kit/*.js"
|
|
37
37
|
},
|
|
38
|
-
"./seo-kit": {
|
|
39
|
-
"types": "./dist/
|
|
40
|
-
"import": "./dist/
|
|
41
|
-
"require": "./dist/
|
|
38
|
+
"./seo-kit/*": {
|
|
39
|
+
"types": "./dist/seo-kit/*.d.ts",
|
|
40
|
+
"import": "./dist/seo-kit/*.mjs",
|
|
41
|
+
"require": "./dist/seo-kit/*.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
|
-
"build": "
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch"
|
|
46
47
|
},
|
|
47
48
|
"repository": {
|
|
48
49
|
"type": "git",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"@types/react-dom": "^19",
|
|
62
63
|
"rimraf": "^6.0.1",
|
|
63
64
|
"schema-dts": "^1.1.5",
|
|
65
|
+
"tsup": "^8.5.1",
|
|
64
66
|
"typescript": "^5.7.3"
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|
|
@@ -74,8 +76,8 @@
|
|
|
74
76
|
},
|
|
75
77
|
"peerDependencies": {
|
|
76
78
|
"drizzle-orm": "^0.44",
|
|
77
|
-
"react-router": "^7",
|
|
78
79
|
"react": "^19",
|
|
79
|
-
"react-dom": "^19"
|
|
80
|
+
"react-dom": "^19",
|
|
81
|
+
"react-router": "^7"
|
|
80
82
|
}
|
|
81
83
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ["src/**/*.ts", "src/**/*.tsx"], // Your entry file(s)
|
|
5
|
+
format: ["cjs", "esm"], // Output both CommonJS (.cjs) and ESM (.js/.mjs)
|
|
6
|
+
dts: true, // Generate .d.ts files for both formats
|
|
7
|
+
splitting: false,
|
|
8
|
+
clean: true, // Clean dist folder before build
|
|
9
|
+
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppleAuth = void 0;
|
|
4
|
-
const jose_1 = require("jose");
|
|
5
|
-
class AppleAuth {
|
|
6
|
-
AUTH;
|
|
7
|
-
constructor(AUTH) {
|
|
8
|
-
this.AUTH = AUTH;
|
|
9
|
-
}
|
|
10
|
-
async signIn(code, type = "web") {
|
|
11
|
-
const url = "https://appleid.apple.com/auth/token";
|
|
12
|
-
const client_secret = await this.generateAppleClientSecret(type);
|
|
13
|
-
const res = await fetch(url, {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: {
|
|
16
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
17
|
-
},
|
|
18
|
-
body: new URLSearchParams({
|
|
19
|
-
client_id: type === "web"
|
|
20
|
-
? process.env.APPLE_SERVICE_ID
|
|
21
|
-
: process.env.APPLE_CLIENT_ID,
|
|
22
|
-
client_secret,
|
|
23
|
-
code,
|
|
24
|
-
grant_type: "authorization_code",
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
if (!res.ok) {
|
|
28
|
-
console.error(await res.text());
|
|
29
|
-
throw new Error("Apple 인증에 실패했습니다.");
|
|
30
|
-
}
|
|
31
|
-
const data = await res.json();
|
|
32
|
-
const { id_token } = data;
|
|
33
|
-
const payload = (0, jose_1.decodeJwt)(id_token);
|
|
34
|
-
const { sub, email, name } = payload;
|
|
35
|
-
const user = await this.AUTH.getOrCreateUser("apple", {
|
|
36
|
-
id: sub,
|
|
37
|
-
email,
|
|
38
|
-
name,
|
|
39
|
-
});
|
|
40
|
-
const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
|
|
41
|
-
return { user, accessToken, refreshToken };
|
|
42
|
-
}
|
|
43
|
-
async generateAppleClientSecret(type = "web") {
|
|
44
|
-
const authKey = process.env.APPLE_AUTH_KEY;
|
|
45
|
-
const teamId = process.env.APPLE_TEAM_ID;
|
|
46
|
-
const keyId = process.env.APPLE_KEY_ID;
|
|
47
|
-
const clientId = type === "web"
|
|
48
|
-
? process.env.APPLE_SERVICE_ID
|
|
49
|
-
: process.env.APPLE_CLIENT_ID;
|
|
50
|
-
const keyObject = await (0, jose_1.importPKCS8)(authKey, "ES256");
|
|
51
|
-
return new jose_1.SignJWT()
|
|
52
|
-
.setProtectedHeader({ alg: "ES256", kid: keyId })
|
|
53
|
-
.setIssuedAt()
|
|
54
|
-
.setIssuer(teamId)
|
|
55
|
-
.setExpirationTime("1h")
|
|
56
|
-
.setAudience("https://appleid.apple.com")
|
|
57
|
-
.setSubject(clientId)
|
|
58
|
-
.sign(keyObject);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.AppleAuth = AppleAuth;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AuthService = exports.REFRESH_TOKEN_COOKIE = exports.ACCESS_TOKEN_COOKIE = exports.REFRESH_TOKEN_KEY = exports.ACCESS_TOKEN_KEY = void 0;
|
|
7
|
-
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
8
|
-
const uuid_1 = require("uuid");
|
|
9
|
-
const react_router_1 = require("react-router");
|
|
10
|
-
exports.ACCESS_TOKEN_KEY = "access_token";
|
|
11
|
-
exports.REFRESH_TOKEN_KEY = "refresh_token";
|
|
12
|
-
exports.ACCESS_TOKEN_COOKIE = (0, react_router_1.createCookie)(exports.ACCESS_TOKEN_KEY, {
|
|
13
|
-
path: "/",
|
|
14
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
15
|
-
secure: process.env.NODE_ENV === "production",
|
|
16
|
-
sameSite: "strict",
|
|
17
|
-
});
|
|
18
|
-
exports.REFRESH_TOKEN_COOKIE = (0, react_router_1.createCookie)(exports.REFRESH_TOKEN_KEY, {
|
|
19
|
-
path: "/",
|
|
20
|
-
httpOnly: process.env.NODE_ENV === "production",
|
|
21
|
-
secure: process.env.NODE_ENV === "production",
|
|
22
|
-
sameSite: "strict",
|
|
23
|
-
});
|
|
24
|
-
class AuthService {
|
|
25
|
-
repository;
|
|
26
|
-
JWT_MANAGER;
|
|
27
|
-
OBJECT_STORAGE;
|
|
28
|
-
constructor({ repository, JWT_MANAGER, OBJECT_STORAGE, }) {
|
|
29
|
-
this.repository = repository;
|
|
30
|
-
this.JWT_MANAGER = JWT_MANAGER;
|
|
31
|
-
this.OBJECT_STORAGE = OBJECT_STORAGE;
|
|
32
|
-
}
|
|
33
|
-
async verify(request) {
|
|
34
|
-
const accessToken = request?.headers.get("Authorization")?.replace("Bearer ", "") ||
|
|
35
|
-
(await this.getAccessTokenFromCookies(request));
|
|
36
|
-
if (accessToken) {
|
|
37
|
-
return this.JWT_MANAGER.verifyAccessToken(accessToken);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async verifyOrRefresh(request) {
|
|
41
|
-
const payload = await this.verify(request);
|
|
42
|
-
if (payload) {
|
|
43
|
-
return payload;
|
|
44
|
-
}
|
|
45
|
-
return this.refresh(request);
|
|
46
|
-
}
|
|
47
|
-
async getAccessTokenFromCookies(request) {
|
|
48
|
-
const cookieStore = await exports.ACCESS_TOKEN_COOKIE.parse(request.headers.get("cookie"));
|
|
49
|
-
return cookieStore.get(exports.ACCESS_TOKEN_KEY)?.value;
|
|
50
|
-
}
|
|
51
|
-
async getRefreshTokenFromCookies(request) {
|
|
52
|
-
const cookieStore = await exports.REFRESH_TOKEN_COOKIE.parse(request.headers.get("cookie"));
|
|
53
|
-
return cookieStore.get(exports.REFRESH_TOKEN_KEY)?.value;
|
|
54
|
-
}
|
|
55
|
-
async refresh(request) {
|
|
56
|
-
const refreshToken = await this.getRefreshTokenFromCookies(request);
|
|
57
|
-
if (refreshToken) {
|
|
58
|
-
try {
|
|
59
|
-
const refreshedAccessToken = await this.refreshAccessToken(refreshToken);
|
|
60
|
-
await this.getAccessTokenSetCookie(refreshedAccessToken);
|
|
61
|
-
const payload = this.JWT_MANAGER.decode(refreshedAccessToken);
|
|
62
|
-
if (payload) {
|
|
63
|
-
return payload;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
if (e instanceof Error) {
|
|
68
|
-
console.log(e.message);
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async signIn({ id, password }) {
|
|
75
|
-
const credential = await this.repository.findCredentialById(id);
|
|
76
|
-
if (!credential) {
|
|
77
|
-
throw Error("아이디 또는 비밀번호가 틀렸습니다.");
|
|
78
|
-
}
|
|
79
|
-
if (!(await bcryptjs_1.default.compare(password, credential.password))) {
|
|
80
|
-
throw Error("아이디 또는 비밀번호가 틀렸습니다.");
|
|
81
|
-
}
|
|
82
|
-
const user = await this.repository.findUserById(credential.userId);
|
|
83
|
-
if (!user) {
|
|
84
|
-
throw Error("회원 정보를 찾을 수 없습니다.");
|
|
85
|
-
}
|
|
86
|
-
const { accessToken, refreshToken } = await this.issueTokenPair(user);
|
|
87
|
-
return {
|
|
88
|
-
accessToken,
|
|
89
|
-
refreshToken,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
async issueAccessToken(user) {
|
|
93
|
-
return this.JWT_MANAGER.signAccessToken({
|
|
94
|
-
userId: user.id,
|
|
95
|
-
role: user.role,
|
|
96
|
-
name: user.name,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
async issueTokenPair(user) {
|
|
100
|
-
const refreshToken = await this.JWT_MANAGER.signRefreshToken({
|
|
101
|
-
userId: user.id,
|
|
102
|
-
role: user.role,
|
|
103
|
-
name: user.name,
|
|
104
|
-
});
|
|
105
|
-
await this.repository.updateUserRefreshToken(user.id, await bcryptjs_1.default.hash(refreshToken, 10));
|
|
106
|
-
const accessToken = await this.issueAccessToken(user);
|
|
107
|
-
return { refreshToken, accessToken };
|
|
108
|
-
}
|
|
109
|
-
async refreshAccessToken(refreshToken) {
|
|
110
|
-
const payload = await this.JWT_MANAGER.verifyRefreshToken(refreshToken);
|
|
111
|
-
if (!payload) {
|
|
112
|
-
throw new Error("토큰이 유효하지 않습니다.");
|
|
113
|
-
}
|
|
114
|
-
const { userId } = payload;
|
|
115
|
-
if (typeof userId !== "string") {
|
|
116
|
-
throw new Error("토큰이 유효하지 않습니다.");
|
|
117
|
-
}
|
|
118
|
-
const user = await this.repository.findUserById(userId);
|
|
119
|
-
if (!user) {
|
|
120
|
-
throw Error("이용자를 찾지 못했습니다.");
|
|
121
|
-
}
|
|
122
|
-
if (!user.refreshToken) {
|
|
123
|
-
throw Error("인증 정보를 찾지 못했습니다.");
|
|
124
|
-
}
|
|
125
|
-
if (await bcryptjs_1.default.compare(user.refreshToken, refreshToken)) {
|
|
126
|
-
throw Error("토큰이 유효하지 않습니다.");
|
|
127
|
-
}
|
|
128
|
-
const accessToken = await this.issueAccessToken(user);
|
|
129
|
-
return accessToken;
|
|
130
|
-
}
|
|
131
|
-
async getAccessTokenSetCookie(accessToken) {
|
|
132
|
-
return exports.ACCESS_TOKEN_COOKIE.serialize(accessToken, {
|
|
133
|
-
expires: accessToken
|
|
134
|
-
? this.JWT_MANAGER.getExpirationTime(accessToken)
|
|
135
|
-
: new Date(0),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
async getRefreshTokenSetCookie(refreshToken) {
|
|
139
|
-
return exports.REFRESH_TOKEN_COOKIE.serialize(refreshToken, {
|
|
140
|
-
expires: refreshToken
|
|
141
|
-
? this.JWT_MANAGER.getExpirationTime(refreshToken)
|
|
142
|
-
: new Date(0),
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
async findUser(provider, info) {
|
|
146
|
-
const thirdPartyAuth = await this.repository.findThirdPartyAuth(provider, info.id);
|
|
147
|
-
if (thirdPartyAuth) {
|
|
148
|
-
const user = await this.repository.findUserById(thirdPartyAuth.userId);
|
|
149
|
-
if (user) {
|
|
150
|
-
return user;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async getOrCreateUser(provider, info) {
|
|
155
|
-
const thirdPartyAuth = await this.repository.findThirdPartyAuth(provider, info.id);
|
|
156
|
-
if (thirdPartyAuth) {
|
|
157
|
-
const user = await this.repository.findUserById(thirdPartyAuth.userId);
|
|
158
|
-
if (user) {
|
|
159
|
-
return user;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
const userId = (0, uuid_1.v4)();
|
|
163
|
-
const email = info.email;
|
|
164
|
-
const name = info.name || "익명";
|
|
165
|
-
const picture = info.picture;
|
|
166
|
-
const profileImageId = (await this.savePicture(picture)) || null;
|
|
167
|
-
const result = await this.repository.createUser({
|
|
168
|
-
id: userId,
|
|
169
|
-
role: "user",
|
|
170
|
-
profileImageId,
|
|
171
|
-
name,
|
|
172
|
-
email,
|
|
173
|
-
});
|
|
174
|
-
await this.repository.createThirdPartyAuth({
|
|
175
|
-
id: info.id,
|
|
176
|
-
provider,
|
|
177
|
-
userId,
|
|
178
|
-
});
|
|
179
|
-
return result;
|
|
180
|
-
}
|
|
181
|
-
async savePicture(picture) {
|
|
182
|
-
if (!picture) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const res = await fetch(picture);
|
|
186
|
-
if (!res.ok) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const buffer = await res.arrayBuffer();
|
|
190
|
-
const id = (0, uuid_1.v4)();
|
|
191
|
-
const key = `/users/${id}/picture`;
|
|
192
|
-
await this.OBJECT_STORAGE.put(key, Buffer.from(buffer));
|
|
193
|
-
await this.repository.createFile({
|
|
194
|
-
id,
|
|
195
|
-
name: "picture",
|
|
196
|
-
type: "image/*",
|
|
197
|
-
key,
|
|
198
|
-
size: buffer.byteLength,
|
|
199
|
-
metadata: {},
|
|
200
|
-
});
|
|
201
|
-
return id;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
exports.AuthService = AuthService;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleLoginButton = GoogleLoginButton;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const fc_1 = require("react-icons/fc");
|
|
6
|
-
const react_router_1 = require("react-router");
|
|
7
|
-
function GoogleLoginButton({ className = "max-w-[300px] w-full", GOOGLE_CLIENT_ID, GOOGLE_REDIRECT_URI, }) {
|
|
8
|
-
const [searchParams] = (0, react_router_1.useSearchParams)();
|
|
9
|
-
const redirectUrl = searchParams.get("redirectUrl") || "";
|
|
10
|
-
const googleClientId = GOOGLE_CLIENT_ID || "";
|
|
11
|
-
const googleRedirectUrl = GOOGLE_REDIRECT_URI || "";
|
|
12
|
-
const href = new URL("https://accounts.google.com/o/oauth2/v2/auth");
|
|
13
|
-
href.searchParams.append("client_id", googleClientId);
|
|
14
|
-
href.searchParams.append("redirect_uri", googleRedirectUrl);
|
|
15
|
-
href.searchParams.append("response_type", "code");
|
|
16
|
-
href.searchParams.append("scope", "email profile");
|
|
17
|
-
href.searchParams.append("state", redirectUrl);
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsxs)("a", { href: href.toString(), className: "relative flex items-center border border-neutral-300 px-4 py-3 no-underline hover:no-underline bg-white hover:bg-neutral-100 rounded", children: [(0, jsx_runtime_1.jsx)(fc_1.FcGoogle, {}), (0, jsx_runtime_1.jsx)("p", { className: "text-[14px] text-black absolute left-0 right-0 text-center", children: "\uAD6C\uAE00\uB85C \uACC4\uC18D\uD558\uAE30" })] }) }));
|
|
19
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RedirectPage = RedirectPage;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const react_router_1 = require("react-router");
|
|
7
|
-
function RedirectPage() {
|
|
8
|
-
const navigate = (0, react_router_1.useNavigate)();
|
|
9
|
-
(0, react_1.useEffect)(() => {
|
|
10
|
-
const searchParams = new URLSearchParams(window.location.search);
|
|
11
|
-
const redirectUrl = searchParams.get("redirectUrl") ||
|
|
12
|
-
new URL("/", window.location.origin).toString();
|
|
13
|
-
if (redirectUrl) {
|
|
14
|
-
navigate(redirectUrl);
|
|
15
|
-
}
|
|
16
|
-
}, [navigate]);
|
|
17
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
18
|
-
}
|