dn-react-router-toolkit 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/api/create_api_handler.d.mts +2 -2
  2. package/dist/api/create_api_handler.d.ts +2 -2
  3. package/dist/api/create_api_handler.js +55 -52
  4. package/dist/api/create_api_handler.mjs +61 -59
  5. package/dist/api/create_handler.d.mts +5 -5
  6. package/dist/api/create_handler.d.ts +5 -5
  7. package/dist/api/create_handler.js +41 -44
  8. package/dist/api/create_handler.mjs +41 -44
  9. package/dist/api/index.d.mts +4 -3
  10. package/dist/api/index.d.ts +4 -3
  11. package/dist/api/index.js +118 -102
  12. package/dist/api/index.mjs +130 -109
  13. package/dist/api/item_api_handler.d.mts +4 -3
  14. package/dist/api/item_api_handler.d.ts +4 -3
  15. package/dist/api/item_api_handler.js +22 -6
  16. package/dist/api/item_api_handler.mjs +28 -6
  17. package/dist/auth/cookie_manager.d.mts +1 -1
  18. package/dist/auth/cookie_manager.d.ts +1 -1
  19. package/dist/auth/index.d.mts +2 -2
  20. package/dist/auth/index.d.ts +2 -2
  21. package/dist/auth/index.js +18 -18
  22. package/dist/auth/index.mjs +18 -18
  23. package/dist/auth/with_auth.d.mts +2 -2
  24. package/dist/auth/with_auth.d.ts +2 -2
  25. package/dist/auth/with_auth.js +18 -18
  26. package/dist/auth/with_auth.mjs +18 -18
  27. package/dist/client/editor.d.mts +2 -2
  28. package/dist/client/editor.d.ts +2 -2
  29. package/dist/client/editor.js +9 -3
  30. package/dist/client/editor.mjs +9 -3
  31. package/dist/client/index.d.mts +2 -2
  32. package/dist/client/index.d.ts +2 -2
  33. package/dist/client/index.js +9 -3
  34. package/dist/client/index.mjs +9 -3
  35. package/dist/crud/crud_form.js +22 -4
  36. package/dist/crud/crud_form.mjs +11 -3
  37. package/dist/crud/crud_form_provider.js +16 -3
  38. package/dist/crud/crud_form_provider.mjs +14 -1
  39. package/dist/crud/index.js +22 -4
  40. package/dist/crud/index.mjs +11 -3
  41. package/dist/db/backup/index.d.mts +1 -1
  42. package/dist/db/backup/index.d.ts +1 -1
  43. package/dist/form/create_form_component.js +21 -2
  44. package/dist/form/create_form_component.mjs +10 -1
  45. package/dist/form/form_components.js +21 -2
  46. package/dist/form/form_components.mjs +10 -1
  47. package/dist/form/index.js +21 -2
  48. package/dist/form/index.mjs +10 -1
  49. package/dist/post/editor_toolbar.js +20 -3
  50. package/dist/post/editor_toolbar.mjs +9 -2
  51. package/dist/post/index.js +31 -11
  52. package/dist/post/index.mjs +19 -9
  53. package/dist/post/post_form_page.js +29 -11
  54. package/dist/post/post_form_page.mjs +17 -9
  55. package/dist/post/thumbnail_picker.js +21 -2
  56. package/dist/post/thumbnail_picker.mjs +10 -1
  57. package/dist/table/buttons.js +11 -14
  58. package/dist/table/buttons.mjs +10 -13
  59. package/dist/table/index.js +14 -18
  60. package/dist/table/index.mjs +13 -17
  61. package/dist/table/table.js +10 -4
  62. package/dist/table/table.mjs +5 -1
  63. package/dist/table/table_form.js +12 -18
  64. package/dist/table/table_form.mjs +9 -15
  65. package/dist/utils/cn.d.mts +3 -0
  66. package/dist/utils/cn.d.ts +3 -0
  67. package/dist/utils/cn.js +32 -0
  68. package/dist/utils/cn.mjs +7 -0
  69. package/dist/utils/date.d.mts +5 -0
  70. package/dist/utils/date.d.ts +5 -0
  71. package/dist/utils/date.js +65 -0
  72. package/dist/utils/date.mjs +29 -0
  73. package/dist/utils/index.d.mts +7 -0
  74. package/dist/utils/index.d.ts +7 -0
  75. package/dist/utils/index.js +116 -0
  76. package/dist/utils/index.mjs +73 -0
  77. package/dist/utils/korean.d.mts +6 -0
  78. package/dist/utils/korean.d.ts +6 -0
  79. package/dist/utils/korean.js +41 -0
  80. package/dist/utils/korean.mjs +16 -0
  81. package/dist/utils/singleton.d.mts +3 -0
  82. package/dist/utils/singleton.d.ts +3 -0
  83. package/dist/utils/singleton.js +37 -0
  84. package/dist/utils/singleton.mjs +12 -0
  85. package/dist/utils/sleep.d.mts +3 -0
  86. package/dist/utils/sleep.d.ts +3 -0
  87. package/dist/utils/sleep.js +32 -0
  88. package/dist/utils/sleep.mjs +7 -0
  89. package/dist/utils/slug.d.mts +3 -0
  90. package/dist/utils/slug.d.ts +3 -0
  91. package/dist/utils/slug.js +32 -0
  92. package/dist/utils/slug.mjs +7 -0
  93. package/package.json +6 -2
