@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 +73 -67
- package/dist/index.js +3 -4
- package/dist/index.mjs +3 -4
- package/package.json +4 -4
- package/src/fs/fs.service.ts +12 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-store
|
|
2
|
-
|
|
3
|
-
## 1.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
## 1.1.
|
|
10
|
-
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
## 1.0
|
|
16
|
-
|
|
17
|
-
###
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
## 1.0.
|
|
22
|
-
|
|
23
|
-
###
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
## 0.
|
|
28
|
-
|
|
29
|
-
###
|
|
30
|
-
|
|
31
|
-
- Modified
|
|
32
|
-
|
|
33
|
-
## 0.3.
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
## 0.3.
|
|
40
|
-
|
|
41
|
-
###
|
|
42
|
-
|
|
43
|
-
- Added:
|
|
44
|
-
|
|
45
|
-
## 0.
|
|
46
|
-
|
|
47
|
-
### Minor Changes
|
|
48
|
-
|
|
49
|
-
- Added:
|
|
50
|
-
|
|
51
|
-
## 0.
|
|
52
|
-
|
|
53
|
-
###
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
## 0.1.
|
|
58
|
-
|
|
59
|
-
###
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
## 0.0
|
|
64
|
-
|
|
65
|
-
###
|
|
66
|
-
|
|
67
|
-
-
|
|
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
|
|
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
|
|
975
|
-
const pathname =
|
|
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
|
-
|
|
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
|
|
896
|
-
const pathname =
|
|
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.
|
|
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": ">=
|
|
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.
|
|
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": "^
|
|
43
|
+
"typescript": "^5.1.6"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
package/src/fs/fs.service.ts
CHANGED
|
@@ -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
|
-
|
|
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?:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
}
|