@fedify/postgres 1.8.1-dev.1247 → 1.8.1-dev.1257
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/deno.json +1 -1
- package/dist/kv.d.ts +7 -7
- package/dist/kv.js +7 -7
- package/kv.ts +9 -9
- package/package.json +2 -2
package/deno.json
CHANGED
package/dist/kv.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { KvKey, KvStore, KvStoreSetOptions } from "@fedify/fedify";
|
|
|
4
4
|
|
|
5
5
|
//#region kv.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* Options for the PostgreSQL key
|
|
7
|
+
* Options for the PostgreSQL key–value store.
|
|
8
8
|
*/
|
|
9
9
|
interface PostgresKvStoreOptions {
|
|
10
10
|
/**
|
|
11
|
-
* The table name to use for the key
|
|
11
|
+
* The table name to use for the key–value store.
|
|
12
12
|
* `"fedify_kv_v2"` by default.
|
|
13
13
|
* @default `"fedify_kv_v2"`
|
|
14
14
|
*/
|
|
@@ -20,7 +20,7 @@ interface PostgresKvStoreOptions {
|
|
|
20
20
|
initialized?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* A key
|
|
23
|
+
* A key–value store that uses PostgreSQL as the underlying storage.
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
@@ -37,21 +37,21 @@ interface PostgresKvStoreOptions {
|
|
|
37
37
|
declare class PostgresKvStore implements KvStore {
|
|
38
38
|
#private;
|
|
39
39
|
/**
|
|
40
|
-
* Creates a new PostgreSQL key
|
|
40
|
+
* Creates a new PostgreSQL key–value store.
|
|
41
41
|
* @param sql The PostgreSQL client to use.
|
|
42
|
-
* @param options The options for the key
|
|
42
|
+
* @param options The options for the key–value store.
|
|
43
43
|
*/
|
|
44
44
|
constructor(sql: Sql<{}>, options?: PostgresKvStoreOptions);
|
|
45
45
|
get<T = unknown>(key: KvKey): Promise<T | undefined>;
|
|
46
46
|
set(key: KvKey, value: unknown, options?: KvStoreSetOptions | undefined): Promise<void>;
|
|
47
47
|
delete(key: KvKey): Promise<void>;
|
|
48
48
|
/**
|
|
49
|
-
* Creates the table used by the key
|
|
49
|
+
* Creates the table used by the key–value store if it does not already exist.
|
|
50
50
|
* Does nothing if the table already exists.
|
|
51
51
|
*/
|
|
52
52
|
initialize(): Promise<void>;
|
|
53
53
|
/**
|
|
54
|
-
* Drops the table used by the key
|
|
54
|
+
* Drops the table used by the key–value store. Does nothing if the table
|
|
55
55
|
* does not exist.
|
|
56
56
|
*/
|
|
57
57
|
drop(): Promise<void>;
|
package/dist/kv.js
CHANGED
|
@@ -11,7 +11,7 @@ const logger = getLogger([
|
|
|
11
11
|
"kv"
|
|
12
12
|
]);
|
|
13
13
|
/**
|
|
14
|
-
* A key
|
|
14
|
+
* A key–value store that uses PostgreSQL as the underlying storage.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
@@ -31,9 +31,9 @@ var PostgresKvStore = class {
|
|
|
31
31
|
#initialized;
|
|
32
32
|
#driverSerializesJson = false;
|
|
33
33
|
/**
|
|
34
|
-
* Creates a new PostgreSQL key
|
|
34
|
+
* Creates a new PostgreSQL key–value store.
|
|
35
35
|
* @param sql The PostgreSQL client to use.
|
|
36
|
-
* @param options The options for the key
|
|
36
|
+
* @param options The options for the key–value store.
|
|
37
37
|
*/
|
|
38
38
|
constructor(sql, options = {}) {
|
|
39
39
|
this.#sql = sql;
|
|
@@ -80,12 +80,12 @@ var PostgresKvStore = class {
|
|
|
80
80
|
await this.#expire();
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
* Creates the table used by the key
|
|
83
|
+
* Creates the table used by the key–value store if it does not already exist.
|
|
84
84
|
* Does nothing if the table already exists.
|
|
85
85
|
*/
|
|
86
86
|
async initialize() {
|
|
87
87
|
if (this.#initialized) return;
|
|
88
|
-
logger.debug("Initializing the key
|
|
88
|
+
logger.debug("Initializing the key–value store table {tableName}...", { tableName: this.#tableName });
|
|
89
89
|
await this.#sql`
|
|
90
90
|
CREATE UNLOGGED TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
|
|
91
91
|
key text[] PRIMARY KEY,
|
|
@@ -96,10 +96,10 @@ var PostgresKvStore = class {
|
|
|
96
96
|
`;
|
|
97
97
|
this.#driverSerializesJson = await driverSerializesJson(this.#sql);
|
|
98
98
|
this.#initialized = true;
|
|
99
|
-
logger.debug("Initialized the key
|
|
99
|
+
logger.debug("Initialized the key–value store table {tableName}.", { tableName: this.#tableName });
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* Drops the table used by the key
|
|
102
|
+
* Drops the table used by the key–value store. Does nothing if the table
|
|
103
103
|
* does not exist.
|
|
104
104
|
*/
|
|
105
105
|
async drop() {
|
package/kv.ts
CHANGED
|
@@ -6,11 +6,11 @@ import { driverSerializesJson } from "./utils.ts";
|
|
|
6
6
|
const logger = getLogger(["fedify", "postgres", "kv"]);
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Options for the PostgreSQL key
|
|
9
|
+
* Options for the PostgreSQL key–value store.
|
|
10
10
|
*/
|
|
11
11
|
export interface PostgresKvStoreOptions {
|
|
12
12
|
/**
|
|
13
|
-
* The table name to use for the key
|
|
13
|
+
* The table name to use for the key–value store.
|
|
14
14
|
* `"fedify_kv_v2"` by default.
|
|
15
15
|
* @default `"fedify_kv_v2"`
|
|
16
16
|
*/
|
|
@@ -24,7 +24,7 @@ export interface PostgresKvStoreOptions {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* A key
|
|
27
|
+
* A key–value store that uses PostgreSQL as the underlying storage.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
@@ -46,9 +46,9 @@ export class PostgresKvStore implements KvStore {
|
|
|
46
46
|
#driverSerializesJson = false;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* Creates a new PostgreSQL key
|
|
49
|
+
* Creates a new PostgreSQL key–value store.
|
|
50
50
|
* @param sql The PostgreSQL client to use.
|
|
51
|
-
* @param options The options for the key
|
|
51
|
+
* @param options The options for the key–value store.
|
|
52
52
|
*/
|
|
53
53
|
constructor(
|
|
54
54
|
// deno-lint-ignore ban-types
|
|
@@ -108,12 +108,12 @@ export class PostgresKvStore implements KvStore {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* Creates the table used by the key
|
|
111
|
+
* Creates the table used by the key–value store if it does not already exist.
|
|
112
112
|
* Does nothing if the table already exists.
|
|
113
113
|
*/
|
|
114
114
|
async initialize(): Promise<void> {
|
|
115
115
|
if (this.#initialized) return;
|
|
116
|
-
logger.debug("Initializing the key
|
|
116
|
+
logger.debug("Initializing the key–value store table {tableName}...", {
|
|
117
117
|
tableName: this.#tableName,
|
|
118
118
|
});
|
|
119
119
|
await this.#sql`
|
|
@@ -126,13 +126,13 @@ export class PostgresKvStore implements KvStore {
|
|
|
126
126
|
`;
|
|
127
127
|
this.#driverSerializesJson = await driverSerializesJson(this.#sql);
|
|
128
128
|
this.#initialized = true;
|
|
129
|
-
logger.debug("Initialized the key
|
|
129
|
+
logger.debug("Initialized the key–value store table {tableName}.", {
|
|
130
130
|
tableName: this.#tableName,
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
* Drops the table used by the key
|
|
135
|
+
* Drops the table used by the key–value store. Does nothing if the table
|
|
136
136
|
* does not exist.
|
|
137
137
|
*/
|
|
138
138
|
async drop(): Promise<void> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/postgres",
|
|
3
|
-
"version": "1.8.1-dev.
|
|
3
|
+
"version": "1.8.1-dev.1257+0f5c486a",
|
|
4
4
|
"description": "PostgreSQL drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"postgres": "^3.4.7",
|
|
57
|
-
"@fedify/fedify": "1.8.1-dev.
|
|
57
|
+
"@fedify/fedify": "1.8.1-dev.1257+0f5c486a"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@std/async": "npm:@jsr/std__async@^1.0.13",
|