@haakco/custd-sdk 2.4.0 → 3.71.2
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 +586 -40
- package/dist/admin-accounting-evidence.d.ts +48 -0
- package/dist/admin-accounting-evidence.js +24 -0
- package/dist/admin-app-releases.d.ts +116 -0
- package/dist/admin-app-releases.js +8 -0
- package/dist/admin-apps.d.ts +120 -0
- package/dist/admin-apps.js +47 -0
- package/dist/admin-auth-project-domain.d.ts +125 -0
- package/dist/admin-auth-project-domain.js +37 -0
- package/dist/admin-auth-projects.d.ts +989 -0
- package/dist/admin-auth-projects.js +527 -0
- package/dist/admin-campaign-email.d.ts +120 -0
- package/dist/admin-campaign-email.js +64 -0
- package/dist/admin-client-setup.d.ts +22 -0
- package/dist/admin-client-setup.js +11 -1
- package/dist/admin-data-scopes.d.ts +93 -0
- package/dist/admin-data-scopes.js +154 -0
- package/dist/admin-email-relay.d.ts +66 -0
- package/dist/admin-email-relay.js +25 -0
- package/dist/admin-environment-policy.d.ts +32 -0
- package/dist/admin-environment-policy.js +26 -0
- package/dist/admin-error-issues.d.ts +91 -0
- package/dist/admin-error-issues.js +52 -0
- package/dist/admin-event-types.d.ts +57 -0
- package/dist/admin-event-types.js +28 -0
- package/dist/admin-impersonation.d.ts +48 -0
- package/dist/admin-impersonation.js +27 -0
- package/dist/admin-ingest-claims.d.ts +35 -0
- package/dist/admin-ingest-claims.js +26 -0
- package/dist/admin-managed-audit.d.ts +13 -0
- package/dist/admin-managed-audit.js +13 -0
- package/dist/admin-measurement-projects.d.ts +166 -0
- package/dist/admin-measurement-projects.js +120 -0
- package/dist/admin-notification-destinations.d.ts +31 -0
- package/dist/admin-notification-destinations.js +19 -0
- package/dist/admin-notification-webhooks.d.ts +64 -0
- package/dist/admin-notification-webhooks.js +42 -0
- package/dist/admin-oauth-client-admissions.d.ts +65 -0
- package/dist/admin-oauth-client-admissions.js +46 -0
- package/dist/admin-offboarding.d.ts +20 -6
- package/dist/admin-offboarding.js +27 -6
- package/dist/admin-predictions.d.ts +127 -8
- package/dist/admin-predictions.js +22 -12
- package/dist/admin-privacy-erasures.d.ts +24 -12
- package/dist/admin-privacy-erasures.js +3 -2
- package/dist/admin-retention.d.ts +72 -24
- package/dist/admin-retention.js +38 -13
- package/dist/admin-rls.d.ts +94 -0
- package/dist/admin-rls.js +33 -0
- package/dist/admin-sdk-usage.d.ts +41 -0
- package/dist/admin-sdk-usage.js +23 -0
- package/dist/admin-site-ai.d.ts +72 -0
- package/dist/admin-site-ai.js +1 -0
- package/dist/admin-site-analytics.d.ts +52 -0
- package/dist/admin-site-analytics.js +14 -0
- package/dist/admin-site-audit-pages.d.ts +76 -0
- package/dist/admin-site-audit-pages.js +27 -0
- package/dist/admin-site-campaign-links.d.ts +40 -0
- package/dist/admin-site-campaign-links.js +9 -0
- package/dist/admin-site-domains.d.ts +733 -0
- package/dist/admin-site-domains.js +768 -0
- package/dist/admin-site-export.d.ts +76 -0
- package/dist/admin-site-export.js +15 -0
- package/dist/admin-site-insights-tasks.d.ts +44 -0
- package/dist/admin-site-insights-tasks.js +28 -0
- package/dist/admin-site-insights.d.ts +527 -0
- package/dist/admin-site-insights.js +61 -0
- package/dist/admin-site-links.d.ts +87 -0
- package/dist/admin-site-links.js +16 -0
- package/dist/admin-site-monitors.d.ts +110 -0
- package/dist/admin-site-monitors.js +25 -0
- package/dist/admin-site-next-actions.d.ts +93 -0
- package/dist/admin-site-next-actions.js +36 -0
- package/dist/admin-site-page-queries.d.ts +63 -0
- package/dist/admin-site-page-queries.js +20 -0
- package/dist/admin-site-rankings.d.ts +98 -0
- package/dist/admin-site-rankings.js +46 -0
- package/dist/admin-site-regional-trends.d.ts +30 -0
- package/dist/admin-site-regional-trends.js +1 -0
- package/dist/admin-site-saved-reports.d.ts +45 -0
- package/dist/admin-site-saved-reports.js +13 -0
- package/dist/admin-site-search-pool.d.ts +77 -0
- package/dist/admin-site-search-pool.js +41 -0
- package/dist/admin-site-search-value.d.ts +97 -0
- package/dist/admin-site-search-value.js +29 -0
- package/dist/admin-site-status-page.d.ts +57 -0
- package/dist/admin-site-status-page.js +10 -0
- package/dist/admin-site-traffic.d.ts +145 -0
- package/dist/admin-site-traffic.js +32 -0
- package/dist/admin-site-web-data.d.ts +258 -0
- package/dist/admin-site-web-data.js +60 -0
- package/dist/admin-subject-exports.d.ts +58 -27
- package/dist/admin-subject-exports.js +32 -16
- package/dist/admin-support-access.d.ts +32 -0
- package/dist/admin-support-access.js +21 -0
- package/dist/admin-system.d.ts +283 -0
- package/dist/admin-system.js +65 -0
- package/dist/admin-tenant-storage.d.ts +22 -14
- package/dist/admin-tenant-storage.js +13 -14
- package/dist/admin-timeplans.d.ts +276 -2
- package/dist/admin-timeplans.js +54 -0
- package/dist/admin-uncertainty-models.d.ts +42 -0
- package/dist/admin-uncertainty-models.js +53 -0
- package/dist/admin-usage.d.ts +124 -0
- package/dist/admin-usage.js +169 -0
- package/dist/admin-users.d.ts +124 -0
- package/dist/admin-users.js +82 -0
- package/dist/admin-workflow-timings.d.ts +367 -0
- package/dist/admin-workflow-timings.js +117 -0
- package/dist/analytics-events.d.ts +82 -0
- package/dist/analytics-events.js +157 -0
- package/dist/analytics-reads.d.ts +81 -0
- package/dist/analytics-reads.js +5 -0
- package/dist/app-account.d.ts +84 -0
- package/dist/app-account.js +177 -0
- package/dist/app-alerts.d.ts +120 -0
- package/dist/app-alerts.js +44 -0
- package/dist/app-items.d.ts +786 -0
- package/dist/app-items.js +524 -0
- package/dist/app-live.d.ts +84 -0
- package/dist/app-live.js +228 -0
- package/dist/app-meetings.d.ts +95 -0
- package/dist/app-meetings.js +26 -0
- package/dist/app-models.d.ts +271 -0
- package/dist/app-models.js +83 -0
- package/dist/app-push.d.ts +64 -0
- package/dist/app-push.js +178 -0
- package/dist/backend-lifecycle.d.ts +2 -2
- package/dist/browser-manifest.json +5 -5
- package/dist/browser-script-BWnwDjAC.js +711 -0
- package/dist/browser-sign-in.d.ts +153 -0
- package/dist/browser-sign-in.js +410 -0
- package/dist/browser-tracker.d.ts +95 -0
- package/dist/browser-tracker.js +362 -40
- package/dist/browser-web-vitals.d.ts +22 -0
- package/dist/browser-web-vitals.js +116 -0
- package/dist/browser.d.ts +9 -0
- package/dist/browser.js +9 -0
- package/dist/download-stream.d.ts +16 -0
- package/dist/download-stream.js +55 -0
- package/dist/error-capture.d.ts +62 -0
- package/dist/error-capture.js +168 -0
- package/dist/hosted-app.d.ts +115 -0
- package/dist/hosted-app.js +275 -0
- package/dist/index.d.ts +1168 -154
- package/dist/index.js +682 -162
- package/dist/ingest-operations.d.ts +483 -0
- package/dist/ingest-operations.js +154 -0
- package/dist/measurement.d.ts +164 -0
- package/dist/measurement.js +104 -0
- package/dist/parsers.d.ts +149 -0
- package/dist/parsers.js +115 -0
- package/dist/public-reads.d.ts +79 -0
- package/dist/public-reads.js +57 -0
- package/dist/reporting-catalogue.d.ts +264 -0
- package/dist/reporting-catalogue.js +5 -0
- package/dist/response-lists.d.ts +16 -0
- package/dist/response-lists.generated.d.ts +7 -0
- package/dist/response-lists.generated.js +1927 -0
- package/dist/response-lists.js +70 -0
- package/dist/response-validation.d.ts +30 -0
- package/dist/response-validation.js +94 -0
- package/dist/schema-registry.d.ts +45 -0
- package/dist/schema-registry.js +9 -0
- package/dist/secure-url.d.ts +4 -0
- package/dist/secure-url.js +23 -0
- package/dist/site-ai-owner.d.ts +34 -0
- package/dist/site-ai-owner.js +99 -0
- package/dist/site-monitor-reports.d.ts +15 -0
- package/dist/site-monitor-reports.js +87 -0
- package/dist/testing/fake-custd.d.ts +150 -0
- package/dist/testing/fake-custd.js +842 -0
- package/dist/testing/fake-results.d.ts +30 -0
- package/dist/testing/fake-results.js +293 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +3 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +25 -14
- package/dist/browser-script-BvgjdZSO.js +0 -429
- package/dist/fixtures.d.ts +0 -10
- package/dist/fixtures.js +0 -57
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification webhooks and their deliveries. A subscription posts signed notifications to an HTTPS
|
|
3
|
+
* endpoint or a Slack incoming webhook; its signing secret is shown only on create and rotate.
|
|
4
|
+
*/
|
|
5
|
+
const webhooksPath = "/notification-webhooks";
|
|
6
|
+
export class NotificationWebhookAdminClient {
|
|
7
|
+
constructor(request) {
|
|
8
|
+
this.request = request;
|
|
9
|
+
}
|
|
10
|
+
async list(companySlug) {
|
|
11
|
+
const response = await this.request("GET", withCompany(webhooksPath, companySlug));
|
|
12
|
+
return { subscriptions: response.subscriptions ?? [] };
|
|
13
|
+
}
|
|
14
|
+
create(body) {
|
|
15
|
+
return this.request("POST", webhooksPath, body);
|
|
16
|
+
}
|
|
17
|
+
setEnabled(uuid, enabled, companySlug) {
|
|
18
|
+
return this.request("PATCH", withCompany(webhookPath(uuid), companySlug), { enabled });
|
|
19
|
+
}
|
|
20
|
+
rotateSecret(uuid, companySlug) {
|
|
21
|
+
return this.request("POST", withCompany(`${webhookPath(uuid)}/rotate-secret`, companySlug));
|
|
22
|
+
}
|
|
23
|
+
delete(uuid, companySlug) {
|
|
24
|
+
return this.request("DELETE", withCompany(webhookPath(uuid), companySlug));
|
|
25
|
+
}
|
|
26
|
+
getDelivery(deliveryUuid, companySlug) {
|
|
27
|
+
return this.request("GET", withCompany(deliveryPath(deliveryUuid), companySlug));
|
|
28
|
+
}
|
|
29
|
+
/** Queues the delivery again. */
|
|
30
|
+
replay(deliveryUuid, body, companySlug) {
|
|
31
|
+
return this.request("POST", withCompany(`${deliveryPath(deliveryUuid)}/replay`, companySlug), body);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function webhookPath(uuid) {
|
|
35
|
+
return `${webhooksPath}/${encodeURIComponent(uuid)}`;
|
|
36
|
+
}
|
|
37
|
+
function deliveryPath(uuid) {
|
|
38
|
+
return `/notification-deliveries/${encodeURIComponent(uuid)}`;
|
|
39
|
+
}
|
|
40
|
+
function withCompany(path, companySlug) {
|
|
41
|
+
return companySlug ? `${path}?companySlug=${encodeURIComponent(companySlug)}` : path;
|
|
42
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth client admissions. A dynamically registered client asks for grants; a tenant administrator
|
|
3
|
+
* reviews the client's metadata, approves the grants it should hold, or revokes it. Every mutation
|
|
4
|
+
* names the revision it was decided against, so a stale decision is rejected.
|
|
5
|
+
*/
|
|
6
|
+
import type { RequestOptions } from "./index.js";
|
|
7
|
+
/** The scopes one client may hold on one resource. */
|
|
8
|
+
export type OAuthClientAdmissionGrant = {
|
|
9
|
+
resourceUri: string;
|
|
10
|
+
scopes: string[];
|
|
11
|
+
};
|
|
12
|
+
export type OAuthClientAdmission = {
|
|
13
|
+
admissionUuid: string;
|
|
14
|
+
clientId: string;
|
|
15
|
+
companyUuid: string;
|
|
16
|
+
revision: number;
|
|
17
|
+
requestedGrants: OAuthClientAdmissionGrant[];
|
|
18
|
+
requestedSecurityRevision: string;
|
|
19
|
+
approvedGrants: OAuthClientAdmissionGrant[];
|
|
20
|
+
approvedSecurityRevision?: string;
|
|
21
|
+
approvedAt?: string;
|
|
22
|
+
revokedAt?: string;
|
|
23
|
+
};
|
|
24
|
+
export type OAuthClientAdmissionListResponse = {
|
|
25
|
+
admissions: OAuthClientAdmission[];
|
|
26
|
+
};
|
|
27
|
+
/** The registered client's public metadata a review needs. */
|
|
28
|
+
export type OAuthClientAdmissionMetadata = {
|
|
29
|
+
clientName: string;
|
|
30
|
+
redirectUris: string[];
|
|
31
|
+
securityRevision: string;
|
|
32
|
+
expiresAt: string;
|
|
33
|
+
};
|
|
34
|
+
export type OAuthClientAdmissionReviewRequest = {
|
|
35
|
+
companySlug: string;
|
|
36
|
+
};
|
|
37
|
+
export type OAuthClientAdmissionReviewResponse = {
|
|
38
|
+
admission: OAuthClientAdmission;
|
|
39
|
+
metadata: OAuthClientAdmissionMetadata;
|
|
40
|
+
};
|
|
41
|
+
export type OAuthClientAdmissionApproveRequest = {
|
|
42
|
+
companySlug: string;
|
|
43
|
+
clientId: string;
|
|
44
|
+
expectedRevision: number;
|
|
45
|
+
securityRevision: string;
|
|
46
|
+
grants: OAuthClientAdmissionGrant[];
|
|
47
|
+
};
|
|
48
|
+
export type OAuthClientAdmissionRevokeRequest = {
|
|
49
|
+
companySlug: string;
|
|
50
|
+
expectedRevision: number;
|
|
51
|
+
};
|
|
52
|
+
export type OAuthClientAdmissionMutationResponse = {
|
|
53
|
+
admission: OAuthClientAdmission;
|
|
54
|
+
};
|
|
55
|
+
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
56
|
+
export declare class OAuthClientAdmissionAdminClient {
|
|
57
|
+
private readonly request;
|
|
58
|
+
constructor(request: AdminRequester);
|
|
59
|
+
list(companySlug: string, options?: RequestOptions): Promise<OAuthClientAdmissionListResponse>;
|
|
60
|
+
review(admissionUuid: string, body: OAuthClientAdmissionReviewRequest, options?: RequestOptions): Promise<OAuthClientAdmissionReviewResponse>;
|
|
61
|
+
approve(admissionUuid: string, body: OAuthClientAdmissionApproveRequest, options?: RequestOptions): Promise<OAuthClientAdmissionMutationResponse>;
|
|
62
|
+
revoke(admissionUuid: string, body: OAuthClientAdmissionRevokeRequest, options?: RequestOptions): Promise<OAuthClientAdmissionMutationResponse>;
|
|
63
|
+
private mutate;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth client admissions. A dynamically registered client asks for grants; a tenant administrator
|
|
3
|
+
* reviews the client's metadata, approves the grants it should hold, or revokes it. Every mutation
|
|
4
|
+
* names the revision it was decided against, so a stale decision is rejected.
|
|
5
|
+
*/
|
|
6
|
+
const admissionsPath = "/oauth-client-admissions";
|
|
7
|
+
export class OAuthClientAdmissionAdminClient {
|
|
8
|
+
constructor(request) {
|
|
9
|
+
this.request = request;
|
|
10
|
+
}
|
|
11
|
+
async list(companySlug, options) {
|
|
12
|
+
const path = `${admissionsPath}?companySlug=${encodeURIComponent(companySlug)}`;
|
|
13
|
+
const list = await this.request("GET", path, undefined, options);
|
|
14
|
+
return { admissions: (list.admissions ?? []).map(normalizeAdmission) };
|
|
15
|
+
}
|
|
16
|
+
async review(admissionUuid, body, options) {
|
|
17
|
+
const review = await this.request("POST", `${admissionPath(admissionUuid)}/review`, body, options);
|
|
18
|
+
return {
|
|
19
|
+
admission: normalizeAdmission(review.admission),
|
|
20
|
+
metadata: { ...review.metadata, redirectUris: review.metadata.redirectUris ?? [] },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
approve(admissionUuid, body, options) {
|
|
24
|
+
return this.mutate(`${admissionPath(admissionUuid)}/approve`, body, options);
|
|
25
|
+
}
|
|
26
|
+
revoke(admissionUuid, body, options) {
|
|
27
|
+
return this.mutate(`${admissionPath(admissionUuid)}/revoke`, body, options);
|
|
28
|
+
}
|
|
29
|
+
async mutate(path, body, options) {
|
|
30
|
+
const response = await this.request("POST", path, body, options);
|
|
31
|
+
return { admission: normalizeAdmission(response.admission) };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function admissionPath(admissionUuid) {
|
|
35
|
+
return `${admissionsPath}/${encodeURIComponent(admissionUuid)}`;
|
|
36
|
+
}
|
|
37
|
+
function normalizeGrants(grants) {
|
|
38
|
+
return (grants ?? []).map((grant) => ({ ...grant, scopes: grant.scopes ?? [] }));
|
|
39
|
+
}
|
|
40
|
+
function normalizeAdmission(admission) {
|
|
41
|
+
return {
|
|
42
|
+
...admission,
|
|
43
|
+
requestedGrants: normalizeGrants(admission.requestedGrants),
|
|
44
|
+
approvedGrants: normalizeGrants(admission.approvedGrants),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CustdDownloadStream } from "./download-stream.js";
|
|
1
2
|
import type { RequestOptions } from "./index.js";
|
|
2
3
|
export type OffboardingSchedule = {
|
|
3
4
|
tenantSlug: string;
|
|
@@ -35,21 +36,25 @@ export type OffboardingPreviewStore = {
|
|
|
35
36
|
estimatedCount: number;
|
|
36
37
|
sourceAuthority?: string;
|
|
37
38
|
};
|
|
39
|
+
export type OffboardingPreviewExclusion = {
|
|
40
|
+
store: string;
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
38
43
|
export type OffboardingPreviewResponse = {
|
|
39
44
|
requestUuid: string;
|
|
40
45
|
generatedAt: string;
|
|
41
46
|
expiresAt: string;
|
|
42
47
|
stores: OffboardingPreviewStore[];
|
|
43
|
-
exclusions?:
|
|
48
|
+
exclusions?: OffboardingPreviewExclusion[];
|
|
44
49
|
previewInventoryDigest: string;
|
|
45
50
|
complete: boolean;
|
|
46
51
|
partial: boolean;
|
|
47
52
|
};
|
|
48
53
|
export type OffboardingWaiver = {
|
|
49
54
|
role: string;
|
|
50
|
-
|
|
51
|
-
timestamp?: string;
|
|
55
|
+
timestamp: string;
|
|
52
56
|
};
|
|
57
|
+
export type OffboardingRequesterKind = "human" | "machine";
|
|
53
58
|
export type OffboardingExportResponse = {
|
|
54
59
|
requestUuid: string;
|
|
55
60
|
checksumSha256: string;
|
|
@@ -64,6 +69,15 @@ export type OffboardingDownloadResponse = {
|
|
|
64
69
|
checksumSha256: string;
|
|
65
70
|
byteSize: number;
|
|
66
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* The offboarding bundle as it arrives. The body errors if it runs past or ends short of
|
|
74
|
+
* `byteSize`; `checksumSha256` is the server's digest, which the caller checks against the
|
|
75
|
+
* bytes it stored before acknowledging the export.
|
|
76
|
+
*/
|
|
77
|
+
export type OffboardingDownloadStream = CustdDownloadStream & {
|
|
78
|
+
byteSize: number;
|
|
79
|
+
checksumSha256: string;
|
|
80
|
+
};
|
|
67
81
|
export type OffboardingAcknowledgeResponse = OffboardingRequest;
|
|
68
82
|
export type OffboardingExecuteResponse = OffboardingReceiptResponse;
|
|
69
83
|
export type OffboardingRetryResponse = OffboardingReceiptResponse;
|
|
@@ -75,8 +89,7 @@ export type OffboardingReceiptPerStore = {
|
|
|
75
89
|
};
|
|
76
90
|
export type OffboardingReceiptResponse = {
|
|
77
91
|
companyId: number;
|
|
78
|
-
|
|
79
|
-
requestedByUserId?: number | null;
|
|
92
|
+
requestedByKind: OffboardingRequesterKind;
|
|
80
93
|
requestedAt: string;
|
|
81
94
|
completedAt: string;
|
|
82
95
|
finalState: string;
|
|
@@ -85,7 +98,7 @@ export type OffboardingReceiptResponse = {
|
|
|
85
98
|
sha256: string;
|
|
86
99
|
};
|
|
87
100
|
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
88
|
-
type AdminDownloader = (path: string, options?: RequestOptions) => Promise<
|
|
101
|
+
type AdminDownloader = (path: string, options?: RequestOptions) => Promise<OffboardingDownloadStream>;
|
|
89
102
|
export declare class OffboardingClient {
|
|
90
103
|
private readonly request;
|
|
91
104
|
private readonly downloadBinary;
|
|
@@ -100,6 +113,7 @@ export declare class OffboardingClient {
|
|
|
100
113
|
confirmRequest(requestUuid: string, options?: RequestOptions): Promise<OffboardingRequest>;
|
|
101
114
|
preview(requestUuid: string, options?: RequestOptions): Promise<OffboardingPreviewResponse>;
|
|
102
115
|
export(requestUuid: string, options?: RequestOptions): Promise<OffboardingExportResponse>;
|
|
116
|
+
downloadStream(requestUuid: string, options?: RequestOptions): Promise<OffboardingDownloadStream>;
|
|
103
117
|
download(requestUuid: string, options?: RequestOptions): Promise<OffboardingDownloadResponse>;
|
|
104
118
|
acknowledge(requestUuid: string, options?: RequestOptions): Promise<OffboardingAcknowledgeResponse>;
|
|
105
119
|
execute(requestUuid: string, options?: RequestOptions): Promise<OffboardingExecuteResponse>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// OffboardingClient owns the offboarding schedule and one-off request
|
|
2
2
|
// surfaces. Its types mirror the current admin-api JSON wire contract.
|
|
3
|
+
import { readDownloadStream } from "./download-stream.js";
|
|
4
|
+
/** The largest bundle download() holds in memory; downloadStream() has no limit. */
|
|
5
|
+
const maxBufferedDownloadBytes = 64 * 1024 * 1024;
|
|
3
6
|
function mapPreview(response) {
|
|
4
7
|
return {
|
|
5
8
|
...response,
|
|
6
|
-
|
|
9
|
+
exclusions: response.exclusions ?? [],
|
|
10
|
+
stores: (response.stores ?? []).map((store) => ({
|
|
7
11
|
store: store.store,
|
|
8
12
|
kind: store.kind,
|
|
9
13
|
retentionClass: store.retention_class,
|
|
@@ -15,12 +19,11 @@ function mapPreview(response) {
|
|
|
15
19
|
function mapReceipt(response) {
|
|
16
20
|
return {
|
|
17
21
|
companyId: response.company_id,
|
|
18
|
-
|
|
19
|
-
requestedByUserId: response.requested_by_user_id,
|
|
22
|
+
requestedByKind: response.requested_by_kind,
|
|
20
23
|
requestedAt: response.requested_at,
|
|
21
24
|
completedAt: response.completed_at,
|
|
22
25
|
finalState: response.final_state,
|
|
23
|
-
perStore: response.per_store.map((store) => ({
|
|
26
|
+
perStore: (response.per_store ?? []).map((store) => ({
|
|
24
27
|
store: store.store,
|
|
25
28
|
retentionClass: store.retention_class,
|
|
26
29
|
deletedCount: store.deleted_count,
|
|
@@ -80,10 +83,24 @@ export class OffboardingClient {
|
|
|
80
83
|
export(requestUuid, options) {
|
|
81
84
|
return this.request("POST", `/offboarding/requests/${encodeURIComponent(requestUuid)}/export`, undefined, options);
|
|
82
85
|
}
|
|
83
|
-
//
|
|
84
|
-
|
|
86
|
+
// downloadStream returns the bundle as it arrives, for a bundle too large to hold in memory.
|
|
87
|
+
// Pass options.signal to stop the transfer.
|
|
88
|
+
downloadStream(requestUuid, options) {
|
|
85
89
|
return this.downloadBinary(`/offboarding/requests/${encodeURIComponent(requestUuid)}/download`, options);
|
|
86
90
|
}
|
|
91
|
+
// download returns authenticated bytes with verified checksum and length, up to 64 MiB.
|
|
92
|
+
async download(requestUuid, options) {
|
|
93
|
+
const stream = await this.downloadStream(requestUuid, options);
|
|
94
|
+
if (stream.byteSize > maxBufferedDownloadBytes) {
|
|
95
|
+
await stream.body.cancel();
|
|
96
|
+
throw new Error("custd: offboarding download exceeds 64 MiB");
|
|
97
|
+
}
|
|
98
|
+
const bytes = await readDownloadStream(stream.body, maxBufferedDownloadBytes, "offboarding download");
|
|
99
|
+
if ((await sha256Hex(bytes)) !== stream.checksumSha256) {
|
|
100
|
+
throw new Error("custd: offboarding download checksum mismatch");
|
|
101
|
+
}
|
|
102
|
+
return { bytes, checksumSha256: stream.checksumSha256, byteSize: stream.byteSize };
|
|
103
|
+
}
|
|
87
104
|
// acknowledge records that the export was downloaded successfully and its
|
|
88
105
|
// inventory was confirmed. Never call it merely because preview succeeded.
|
|
89
106
|
acknowledge(requestUuid, options) {
|
|
@@ -106,3 +123,7 @@ export class OffboardingClient {
|
|
|
106
123
|
return this.request("GET", `/offboarding/requests/${encodeURIComponent(requestUuid)}/receipt`, undefined, options).then(mapReceipt);
|
|
107
124
|
}
|
|
108
125
|
}
|
|
126
|
+
async function sha256Hex(bytes) {
|
|
127
|
+
const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", Uint8Array.from(bytes).buffer));
|
|
128
|
+
return Array.from(digest, (value) => value.toString(16).padStart(2, "0")).join("");
|
|
129
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { RequestOptions } from "./index.js";
|
|
2
|
+
/** What a prediction definition forecasts. */
|
|
3
|
+
export type PredictionProjectKind = "deadline_forecast" | "runway_forecast" | "decision_analysis" | "calibration" | "duration" | "event_probability";
|
|
2
4
|
export type PredictionDefinition = {
|
|
3
5
|
uuid: string;
|
|
4
6
|
definition_key: string;
|
|
5
7
|
display_name: string;
|
|
6
8
|
description?: string;
|
|
9
|
+
project_kind: PredictionProjectKind;
|
|
7
10
|
status: string;
|
|
8
11
|
schedule_kind: string;
|
|
9
12
|
default_horizon_seconds?: number;
|
|
10
13
|
is_paused: boolean;
|
|
14
|
+
active_version_uuid?: string;
|
|
15
|
+
candidate_version_uuid?: string;
|
|
16
|
+
candidate_version_count?: number;
|
|
11
17
|
created_at: string;
|
|
12
18
|
updated_at: string;
|
|
13
19
|
};
|
|
@@ -15,6 +21,7 @@ export type PredictionDefinitionCreateRequest = {
|
|
|
15
21
|
definition_key: string;
|
|
16
22
|
display_name: string;
|
|
17
23
|
description?: string;
|
|
24
|
+
project_kind?: PredictionProjectKind;
|
|
18
25
|
};
|
|
19
26
|
export type PredictionDefinitionUpdateRequest = {
|
|
20
27
|
definition_key?: string;
|
|
@@ -44,9 +51,6 @@ export type PredictionVersionPublishRequest = {
|
|
|
44
51
|
};
|
|
45
52
|
export type PredictionActivateRequest = {
|
|
46
53
|
version_uuid: string;
|
|
47
|
-
};
|
|
48
|
-
export type PredictionRollbackRequest = {
|
|
49
|
-
version_uuid: string;
|
|
50
54
|
reason?: string;
|
|
51
55
|
};
|
|
52
56
|
export type PredictionPauseRequest = {
|
|
@@ -77,6 +81,19 @@ export type PredictionSignalSourceCreateRequest = {
|
|
|
77
81
|
configuration: Record<string, unknown>;
|
|
78
82
|
poll_interval_seconds?: number;
|
|
79
83
|
};
|
|
84
|
+
export type PredictionSignalSourceListResponse = {
|
|
85
|
+
sources: PredictionSignalSource[];
|
|
86
|
+
next_page_token?: string;
|
|
87
|
+
};
|
|
88
|
+
export type PredictionRunListResponse = {
|
|
89
|
+
runs: PredictionRunSummary[];
|
|
90
|
+
};
|
|
91
|
+
export type PredictionOutcomeListResponse = {
|
|
92
|
+
outcomes: PredictionOutcomeSummary[];
|
|
93
|
+
};
|
|
94
|
+
export type PredictionThresholdEventListResponse = {
|
|
95
|
+
events: PredictionThresholdEvent[];
|
|
96
|
+
};
|
|
80
97
|
export type PredictionRunSummary = {
|
|
81
98
|
run_uuid: string;
|
|
82
99
|
as_of_at: string;
|
|
@@ -118,6 +135,108 @@ export type PredictionThresholdEvent = {
|
|
|
118
135
|
dedup_key: string;
|
|
119
136
|
emitted_at: string;
|
|
120
137
|
};
|
|
138
|
+
/** Scores a definition's duration forecasts against one plan block's completed history. */
|
|
139
|
+
export type PredictionDurationEvaluationRequest = {
|
|
140
|
+
planUuid: string;
|
|
141
|
+
semanticKey: string;
|
|
142
|
+
predictionVersionUuid?: string;
|
|
143
|
+
asOf?: string;
|
|
144
|
+
windowStart?: string;
|
|
145
|
+
limit?: number;
|
|
146
|
+
};
|
|
147
|
+
export type DurationForecastMethod = "nominal" | "duration_shrinkage";
|
|
148
|
+
export type DurationForecastInterval = {
|
|
149
|
+
p10_ms?: number;
|
|
150
|
+
p90_ms?: number;
|
|
151
|
+
};
|
|
152
|
+
/** One held-out run of the rolling-origin evaluation. Fields are as the measurement owner stores them. */
|
|
153
|
+
export type DurationForecastEvaluationFold = {
|
|
154
|
+
fold_number: number;
|
|
155
|
+
held_out_run_id: string;
|
|
156
|
+
observed_at: string;
|
|
157
|
+
actual_ms: number;
|
|
158
|
+
training_sample_count: number;
|
|
159
|
+
nominal_point_ms: number;
|
|
160
|
+
nominal_absolute_error_ms: number;
|
|
161
|
+
shrinkage_point_ms: number;
|
|
162
|
+
shrinkage_absolute_error_ms: number;
|
|
163
|
+
shrinkage_interval: DurationForecastInterval;
|
|
164
|
+
};
|
|
165
|
+
export type DurationForecastEvaluationMetric = {
|
|
166
|
+
method: DurationForecastMethod;
|
|
167
|
+
evaluated_fold_count: number;
|
|
168
|
+
mean_absolute_error_ms: number;
|
|
169
|
+
interval: {
|
|
170
|
+
available_fold_count: number;
|
|
171
|
+
covered_fold_count: number;
|
|
172
|
+
coverage: number;
|
|
173
|
+
mean_width_ms: number;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export type DurationForecastEvaluation = {
|
|
177
|
+
tenant_id: string;
|
|
178
|
+
project_id: string;
|
|
179
|
+
series_id: string;
|
|
180
|
+
as_of: string;
|
|
181
|
+
input_hash: string;
|
|
182
|
+
primary_metric: string;
|
|
183
|
+
minimum_training_history: number;
|
|
184
|
+
fold_count: number;
|
|
185
|
+
definition: {
|
|
186
|
+
method: DurationForecastMethod;
|
|
187
|
+
method_version: string;
|
|
188
|
+
minimum_history: number;
|
|
189
|
+
prior_weight: number;
|
|
190
|
+
schema_version: string;
|
|
191
|
+
};
|
|
192
|
+
folds: DurationForecastEvaluationFold[];
|
|
193
|
+
metrics: {
|
|
194
|
+
nominal: DurationForecastEvaluationMetric;
|
|
195
|
+
shrinkage: DurationForecastEvaluationMetric;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
/** The stored evaluation artifact and the checksum of its content. */
|
|
199
|
+
export type DurationForecastEvaluationArtifact = {
|
|
200
|
+
schema_version: string;
|
|
201
|
+
source: string;
|
|
202
|
+
prediction_version_uuid: string;
|
|
203
|
+
content_sha256: string;
|
|
204
|
+
evaluation: DurationForecastEvaluation;
|
|
205
|
+
};
|
|
206
|
+
export type PredictionDurationEvaluationVersionHistoryEntry = {
|
|
207
|
+
versionUuid: string;
|
|
208
|
+
transitionKind: string;
|
|
209
|
+
fromStatus: string;
|
|
210
|
+
toStatus: string;
|
|
211
|
+
actor: string;
|
|
212
|
+
reason: string;
|
|
213
|
+
transitionedAt: string;
|
|
214
|
+
};
|
|
215
|
+
export type PredictionDurationEvaluation = {
|
|
216
|
+
definitionUuid: string;
|
|
217
|
+
planUuid: string;
|
|
218
|
+
semanticKey: string;
|
|
219
|
+
outcomes: {
|
|
220
|
+
eligible: number;
|
|
221
|
+
censored: number;
|
|
222
|
+
cancelled: number;
|
|
223
|
+
skipped: number;
|
|
224
|
+
notRun: number;
|
|
225
|
+
};
|
|
226
|
+
versionEvidence: {
|
|
227
|
+
activeVersionUuid?: string;
|
|
228
|
+
selected: {
|
|
229
|
+
uuid: string;
|
|
230
|
+
versionNumber: number;
|
|
231
|
+
status: string;
|
|
232
|
+
createdAt: string;
|
|
233
|
+
};
|
|
234
|
+
history: {
|
|
235
|
+
items: PredictionDurationEvaluationVersionHistoryEntry[];
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
artifact: DurationForecastEvaluationArtifact;
|
|
239
|
+
};
|
|
121
240
|
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
122
241
|
export declare class PredictionAdminClient {
|
|
123
242
|
private readonly request;
|
|
@@ -129,16 +248,16 @@ export declare class PredictionAdminClient {
|
|
|
129
248
|
getVersion(companySlug: string, definitionUuid: string, versionUuid: string, options?: RequestOptions): Promise<PredictionVersion>;
|
|
130
249
|
publishVersion(companySlug: string, definitionUuid: string, body: PredictionVersionPublishRequest, options?: RequestOptions): Promise<PredictionVersion>;
|
|
131
250
|
activateVersion(companySlug: string, definitionUuid: string, body: PredictionActivateRequest, options?: RequestOptions): Promise<PredictionVersion>;
|
|
132
|
-
rollbackVersion(companySlug: string, definitionUuid: string, body: PredictionRollbackRequest, options?: RequestOptions): Promise<PredictionVersion>;
|
|
133
251
|
pauseDefinition(companySlug: string, definitionUuid: string, body?: PredictionPauseRequest, options?: RequestOptions): Promise<void>;
|
|
134
252
|
resumeDefinition(companySlug: string, definitionUuid: string, options?: RequestOptions): Promise<void>;
|
|
135
253
|
archiveDefinition(companySlug: string, definitionUuid: string, options?: RequestOptions): Promise<void>;
|
|
136
254
|
runNow(companySlug: string, definitionUuid: string, body?: PredictionRunNowRequest, options?: RequestOptions): Promise<void>;
|
|
137
|
-
listRuns(companySlug: string, definitionUuid: string, pageSize?: number, options?: RequestOptions): Promise<
|
|
138
|
-
listOutcomes(companySlug: string, definitionUuid: string, pageSize?: number, options?: RequestOptions): Promise<
|
|
255
|
+
listRuns(companySlug: string, definitionUuid: string, pageSize?: number, options?: RequestOptions): Promise<PredictionRunListResponse>;
|
|
256
|
+
listOutcomes(companySlug: string, definitionUuid: string, pageSize?: number, options?: RequestOptions): Promise<PredictionOutcomeListResponse>;
|
|
139
257
|
getEvaluation(companySlug: string, definitionUuid: string, options?: RequestOptions): Promise<PredictionEvaluationSummary>;
|
|
140
|
-
|
|
141
|
-
|
|
258
|
+
evaluateDurationHistory(companySlug: string, definitionUuid: string, body: PredictionDurationEvaluationRequest, options?: RequestOptions): Promise<PredictionDurationEvaluation>;
|
|
259
|
+
listThresholdEvents(companySlug: string, definitionUuid: string, pageSize?: number, options?: RequestOptions): Promise<PredictionThresholdEventListResponse>;
|
|
260
|
+
listSignalSources(companySlug: string, pageSize?: number, pageToken?: string, options?: RequestOptions): Promise<PredictionSignalSourceListResponse>;
|
|
142
261
|
getSignalSource(companySlug: string, sourceUuid: string, options?: RequestOptions): Promise<PredictionSignalSource>;
|
|
143
262
|
createSignalSource(companySlug: string, body: PredictionSignalSourceCreateRequest, options?: RequestOptions): Promise<PredictionSignalSource>;
|
|
144
263
|
activateSignalSource(companySlug: string, sourceUuid: string, options?: RequestOptions): Promise<void>;
|
|
@@ -23,9 +23,6 @@ export class PredictionAdminClient {
|
|
|
23
23
|
activateVersion(companySlug, definitionUuid, body, options) {
|
|
24
24
|
return this.request("POST", resourcePath(`/definitions/${definitionUuid}/activate`, companySlug), body, options);
|
|
25
25
|
}
|
|
26
|
-
rollbackVersion(companySlug, definitionUuid, body, options) {
|
|
27
|
-
return this.request("POST", resourcePath(`/definitions/${definitionUuid}/rollback`, companySlug), body, options);
|
|
28
|
-
}
|
|
29
26
|
pauseDefinition(companySlug, definitionUuid, body = {}, options) {
|
|
30
27
|
return this.request("POST", resourcePath(`/definitions/${definitionUuid}/pause`, companySlug), body, options);
|
|
31
28
|
}
|
|
@@ -38,20 +35,33 @@ export class PredictionAdminClient {
|
|
|
38
35
|
runNow(companySlug, definitionUuid, body = {}, options) {
|
|
39
36
|
return this.request("POST", resourcePath(`/definitions/${definitionUuid}/run-now`, companySlug), body, options);
|
|
40
37
|
}
|
|
41
|
-
listRuns(companySlug, definitionUuid, pageSize, options) {
|
|
42
|
-
|
|
38
|
+
async listRuns(companySlug, definitionUuid, pageSize, options) {
|
|
39
|
+
const list = await this.request("GET", collectionPath(`/definitions/${definitionUuid}/runs`, companySlug, pageSize), undefined, options);
|
|
40
|
+
return { runs: list.runs ?? [] };
|
|
43
41
|
}
|
|
44
|
-
listOutcomes(companySlug, definitionUuid, pageSize, options) {
|
|
45
|
-
|
|
42
|
+
async listOutcomes(companySlug, definitionUuid, pageSize, options) {
|
|
43
|
+
const list = await this.request("GET", collectionPath(`/definitions/${definitionUuid}/outcomes`, companySlug, pageSize), undefined, options);
|
|
44
|
+
return { outcomes: list.outcomes ?? [] };
|
|
46
45
|
}
|
|
47
46
|
getEvaluation(companySlug, definitionUuid, options) {
|
|
48
47
|
return this.request("GET", resourcePath(`/definitions/${definitionUuid}/evaluations`, companySlug), undefined, options);
|
|
49
48
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
async evaluateDurationHistory(companySlug, definitionUuid, body, options) {
|
|
50
|
+
const evaluation = await this.request("POST", resourcePath(`/definitions/${definitionUuid}/duration-evaluations`, companySlug), body, options);
|
|
51
|
+
const { versionEvidence, artifact } = evaluation;
|
|
52
|
+
return {
|
|
53
|
+
...evaluation,
|
|
54
|
+
versionEvidence: { ...versionEvidence, history: { items: versionEvidence.history?.items ?? [] } },
|
|
55
|
+
artifact: { ...artifact, evaluation: { ...artifact.evaluation, folds: artifact.evaluation.folds ?? [] } },
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async listThresholdEvents(companySlug, definitionUuid, pageSize, options) {
|
|
59
|
+
const list = await this.request("GET", collectionPath(`/definitions/${definitionUuid}/threshold-events`, companySlug, pageSize), undefined, options);
|
|
60
|
+
return { events: list.events ?? [] };
|
|
61
|
+
}
|
|
62
|
+
async listSignalSources(companySlug, pageSize, pageToken, options) {
|
|
63
|
+
const list = await this.request("GET", collectionPath("/sources", companySlug, pageSize, pageToken), undefined, options);
|
|
64
|
+
return { ...list, sources: list.sources ?? [] };
|
|
55
65
|
}
|
|
56
66
|
getSignalSource(companySlug, sourceUuid, options) {
|
|
57
67
|
return this.request("GET", resourcePath(`/sources/${sourceUuid}`, companySlug), undefined, options);
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
import type { RequestOptions } from "./index.js";
|
|
2
2
|
export type PrivacyErasureSelector = {
|
|
3
3
|
type: string;
|
|
4
|
-
value
|
|
5
|
-
|
|
6
|
-
export type PrivacyErasureStoreProgress = {
|
|
7
|
-
store: string;
|
|
8
|
-
state: string;
|
|
9
|
-
deletedCount?: number;
|
|
10
|
-
reason?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
values?: string[];
|
|
11
6
|
};
|
|
12
7
|
export type PrivacyErasure = {
|
|
13
8
|
requestUuid: string;
|
|
14
9
|
status: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
selectorType: string;
|
|
11
|
+
selectorDisplay: string;
|
|
12
|
+
source?: string;
|
|
13
|
+
requestedBy?: string;
|
|
14
|
+
matchedEventCount: number;
|
|
15
|
+
redactedEventCount: number;
|
|
16
|
+
affectedSegmentCount: number;
|
|
17
|
+
rewriteCount?: number;
|
|
18
|
+
pendingRewriteCount?: number;
|
|
19
|
+
rewritingRewriteCount?: number;
|
|
20
|
+
rewrittenRewriteCount?: number;
|
|
21
|
+
recompactedRewriteCount?: number;
|
|
22
|
+
failedRewriteCount?: number;
|
|
23
|
+
oldestPendingRewriteAt?: string;
|
|
24
|
+
latestRecompactedAt?: string;
|
|
25
|
+
archiveRecompactedAt?: string;
|
|
26
|
+
s3PropagationLagSeconds?: number;
|
|
27
|
+
latestFailureReason?: string;
|
|
28
|
+
slaDeadlineAt?: string;
|
|
29
|
+
slaState?: string;
|
|
30
|
+
forceRequestedAt?: string;
|
|
19
31
|
createdAt?: string;
|
|
20
|
-
|
|
32
|
+
updatedAt?: string;
|
|
21
33
|
};
|
|
22
34
|
export type PrivacyErasureCreateRequest = {
|
|
23
35
|
companySlug: string;
|
|
@@ -17,8 +17,9 @@ export class PrivacyErasureClient {
|
|
|
17
17
|
create(body, options) {
|
|
18
18
|
return classifiedRequest(() => this.request("POST", "/privacy/erasures", body, options), "create_request_failed");
|
|
19
19
|
}
|
|
20
|
-
list(companySlug, options) {
|
|
21
|
-
|
|
20
|
+
async list(companySlug, options) {
|
|
21
|
+
const list = await classifiedRequest(() => this.request("GET", `/privacy/erasures?companySlug=${encodeURIComponent(companySlug)}`, undefined, options), "list_request_failed");
|
|
22
|
+
return { requests: list.requests ?? [] };
|
|
22
23
|
}
|
|
23
24
|
get(companySlug, requestUuid, options) {
|
|
24
25
|
return classifiedRequest(() => this.request("GET", `/privacy/erasures/${encodeURIComponent(requestUuid)}?companySlug=${encodeURIComponent(companySlug)}`, undefined, options), "get_request_failed");
|