@websolutespa/bom-mixer-store 1.1.1 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,67 +1,73 @@
1
- # @websolutespa/bom-mixer-store
2
-
3
- ## 1.1.1
4
-
5
- ### Patch Changes
6
-
7
- - Fixing: check redirects by pattern.
8
-
9
- ## 1.1.0
10
-
11
- ### Minor Changes
12
-
13
- - Modified: store refactor.
14
-
15
- ## 1.0.1
16
-
17
- ### Patch Changes
18
-
19
- - Fixing: localhost url.
20
-
21
- ## 1.0.0
22
-
23
- ### Minor Changes
24
-
25
- - Modified routes, added redirects.
26
-
27
- ## 0.3.2
28
-
29
- ### Patch Changes
30
-
31
- - Modified: MockMenuService.
32
-
33
- ## 0.3.1
34
-
35
- ### Patch Changes
36
-
37
- - Added: source files.
38
-
39
- ## 0.3.0
40
-
41
- ### Minor Changes
42
-
43
- - Added: splat routes.
44
-
45
- ## 0.2.0
46
-
47
- ### Minor Changes
48
-
49
- - Added: @websolutespa/bom-core.
50
-
51
- ## 0.1.1
52
-
53
- ### Patch Changes
54
-
55
- - Modified: store service.
56
-
57
- ## 0.1.0
58
-
59
- ### Minor Changes
60
-
61
- - mock refactor.
62
-
63
- ## 0.0.2
64
-
65
- ### Patch Changes
66
-
67
- - Added: first release.
1
+ # @websolutespa/bom-mixer-store
2
+
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Updating: next 13.
8
+
9
+ ## 1.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixing: check redirects by pattern.
14
+
15
+ ## 1.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Modified: store refactor.
20
+
21
+ ## 1.0.1
22
+
23
+ ### Patch Changes
24
+
25
+ - Fixing: localhost url.
26
+
27
+ ## 1.0.0
28
+
29
+ ### Minor Changes
30
+
31
+ - Modified routes, added redirects.
32
+
33
+ ## 0.3.2
34
+
35
+ ### Patch Changes
36
+
37
+ - Modified: MockMenuService.
38
+
39
+ ## 0.3.1
40
+
41
+ ### Patch Changes
42
+
43
+ - Added: source files.
44
+
45
+ ## 0.3.0
46
+
47
+ ### Minor Changes
48
+
49
+ - Added: splat routes.
50
+
51
+ ## 0.2.0
52
+
53
+ ### Minor Changes
54
+
55
+ - Added: @websolutespa/bom-core.
56
+
57
+ ## 0.1.1
58
+
59
+ ### Patch Changes
60
+
61
+ - Modified: store service.
62
+
63
+ ## 0.1.0
64
+
65
+ ### Minor Changes
66
+
67
+ - mock refactor.
68
+
69
+ ## 0.0.2
70
+
71
+ ### Patch Changes
72
+
73
+ - Added: first release.
package/dist/index.js CHANGED
@@ -271,8 +271,7 @@ var COLLECTIONS = [...ENV_COLLECTIONS, ...KNOWN_COLLECTIONS];
271
271
  var import_bom_core7 = require("@websolutespa/bom-core");
272
272
 
273
273
  // src/fs/fs.service.ts
