@dosu/seshi-client 0.14.0 → 0.16.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/README.md +1 -1
- package/dist/index.js +39 -12
- package/package.json +2 -2
- package/types/http.d.ts +15 -7
- package/types/types.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<img src="https://raw.githubusercontent.com/dosu-ai/seshi/v0.
|
|
1
|
+
<img src="https://raw.githubusercontent.com/dosu-ai/seshi/v0.16.0/brand/glyph/seshi-glyph-badge.svg" alt="" width="64" height="64">
|
|
2
2
|
|
|
3
3
|
# @dosu/seshi-client
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -150,11 +150,11 @@ class HttpSessionDB {
|
|
|
150
150
|
refuse(status, body, upload.offset ?? 0);
|
|
151
151
|
return body;
|
|
152
152
|
}
|
|
153
|
-
sessionPath(
|
|
154
|
-
return `/v1/sessions/${encodeURIComponent(
|
|
153
|
+
sessionPath(format, sessionId) {
|
|
154
|
+
return `/v1/sessions/${encodeURIComponent(format)}/${encodeURIComponent(sessionId)}`;
|
|
155
155
|
}
|
|
156
|
-
async getSession(
|
|
157
|
-
const { status, body } = await this.request("GET", this.sessionPath(
|
|
156
|
+
async getSession(format, sessionId, options = {}) {
|
|
157
|
+
const { status, body } = await this.request("GET", this.sessionPath(format, sessionId), {
|
|
158
158
|
query: { owner: options.owner }
|
|
159
159
|
});
|
|
160
160
|
if (status === 404)
|
|
@@ -163,14 +163,41 @@ class HttpSessionDB {
|
|
|
163
163
|
refuse(status, body);
|
|
164
164
|
return body;
|
|
165
165
|
}
|
|
166
|
-
async getTrace(
|
|
167
|
-
const { status, body } = await this.request("GET", `${this.sessionPath(
|
|
166
|
+
async getTrace(format, sessionId, hash, render, options = {}) {
|
|
167
|
+
const { status, body } = await this.request("GET", `${this.sessionPath(format, sessionId)}/trace`, { query: { hash, render, owner: options.owner } });
|
|
168
168
|
if (status === 404 || status === 410)
|
|
169
169
|
return null;
|
|
170
170
|
if (status !== 200)
|
|
171
171
|
refuse(status, body);
|
|
172
172
|
return body;
|
|
173
173
|
}
|
|
174
|
+
archivePath(owner, archiveId) {
|
|
175
|
+
return `/v1/owners/${encodeURIComponent(owner)}/sessions/${encodeURIComponent(archiveId)}`;
|
|
176
|
+
}
|
|
177
|
+
async getSessionByArchive(owner, archiveId) {
|
|
178
|
+
const { status, body } = await this.request("GET", this.archivePath(owner, archiveId));
|
|
179
|
+
if (status === 404)
|
|
180
|
+
return null;
|
|
181
|
+
if (status !== 200)
|
|
182
|
+
refuse(status, body);
|
|
183
|
+
return body;
|
|
184
|
+
}
|
|
185
|
+
async getTraceByArchive(owner, archiveId, hash, render) {
|
|
186
|
+
const { status, body } = await this.request("GET", `${this.archivePath(owner, archiveId)}/trace`, { query: { hash, render } });
|
|
187
|
+
if (status === 404 || status === 410)
|
|
188
|
+
return null;
|
|
189
|
+
if (status !== 200)
|
|
190
|
+
refuse(status, body);
|
|
191
|
+
return body;
|
|
192
|
+
}
|
|
193
|
+
async reviewsByArchive(owner, archiveId) {
|
|
194
|
+
const { status, body } = await this.request("GET", `${this.archivePath(owner, archiveId)}/reviews`);
|
|
195
|
+
if (status === 404)
|
|
196
|
+
return null;
|
|
197
|
+
if (status !== 200)
|
|
198
|
+
refuse(status, body);
|
|
199
|
+
return body.reviews;
|
|
200
|
+
}
|
|
174
201
|
async listSessions(options = {}) {
|
|
175
202
|
const { status, body } = await this.request("GET", "/v1/sessions", {
|
|
176
203
|
query: { after: options.after, limit: options.limit, owner: options.owner }
|
|
@@ -187,8 +214,8 @@ class HttpSessionDB {
|
|
|
187
214
|
refuse(status, body);
|
|
188
215
|
return body;
|
|
189
216
|
}
|
|
190
|
-
async tombstone(
|
|
191
|
-
const { status, body } = await this.request("DELETE", this.sessionPath(
|
|
217
|
+
async tombstone(format, sessionId, options = {}) {
|
|
218
|
+
const { status, body } = await this.request("DELETE", this.sessionPath(format, sessionId), {
|
|
192
219
|
query: { owner: options.owner },
|
|
193
220
|
...options.retractSecret !== undefined ? { headers: { [RETRACT_HEADER]: options.retractSecret } } : {}
|
|
194
221
|
});
|
|
@@ -198,8 +225,8 @@ class HttpSessionDB {
|
|
|
198
225
|
refuse(status, body);
|
|
199
226
|
return body;
|
|
200
227
|
}
|
|
201
|
-
async setVisibility(
|
|
202
|
-
const { status, body } = await this.request("PATCH", this.sessionPath(
|
|
228
|
+
async setVisibility(format, sessionId, visibility, options = {}) {
|
|
229
|
+
const { status, body } = await this.request("PATCH", this.sessionPath(format, sessionId), {
|
|
203
230
|
body: { visibility },
|
|
204
231
|
query: { owner: options.owner }
|
|
205
232
|
});
|
|
@@ -209,8 +236,8 @@ class HttpSessionDB {
|
|
|
209
236
|
refuse(status, body);
|
|
210
237
|
return body;
|
|
211
238
|
}
|
|
212
|
-
async reviews(
|
|
213
|
-
const { status, body } = await this.request("GET", `${this.sessionPath(
|
|
239
|
+
async reviews(format, sessionId, options = {}) {
|
|
240
|
+
const { status, body } = await this.request("GET", `${this.sessionPath(format, sessionId)}/reviews`, { query: { owner: options.owner } });
|
|
214
241
|
if (status === 404)
|
|
215
242
|
return null;
|
|
216
243
|
if (status !== 200)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosu/seshi-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/dosu-ai/seshi#readme",
|
|
6
6
|
"repository": {
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"node": ">=20"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@dosu/seshi-model": "0.
|
|
33
|
+
"@dosu/seshi-model": "0.16.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/types/http.d.ts
CHANGED
|
@@ -59,10 +59,18 @@ export declare class HttpSessionDB implements SessionDB {
|
|
|
59
59
|
ingest(upload: Upload, options?: IngestOptions): Promise<StoreSessionResult>;
|
|
60
60
|
private sessionPath;
|
|
61
61
|
/** The session's metadata; null for one not stored, or one the caller may not read. */
|
|
62
|
-
getSession(
|
|
63
|
-
/** The head trace, or `hash`, as `
|
|
64
|
-
* redacted. */
|
|
65
|
-
getTrace(
|
|
62
|
+
getSession(format: string, sessionId: string, options?: OwnerOption): Promise<SessionMetadata | null>;
|
|
63
|
+
/** The head trace, or `hash`, rendered as `render`; null for a session not stored,
|
|
64
|
+
* unreadable or redacted. */
|
|
65
|
+
getTrace(format: string, sessionId: string, hash?: string, render?: RenderFormat, options?: OwnerOption): Promise<StoredTrace | null>;
|
|
66
|
+
private archivePath;
|
|
67
|
+
/** The session's metadata by its owner and archive id, as change entries, search results and
|
|
68
|
+
* listings name it (that owner's folder exactly); null when not stored or not readable. */
|
|
69
|
+
getSessionByArchive(owner: string, archiveId: string): Promise<SessionMetadata | null>;
|
|
70
|
+
/** `getTrace` by owner and archive id. */
|
|
71
|
+
getTraceByArchive(owner: string, archiveId: string, hash?: string, render?: RenderFormat): Promise<StoredTrace | null>;
|
|
72
|
+
/** `reviews` by owner and archive id. */
|
|
73
|
+
reviewsByArchive(owner: string, archiveId: string): Promise<ReviewDecision[] | null>;
|
|
66
74
|
listSessions(options?: ListSessionsOptions): Promise<SessionsPage>;
|
|
67
75
|
/** `GET /v1/sessions/stale`: the caller's own sessions an older normalizer built (X4.9), a
|
|
68
76
|
* page at a time. Needs `sessions:write`, which the uploader's credential has. */
|
|
@@ -76,18 +84,18 @@ export declare class HttpSessionDB implements SessionDB {
|
|
|
76
84
|
* session proves it with the secret whose hash it sent, using its normal upload credential
|
|
77
85
|
* (`sessions:write`), and the tombstone says `retracted`. A refused retraction is
|
|
78
86
|
* `ServerError` 403 `bad_retract_secret` or `retract_disabled`. */
|
|
79
|
-
tombstone(
|
|
87
|
+
tombstone(format: string, sessionId: string, options?: OwnerOption & {
|
|
80
88
|
retractSecret?: string;
|
|
81
89
|
}): Promise<{
|
|
82
90
|
removed: number;
|
|
83
91
|
} | null>;
|
|
84
92
|
/** Change who may read a session (X5.10); the metadata as it now is, null for one not
|
|
85
93
|
* stored. A redacted session is `ServerError` 410. The owner or an admin may. */
|
|
86
|
-
setVisibility(
|
|
94
|
+
setVisibility(format: string, sessionId: string, visibility: Visibility, options?: OwnerOption): Promise<SessionMetadata | null>;
|
|
87
95
|
/** What model review decided for each stored write of the session, oldest first (F3.8,
|
|
88
96
|
* `GET …/reviews`): the whole audit record for admins, only `n`, `at`, `content_hash` and
|
|
89
97
|
* `decision` for anyone else who may read it. Null for a session not stored. */
|
|
90
|
-
reviews(
|
|
98
|
+
reviews(format: string, sessionId: string, options?: OwnerOption): Promise<ReviewDecision[] | null>;
|
|
91
99
|
changes(options?: ReadChangesOptions): Promise<ChangesPage>;
|
|
92
100
|
/** Every owner's change feed as one (`GET /v1/changes/all`), by stamp, then owner, then
|
|
93
101
|
* key; each entry names its owner. Only for a credential that reads every session (a
|
package/types/types.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ export interface ConfigStatus {
|
|
|
193
193
|
live_sections: string[];
|
|
194
194
|
restart_only_sections: string[];
|
|
195
195
|
}
|
|
196
|
-
/** One stored write's model review (`GET /v1/sessions/{
|
|
196
|
+
/** One stored write's model review (`GET /v1/sessions/{format}/{id}/reviews`, F3.8). Callers
|
|
197
197
|
* who are not admins get `schema`, `n`, `at`, `content_hash` and `decision` only. */
|
|
198
198
|
export interface ReviewDecision {
|
|
199
199
|
schema: "seshi/review/1";
|