@@ -4,8 +4,8 @@ import { TableRepository } from '../table/repository.mjs';
4
4
  import { PgTableWithColumns } from 'drizzle-orm/pg-core';
5
5
  import { WithAuthHandler } from '../auth/with_auth.mjs';
6
6
  import 'drizzle-orm/node-postgres';
7
- import 'dn-react-toolkit/auth';
8
- import 'dn-react-toolkit/auth/server';
7
+ import 'gw-auth';
8
+ import 'gw-auth/server';
9
9
 
10
10
  type APIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
11
11
  withAuthAction: WithAuthHandler<ActionFunctionArgs>;
@@ -4,8 +4,8 @@ import { TableRepository } from '../table/repository.js';
4
4
  import { PgTableWithColumns } from 'drizzle-orm/pg-core';
5
5
  import { WithAuthHandler } from '../auth/with_auth.js';
6
6
  import 'drizzle-orm/node-postgres';
7
- import 'dn-react-toolkit/auth';
8
- import 'dn-react-toolkit/auth/server';
7
+ import 'gw-auth';
8
+ import 'gw-auth/server';
9
9
 
10
10
  type APIHandlerOptions<T extends PgTableWithColumns<any>, TSelect> = {
11
11
  withAuthAction: WithAuthHandler<ActionFunctionArgs>;
@@ -23,7 +23,6 @@ __export(create_api_handler_exports, {
23
23
  apiHandler: () => apiHandler
24
24
  });
25
25
  module.exports = __toCommonJS(create_api_handler_exports);
26
- var import_http = require("dn-react-toolkit/http");
27
26
  var import_drizzle_orm = require("drizzle-orm");
28
27
  var import_uuid = require("uuid");
29
28
 
@@ -65,6 +64,7 @@ function deserialize(data) {
65
64
  }
66
65
 
67
66
  // src/api/create_api_handler.ts
67
+ var import_gw_response = require("gw-response");
68
68
  function apiHandler({
69
69
  withAuthAction,
70
70
  repository,
@@ -78,70 +78,73 @@ function apiHandler({
78
78
  };
79
79
  const action = withAuthAction((auth) => async ({ request }) => {
80
80
  if (roles && roles.length > 0 && (!auth || !roles.includes(auth.role))) {
81
- throw (0, import_http.UNAUTHORIZED)();
81
+ throw (0, import_gw_response.httpUnauthorized)({
82
+ code: "UNAUTHORIZED",
83
+ message: "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4."
84
+ });
82
85
  }
83
86
  switch (request.method) {
84
87
  case "POST":
85
88
  case "PUT": {
86
- try {
87
- const serilaizedParams = await request.json();
88
- const params = deserialize(serilaizedParams);
89
- if (validators) {
90
- const paramsForValidation = Object.keys(validators).filter(
91
- (key) => Object.prototype.hasOwnProperty.call(validators, key)
92
- );
93
- for (const paramKey of paramsForValidation) {
94
- const value = params[paramKey];
95
- const validator = validators[paramKey];
96
- if (validator?.validate && !validator.validate(value)) {
97
- throw (0, import_http.BAD_REQUEST)(
98
- validator.message ? validator.message(value) : void 0
99
- );
100
- }
89
+ const serilaizedParams = await request.json();
90
+ const params = deserialize(serilaizedParams);
91
+ if (validators) {
92
+ const paramsForValidation = Object.keys(validators).filter(
93
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
94
+ );
95
+ for (const paramKey of paramsForValidation) {
96
+ const value = params[paramKey];
97
+ const validator = validators[paramKey];
98
+ if (validator?.validate && !validator.validate(value)) {
99
+ throw (0, import_gw_response.httpBadRequest)({
100
+ code: "BAD_REQUEST",
101
+ message: validator.message ? validator.message(value) : "\uC798\uBABB\uB41C \uC694\uCCAD\uC785\uB2C8\uB2E4."
102
+ });
101
103
  }
102
104
  }
103
- const itemId = params.id || (0, import_uuid.v4)();
104
- if (!params.id && existingConditions) {
105
- const paramsForExistenceCheck = Object.keys(
106
- existingConditions
107
- ).filter(
108
- (key) => Object.prototype.hasOwnProperty.call(params, key)
105
+ }
106
+ const itemId = params.id || (0, import_uuid.v4)();
107
+ if (!params.id && existingConditions) {
108
+ const paramsForExistenceCheck = Object.keys(
109
+ existingConditions
110
+ ).filter(
111
+ (key) => Object.prototype.hasOwnProperty.call(params, key)
112
+ );
113
+ if (paramsForExistenceCheck.length > 0) {
114
+ const where = (0, import_drizzle_orm.and)(
115
+ ...paramsForExistenceCheck.reduce((acc, key) => {
116
+ const condition = existingConditions[key];
117
+ if (condition) {
118
+ acc.push(condition(params[key]));
119
+ }
120
+ return acc;
121
+ }, [])
109
122
  );
110
- if (paramsForExistenceCheck.length > 0) {
111
- const where = (0, import_drizzle_orm.and)(
112
- ...paramsForExistenceCheck.reduce((acc, key) => {
113
- const condition = existingConditions[key];
114
- if (condition) {
115
- acc.push(condition(params[key]));
116
- }
117
- return acc;
118
- }, [])
119
- );
120
- const existing = await repository.findAll({
121
- limit: 1,
122
- where
123
+ const existing = await repository.findAll({
124
+ limit: 1,
125
+ where
126
+ });
127
+ if (existing.length > 0) {
128
+ return (0, import_gw_response.httpConflict)({
129
+ code: "CONFLICT",
130
+ message: "\uC790\uB8CC\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4."
123
131
  });
124
- if (existing.length > 0) {
125
- throw (0, import_http.CONFLICT)("\uC790\uB8CC\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4.");
126
- }
127
132
  }
128
133
  }
129
- const values = {
130
- id: itemId,
131
- userId: injectUserId ? auth?.userId : void 0,
132
- ...params
133
- };
134
- const item = await repository.save(values);
135
- return (0, import_http.CREATED)(item);
136
- } catch (error) {
137
- if (error instanceof Error) {
138
- throw (0, import_http.INTERNAL_SERVER_ERROR)(error.message);
139
- }
140
- throw error;
141
134
  }
135
+ const values = {
136
+ id: itemId,
137
+ userId: injectUserId ? auth?.userId : void 0,
138
+ ...params
139
+ };
140
+ const item = await repository.save(values);
141
+ return (0, import_gw_response.httpCreated)(item);
142
142
  }
143
143
  default:
144
- throw (0, import_http.METHOD_NOT_ALLOWED)();
144
+ throw (0, import_gw_response.httpMethodNotAllowed)({
145
+ code: "METHOD_NOT_ALLOWED",
146
+ message: "\uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC740 \uBA54\uC11C\uB4DC\uC785\uB2C8\uB2E4."
147
+ });
145
148
  }
146
149
  });
147
150
  return {
@@ -1,12 +1,4 @@
1
1
  // src/api/create_api_handler.ts
2
- import {
3
- BAD_REQUEST,
4
- CONFLICT,
5
- CREATED,
6
- INTERNAL_SERVER_ERROR,
7
- METHOD_NOT_ALLOWED,
8
- UNAUTHORIZED
9
- } from "dn-react-toolkit/http";
10
2
  import {
11
3
  and
12
4
  } from "drizzle-orm";
@@ -50,6 +42,13 @@ function deserialize(data) {
50
42
  }
51
43
 
52
44
  // src/api/create_api_handler.ts
45
+ import {
46
+ httpBadRequest,
47
+ httpConflict,
48
+ httpCreated,
49
+ httpMethodNotAllowed,
50
+ httpUnauthorized
51
+ } from "gw-response";
53
52
  function apiHandler({
54
53
  withAuthAction,
55
54
  repository,
@@ -63,70 +62,73 @@ function apiHandler({
63
62
  };
64
63
  const action = withAuthAction((auth) => async ({ request }) => {
65
64
  if (roles && roles.length > 0 && (!auth || !roles.includes(auth.role))) {
66
- throw UNAUTHORIZED();
65
+ throw httpUnauthorized({
66
+ code: "UNAUTHORIZED",
67
+ message: "\uC778\uC99D\uC774 \uD544\uC694\uD569\uB2C8\uB2E4."
68
+ });
67
69
  }
68
70
  switch (request.method) {
69
71
  case "POST":
70
72
  case "PUT": {
71
- try {
72
- const serilaizedParams = await request.json();
73
- const params = deserialize(serilaizedParams);
74
- if (validators) {
75
- const paramsForValidation = Object.keys(validators).filter(
76
- (key) => Object.prototype.hasOwnProperty.call(validators, key)
77
- );
78
- for (const paramKey of paramsForValidation) {
79
- const value = params[paramKey];
80
- const validator = validators[paramKey];
81
- if (validator?.validate && !validator.validate(value)) {
82
- throw BAD_REQUEST(
83
- validator.message ? validator.message(value) : void 0
84
- );
85
- }
73
+ const serilaizedParams = await request.json();
74
+ const params = deserialize(serilaizedParams);
75
+ if (validators) {
76
+ const paramsForValidation = Object.keys(validators).filter(
77
+ (key) => Object.prototype.hasOwnProperty.call(validators, key)
78
+ );
79
+ for (const paramKey of paramsForValidation) {
80
+ const value = params[paramKey];
81
+ const validator = validators[paramKey];
82
+ if (validator?.validate && !validator.validate(value)) {
83
+ throw httpBadRequest({
84
+ code: "BAD_REQUEST",
85
+ message: validator.message ? validator.message(value) : "\uC798\uBABB\uB41C \uC694\uCCAD\uC785\uB2C8\uB2E4."
86
+ });
86
87
  }
87
88
  }
88
- const itemId = params.id || v4();
89
- if (!params.id && existingConditions) {
90
- const paramsForExistenceCheck = Object.keys(
91
- existingConditions
92
- ).filter(
93
- (key) => Object.prototype.hasOwnProperty.call(params, key)
89
+ }
90
+ const itemId = params.id || v4();
91
+ if (!params.id && existingConditions) {
92
+ const paramsForExistenceCheck = Object.keys(
93
+ existingConditions
94
+ ).filter(
95
+ (key) => Object.prototype.hasOwnProperty.call(params, key)
96
+ );
97
+ if (paramsForExistenceCheck.length > 0) {
98
+ const where = and(
99
+ ...paramsForExistenceCheck.reduce((acc, key) => {
100
+ const condition = existingConditions[key];
101
+ if (condition) {
102
+ acc.push(condition(params[key]));
103
+ }
104
+ return acc;
105
+ }, [])
94
106
  );
95
- if (paramsForExistenceCheck.length > 0) {
96
- const where = and(
97
- ...paramsForExistenceCheck.reduce((acc, key) => {
98
- const condition = existingConditions[key];
99
- if (condition) {
100
- acc.push(condition(params[key]));
101
- }
102
- return acc;
103
- }, [])
104
- );
105
- const existing = await repository.findAll({
106
- limit: 1,
107
- where
107
+ const existing = await repository.findAll({
108
+ limit: 1,
109
+ where
110
+ });
111
+ if (existing.length > 0) {
112
+ return httpConflict({
113
+ code: "CONFLICT",
114
+ message: "\uC790\uB8CC\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4."
108
115
  });
109
- if (existing.length > 0) {
110
- throw CONFLICT("\uC790\uB8CC\uAC00 \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4.");
111
- }
112
116
  }
113
117
  }
114
- const values = {
115
- id: itemId,
116
- userId: injectUserId ? auth?.userId : void 0,
117
- ...params
118
- };
119
- const item = await repository.save(values);
120
- return CREATED(item);
121
- } catch (error) {
122
- if (error instanceof Error) {
123
- throw INTERNAL_SERVER_ERROR(error.message);
124
- }
125
- throw error;
126
118
  }
119
+ const values = {
120
+ id: itemId,
121
+ userId: injectUserId ? auth?.userId : void 0,
122
+ ...params
123
+ };
124
+ const item = await repository.save(values);
125
+ return httpCreated(item);
127
126
  }
128
127
  default:
129
- throw METHOD_NOT_ALLOWED();
128
+ throw httpMethodNotAllowed({
129
+ code: "METHOD_NOT_ALLOWED",
130
+ message: "\uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC740 \uBA54\uC11C\uB4DC\uC785\uB2C8\uB2E4."
131
+ });
130
132
  }
131
133
  });
132
134
  return {
@@ -1,13 +1,13 @@
1
1
  import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
- import { AuthService, PasswordRecoveryService, ThirdpartyAuth, JWTManager, ThirdpartySignupTokenPayload } from 'dn-react-toolkit/auth/server';
3
- import { FileService } from 'dn-react-toolkit/file/server';
2
+ import { AuthService, PasswordRecoveryService, AuthProvider, JWTManager, ThirdpartyAuthPayload } from 'gw-auth/server';
3
+ import { FileService } from 'gw-file/server';
4
4
 
5
- declare const createAPIHandler: <TFile>({ authService, fileService, passwordRecoveryService, getThirdPartyAuth, signupTokenManager, }: {
5
+ declare const createAPIHandler: <TFile>({ authService, fileService, passwordRecoveryService, authProviders, signupTokenManager, }: {
6
6
  authService: AuthService<TFile>;
7
7
  fileService: FileService<TFile>;
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
- getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
- signupTokenManager: JWTManager<ThirdpartySignupTokenPayload>;
9
+ authProviders: AuthProvider[];
10
+ signupTokenManager: JWTManager<ThirdpartyAuthPayload>;
11
11
  }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: ActionFunctionArgs<any> | LoaderFunctionArgs<any>) => Promise<Response>)>;
12
12
 
13
13
  export { createAPIHandler };
@@ -1,13 +1,13 @@
1
1
  import { LoaderFunctionArgs, ActionFunctionArgs } from 'react-router';
2
- import { AuthService, PasswordRecoveryService, ThirdpartyAuth, JWTManager, ThirdpartySignupTokenPayload } from 'dn-react-toolkit/auth/server';
3
- import { FileService } from 'dn-react-toolkit/file/server';
2
+ import { AuthService, PasswordRecoveryService, AuthProvider, JWTManager, ThirdpartyAuthPayload } from 'gw-auth/server';
3
+ import { FileService } from 'gw-file/server';
4
4
 
5
- declare const createAPIHandler: <TFile>({ authService, fileService, passwordRecoveryService, getThirdPartyAuth, signupTokenManager, }: {
5
+ declare const createAPIHandler: <TFile>({ authService, fileService, passwordRecoveryService, authProviders, signupTokenManager, }: {
6
6
  authService: AuthService<TFile>;
7
7
  fileService: FileService<TFile>;
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
- getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
- signupTokenManager: JWTManager<ThirdpartySignupTokenPayload>;
9
+ authProviders: AuthProvider[];
10
+ signupTokenManager: JWTManager<ThirdpartyAuthPayload>;
11
11
  }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: ActionFunctionArgs<any> | LoaderFunctionArgs<any>) => Promise<Response>)>;
12
12
 
13
13
  export { createAPIHandler };
@@ -23,8 +23,7 @@ __export(create_handler_exports, {
23
23
  createAPIHandler: () => createAPIHandler
24
24
  });
25
25
  module.exports = __toCommonJS(create_handler_exports);
26
- var import_http = require("dn-react-toolkit/http");
27
- var import_server = require("dn-react-toolkit/auth/server");
26
+ var import_server = require("gw-auth/server");
28
27
 
29
28
  // src/auth/with_auth.ts
30
29
  var toResponse = (result) => {
@@ -50,31 +49,31 @@ function createWithStrictAuthHandler({ authService }) {
50
49
  arg.request
51
50
  );
52
51
  if (accessToken) {
53
- const payload = await authService.accessTokenManager.verify(accessToken);
54
- if (payload) {
55
- return respond(payload);
52
+ const verifyResult = await authService.accessTokenManager.verify(accessToken);
53
+ if (verifyResult.isOk) {
54
+ const payload = verifyResult.value;
55
+ if (payload) {
56
+ return respond(payload);
57
+ }
56
58
  }
57
59
  }
58
60
  const refreshToken = await authService.getRefreshTokenFromCookies(
59
61
  arg.request
60
62
  );
61
63
  if (refreshToken) {
62
- try {
63
- const newAccessToken = await authService.refreshAccessToken(refreshToken);
64
- const setCookieHeader = await authService.getAccessTokenSetCookie(
65
- newAccessToken
66
- );
67
- const headers = new Headers();
68
- headers.append("Set-Cookie", setCookieHeader);
69
- const payload = authService.accessTokenManager.decode(newAccessToken);
70
- return respond(payload, headers);
71
- } catch (e) {
72
- console.log(e);
73
- const setCookieHeader = await authService.getRefreshTokenSetCookie(void 0);
74
- const headers = new Headers();
75
- headers.append("Set-Cookie", setCookieHeader);
76
- return respond(void 0, headers);
64
+ const refreshResult = await authService.refreshAccessToken(refreshToken);
65
+ if (refreshResult.isErr) {
66
+ const setCookieHeader2 = await authService.getRefreshTokenSetCookie(void 0);
67
+ const headers2 = new Headers();
68
+ headers2.append("Set-Cookie", setCookieHeader2);
69
+ return respond(void 0, headers2);
77
70
  }
71
+ const newAccessToken = refreshResult.value;
72
+ const setCookieHeader = await authService.getAccessTokenSetCookie(newAccessToken);
73
+ const headers = new Headers();
74
+ headers.append("Set-Cookie", setCookieHeader);
75
+ const payload = authService.accessTokenManager.decode(newAccessToken);
76
+ return respond(payload, headers);
78
77
  }
79
78
  return respond(void 0);
80
79
  };
@@ -86,12 +85,13 @@ function createWithStrictAuthHandler({ authService }) {
86
85
  var import_react_router = require("react-router");
87
86
 
88
87
  // src/api/create_handler.ts
89
- var import_server2 = require("dn-react-toolkit/file/server");
88
+ var import_server2 = require("gw-file/server");
89
+ var import_gw_response = require("gw-response");
90
90
  var createAPIHandler = ({
91
91
  authService,
92
92
  fileService,
93
93
  passwordRecoveryService,
94
- getThirdPartyAuth,
94
+ authProviders,
95
95
  signupTokenManager
96
96
  }) => {
97
97
  const handler = async (args) => {
@@ -106,7 +106,7 @@ var createAPIHandler = ({
106
106
  switch (method) {
107
107
  case "GET": {
108
108
  return withAuth(
109
- (auth) => ({ request: request2 }) => (0, import_server.findAuthHandler)(auth)(request2)
109
+ (auth) => ({ request: request2 }) => (0, import_server.findAuthHandler)(auth)()
110
110
  );
111
111
  }
112
112
  }
@@ -126,13 +126,10 @@ var createAPIHandler = ({
126
126
  const provider = slug[2];
127
127
  switch (method) {
128
128
  case "POST": {
129
- return (0, import_server.loginWithThirdPartyHandler)(
130
- request,
131
- {
132
- provider,
133
- getThirdPartyAuth
134
- }
135
- );
129
+ return (0, import_server.loginWithThirdPartyHandler)(request, {
130
+ provider,
131
+ authProviders
132
+ });
136
133
  }
137
134
  }
138
135
  }
@@ -171,14 +168,11 @@ var createAPIHandler = ({
171
168
  default: {
172
169
  switch (method) {
173
170
  case "POST": {
174
- return (0, import_server.signUpWithThirdpartyHandler)(
175
- request,
176
- {
177
- authService,
178
- fileService,
179
- signupTokenManager
180
- }
181
- );
171
+ return (0, import_server.signUpWithThirdpartyHandler)(request, {
172
+ authService,
173
+ fileService,
174
+ signupTokenManager
175
+ });
182
176
  }
183
177
  }
184
178
  }
@@ -191,7 +185,7 @@ var createAPIHandler = ({
191
185
  return (0, import_server.thirdpartyAuthCallbackHandler)(request, {
192
186
  provider,
193
187
  authService,
194
- getThirdPartyAuth
188
+ authProviders
195
189
  });
196
190
  }
197
191
  }
@@ -214,9 +208,9 @@ var createAPIHandler = ({
214
208
  switch (method) {
215
209
  case "POST": {
216
210
  return withAuth(
217
- (auth) => ({ request: request2 }) => (0, import_server2.uploadFileHandler)({ fileService })(
218
- auth
219
- )(request2)
211
+ (auth) => ({ request: request2 }) => (0, import_server2.uploadFileHandler)({ fileService })(request2, {
212
+ userId: auth?.userId
213
+ })
220
214
  )(args);
221
215
  }
222
216
  }
@@ -228,7 +222,7 @@ var createAPIHandler = ({
228
222
  return withAuth(
229
223
  (auth) => () => (0, import_server2.deleteFileHandler)({
230
224
  fileRepository: fileService.fileRepository
231
- })({ fileId })(auth)()
225
+ })({ fileId, userId: auth?.userId })()
232
226
  );
233
227
  }
234
228
  }
@@ -236,7 +230,10 @@ var createAPIHandler = ({
236
230
  }
237
231
  }
238
232
  default: {
239
- return (0, import_http.NOT_FOUND)();
233
+ return (0, import_gw_response.httpNotFound)({
234
+ code: "RESOURCE_NOT_FOUND",
235
+ message: "\uB9AC\uC18C\uC2A4\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."
236
+ });
240
237
  }
241
238
  }
242
239
  };