@unikvs/redis.node 0.0.0 → 0.0.14
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/LICENSE +21 -0
- package/README.md +1 -43
- package/dist/index.d.ts +222 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +430 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -8
- package/src/errors.ts +161 -0
- package/src/index.ts +19 -0
- package/src/redis.ts +544 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, tai-kun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,3 @@
|
|
|
1
1
|
# @unikvs/redis.node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@unikvs/redis.node`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|
|
3
|
+
[Document](https://tai-kun.github.io/unikvs/)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { ErrorBase, ErrorOptions, IStorage, InvalidUsageErrorBase, KeyNotFoundError, KeyNotFoundErrorArgs, KeyNotFoundErrorMeta } from "@unikvs/core";
|
|
2
|
+
import { ClusterNode, ClusterOptions, RedisOptions } from "ioredis";
|
|
3
|
+
//#region ../src/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-cluster-not-supported)
|
|
6
|
+
*/
|
|
7
|
+
export declare class ClusterNotSupportedError extends InvalidUsageErrorBase<undefined> {
|
|
8
|
+
/**
|
|
9
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-cluster-not-supported)
|
|
10
|
+
*/
|
|
11
|
+
constructor(options?: ErrorOptions);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-invalid-close-timeout)
|
|
15
|
+
*/
|
|
16
|
+
type InvalidCloseTimeoutErrorMeta = {
|
|
17
|
+
/**
|
|
18
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#invalid-close-timeout-actual)
|
|
19
|
+
*/
|
|
20
|
+
readonly actual: unknown;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-invalid-close-timeout)
|
|
24
|
+
*/
|
|
25
|
+
type InvalidCloseTimeoutErrorArgs = ErrorOptions & InvalidCloseTimeoutErrorMeta;
|
|
26
|
+
/**
|
|
27
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-invalid-close-timeout)
|
|
28
|
+
*/
|
|
29
|
+
export declare class InvalidCloseTimeoutError extends ErrorBase<InvalidCloseTimeoutErrorMeta> {
|
|
30
|
+
/**
|
|
31
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-invalid-close-timeout)
|
|
32
|
+
*/
|
|
33
|
+
constructor(args: InvalidCloseTimeoutErrorArgs);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-connect-timeout)
|
|
37
|
+
*/
|
|
38
|
+
type ConnectTimeoutErrorMeta = {
|
|
39
|
+
/**
|
|
40
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#connect-timeout-timeoutms)
|
|
41
|
+
*/
|
|
42
|
+
readonly timeoutMs: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-connect-timeout)
|
|
46
|
+
*/
|
|
47
|
+
type ConnectTimeoutErrorArgs = ErrorOptions & ConnectTimeoutErrorMeta;
|
|
48
|
+
/**
|
|
49
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-connect-timeout)
|
|
50
|
+
*/
|
|
51
|
+
export declare class ConnectTimeoutError extends ErrorBase<ConnectTimeoutErrorMeta> {
|
|
52
|
+
/**
|
|
53
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-connect-timeout)
|
|
54
|
+
*/
|
|
55
|
+
constructor(args: ConnectTimeoutErrorArgs);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-close-timeout)
|
|
59
|
+
*/
|
|
60
|
+
type CloseTimeoutErrorMeta = {
|
|
61
|
+
/**
|
|
62
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#close-timeout-timeoutms)
|
|
63
|
+
*/
|
|
64
|
+
readonly timeoutMs: number;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-close-timeout)
|
|
68
|
+
*/
|
|
69
|
+
type CloseTimeoutErrorArgs = ErrorOptions & CloseTimeoutErrorMeta;
|
|
70
|
+
/**
|
|
71
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-close-timeout)
|
|
72
|
+
*/
|
|
73
|
+
export declare class CloseTimeoutError extends ErrorBase<CloseTimeoutErrorMeta> {
|
|
74
|
+
/**
|
|
75
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#error-close-timeout)
|
|
76
|
+
*/
|
|
77
|
+
constructor(args: CloseTimeoutErrorArgs);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region ../src/redis.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisclusterspec)
|
|
83
|
+
*/
|
|
84
|
+
type RedisClusterSpec = {
|
|
85
|
+
/**
|
|
86
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisclusterspec-nodes)
|
|
87
|
+
*/
|
|
88
|
+
readonly nodes: readonly ClusterNode[];
|
|
89
|
+
/**
|
|
90
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisclusterspec-options)
|
|
91
|
+
*/
|
|
92
|
+
readonly options?: ClusterOptions | undefined;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisstorageoptions)
|
|
96
|
+
*/
|
|
97
|
+
type RedisStorageOptions = Omit<RedisOptions, "keyPrefix" | "lazyConnect"> & {
|
|
98
|
+
/**
|
|
99
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisstorageoptions-keyprefix)
|
|
100
|
+
*/
|
|
101
|
+
readonly keyPrefix?: string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisstorageoptions-cluster)
|
|
104
|
+
*/
|
|
105
|
+
readonly cluster?: RedisClusterSpec | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redisstorageoptions-closetimeout)
|
|
108
|
+
*/
|
|
109
|
+
readonly closeTimeout?: number | undefined;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redis)
|
|
113
|
+
*/
|
|
114
|
+
declare class Redis implements IStorage {
|
|
115
|
+
#private;
|
|
116
|
+
/**
|
|
117
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redis)
|
|
118
|
+
*/
|
|
119
|
+
readonly name: string;
|
|
120
|
+
/**
|
|
121
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/redis-node#redis)
|
|
122
|
+
*/
|
|
123
|
+
constructor(url?: string, options?: RedisStorageOptions);
|
|
124
|
+
/**
|
|
125
|
+
* ストレージがオープン済みかどうかです。
|
|
126
|
+
*
|
|
127
|
+
* @returns オープン済みなら真です。
|
|
128
|
+
*/
|
|
129
|
+
get isOpen(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* ストレージをオープンします。
|
|
132
|
+
*
|
|
133
|
+
* `ioredis` クライアントを作成して接続します。
|
|
134
|
+
*
|
|
135
|
+
* @param _c オープンコンテキストです。
|
|
136
|
+
*
|
|
137
|
+
* @returns オープンが完了したら解決します。
|
|
138
|
+
*/
|
|
139
|
+
open(_c: IStorage.OpenContext): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* ストレージをクローズします。
|
|
142
|
+
*
|
|
143
|
+
* `quit` で丁寧に閉じ、失敗時は `disconnect` で掃除します。
|
|
144
|
+
*
|
|
145
|
+
* @param _c クローズコンテキストです。
|
|
146
|
+
*
|
|
147
|
+
* @returns クローズが完了したら解決します。
|
|
148
|
+
*/
|
|
149
|
+
close(_c: IStorage.CloseContext): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* バイト列を書き込みます。
|
|
152
|
+
*
|
|
153
|
+
* 指定したキーで値を上書きします。
|
|
154
|
+
*
|
|
155
|
+
* @param c 書き込みコンテキストです。
|
|
156
|
+
* @param data 保存するバイト列です。
|
|
157
|
+
*
|
|
158
|
+
* @returns 書き込みが完了したら解決します。
|
|
159
|
+
*/
|
|
160
|
+
write(c: IStorage.WriteContext, data: Uint8Array<ArrayBuffer>): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* バイト列を読み取ります。
|
|
163
|
+
*
|
|
164
|
+
* 指定したキーの値を取得します。
|
|
165
|
+
*
|
|
166
|
+
* @param c 読み取りコンテキストです。
|
|
167
|
+
*
|
|
168
|
+
* @returns 読み取ったバイト列です。
|
|
169
|
+
*/
|
|
170
|
+
read(c: IStorage.ReadContext): Promise<Uint8Array<ArrayBuffer>>;
|
|
171
|
+
/**
|
|
172
|
+
* キーの存在を確認します。
|
|
173
|
+
*
|
|
174
|
+
* @param c 存在確認コンテキストです。
|
|
175
|
+
*
|
|
176
|
+
* @returns 存在すれば真です。
|
|
177
|
+
*/
|
|
178
|
+
exists(c: IStorage.ExistsContext): Promise<boolean>;
|
|
179
|
+
/**
|
|
180
|
+
* キーを削除します。
|
|
181
|
+
*
|
|
182
|
+
* 存在しないキーも成功扱いにします。
|
|
183
|
+
*
|
|
184
|
+
* @param c 削除コンテキストです。
|
|
185
|
+
*
|
|
186
|
+
* @returns 削除が完了したら解決します。
|
|
187
|
+
*/
|
|
188
|
+
delete(c: IStorage.DeleteContext): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* 接頭辞に一致するキーをすべて削除します。
|
|
191
|
+
*
|
|
192
|
+
* `SCAN` で列挙しながら削除します。
|
|
193
|
+
*
|
|
194
|
+
* @param c クリアコンテキストです。
|
|
195
|
+
*
|
|
196
|
+
* @returns 削除が完了したら解決します。
|
|
197
|
+
*/
|
|
198
|
+
clear(c: IStorage.ClearContext): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* 書き込み用ストリームを取得します。
|
|
201
|
+
*
|
|
202
|
+
* 一時キーに追記し、`close` 時に最終キーへ置き換えます。
|
|
203
|
+
*
|
|
204
|
+
* @param c 書き込みストリーム取得コンテキストです。
|
|
205
|
+
*
|
|
206
|
+
* @returns 書き込み用ストリームです。
|
|
207
|
+
*/
|
|
208
|
+
getWritable(c: IStorage.GetWritableContext): WritableStream<Uint8Array<ArrayBuffer>>;
|
|
209
|
+
/**
|
|
210
|
+
* 読み取り用ストリームを取得します。
|
|
211
|
+
*
|
|
212
|
+
* 取得した値を単一チャンクとして送出します。
|
|
213
|
+
*
|
|
214
|
+
* @param c 読み取りストリーム取得コンテキストです。
|
|
215
|
+
*
|
|
216
|
+
* @returns 読み取り用ストリームです。
|
|
217
|
+
*/
|
|
218
|
+
getReadable(c: IStorage.GetReadableContext): ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
export { type CloseTimeoutErrorArgs, type CloseTimeoutErrorMeta, type ConnectTimeoutErrorArgs, type ConnectTimeoutErrorMeta, type InvalidCloseTimeoutErrorArgs, type InvalidCloseTimeoutErrorMeta, KeyNotFoundError, type KeyNotFoundErrorArgs, type KeyNotFoundErrorMeta, Redis, type RedisClusterSpec, type RedisStorageOptions };
|
|
222
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors.ts","../src/redis.ts"],"mappings":";;;;;;qBAQa,iCAAiC;;;;EAQ5C,YAAmB,UAAU;;;;;KAiBnB;;;;WAID;;;;;KAMC,+BAA+B,eAAe;;;;qBAK7C,iCAAiC,UAAU;;;;EAQtD,YAAmB,MAAM;;;;;KAsBf;;;;WAID;;;;;KAMC,0BAA0B,eAAe;;;;qBAKxC,4BAA4B,UAAU;;;;EAQjD,YAAmB,MAAM;;;;;KAqBf;;;;WAID;;;;;KAMC,wBAAwB,eAAe;;;;qBAKtC,0BAA0B,UAAU;;;;EAQ/C,YAAmB,MAAM;;;;;;;KC7Hf;;;;WAID,gBAAgB;;;;WAKhB,UAAU;;;;;KAMT,sBAAsB,KAAK;;;;WAI5B;;;;WAKA,UAAU;;;;WAKV;;;;;cAiCU,iBAAiB;;;;;WAIpB;;;;EAuChB,YAAmB,cAAc,UAAS;;;;;;MAiC/B;;;;;;;;;;EAaX,KAAkB,IAAI,SAAS,cAAc;;;;;;;;;;EAwE7C,MAAmB,IAAI,SAAS,eAAe;;;;;;;;;;;EAwC/C,MAAmB,GAAG,SAAS,cAAc,MAAM,WAAW,eAAe;;;;;;;;;;EAiB7E,KAAkB,GAAG,SAAS,cAAc,QAAQ,WAAW;;;;;;;;EAqB/D,OAAoB,GAAG,SAAS,gBAAgB;;;;;;;;;;EAiBhD,OAAoB,GAAG,SAAS,gBAAgB;;;;;;;;;;EAiBhD,MAAmB,GAAG,SAAS,eAAe;;;;;;;;;;EAmB9C,YAAmB,GAAG,SAAS,qBAAqB,eAAe,WAAW;;;;;;;;;;EAmF9E,YAAmB,GAAG,SAAS,qBAAqB,eAAe,WAAW"}
|