@larc-iu/plaid-client 0.2.0-alpha.32 → 0.2.0-alpha.34
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/package.json +1 -1
- package/src/apiDocuments.d.ts +2 -2
- package/src/apiDocuments.js +2 -2
- package/src/apiVocab.d.ts +7 -2
- package/src/apiVocab.js +9 -3
- package/src/client.d.ts +6 -2
- package/src/client.js +3 -1
- package/src/services.d.ts +2 -0
- package/src/services.js +8 -2
package/package.json
CHANGED
package/src/apiDocuments.d.ts
CHANGED
|
@@ -421,8 +421,8 @@ export function textsApi(client: import("./client.js").PlaidClient): {
|
|
|
421
421
|
tokenizeLayer?: string;
|
|
422
422
|
}) => Promise<Created>;
|
|
423
423
|
/**
|
|
424
|
-
* Update a text's body.
|
|
425
|
-
*
|
|
424
|
+
* Update a text's body. The change is read as the character diff of the
|
|
425
|
+
* two bodies, by the rules edits follow. Alternatively, `body` can be a list of
|
|
426
426
|
* edit directives (code-point indices, applied in order):
|
|
427
427
|
* {type: 'delete', index, value: count}
|
|
428
428
|
* {type: 'insert', index, value: string}
|
package/src/apiDocuments.js
CHANGED
|
@@ -484,8 +484,8 @@ export function textsApi(client) {
|
|
|
484
484
|
}),
|
|
485
485
|
}),
|
|
486
486
|
/**
|
|
487
|
-
* Update a text's body.
|
|
488
|
-
*
|
|
487
|
+
* Update a text's body. The change is read as the character diff of the
|
|
488
|
+
* two bodies, by the rules edits follow. Alternatively, `body` can be a list of
|
|
489
489
|
* edit directives (code-point indices, applied in order):
|
|
490
490
|
* {type: 'delete', index, value: count}
|
|
491
491
|
* {type: 'insert', index, value: string}
|
package/src/apiVocab.d.ts
CHANGED
|
@@ -162,12 +162,17 @@ export function vocabLayersApi(client: import("./client.js").PlaidClient): {
|
|
|
162
162
|
*/
|
|
163
163
|
update: (id: string, name: string, auditMessage?: string) => Promise<VocabLayer>;
|
|
164
164
|
/**
|
|
165
|
-
* Delete a vocab layer.
|
|
165
|
+
* Delete a vocab layer. With `onlyInProject`, refused (409) when any
|
|
166
|
+
* other project links it, including projects the caller cannot read.
|
|
166
167
|
* @param {string} id - The resource ID
|
|
167
168
|
* @param {string} [auditMessage] - Audit message for this write
|
|
169
|
+
* @param {object} [opts]
|
|
170
|
+
* @param {string} [opts.onlyInProject] - The one project allowed to link it
|
|
168
171
|
* @returns {Promise<void>}
|
|
169
172
|
*/
|
|
170
|
-
delete: (id: string, auditMessage?: string
|
|
173
|
+
delete: (id: string, auditMessage?: string, { onlyInProject }?: {
|
|
174
|
+
onlyInProject?: string;
|
|
175
|
+
}) => Promise<void>;
|
|
171
176
|
/**
|
|
172
177
|
* Get the audit log of a vocabulary: every change to it or to its
|
|
173
178
|
* entries, folded into entries as the document log is. Links are not
|
package/src/apiVocab.js
CHANGED
|
@@ -181,13 +181,19 @@ export function vocabLayersApi(client) {
|
|
|
181
181
|
body: bodyOf({ name }),
|
|
182
182
|
}),
|
|
183
183
|
/**
|
|
184
|
-
* Delete a vocab layer.
|
|
184
|
+
* Delete a vocab layer. With `onlyInProject`, refused (409) when any
|
|
185
|
+
* other project links it, including projects the caller cannot read.
|
|
185
186
|
* @param {string} id - The resource ID
|
|
186
187
|
* @param {string} [auditMessage] - Audit message for this write
|
|
188
|
+
* @param {object} [opts]
|
|
189
|
+
* @param {string} [opts.onlyInProject] - The one project allowed to link it
|
|
187
190
|
* @returns {Promise<void>}
|
|
188
191
|
*/
|
|
189
|
-
delete: (id, auditMessage) =>
|
|
190
|
-
client._request("DELETE", `/api/v1/vocab-layers/${id}`, {
|
|
192
|
+
delete: (id, auditMessage, { onlyInProject } = {}) =>
|
|
193
|
+
client._request("DELETE", `/api/v1/vocab-layers/${id}`, {
|
|
194
|
+
auditMessage,
|
|
195
|
+
...(onlyInProject ? { queryParams: { "only-in-project": onlyInProject } } : {}),
|
|
196
|
+
}),
|
|
191
197
|
/**
|
|
192
198
|
* Get the audit log of a vocabulary: every change to it or to its
|
|
193
199
|
* entries, folded into entries as the document log is. Links are not
|
package/src/client.d.ts
CHANGED
|
@@ -155,7 +155,8 @@ export class PlaidClient {
|
|
|
155
155
|
* the UI; defaults to the local part of the email (signup only)
|
|
156
156
|
* @param {string} credentials.password - Desired password (min 8 characters)
|
|
157
157
|
* @param {object} [options]
|
|
158
|
-
* @returns {Promise<{client: PlaidClient, userId: string, kind: string}>}
|
|
158
|
+
* @returns {Promise<{client: PlaidClient, userId: string, kind: string, projectId?: string}>}
|
|
159
|
+
* `projectId` names the project a signup invite joined.
|
|
159
160
|
*/
|
|
160
161
|
static redeemInvite(baseUrl: string, code: string, { email, password, displayName }?: {
|
|
161
162
|
email?: string;
|
|
@@ -165,6 +166,7 @@ export class PlaidClient {
|
|
|
165
166
|
client: PlaidClient;
|
|
166
167
|
userId: string;
|
|
167
168
|
kind: string;
|
|
169
|
+
projectId?: string;
|
|
168
170
|
}>;
|
|
169
171
|
/**
|
|
170
172
|
* Authenticate and return a new client instance with token. This is the
|
|
@@ -636,7 +638,9 @@ export class PlaidClient {
|
|
|
636
638
|
id?: string;
|
|
637
639
|
}) => Promise<import("./apiVocab.js").Created>;
|
|
638
640
|
update: (id: string, name: string, auditMessage?: string) => Promise<import("./apiVocab.js").VocabLayer>;
|
|
639
|
-
delete: (id: string, auditMessage?: string
|
|
641
|
+
delete: (id: string, auditMessage?: string, { onlyInProject }?: {
|
|
642
|
+
onlyInProject?: string;
|
|
643
|
+
}) => Promise<void>;
|
|
640
644
|
audit: (id: string, startTime?: string, endTime?: string, opTypes?: string[] | string, itemId?: string, kinds?: string[] | string) => Promise<import("./apiVocab.js").AuditEntry[]>;
|
|
641
645
|
auditPage: (id: string, { startTime, endTime, opTypes, kinds, order, limit, cursor, opsLimit, entryId, itemId }?: {
|
|
642
646
|
startTime?: string;
|
package/src/client.js
CHANGED
|
@@ -687,7 +687,8 @@ class PlaidClient {
|
|
|
687
687
|
* the UI; defaults to the local part of the email (signup only)
|
|
688
688
|
* @param {string} credentials.password - Desired password (min 8 characters)
|
|
689
689
|
* @param {object} [options]
|
|
690
|
-
* @returns {Promise<{client: PlaidClient, userId: string, kind: string}>}
|
|
690
|
+
* @returns {Promise<{client: PlaidClient, userId: string, kind: string, projectId?: string}>}
|
|
691
|
+
* `projectId` names the project a signup invite joined.
|
|
691
692
|
*/
|
|
692
693
|
static async redeemInvite(
|
|
693
694
|
baseUrl,
|
|
@@ -715,6 +716,7 @@ class PlaidClient {
|
|
|
715
716
|
),
|
|
716
717
|
userId: data.userId,
|
|
717
718
|
kind: data.kind,
|
|
719
|
+
projectId: data.projectId,
|
|
718
720
|
};
|
|
719
721
|
}
|
|
720
722
|
|
package/src/services.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export function reportRequestEvent(client: any, projectId: string, requestId: st
|
|
|
107
107
|
* @typedef {CancelScope & {
|
|
108
108
|
* requestId: string,
|
|
109
109
|
* requesterId: string | null,
|
|
110
|
+
* projectId: string,
|
|
110
111
|
* progress(percent: number, message: string, extra?: Record<string, any>): void,
|
|
111
112
|
* complete(data: any): void,
|
|
112
113
|
* stopped(data?: any): void,
|
|
@@ -287,6 +288,7 @@ export type CancelScope = {
|
|
|
287
288
|
export type ResponseHelper = CancelScope & {
|
|
288
289
|
requestId: string;
|
|
289
290
|
requesterId: string | null;
|
|
291
|
+
projectId: string;
|
|
290
292
|
progress(percent: number, message: string, extra?: Record<string, any>): void;
|
|
291
293
|
complete(data: any): void;
|
|
292
294
|
stopped(data?: any): void;
|
package/src/services.js
CHANGED
|
@@ -240,6 +240,7 @@ const PERMANENT_STATUSES = new Set([400, 401, 403, 404, 405, 422]);
|
|
|
240
240
|
* @typedef {CancelScope & {
|
|
241
241
|
* requestId: string,
|
|
242
242
|
* requesterId: string | null,
|
|
243
|
+
* projectId: string,
|
|
243
244
|
* progress(percent: number, message: string, extra?: Record<string, any>): void,
|
|
244
245
|
* complete(data: any): void,
|
|
245
246
|
* stopped(data?: any): void,
|
|
@@ -371,15 +372,18 @@ export function serve(client, projectId, serviceInfo, onServiceRequest, extras =
|
|
|
371
372
|
// service (extras `delegation: true`) also gets a short-lived token for the
|
|
372
373
|
// requesting user (`delegatedToken`) and the projects that token reaches
|
|
373
374
|
// (`delegatedProjects`, the request's own first), as the Python client
|
|
374
|
-
// hands them over.
|
|
375
|
+
// hands them over. `projectId` is the project of this channel, the one
|
|
376
|
+
// core checked the requester may write: it replaces any the body names,
|
|
377
|
+
// so a service acts in no other project.
|
|
375
378
|
const requesterId = payload.requesterId || null;
|
|
376
379
|
const extra = {
|
|
377
380
|
...(requesterId ? { requesterId } : {}),
|
|
378
381
|
...(payload.delegatedToken ? { delegatedToken: payload.delegatedToken } : {}),
|
|
379
382
|
...(payload.delegatedProjects ? { delegatedProjects: payload.delegatedProjects } : {}),
|
|
383
|
+
projectId,
|
|
380
384
|
};
|
|
381
385
|
const data =
|
|
382
|
-
|
|
386
|
+
payload.data && typeof payload.data === 'object' && !Array.isArray(payload.data)
|
|
383
387
|
? { ...payload.data, ...extra }
|
|
384
388
|
: payload.data;
|
|
385
389
|
|
|
@@ -387,6 +391,8 @@ export function serve(client, projectId, serviceInfo, onServiceRequest, extras =
|
|
|
387
391
|
const responseHelper = {
|
|
388
392
|
requestId,
|
|
389
393
|
requesterId,
|
|
394
|
+
// The project of the channel the request came through, the only one it may act in.
|
|
395
|
+
projectId,
|
|
390
396
|
// True once the requester asked for the request to stop.
|
|
391
397
|
get cancelled() {
|
|
392
398
|
return scope.cancelled;
|