dn-react-router-toolkit 0.3.1 → 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.
@@ -8,6 +8,6 @@ declare const createAPIHandler: <TFile>({ authService, fileService, passwordReco
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
9
  getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
10
  signupTokenSecret: string;
11
- }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>)>;
11
+ }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<(({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>) | Response>;
12
12
 
13
13
  export { createAPIHandler };
@@ -8,6 +8,6 @@ declare const createAPIHandler: <TFile>({ authService, fileService, passwordReco
8
8
  passwordRecoveryService: PasswordRecoveryService;
9
9
  getThirdPartyAuth: (provider: string) => ThirdpartyAuth;
10
10
  signupTokenSecret: string;
11
- }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<Response | (({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>)>;
11
+ }) => (args: LoaderFunctionArgs | ActionFunctionArgs) => Promise<(({ request }: LoaderFunctionArgs<any> | ActionFunctionArgs<any>) => Promise<Response>) | Response>;
12
12
 
13
13
  export { createAPIHandler };
@@ -35,6 +35,7 @@ var import_server = require("dn-react-toolkit/auth/server");
35
35
  // src/auth/index.ts
36
36
  var auth_exports = {};
37
37
  __export(auth_exports, {
38
+ ReactRouterCookieStore: () => ReactRouterCookieStore,
38
39
  createWithAuthHandler: () => createWithAuthHandler
39
40
  });
40
41
  __reExport(auth_exports, require("dn-react-toolkit/auth"));
@@ -123,6 +124,27 @@ function createWithAuthHandler({ authService }) {
123
124
  };
124
125
  }
125
126
 
127
+ // src/auth/cookie_store.ts
128
+ var import_react_router = require("react-router");
129
+ var ReactRouterCookieStore = class {
130
+ store;
131
+ constructor(key) {
132
+ this.store = (0, import_react_router.createCookie)(key, {
133
+ path: "/",
134
+ httpOnly: process.env.NODE_ENV === "production",
135
+ secure: process.env.NODE_ENV === "production",
136
+ sameSite: "strict"
137
+ });
138
+ }
139
+ parse(request) {
140
+ const cookieHeader = request.headers.get("cookie") || "";
141
+ return this.store.parse(cookieHeader);
142
+ }
143
+ serialize(value, options) {
144
+ return this.store.serialize(value, options);
145
+ }
146
+ };
147
+
126
148
  // src/api/create_handler.ts
127
149
  var import_server2 = require("dn-react-toolkit/file/server");
128
150
  var createAPIHandler = ({
@@ -38,6 +38,7 @@ import {
38
38
  // src/auth/index.ts
39
39
  var auth_exports = {};
40
40
  __export(auth_exports, {
41
+ ReactRouterCookieStore: () => ReactRouterCookieStore,
41
42
  createWithAuthHandler: () => createWithAuthHandler
42
43
  });
43
44
  __reExport(auth_exports, auth_star);
@@ -127,6 +128,27 @@ function createWithAuthHandler({ authService }) {
127
128
  };
128
129
  }
129
130
 
131
+ // src/auth/cookie_store.ts
132
+ import { createCookie } from "react-router";
133
+ var ReactRouterCookieStore = class {
134
+ store;
135
+ constructor(key) {
136
+ this.store = createCookie(key, {
137
+ path: "/",
138
+ httpOnly: process.env.NODE_ENV === "production",
139
+ secure: process.env.NODE_ENV === "production",
140
+ sameSite: "strict"
141
+ });
142
+ }
143
+ parse(request) {
144
+ const cookieHeader = request.headers.get("cookie") || "";
145
+ return this.store.parse(cookieHeader);
146
+ }
147
+ serialize(value, options) {
148
+ return this.store.serialize(value, options);
149
+ }
150
+ };
151
+
130
152
  // src/api/create_handler.ts
131
153
  import {
132
154
  deleteFileHandler,
package/dist/api/index.js CHANGED
@@ -35,6 +35,7 @@ var import_server = require("dn-react-toolkit/auth/server");
35
35
  // src/auth/index.ts
36
36
  var auth_exports = {};
37
37
  __export(auth_exports, {
38
+ ReactRouterCookieStore: () => ReactRouterCookieStore,
38
39
  createWithAuthHandler: () => createWithAuthHandler
39
40
  });
40
41
  __reExport(auth_exports, require("dn-react-toolkit/auth"));
@@ -123,6 +124,27 @@ function createWithAuthHandler({ authService }) {
123
124
  };
124
125
  }
125
126
 
127
+ // src/auth/cookie_store.ts
128
+ var import_react_router = require("react-router");
129
+ var ReactRouterCookieStore = class {
130
+ store;
131
+ constructor(key) {
132
+ this.store = (0, import_react_router.createCookie)(key, {
133
+ path: "/",
134
+ httpOnly: process.env.NODE_ENV === "production",
135
+ secure: process.env.NODE_ENV === "production",
136
+ sameSite: "strict"
137
+ });
138
+ }
139
+ parse(request) {
140
+ const cookieHeader = request.headers.get("cookie") || "";
141
+ return this.store.parse(cookieHeader);
142
+ }
143
+ serialize(value, options) {
144
+ return this.store.serialize(value, options);
145
+ }
146
+ };
147
+
126
148
  // src/api/create_handler.ts
127
149
  var import_server2 = require("dn-react-toolkit/file/server");
128
150
  var createAPIHandler = ({
@@ -38,6 +38,7 @@ import {
38
38
  // src/auth/index.ts
39
39
  var auth_exports = {};
40
40
  __export(auth_exports, {
41
+ ReactRouterCookieStore: () => ReactRouterCookieStore,
41
42
  createWithAuthHandler: () => createWithAuthHandler
42
43
  });
43
44
  __reExport(auth_exports, auth_star);
@@ -127,6 +128,27 @@ function createWithAuthHandler({ authService }) {
127
128
  };
128
129
  }
129
130
 
131
+ // src/auth/cookie_store.ts
132
+ import { createCookie } from "react-router";
133
+ var ReactRouterCookieStore = class {
134
+ store;
135
+ constructor(key) {
136
+ this.store = createCookie(key, {
137
+ path: "/",
138
+ httpOnly: process.env.NODE_ENV === "production",
139
+ secure: process.env.NODE_ENV === "production",
140
+ sameSite: "strict"
141
+ });
142
+ }
143
+ parse(request) {
144
+ const cookieHeader = request.headers.get("cookie") || "";
145
+ return this.store.parse(cookieHeader);
146
+ }
147
+ serialize(value, options) {
148
+ return this.store.serialize(value, options);
149
+ }
150
+ };
151
+
130
152
  // src/api/create_handler.ts
131
153
  import {
132
154
  deleteFileHandler,
@@ -0,0 +1,13 @@
1
+ import { Cookie } from 'react-router';
2
+ import { CookieStore } from 'dn-react-toolkit/auth/server';
3
+
4
+ declare class ReactRouterCookieStore implements CookieStore {
5
+ store: Cookie;
6
+ constructor(key: string);
7
+ parse(request: Request): Promise<string | null>;
8
+ serialize(value: string | null, options: {
9
+ expires: Date;
10
+ }): Promise<string>;
11
+ }
12
+
13
+ export { ReactRouterCookieStore };
@@ -0,0 +1,13 @@
1
+ import { Cookie } from 'react-router';
2
+ import { CookieStore } from 'dn-react-toolkit/auth/server';
3
+
4
+ declare class ReactRouterCookieStore implements CookieStore {
5
+ store: Cookie;
6
+ constructor(key: string);
7
+ parse(request: Request): Promise<string | null>;
8
+ serialize(value: string | null, options: {
9
+ expires: Date;
10
+ }): Promise<string>;
11
+ }
12
+
13
+ export { ReactRouterCookieStore };
@@ -0,0 +1,48 @@
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/auth/cookie_store.ts
21
+ var cookie_store_exports = {};
22
+ __export(cookie_store_exports, {
23
+ ReactRouterCookieStore: () => ReactRouterCookieStore
24
+ });
25
+ module.exports = __toCommonJS(cookie_store_exports);
26
+ var import_react_router = require("react-router");
27
+ var ReactRouterCookieStore = class {
28
+ store;
29
+ constructor(key) {
30
+ this.store = (0, import_react_router.createCookie)(key, {
31
+ path: "/",
32
+ httpOnly: process.env.NODE_ENV === "production",
33
+ secure: process.env.NODE_ENV === "production",
34
+ sameSite: "strict"
35
+ });
36
+ }
37
+ parse(request) {
38
+ const cookieHeader = request.headers.get("cookie") || "";
39
+ return this.store.parse(cookieHeader);
40
+ }
41
+ serialize(value, options) {
42
+ return this.store.serialize(value, options);
43
+ }
44
+ };
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ ReactRouterCookieStore
48
+ });
@@ -0,0 +1,23 @@
1
+ // src/auth/cookie_store.ts
2
+ import { createCookie } from "react-router";
3
+ var ReactRouterCookieStore = class {
4
+ store;
5
+ constructor(key) {
6
+ this.store = createCookie(key, {
7
+ path: "/",
8
+ httpOnly: process.env.NODE_ENV === "production",
9
+ secure: process.env.NODE_ENV === "production",
10
+ sameSite: "strict"
11
+ });
12
+ }
13
+ parse(request) {
14
+ const cookieHeader = request.headers.get("cookie") || "";
15
+ return this.store.parse(cookieHeader);
16
+ }
17
+ serialize(value, options) {
18
+ return this.store.serialize(value, options);
19
+ }
20
+ };
21
+ export {
22
+ ReactRouterCookieStore
23
+ };
@@ -1,4 +1,5 @@
1
1
  export * from 'dn-react-toolkit/auth';
2
2
  export { WithAuthHandler, createWithAuthHandler } from './with_auth.mjs';
3
+ export { ReactRouterCookieStore } from './cookie_store.mjs';
3
4
  import 'dn-react-toolkit/auth/server';
4
5
  import 'react-router';
@@ -1,4 +1,5 @@
1
1
  export * from 'dn-react-toolkit/auth';
2
2
  export { WithAuthHandler, createWithAuthHandler } from './with_auth.js';
3
+ export { ReactRouterCookieStore } from './cookie_store.js';
3
4
  import 'dn-react-toolkit/auth/server';
4
5
  import 'react-router';
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/auth/index.ts
22
22
  var auth_exports = {};
23
23
  __export(auth_exports, {
24
+ ReactRouterCookieStore: () => ReactRouterCookieStore,
24
25
  createWithAuthHandler: () => createWithAuthHandler
25
26
  });
26
27
  module.exports = __toCommonJS(auth_exports);
@@ -109,8 +110,30 @@ function createWithAuthHandler({ authService }) {
109
110
  return handler;
110
111
  };
111
112
  }
113
+
114
+ // src/auth/cookie_store.ts
115
+ var import_react_router = require("react-router");
116
+ var ReactRouterCookieStore = class {
117
+ store;
118
+ constructor(key) {
119
+ this.store = (0, import_react_router.createCookie)(key, {
120
+ path: "/",
121
+ httpOnly: process.env.NODE_ENV === "production",
122
+ secure: process.env.NODE_ENV === "production",
123
+ sameSite: "strict"
124
+ });
125
+ }
126
+ parse(request) {
127
+ const cookieHeader = request.headers.get("cookie") || "";
128
+ return this.store.parse(cookieHeader);
129
+ }
130
+ serialize(value, options) {
131
+ return this.store.serialize(value, options);
132
+ }
133
+ };
112
134
  // Annotate the CommonJS export names for ESM import in node:
113
135
  0 && (module.exports = {
136
+ ReactRouterCookieStore,
114
137
  createWithAuthHandler,
115
138
  ...require("dn-react-toolkit/auth")
116
139
  });
@@ -84,6 +84,28 @@ function createWithAuthHandler({ authService }) {
84
84
  return handler;
85
85
  };
86
86
  }
87
+
88
+ // src/auth/cookie_store.ts
89
+ import { createCookie } from "react-router";
90
+ var ReactRouterCookieStore = class {
91
+ store;
92
+ constructor(key) {
93
+ this.store = createCookie(key, {
94
+ path: "/",
95
+ httpOnly: process.env.NODE_ENV === "production",
96
+ secure: process.env.NODE_ENV === "production",
97
+ sameSite: "strict"
98
+ });
99
+ }
100
+ parse(request) {
101
+ const cookieHeader = request.headers.get("cookie") || "";
102
+ return this.store.parse(cookieHeader);
103
+ }
104
+ serialize(value, options) {
105
+ return this.store.serialize(value, options);
106
+ }
107
+ };
87
108
  export {
109
+ ReactRouterCookieStore,
88
110
  createWithAuthHandler
89
111
  };
package/dist/index.d.mts CHANGED
@@ -3,6 +3,6 @@ import 'dn-react-toolkit/file';
3
3
  import 'dn-react-toolkit/http';
4
4
  import 'dn-react-toolkit/modal';
5
5
  import 'dn-react-toolkit/text_editor';
6
- import 'dn-react-toolkit/file/client';
7
- import 'dn-react-toolkit/auth/server';
8
6
  import 'dn-react-toolkit/file/server';
7
+ import 'dn-react-toolkit/auth/server';
8
+ import 'dn-react-toolkit/file/client';
package/dist/index.d.ts CHANGED
@@ -3,6 +3,6 @@ import 'dn-react-toolkit/file';
3
3
  import 'dn-react-toolkit/http';
4
4
  import 'dn-react-toolkit/modal';
5
5
  import 'dn-react-toolkit/text_editor';
6
- import 'dn-react-toolkit/file/client';
7
- import 'dn-react-toolkit/auth/server';
8
6
  import 'dn-react-toolkit/file/server';
7
+ import 'dn-react-toolkit/auth/server';
8
+ import 'dn-react-toolkit/file/client';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",