@deliverd/sdk 0.15.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 +5 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/released.d.ts +1 -1
- package/dist/released.d.ts.map +1 -1
- package/dist/released.js +816 -0
- package/dist/reports.d.ts +9 -3
- package/dist/reports.d.ts.map +1 -1
- package/dist/reports.js +14 -3
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/released.ts +816 -0
- package/src/reports.ts +20 -3
- package/src/types.ts +12 -0
package/src/reports.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
ReportData,
|
|
11
11
|
ScheduleSummary,
|
|
12
12
|
SendResult,
|
|
13
|
+
ShareOptions,
|
|
13
14
|
UpdateReportInput,
|
|
14
15
|
EvidencePack,
|
|
15
16
|
} from "./types.js";
|
|
@@ -122,12 +123,28 @@ export class Reports {
|
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
/**
|
|
126
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Grant people, teams or groups access. Filing is not access; this is.
|
|
128
|
+
*
|
|
129
|
+
* `{ capability: "comment" }` lets them comment as well as read; leave it
|
|
130
|
+
* out for view. A signal in third place, as before options existed, still
|
|
131
|
+
* works.
|
|
132
|
+
*/
|
|
133
|
+
async share(
|
|
134
|
+
idOrSlug: string,
|
|
135
|
+
audience: unknown,
|
|
136
|
+
options?: ShareOptions | AbortSignal,
|
|
137
|
+
signal?: AbortSignal
|
|
138
|
+
): Promise<unknown[]> {
|
|
139
|
+
if (options instanceof AbortSignal) {
|
|
140
|
+
signal = options;
|
|
141
|
+
options = undefined;
|
|
142
|
+
}
|
|
143
|
+
const capability = options?.capability;
|
|
127
144
|
const { granted } = await this.http.request<{ granted: unknown[] }>({
|
|
128
145
|
method: "POST",
|
|
129
146
|
path: `/reports/${encodeURIComponent(idOrSlug)}/share`,
|
|
130
|
-
body: { audience },
|
|
147
|
+
body: capability ? { audience, capability } : { audience },
|
|
131
148
|
signal,
|
|
132
149
|
});
|
|
133
150
|
return granted;
|
package/src/types.ts
CHANGED
|
@@ -612,6 +612,18 @@ export interface SendResult {
|
|
|
612
612
|
alreadyHadAccess: string[];
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
+
/**
|
|
616
|
+
* What a share lets its audience do. `"view"` is the default.
|
|
617
|
+
*
|
|
618
|
+
* "Can manage", which lets someone share the report on, is not here: it is a
|
|
619
|
+
* person's decision, made in the app, and the API refuses it from a key.
|
|
620
|
+
*/
|
|
621
|
+
export type ShareCapability = "view" | "comment";
|
|
622
|
+
|
|
623
|
+
export interface ShareOptions {
|
|
624
|
+
capability?: ShareCapability;
|
|
625
|
+
}
|
|
626
|
+
|
|
615
627
|
/* ── Schedules ───────────────────────────────────────────────────────────── */
|
|
616
628
|
|
|
617
629
|
/**
|