274
- var path = require("path");
275
- var fs = require("fs");
274
+ var fs = __toESM(require("fs"));
276
275
  async function fsRead(pathname, option) {
277
276
  try {
278
277
  const data = await fs.promises.readFile(pathname, option?.encoding || "utf8");
@@ -971,8 +970,8 @@ function getMockStoreFromData_(data) {
971
970
  }
972
971
  async function getStoreData_() {
973
972
  if (import_bom_core7.isDevelopment) {
974
- const path2 = require("path");
975
- const pathname = path2.join(process.cwd(), ".mixer", "store.json");
973
+ const path = require("path");
974
+ const pathname = path.join(process.cwd(), ".mixer", "store.json");
976
975
  return await fsReadJson(pathname) || {};
977
976
  } else {
978
977
  const store = process.env.STORE_ || {};
package/dist/index.mjs CHANGED
@@ -190,8 +190,7 @@ var COLLECTIONS = [...ENV_COLLECTIONS, ...KNOWN_COLLECTIONS];
190
190
  import { isDevelopment } from "@websolutespa/bom-core";
191
191
 
192
192
  // src/fs/fs.service.ts
193
- var path = __require("path");
194
- var fs = __require("fs");
193
+ import * as fs from "fs";
195
194
  async function fsRead(pathname, option) {
196
195
  try {
197
196
  const data = await fs.promises.readFile(pathname, option?.encoding || "utf8");
@@ -892,8 +891,8 @@ function getMockStoreFromData_(data) {
892
891
  }
893
892
  async function getStoreData_() {
894
893
  if (isDevelopment) {
895
- const path2 = __require("path");
896
- const pathname = path2.join(process.cwd(), ".mixer", "store.json");
894
+ const path = __require("path");
895
+ const pathname = path.join(process.cwd(), ".mixer", "store.json");
897
896
  return await fsReadJson(pathname) || {};
898
897
  } else {
899
898
  const store = process.env.STORE_ || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -28,19 +28,19 @@
28
28
  "peerDependencies": {
29
29
  "@websolutespa/bom-core": "*",
30
30
  "iron-session": ">= 6.2.1",
31
- "next": ">= 12.3.2"
31
+ "next": ">= 13.4.19"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/mime": "^3.0.1",
35
35
  "@websolutespa/bom-cli": "*",
36
36
  "@websolutespa/test": "*",
37
37
  "@websolutespa/tsconfig": "*",
38
- "eslint": "^8.36.0",
38
+ "eslint": "^8.46.0",
39
39
  "eslint-config-websolute": "*",
40
40
  "npm-run-all": "^4.1.5",
41
41
  "ts-node": "^10.9.1",
42
42
  "tsup": "^6.7.0",
43
- "typescript": "^4.8.4"
43
+ "typescript": "^5.1.6"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
@@ -1,15 +1,17 @@
1
1
  import { Json } from '@websolutespa/bom-core';
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
2
4
 
3
- /* eslint-disable @typescript-eslint/no-var-requires */
4
- const path = require('path');
5
- const fs = require('fs');
6
-
7
- export type TFsReadOption = {
5
+ export type fsReadOptions = {
8
6
  encoding?: null | undefined;
9
7
  flag?: number | string | undefined;
10
8
  signal?: AbortSignal | undefined;
11
9
  };
12
10
 
11
+ export type fsWatchOptions = (fs.WatchOptions & { encoding: 'buffer' }) | 'buffer';
12
+ export type fsWatchFileOptions = (fs.WatchFileOptions & { bigint?: false });
13
+ export type fsWriteFileOptions = (fs.ObjectEncodingOptions & { mode?: fs.Mode; flag?: fs.OpenMode }) | BufferEncoding | null;
14
+
13
15
  export async function fsExists(pathname: string): Promise<boolean> {
14
16
  try {
15
17
  await fs.promises.access(pathname);
@@ -19,7 +21,7 @@ export async function fsExists(pathname: string): Promise<boolean> {
19
21
  }
20
22
  }
21
23
 
22
- export async function fsRead(pathname: string, option?: TFsReadOption): Promise<string | undefined> {
24
+ export async function fsRead(pathname: string, option?: fsReadOptions): Promise<string | undefined> {
23
25
  try {
24
26
  const data = await fs.promises.readFile(pathname, option?.encoding || 'utf8');
25
27
  return data || undefined;
@@ -45,7 +47,7 @@ export async function fsReadJson<T = Json>(pathname: string): Promise<T | undefi
45
47
  }
46
48
  }
47
49
 
48
- export async function fsWrite(pathname: string, data: string, encoding = 'utf8'): Promise<void> {
50
+ export async function fsWrite(pathname: string, data: string, encoding: fsWriteFileOptions = 'utf8'): Promise<void> {
49
51
  try {
50
52
  await fs.promises.mkdir(path.dirname(pathname), { recursive: true });
51
53
  await fs.promises.writeFile(pathname, data, encoding);
@@ -54,7 +56,7 @@ export async function fsWrite(pathname: string, data: string, encoding = 'utf8')
54
56
  }
55
57
  }
56
58
 
57
- export async function fsWriteJson(pathname: string, data: any): Promise<void> {
59
+ export async function fsWriteJson(pathname: string, data: Json): Promise<void> {
58
60
  try {
59
61
  await fsWrite(pathname, JSON.stringify(data, null, 2));
60
62
  } catch (error) {
@@ -111,12 +113,12 @@ export async function fsReadJsonDirectory(pathname: string): Promise<{ name: str
111
113
  }
112
114
  }
113
115
 
114
- export function fsWatch(pathname: string, callback: (eventType: any, fileName: string) => void, options?: { interval: 2000 }): void {
116
+ export function fsWatch(pathname: string, callback: (eventType: fs.WatchEventType, fileName: string) => void, options: fsWatchOptions) {
115
117
  const debounced = debounce(callback);
116
118
  return fs.watch(pathname, options, debounced);
117
119
  }
118
120
 
119
- export function fsWatchFile(pathname: string, callback: (eventType: any, fileName: string) => void, options?: { interval: 2000 }): void {
121
+ export function fsWatchFile(pathname: string, callback: (eventType: fs.WatchEventType, fileName: string) => void, options?: fsWatchFileOptions) {
120
122
  const debounced = debounce(callback);
121
123
  return fs.watchFile(pathname, options, debounced);
122
124
  }