dn-react-router-toolkit 0.5.7 → 0.5.8

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.
@@ -1,6 +1,3 @@
1
- import 'drizzle-orm/node-postgres';
2
- import 'drizzle-orm';
3
- import 'drizzle-orm/pg-core';
4
1
  import { ObjectStorage } from 'dn-react-toolkit/file/server';
5
2
 
6
3
  declare const backup: ({ objectStorage }: {
@@ -1,6 +1,3 @@
1
- import 'drizzle-orm/node-postgres';
2
- import 'drizzle-orm';
3
- import 'drizzle-orm/pg-core';
4
1
  import { ObjectStorage } from 'dn-react-toolkit/file/server';
5
2
 
6
3
  declare const backup: ({ objectStorage }: {
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/db/backup.ts
30
+ // src/db/backup/index.ts
31
31
  var backup_exports = {};
32
32
  __export(backup_exports, {
33
33
  backup: () => backup
@@ -1,4 +1,4 @@
1
- // src/db/backup.ts
1
+ // src/db/backup/index.ts
2
2
  import { promisify } from "util";
3
3
  import * as fs from "fs";
4
4
  import { exec } from "child_process";
@@ -2,5 +2,3 @@ export { drizzle } from 'drizzle-orm/node-postgres';
2
2
  export * from 'drizzle-orm';
3
3
  import * as pgCore from 'drizzle-orm/pg-core';
4
4
  export { pgCore as core };
5
- export { backup } from './backup.mjs';
6
- import 'dn-react-toolkit/file/server';
@@ -2,5 +2,3 @@ export { drizzle } from 'drizzle-orm/node-postgres';
2
2
  export * from 'drizzle-orm';
3
3
  import * as pgCore from 'drizzle-orm/pg-core';
4
4
  export { pgCore as core };
5
- export { backup } from './backup.js';
6
- import 'dn-react-toolkit/file/server';
package/dist/db/index.js CHANGED
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/db/index.ts
32
32
  var db_exports = {};
33
33
  __export(db_exports, {
34
- backup: () => backup,
35
34
  core: () => core,
36
35
  drizzle: () => import_node_postgres.drizzle
37
36
  });
@@ -39,27 +38,8 @@ module.exports = __toCommonJS(db_exports);
39
38
  var import_node_postgres = require("drizzle-orm/node-postgres");
40
39
  __reExport(db_exports, require("drizzle-orm"), module.exports);
41
40
  var core = __toESM(require("drizzle-orm/pg-core"));
42
-
43
- // src/db/backup.ts
44
- var import_util = require("util");
45
- var fs = __toESM(require("fs"));
46
- var import_child_process = require("child_process");
47
- var backup = ({ objectStorage }) => async () => {
48
- const now = /* @__PURE__ */ new Date();
49
- console.log(`Running daily database backup at ${now.toISOString()}`);
50
- const out = "./backup.sql";
51
- const databaseUrl = `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`;
52
- await (0, import_util.promisify)(import_child_process.exec)(`pg_dump --dbname=${databaseUrl} > ${out}`);
53
- const buffer = await (0, import_util.promisify)(fs.readFile)(out);
54
- await objectStorage.put(`backup/${now.toISOString()}.sql`, buffer, {
55
- contentType: "application/sql"
56
- });
57
- await (0, import_util.promisify)(fs.unlink)(out);
58
- console.log("Database backup completed and uploaded to object storage");
59
- };
60
41
  // Annotate the CommonJS export names for ESM import in node:
61
42
  0 && (module.exports = {
62
- backup,
63
43
  core,
64
44
  drizzle,
65
45
  ...require("drizzle-orm")
package/dist/db/index.mjs CHANGED
@@ -2,26 +2,7 @@
2
2
  import { drizzle } from "drizzle-orm/node-postgres";
3
3
  export * from "drizzle-orm";
4
4
  import * as core from "drizzle-orm/pg-core";
5
-
6
- // src/db/backup.ts
7
- import { promisify } from "util";
8
- import * as fs from "fs";
9
- import { exec } from "child_process";
10
- var backup = ({ objectStorage }) => async () => {
11
- const now = /* @__PURE__ */ new Date();
12
- console.log(`Running daily database backup at ${now.toISOString()}`);
13
- const out = "./backup.sql";
14
- const databaseUrl = `postgresql://${process.env.DB_USER}:${process.env.DB_PASSWORD}@${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`;
15
- await promisify(exec)(`pg_dump --dbname=${databaseUrl} > ${out}`);
16
- const buffer = await promisify(fs.readFile)(out);
17
- await objectStorage.put(`backup/${now.toISOString()}.sql`, buffer, {
18
- contentType: "application/sql"
19
- });
20
- await promisify(fs.unlink)(out);
21
- console.log("Database backup completed and uploaded to object storage");
22
- };
23
5
  export {
24
- backup,
25
6
  core,
26
7
  drizzle
27
8
  };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
package/dist/seo/index.js CHANGED
@@ -50,7 +50,7 @@ var import_react = __toESM(require("react"));
50
50
  var Schema = __toESM(require_schema());
51
51
  var import_react_router = require("react-router");
52
52
  function configSEO(config) {
53
- function init(props) {
53
+ function create(props) {
54
54
  const canonicalPath = props.canonicalPath;
55
55
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
56
56
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -133,9 +133,7 @@ function configSEO(config) {
133
133
  }
134
134
  ] : [],
135
135
  ...props.images || [],
136
- ...props.collection?.map(
137
- (portfolio) => portfolio.thumbnail
138
- ) || []
136
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
139
137
  ].filter(Boolean);
140
138
  const image = images.filter((file) => file.id).map((file) => ({
141
139
  "@type": "ImageObject",
@@ -151,23 +149,21 @@ function configSEO(config) {
151
149
  const collectionMainEntity = props.collection ? {
152
150
  "@type": "ItemList",
153
151
  numberOfItems: props.collection.length,
154
- itemListElement: props.collection.map(
155
- (item, index) => ({
156
- "@type": "ListItem",
157
- position: index + 1,
152
+ itemListElement: props.collection.map((item, index) => ({
153
+ "@type": "ListItem",
154
+ position: index + 1,
155
+ url: item.url,
156
+ item: {
157
+ "@type": "WebPage",
158
+ "@id": `${item.url}#webpage`,
158
159
  url: item.url,
159
- item: {
160
- "@type": "WebPage",
161
- "@id": `${item.url}#webpage`,
162
- url: item.url,
163
- name: item.title,
164
- thumbnailUrl: item.thumbnail?.url,
165
- dateModified: item.updatedAt?.toISOString(),
166
- dateCreated: item.createdAt?.toISOString(),
167
- datePublished: item.createdAt?.toISOString()
168
- }
169
- })
170
- )
160
+ name: item.title,
161
+ thumbnailUrl: item.thumbnail?.url,
162
+ dateModified: item.updatedAt?.toISOString(),
163
+ dateCreated: item.createdAt?.toISOString(),
164
+ datePublished: item.createdAt?.toISOString()
165
+ }
166
+ }))
171
167
  } : void 0;
172
168
  const structuredData = {
173
169
  "@context": "https://schema.org",
@@ -306,7 +302,7 @@ function configSEO(config) {
306
302
  }
307
303
  return {
308
304
  config,
309
- init,
305
+ create,
310
306
  meta,
311
307
  StructedData
312
308
  };
@@ -37,7 +37,7 @@ var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
38
  import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
- function init(props) {
40
+ function create(props) {
41
41
  const canonicalPath = props.canonicalPath;
42
42
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
43
43
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -120,9 +120,7 @@ function configSEO(config) {
120
120
  }
121
121
  ] : [],
122
122
  ...props.images || [],
123
- ...props.collection?.map(
124
- (portfolio) => portfolio.thumbnail
125
- ) || []
123
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
126
124
  ].filter(Boolean);
127
125
  const image = images.filter((file) => file.id).map((file) => ({
128
126
  "@type": "ImageObject",
@@ -138,23 +136,21 @@ function configSEO(config) {
138
136
  const collectionMainEntity = props.collection ? {
139
137
  "@type": "ItemList",
140
138
  numberOfItems: props.collection.length,
141
- itemListElement: props.collection.map(
142
- (item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
139
+ itemListElement: props.collection.map((item, index) => ({
140
+ "@type": "ListItem",
141
+ position: index + 1,
142
+ url: item.url,
143
+ item: {
144
+ "@type": "WebPage",
145
+ "@id": `${item.url}#webpage`,
145
146
  url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
149
- url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- })
157
- )
147
+ name: item.title,
148
+ thumbnailUrl: item.thumbnail?.url,
149
+ dateModified: item.updatedAt?.toISOString(),
150
+ dateCreated: item.createdAt?.toISOString(),
151
+ datePublished: item.createdAt?.toISOString()
152
+ }
153
+ }))
158
154
  } : void 0;
159
155
  const structuredData = {
160
156
  "@context": "https://schema.org",
@@ -293,7 +289,7 @@ function configSEO(config) {
293
289
  }
294
290
  return {
295
291
  config,
296
- init,
292
+ create,
297
293
  meta,
298
294
  StructedData
299
295
  };
@@ -9,7 +9,7 @@ type SEOImage = {
9
9
  width?: number;
10
10
  height?: number;
11
11
  };
12
- type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["init"]>>;
12
+ type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["create"]>>;
13
13
  declare function configSEO(config: {
14
14
  origin: string;
15
15
  siteName: string;
@@ -28,7 +28,7 @@ declare function configSEO(config: {
28
28
  structedData?: Schema.Thing[] | (() => Schema.Thing[]);
29
29
  copyright?: string;
30
30
  };
31
- init: (props: {
31
+ create: (props: {
32
32
  title?: string;
33
33
  description?: string;
34
34
  keywords?: string[];
package/dist/seo/seo.d.ts CHANGED
@@ -9,7 +9,7 @@ type SEOImage = {
9
9
  width?: number;
10
10
  height?: number;
11
11
  };
12
- type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["init"]>>;
12
+ type SEO = Awaited<ReturnType<ReturnType<typeof configSEO>["create"]>>;
13
13
  declare function configSEO(config: {
14
14
  origin: string;
15
15
  siteName: string;
@@ -28,7 +28,7 @@ declare function configSEO(config: {
28
28
  structedData?: Schema.Thing[] | (() => Schema.Thing[]);
29
29
  copyright?: string;
30
30
  };
31
- init: (props: {
31
+ create: (props: {
32
32
  title?: string;
33
33
  description?: string;
34
34
  keywords?: string[];
package/dist/seo/seo.js CHANGED
@@ -48,7 +48,7 @@ var import_react = __toESM(require("react"));
48
48
  var Schema = __toESM(require_schema());
49
49
  var import_react_router = require("react-router");
50
50
  function configSEO(config) {
51
- function init(props) {
51
+ function create(props) {
52
52
  const canonicalPath = props.canonicalPath;
53
53
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
54
54
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -131,9 +131,7 @@ function configSEO(config) {
131
131
  }
132
132
  ] : [],
133
133
  ...props.images || [],
134
- ...props.collection?.map(
135
- (portfolio) => portfolio.thumbnail
136
- ) || []
134
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
137
135
  ].filter(Boolean);
138
136
  const image = images.filter((file) => file.id).map((file) => ({
139
137
  "@type": "ImageObject",
@@ -149,23 +147,21 @@ function configSEO(config) {
149
147
  const collectionMainEntity = props.collection ? {
150
148
  "@type": "ItemList",
151
149
  numberOfItems: props.collection.length,
152
- itemListElement: props.collection.map(
153
- (item, index) => ({
154
- "@type": "ListItem",
155
- position: index + 1,
150
+ itemListElement: props.collection.map((item, index) => ({
151
+ "@type": "ListItem",
152
+ position: index + 1,
153
+ url: item.url,
154
+ item: {
155
+ "@type": "WebPage",
156
+ "@id": `${item.url}#webpage`,
156
157
  url: item.url,
157
- item: {
158
- "@type": "WebPage",
159
- "@id": `${item.url}#webpage`,
160
- url: item.url,
161
- name: item.title,
162
- thumbnailUrl: item.thumbnail?.url,
163
- dateModified: item.updatedAt?.toISOString(),
164
- dateCreated: item.createdAt?.toISOString(),
165
- datePublished: item.createdAt?.toISOString()
166
- }
167
- })
168
- )
158
+ name: item.title,
159
+ thumbnailUrl: item.thumbnail?.url,
160
+ dateModified: item.updatedAt?.toISOString(),
161
+ dateCreated: item.createdAt?.toISOString(),
162
+ datePublished: item.createdAt?.toISOString()
163
+ }
164
+ }))
169
165
  } : void 0;
170
166
  const structuredData = {
171
167
  "@context": "https://schema.org",
@@ -304,7 +300,7 @@ function configSEO(config) {
304
300
  }
305
301
  return {
306
302
  config,
307
- init,
303
+ create,
308
304
  meta,
309
305
  StructedData
310
306
  };
package/dist/seo/seo.mjs CHANGED
@@ -37,7 +37,7 @@ var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
38
  import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
- function init(props) {
40
+ function create(props) {
41
41
  const canonicalPath = props.canonicalPath;
42
42
  const url = canonicalPath ? `${config.origin}${canonicalPath === "/" ? "" : canonicalPath}` : `${config.origin}${props.path || ""}`;
43
43
  const pageTitle = props.title ? `${props.title} | ${config.siteName}` : config.siteName;
@@ -120,9 +120,7 @@ function configSEO(config) {
120
120
  }
121
121
  ] : [],
122
122
  ...props.images || [],
123
- ...props.collection?.map(
124
- (portfolio) => portfolio.thumbnail
125
- ) || []
123
+ ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
126
124
  ].filter(Boolean);
127
125
  const image = images.filter((file) => file.id).map((file) => ({
128
126
  "@type": "ImageObject",
@@ -138,23 +136,21 @@ function configSEO(config) {
138
136
  const collectionMainEntity = props.collection ? {
139
137
  "@type": "ItemList",
140
138
  numberOfItems: props.collection.length,
141
- itemListElement: props.collection.map(
142
- (item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
139
+ itemListElement: props.collection.map((item, index) => ({
140
+ "@type": "ListItem",
141
+ position: index + 1,
142
+ url: item.url,
143
+ item: {
144
+ "@type": "WebPage",
145
+ "@id": `${item.url}#webpage`,
145
146
  url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
149
- url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- })
157
- )
147
+ name: item.title,
148
+ thumbnailUrl: item.thumbnail?.url,
149
+ dateModified: item.updatedAt?.toISOString(),
150
+ dateCreated: item.createdAt?.toISOString(),
151
+ datePublished: item.createdAt?.toISOString()
152
+ }
153
+ }))
158
154
  } : void 0;
159
155
  const structuredData = {
160
156
  "@context": "https://schema.org",
@@ -293,7 +289,7 @@ function configSEO(config) {
293
289
  }
294
290
  return {
295
291
  config,
296
- init,
292
+ create,
297
293
  meta,
298
294
  StructedData
299
295
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.js",
@@ -35,6 +35,11 @@
35
35
  "import": "./dist/db/index.mjs",
36
36
  "require": "./dist/db/index.js"
37
37
  },
38
+ "./db/backup": {
39
+ "types": "./dist/db/backup/index.d.ts",
40
+ "import": "./dist/db/backup/index.mjs",
41
+ "require": "./dist/db/backup/index.js"
42
+ },
38
43
  "./table": {
39
44
  "types": "./dist/table/index.d.ts",
40
45
  "import": "./dist/table/index.mjs",