@dereekb/nestjs 13.10.9 → 13.11.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.
- package/discord/package.json +4 -4
- package/eslint/package.json +1 -1
- package/index.cjs.js +669 -26
- package/index.esm.js +664 -29
- package/mailgun/package.json +6 -6
- package/openai/package.json +6 -6
- package/package.json +3 -3
- package/src/lib/util/cache/cache.file.d.ts +106 -0
- package/src/lib/util/cache/index.d.ts +1 -0
- package/src/lib/util/file/file.json.d.ts +57 -0
- package/src/lib/util/file/index.d.ts +1 -0
- package/src/lib/util/index.d.ts +2 -0
- package/stripe/package.json +6 -6
- package/typeform/package.json +6 -6
- package/vapiai/package.json +6 -6
package/mailgun/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/mailgun",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.11.1",
|
|
6
|
+
"@dereekb/model": "13.11.1",
|
|
7
|
+
"@dereekb/nestjs": "13.11.1",
|
|
8
|
+
"@dereekb/rxjs": "13.11.1",
|
|
9
|
+
"@dereekb/util": "13.11.1",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"form-data": "^4.0.5",
|
package/openai/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/openai",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.11.1",
|
|
6
|
+
"@dereekb/model": "13.11.1",
|
|
7
|
+
"@dereekb/nestjs": "13.11.1",
|
|
8
|
+
"@dereekb/rxjs": "13.11.1",
|
|
9
|
+
"@dereekb/util": "13.11.1",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"express": "^5.2.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"types": "./src/index.d.ts",
|
|
5
5
|
"module": "./index.esm.js",
|
|
6
6
|
"main": "./index.cjs.js",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@dereekb/rxjs": "13.
|
|
60
|
-
"@dereekb/util": "13.
|
|
59
|
+
"@dereekb/rxjs": "13.11.1",
|
|
60
|
+
"@dereekb/util": "13.11.1",
|
|
61
61
|
"@nestjs/common": "^11.1.19",
|
|
62
62
|
"@nestjs/config": "^4.0.4",
|
|
63
63
|
"@typeform/api-client": "^2.10.2",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type AsyncKeyedValueCache, type AsyncValueCache, type Maybe } from '@dereekb/util';
|
|
2
|
+
/**
|
|
3
|
+
* Default file mode used by the JSON-file caches when none is provided.
|
|
4
|
+
*
|
|
5
|
+
* 0o600 restricts the file to read/write for the owning user only — appropriate for
|
|
6
|
+
* secrets like cached access/refresh tokens.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_JSON_FILE_CACHE_MODE = 384;
|
|
9
|
+
/**
|
|
10
|
+
* Input for {@link createJsonFileAsyncValueCache} and {@link createMemoizedJsonFileAsyncValueCache}.
|
|
11
|
+
*/
|
|
12
|
+
export interface CreateJsonFileAsyncValueCacheInput<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Absolute path to the JSON file that backs the cache.
|
|
15
|
+
*/
|
|
16
|
+
readonly filePath: string;
|
|
17
|
+
/**
|
|
18
|
+
* File mode applied on write. Defaults to {@link DEFAULT_JSON_FILE_CACHE_MODE} (0o600).
|
|
19
|
+
*/
|
|
20
|
+
readonly mode?: Maybe<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Optional transform applied to the raw JSON-parsed payload before it is returned from `load()`.
|
|
23
|
+
*
|
|
24
|
+
* Use this to revive types that don't roundtrip through JSON — e.g. a `Date` field stored as an ISO string.
|
|
25
|
+
*/
|
|
26
|
+
readonly reviver?: Maybe<(raw: unknown) => Maybe<T>>;
|
|
27
|
+
/**
|
|
28
|
+
* Optional transform applied to the value before it is stringified to JSON on `update()`.
|
|
29
|
+
*/
|
|
30
|
+
readonly replacer?: Maybe<(value: T) => unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates an {@link AsyncValueCache} backed by a single JSON file on disk.
|
|
34
|
+
*
|
|
35
|
+
* Reads always touch disk; wrap with {@link memoizeAsyncValueCache} (or use
|
|
36
|
+
* {@link createMemoizedJsonFileAsyncValueCache}) to add per-process memoization.
|
|
37
|
+
*
|
|
38
|
+
* Multi-process invalidation is not provided. Two processes writing to the same file
|
|
39
|
+
* will last-writer-wins; once memoized, a long-running process will not observe writes
|
|
40
|
+
* from another process.
|
|
41
|
+
*
|
|
42
|
+
* @param input - Configuration bag describing the backing file and optional JSON revive/replace hooks.
|
|
43
|
+
* @param input.filePath - Absolute path to the JSON file that backs the cache.
|
|
44
|
+
* @param input.mode - Optional file mode applied on write; defaults to {@link DEFAULT_JSON_FILE_CACHE_MODE} (0o600).
|
|
45
|
+
* @param input.reviver - Optional transform applied to the raw JSON-parsed payload before it is returned from `load()` (e.g. revive `Date` fields).
|
|
46
|
+
* @param input.replacer - Optional transform applied to the value before it is stringified to JSON on `update()`.
|
|
47
|
+
* @returns An {@link AsyncValueCache} that persists the value to the configured JSON file.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createJsonFileAsyncValueCache<T>(input: CreateJsonFileAsyncValueCacheInput<T>): AsyncValueCache<T>;
|
|
50
|
+
/**
|
|
51
|
+
* Convenience wrapper around {@link createJsonFileAsyncValueCache} composed with
|
|
52
|
+
* {@link memoizeAsyncValueCache}.
|
|
53
|
+
*
|
|
54
|
+
* @param input - Same configuration accepted by {@link createJsonFileAsyncValueCache}; see {@link CreateJsonFileAsyncValueCacheInput}.
|
|
55
|
+
* @returns An {@link AsyncValueCache} backed by the JSON file with a per-process single-load memoization layer in front.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createMemoizedJsonFileAsyncValueCache<T>(input: CreateJsonFileAsyncValueCacheInput<T>): AsyncValueCache<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Input for {@link createJsonFileAsyncKeyedValueCache} and {@link createMemoizedJsonFileAsyncKeyedValueCache}.
|
|
60
|
+
*/
|
|
61
|
+
export interface CreateJsonFileAsyncKeyedValueCacheInput<T> {
|
|
62
|
+
/**
|
|
63
|
+
* Absolute path to the JSON file that backs the cache. The file holds the entire `Record<string, T>`.
|
|
64
|
+
*/
|
|
65
|
+
readonly filePath: string;
|
|
66
|
+
/**
|
|
67
|
+
* File mode applied on write. Defaults to {@link DEFAULT_JSON_FILE_CACHE_MODE} (0o600).
|
|
68
|
+
*/
|
|
69
|
+
readonly mode?: Maybe<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Optional transform applied to each entry after it is JSON-parsed on `load()`/`get()`.
|
|
72
|
+
*/
|
|
73
|
+
readonly reviver?: Maybe<(raw: unknown) => Maybe<T>>;
|
|
74
|
+
/**
|
|
75
|
+
* Optional transform applied to each entry before it is stringified on `set()`.
|
|
76
|
+
*/
|
|
77
|
+
readonly replacer?: Maybe<(value: T) => unknown>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates an {@link AsyncKeyedValueCache} backed by a single JSON file holding a `Record<string, T>`.
|
|
81
|
+
*
|
|
82
|
+
* Reads/writes always touch disk; wrap with {@link memoizeAsyncKeyedValueCache} (or use
|
|
83
|
+
* {@link createMemoizedJsonFileAsyncKeyedValueCache}) to add per-process memoization of the
|
|
84
|
+
* entire record.
|
|
85
|
+
*
|
|
86
|
+
* Multi-process invalidation is not provided; see {@link createJsonFileAsyncValueCache} for caveats.
|
|
87
|
+
*
|
|
88
|
+
* Concurrent `set`/`remove`/`clear` calls are serialized through a per-instance promise chain so
|
|
89
|
+
* the read-modify-write of the entire record file does not race within the same process.
|
|
90
|
+
*
|
|
91
|
+
* @param input - Configuration bag describing the backing file and optional per-entry revive/replace hooks.
|
|
92
|
+
* @param input.filePath - Absolute path to the JSON file that holds the entire `Record<string, T>`.
|
|
93
|
+
* @param input.mode - Optional file mode applied on write; defaults to {@link DEFAULT_JSON_FILE_CACHE_MODE} (0o600).
|
|
94
|
+
* @param input.reviver - Optional transform applied to each entry after it is JSON-parsed on `load()`/`get()`. Returning null/undefined drops the entry.
|
|
95
|
+
* @param input.replacer - Optional transform applied to each entry before it is stringified on `set()`.
|
|
96
|
+
* @returns An {@link AsyncKeyedValueCache} that persists all entries in the configured JSON file.
|
|
97
|
+
*/
|
|
98
|
+
export declare function createJsonFileAsyncKeyedValueCache<T>(input: CreateJsonFileAsyncKeyedValueCacheInput<T>): AsyncKeyedValueCache<T>;
|
|
99
|
+
/**
|
|
100
|
+
* Convenience wrapper around {@link createJsonFileAsyncKeyedValueCache} composed with
|
|
101
|
+
* {@link memoizeAsyncKeyedValueCache}.
|
|
102
|
+
*
|
|
103
|
+
* @param input - Same configuration accepted by {@link createJsonFileAsyncKeyedValueCache}; see {@link CreateJsonFileAsyncKeyedValueCacheInput}.
|
|
104
|
+
* @returns An {@link AsyncKeyedValueCache} backed by the JSON file with a per-process record-level memoization layer in front.
|
|
105
|
+
*/
|
|
106
|
+
export declare function createMemoizedJsonFileAsyncKeyedValueCache<T>(input: CreateJsonFileAsyncKeyedValueCacheInput<T>): AsyncKeyedValueCache<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cache.file';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Maybe } from '@dereekb/util';
|
|
2
|
+
/**
|
|
3
|
+
* Reads JSON from disk, resolving `undefined` when the file is missing (ENOENT) or its
|
|
4
|
+
* contents fail to parse as JSON. Other I/O errors (permission denied, busy handles) are
|
|
5
|
+
* forwarded to the caller — silently swallowing them masks real failures.
|
|
6
|
+
*
|
|
7
|
+
* @param filePath - Absolute path to the JSON file to read.
|
|
8
|
+
* @returns The parsed JSON cast to `T`, or `undefined` when the file does not exist or its contents are not valid JSON.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readJsonFile<T>(filePath: string): Promise<Maybe<T>>;
|
|
11
|
+
/**
|
|
12
|
+
* Configuration bag for {@link writeJsonFile}.
|
|
13
|
+
*/
|
|
14
|
+
export interface WriteJsonFileInput {
|
|
15
|
+
/**
|
|
16
|
+
* Absolute path to the file to write.
|
|
17
|
+
*/
|
|
18
|
+
readonly filePath: string;
|
|
19
|
+
/**
|
|
20
|
+
* Absolute path to the parent directory; created (recursively) if missing before the write.
|
|
21
|
+
*/
|
|
22
|
+
readonly dirPath: string;
|
|
23
|
+
/**
|
|
24
|
+
* Value to serialize as JSON.
|
|
25
|
+
*/
|
|
26
|
+
readonly data: unknown;
|
|
27
|
+
/**
|
|
28
|
+
* Optional numeric file mode (e.g. `0o600`) enforced via an explicit `chmod` after the write.
|
|
29
|
+
*/
|
|
30
|
+
readonly mode?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Writes a value to disk as JSON. Creates the parent directory if it does not exist.
|
|
34
|
+
*
|
|
35
|
+
* The `mode` option is enforced via an explicit `chmod` after the write — `writeFile`'s `mode`
|
|
36
|
+
* parameter is ignored when the file already exists, which would otherwise leave a
|
|
37
|
+
* pre-existing file at its original (potentially world-readable) permissions.
|
|
38
|
+
*
|
|
39
|
+
* @param input - Configuration describing the destination, payload, and optional file mode.
|
|
40
|
+
* @param input.filePath - Absolute path to the file to write.
|
|
41
|
+
* @param input.dirPath - Absolute path to the parent directory; created (recursively) when missing.
|
|
42
|
+
* @param input.data - Value to serialize as JSON (pretty-printed with two-space indentation).
|
|
43
|
+
* @param input.mode - Optional numeric file mode (e.g. `0o600`) applied via `chmod` after the write.
|
|
44
|
+
* @returns A promise that resolves once the JSON has been written and the optional `chmod` has completed.
|
|
45
|
+
*/
|
|
46
|
+
export declare function writeJsonFile(input: WriteJsonFileInput): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Removes the file at the given path.
|
|
49
|
+
*
|
|
50
|
+
* Resolves silently when the file does not exist (`force: true`); other errors
|
|
51
|
+
* (permission denied, busy file handles) are forwarded to the caller — silently
|
|
52
|
+
* swallowing them masks real failures and makes operations appear to have succeeded.
|
|
53
|
+
*
|
|
54
|
+
* @param filePath - Absolute path to the file to remove.
|
|
55
|
+
* @returns A promise that resolves once the file is removed (or was already absent).
|
|
56
|
+
*/
|
|
57
|
+
export declare function removeFile(filePath: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file.json';
|
package/src/lib/util/index.d.ts
CHANGED
package/stripe/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/stripe",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.11.1",
|
|
6
|
+
"@dereekb/model": "13.11.1",
|
|
7
|
+
"@dereekb/nestjs": "13.11.1",
|
|
8
|
+
"@dereekb/rxjs": "13.11.1",
|
|
9
|
+
"@dereekb/util": "13.11.1",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"express": "^5.2.1",
|
package/typeform/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/typeform",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.11.1",
|
|
6
|
+
"@dereekb/model": "13.11.1",
|
|
7
|
+
"@dereekb/nestjs": "13.11.1",
|
|
8
|
+
"@dereekb/rxjs": "13.11.1",
|
|
9
|
+
"@dereekb/util": "13.11.1",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"@typeform/api-client": "^2.10.2",
|
package/vapiai/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/nestjs/vapiai",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/model": "13.
|
|
7
|
-
"@dereekb/nestjs": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.11.1",
|
|
6
|
+
"@dereekb/model": "13.11.1",
|
|
7
|
+
"@dereekb/nestjs": "13.11.1",
|
|
8
|
+
"@dereekb/rxjs": "13.11.1",
|
|
9
|
+
"@dereekb/util": "13.11.1",
|
|
10
10
|
"@nestjs/common": "^11.1.19",
|
|
11
11
|
"@nestjs/config": "^4.0.4",
|
|
12
12
|
"@vapi-ai/server-sdk": "^0.11.0",
|