@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
|
@@ -1,51 +1,99 @@
|
|
|
1
1
|
import type { RequestOptions } from "./index.js";
|
|
2
|
+
/** Which data a retention policy row covers. */
|
|
3
|
+
export type RetentionScope = "tenant" | "data_space" | "event_type" | "global";
|
|
4
|
+
/** The classified store a retention policy row governs. */
|
|
5
|
+
export type RetentionClass = "raw" | "archive" | "materialized" | "cache" | "object" | "audit_event" | "audit_ip_address" | "audit_user_agent";
|
|
6
|
+
/** One bounded retention policy row. */
|
|
2
7
|
export type RetentionPolicy = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
id: number;
|
|
9
|
+
companyId?: number;
|
|
10
|
+
scope: RetentionScope;
|
|
11
|
+
retentionClass: RetentionClass;
|
|
12
|
+
maxAgeSeconds: number;
|
|
13
|
+
precedence: number;
|
|
14
|
+
legalHold: boolean;
|
|
15
|
+
legalHoldUntil?: string;
|
|
16
|
+
effectiveAt: string;
|
|
17
|
+
expiresAt?: string;
|
|
18
|
+
nextRunAt?: string;
|
|
19
|
+
lastResult?: string;
|
|
20
|
+
lastAffectedCounts: Record<string, number>;
|
|
21
|
+
lastError?: string;
|
|
22
|
+
auditId?: number;
|
|
8
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* The body for PUT /admin/retention/policies/{tenantSlug}. legalHold is
|
|
26
|
+
* system-admin only and needs a future legalHoldUntil plus an opaque
|
|
27
|
+
* legalHoldReference.
|
|
28
|
+
*/
|
|
9
29
|
export type RetentionPolicyUpsertRequest = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
scope: RetentionScope;
|
|
31
|
+
retentionClass: RetentionClass;
|
|
32
|
+
maxAgeSeconds: number;
|
|
33
|
+
precedence: number;
|
|
34
|
+
legalHold: boolean;
|
|
35
|
+
legalHoldUntil?: string;
|
|
36
|
+
legalHoldReference?: string;
|
|
37
|
+
effectiveAt?: string;
|
|
38
|
+
expiresAt?: string;
|
|
14
39
|
};
|
|
40
|
+
/** The policies for every tenant (list) or one tenant (get). */
|
|
15
41
|
export type RetentionPolicyListResponse = {
|
|
16
42
|
policies: RetentionPolicy[];
|
|
17
43
|
};
|
|
18
|
-
|
|
44
|
+
/** One classified store's share of a retention preview or apply. */
|
|
45
|
+
export type RetentionStoreBreakdown = {
|
|
19
46
|
store: string;
|
|
20
|
-
|
|
47
|
+
retentionClass: string;
|
|
48
|
+
candidateCount: number;
|
|
49
|
+
estimatedAffected: number;
|
|
50
|
+
sampleSubjects: string[];
|
|
51
|
+
legalHoldCount: number;
|
|
21
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* The body for preview and apply. lastResult is "preview" for a dry run and
|
|
55
|
+
* "applied" for a live run; lastAffectedCounts is set only for an apply.
|
|
56
|
+
*/
|
|
22
57
|
export type RetentionRunPreview = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
58
|
+
perStore: RetentionStoreBreakdown[];
|
|
59
|
+
nextRunAt?: string;
|
|
60
|
+
lastResult: string;
|
|
61
|
+
lastAffectedCounts?: Record<string, number>;
|
|
62
|
+
lastError?: string;
|
|
63
|
+
safeNextAction: string;
|
|
64
|
+
startedAt: string;
|
|
65
|
+
completedAt: string;
|
|
27
66
|
};
|
|
67
|
+
/** One historical retention run. */
|
|
28
68
|
export type RetentionRun = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
69
|
+
startAt: string;
|
|
70
|
+
endAt: string;
|
|
71
|
+
lastResult: string;
|
|
72
|
+
lastAffectedCounts: Record<string, number>;
|
|
73
|
+
lastError?: string;
|
|
74
|
+
auditId?: number;
|
|
35
75
|
};
|
|
76
|
+
/** One page of retention runs. Follow nextOffset while hasMore. */
|
|
36
77
|
export type RetentionRunsListResponse = {
|
|
37
78
|
runs: RetentionRun[];
|
|
79
|
+
nextOffset: number;
|
|
80
|
+
hasMore: boolean;
|
|
81
|
+
};
|
|
82
|
+
/** A page of retention runs: limit defaults to 25 server-side, offset to 0. */
|
|
83
|
+
export type RetentionRunsPage = {
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
38
86
|
};
|
|
39
87
|
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
40
88
|
export declare class RetentionClient {
|
|
41
89
|
private readonly request;
|
|
42
90
|
constructor(request: AdminRequester);
|
|
43
91
|
list(options?: RequestOptions): Promise<RetentionPolicyListResponse>;
|
|
44
|
-
get(tenantSlug: string, options?: RequestOptions): Promise<
|
|
92
|
+
get(tenantSlug: string, options?: RequestOptions): Promise<RetentionPolicyListResponse>;
|
|
45
93
|
upsert(tenantSlug: string, body: RetentionPolicyUpsertRequest, options?: RequestOptions): Promise<RetentionPolicy>;
|
|
46
94
|
delete(tenantSlug: string, options?: RequestOptions): Promise<void>;
|
|
47
95
|
preview(tenantSlug: string, options?: RequestOptions): Promise<RetentionRunPreview>;
|
|
48
|
-
apply(tenantSlug: string, options?: RequestOptions): Promise<
|
|
49
|
-
listRuns(tenantSlug: string, options?: RequestOptions): Promise<RetentionRunsListResponse>;
|
|
96
|
+
apply(tenantSlug: string, options?: RequestOptions): Promise<RetentionRunPreview>;
|
|
97
|
+
listRuns(tenantSlug: string, page?: RetentionRunsPage, options?: RequestOptions): Promise<RetentionRunsListResponse>;
|
|
50
98
|
}
|
|
51
99
|
export {};
|
package/dist/admin-retention.js
CHANGED
|
@@ -1,35 +1,60 @@
|
|
|
1
1
|
// RetentionClient owns per-tenant retention policies. Effective-tenant
|
|
2
2
|
// authority is enforced server-side; wrong-tenant requests return 404.
|
|
3
|
+
function policyPath(tenantSlug) {
|
|
4
|
+
return `/retention/policies/${encodeURIComponent(tenantSlug)}`;
|
|
5
|
+
}
|
|
6
|
+
function policyList(list) {
|
|
7
|
+
return { policies: (list.policies ?? []).map(normalizePolicy) };
|
|
8
|
+
}
|
|
9
|
+
function normalizePolicy(policy) {
|
|
10
|
+
return { ...policy, lastAffectedCounts: policy.lastAffectedCounts ?? {} };
|
|
11
|
+
}
|
|
12
|
+
function runPreview(preview) {
|
|
13
|
+
return {
|
|
14
|
+
...preview,
|
|
15
|
+
perStore: (preview.perStore ?? []).map((store) => ({ ...store, sampleSubjects: store.sampleSubjects ?? [] })),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
3
18
|
export class RetentionClient {
|
|
4
19
|
constructor(request) {
|
|
5
20
|
this.request = request;
|
|
6
21
|
}
|
|
7
|
-
list(options) {
|
|
8
|
-
return this.request("GET", "/retention/policies", undefined, options);
|
|
22
|
+
async list(options) {
|
|
23
|
+
return policyList(await this.request("GET", "/retention/policies", undefined, options));
|
|
9
24
|
}
|
|
10
|
-
get(tenantSlug, options) {
|
|
11
|
-
return this.request("GET",
|
|
25
|
+
async get(tenantSlug, options) {
|
|
26
|
+
return policyList(await this.request("GET", policyPath(tenantSlug), undefined, options));
|
|
12
27
|
}
|
|
13
|
-
upsert(tenantSlug, body, options) {
|
|
14
|
-
return this.request("PUT",
|
|
28
|
+
async upsert(tenantSlug, body, options) {
|
|
29
|
+
return normalizePolicy(await this.request("PUT", policyPath(tenantSlug), body, options));
|
|
15
30
|
}
|
|
16
31
|
delete(tenantSlug, options) {
|
|
17
|
-
return this.request("DELETE",
|
|
32
|
+
return this.request("DELETE", policyPath(tenantSlug), undefined, options);
|
|
18
33
|
}
|
|
19
34
|
// Preview asks the server to compute a deletion estimate without applying
|
|
20
35
|
// it. The estimate is server-issued; the SDK must surface it verbatim and
|
|
21
36
|
// never round or re-derive the per-store counts.
|
|
22
|
-
preview(tenantSlug, options) {
|
|
23
|
-
return this.request("POST",
|
|
37
|
+
async preview(tenantSlug, options) {
|
|
38
|
+
return runPreview(await this.request("POST", `${policyPath(tenantSlug)}/preview`, undefined, options));
|
|
24
39
|
}
|
|
25
40
|
// Apply submits the destructive retention run. The server is the authority
|
|
26
41
|
// for whether deletion actually happens; the SDK must not pre-announce state.
|
|
27
|
-
apply(tenantSlug, options) {
|
|
28
|
-
return this.request("POST",
|
|
42
|
+
async apply(tenantSlug, options) {
|
|
43
|
+
return runPreview(await this.request("POST", `${policyPath(tenantSlug)}/apply`, undefined, options));
|
|
29
44
|
}
|
|
30
45
|
// ListRuns returns the retention runs for a single tenant. Empty runs list
|
|
31
46
|
// is the canonical "no runs yet" response, not an error.
|
|
32
|
-
listRuns(tenantSlug, options) {
|
|
33
|
-
|
|
47
|
+
async listRuns(tenantSlug, page = {}, options) {
|
|
48
|
+
const query = new URLSearchParams();
|
|
49
|
+
if (page.limit !== undefined)
|
|
50
|
+
query.set("limit", String(page.limit));
|
|
51
|
+
if (page.offset !== undefined)
|
|
52
|
+
query.set("offset", String(page.offset));
|
|
53
|
+
const suffix = query.toString() ? `?${query}` : "";
|
|
54
|
+
const runs = await this.request("GET", `${policyPath(tenantSlug)}/runs${suffix}`, undefined, options);
|
|
55
|
+
return {
|
|
56
|
+
...runs,
|
|
57
|
+
runs: (runs.runs ?? []).map((run) => ({ ...run, lastAffectedCounts: run.lastAffectedCounts ?? {} })),
|
|
58
|
+
};
|
|
34
59
|
}
|
|
35
60
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-level security status and reconciliation plans. A plan records the policy state the catalogue
|
|
3
|
+
* expects; executing it converges the live database and returns a diff plus the SQL that undoes it.
|
|
4
|
+
* Creating and executing a plan both require an idempotency key.
|
|
5
|
+
*/
|
|
6
|
+
import type { RequestOptions } from "./index.js";
|
|
7
|
+
/** One table's row-level security policy. */
|
|
8
|
+
export type RlsPolicySpec = {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
force: boolean;
|
|
11
|
+
policy_name: string;
|
|
12
|
+
};
|
|
13
|
+
/** One table's live policy compared with the catalogue. */
|
|
14
|
+
export type RlsTableDiff = {
|
|
15
|
+
table: string;
|
|
16
|
+
classification: string;
|
|
17
|
+
drift: boolean;
|
|
18
|
+
desired?: RlsPolicySpec;
|
|
19
|
+
live?: RlsPolicySpec;
|
|
20
|
+
reason?: string;
|
|
21
|
+
};
|
|
22
|
+
export type RlsStatus = {
|
|
23
|
+
catalog_version: string;
|
|
24
|
+
catalog_digest: string;
|
|
25
|
+
tables: RlsTableDiff[];
|
|
26
|
+
};
|
|
27
|
+
/** A table's policy before and after reconciliation. */
|
|
28
|
+
export type RlsPolicyDiff = {
|
|
29
|
+
table: string;
|
|
30
|
+
converged: boolean;
|
|
31
|
+
desired: RlsPolicySpec;
|
|
32
|
+
live: RlsPolicySpec;
|
|
33
|
+
drift: string[];
|
|
34
|
+
};
|
|
35
|
+
export type RlsPlanRequest = {
|
|
36
|
+
label: string;
|
|
37
|
+
git_commit: string;
|
|
38
|
+
expires_in_seconds?: number;
|
|
39
|
+
};
|
|
40
|
+
/** One catalogue decision the plan expects to hold. */
|
|
41
|
+
export type RlsExpectedTable = {
|
|
42
|
+
table: string;
|
|
43
|
+
classification: string;
|
|
44
|
+
reason?: string;
|
|
45
|
+
};
|
|
46
|
+
export type RlsPlan = {
|
|
47
|
+
plan_uuid: string;
|
|
48
|
+
label: string;
|
|
49
|
+
git_commit: string;
|
|
50
|
+
catalog_version: string;
|
|
51
|
+
catalog_digest: string;
|
|
52
|
+
target_tables: string[];
|
|
53
|
+
expected_state: RlsExpectedTable[];
|
|
54
|
+
reversible_sql_digest: string;
|
|
55
|
+
created_at: string;
|
|
56
|
+
expires_at: string;
|
|
57
|
+
idempotency_key: string;
|
|
58
|
+
actor_id: string;
|
|
59
|
+
};
|
|
60
|
+
export type RlsExecuteRequest = {
|
|
61
|
+
force?: boolean;
|
|
62
|
+
};
|
|
63
|
+
export type RlsExecuteOutcome = "attempted" | "success" | "failure";
|
|
64
|
+
export type RlsExecuteResponse = {
|
|
65
|
+
plan_uuid: string;
|
|
66
|
+
outcome: RlsExecuteOutcome;
|
|
67
|
+
diff: RlsPolicyDiff[];
|
|
68
|
+
rollback_sql: string;
|
|
69
|
+
started_at: string;
|
|
70
|
+
finished_at: string;
|
|
71
|
+
};
|
|
72
|
+
export type RlsProof = {
|
|
73
|
+
plan_uuid: string;
|
|
74
|
+
diff: RlsPolicyDiff[];
|
|
75
|
+
before: Record<string, RlsPolicySpec>;
|
|
76
|
+
after: Record<string, RlsPolicySpec>;
|
|
77
|
+
rollback_sql: string;
|
|
78
|
+
attempted_at: string;
|
|
79
|
+
completed_at: string;
|
|
80
|
+
};
|
|
81
|
+
/** Plan creation and execution are rejected without an idempotency key. */
|
|
82
|
+
export type RlsIdempotentOptions = RequestOptions & {
|
|
83
|
+
idempotencyKey: string;
|
|
84
|
+
};
|
|
85
|
+
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
86
|
+
export declare class RlsAdminClient {
|
|
87
|
+
private readonly request;
|
|
88
|
+
constructor(request: AdminRequester);
|
|
89
|
+
status(options?: RequestOptions): Promise<RlsStatus>;
|
|
90
|
+
createPlan(body: RlsPlanRequest, options: RlsIdempotentOptions): Promise<RlsPlan>;
|
|
91
|
+
executePlan(planUuid: string, body: RlsExecuteRequest, options: RlsIdempotentOptions): Promise<RlsExecuteResponse>;
|
|
92
|
+
getPlanProof(planUuid: string, options?: RequestOptions): Promise<RlsProof>;
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-level security status and reconciliation plans. A plan records the policy state the catalogue
|
|
3
|
+
* expects; executing it converges the live database and returns a diff plus the SQL that undoes it.
|
|
4
|
+
* Creating and executing a plan both require an idempotency key.
|
|
5
|
+
*/
|
|
6
|
+
const plansPath = "/rls/reconciliation-plans";
|
|
7
|
+
export class RlsAdminClient {
|
|
8
|
+
constructor(request) {
|
|
9
|
+
this.request = request;
|
|
10
|
+
}
|
|
11
|
+
async status(options) {
|
|
12
|
+
const status = await this.request("GET", "/rls/status", undefined, options);
|
|
13
|
+
return { ...status, tables: status.tables ?? [] };
|
|
14
|
+
}
|
|
15
|
+
async createPlan(body, options) {
|
|
16
|
+
const plan = await this.request("POST", plansPath, body, options);
|
|
17
|
+
return { ...plan, target_tables: plan.target_tables ?? [] };
|
|
18
|
+
}
|
|
19
|
+
async executePlan(planUuid, body, options) {
|
|
20
|
+
const result = await this.request("POST", `${planPath(planUuid)}/execute`, body, options);
|
|
21
|
+
return { ...result, diff: normalizeDiffs(result.diff) };
|
|
22
|
+
}
|
|
23
|
+
async getPlanProof(planUuid, options) {
|
|
24
|
+
const proof = await this.request("GET", `${planPath(planUuid)}/proof`, undefined, options);
|
|
25
|
+
return { ...proof, diff: normalizeDiffs(proof.diff) };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function planPath(planUuid) {
|
|
29
|
+
return `${plansPath}/${encodeURIComponent(planUuid)}`;
|
|
30
|
+
}
|
|
31
|
+
function normalizeDiffs(diffs) {
|
|
32
|
+
return (diffs ?? []).map((diff) => ({ ...diff, drift: diff.drift ?? [] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK usage by release, as Custd observes it from the `X-Custd-Sdk` header, and the deprecations
|
|
3
|
+
* Custd announces for a release range.
|
|
4
|
+
*/
|
|
5
|
+
import type { RequestOptions } from "./index.js";
|
|
6
|
+
/** A deprecation recorded for every release of one SDK within `versionScope`. */
|
|
7
|
+
export type SdkVersionDeprecation = {
|
|
8
|
+
sdk: string;
|
|
9
|
+
versionScope: string;
|
|
10
|
+
recommendedVersion: string;
|
|
11
|
+
note: string;
|
|
12
|
+
markedBy: string;
|
|
13
|
+
deprecatedAt: string;
|
|
14
|
+
};
|
|
15
|
+
/** One SDK release seen in requests. */
|
|
16
|
+
export type SdkUsageItem = {
|
|
17
|
+
sdk: string;
|
|
18
|
+
version: string;
|
|
19
|
+
state: string;
|
|
20
|
+
requests: number;
|
|
21
|
+
firstSeenAt: string;
|
|
22
|
+
lastSeenAt: string;
|
|
23
|
+
deprecation?: SdkVersionDeprecation;
|
|
24
|
+
};
|
|
25
|
+
export type SdkUsageListResponse = {
|
|
26
|
+
items: SdkUsageItem[];
|
|
27
|
+
};
|
|
28
|
+
export type SdkVersionDeprecationRequest = {
|
|
29
|
+
recommendedVersion: string;
|
|
30
|
+
note: string;
|
|
31
|
+
};
|
|
32
|
+
type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
|
|
33
|
+
export declare class SdkUsageAdminClient {
|
|
34
|
+
private readonly request;
|
|
35
|
+
constructor(request: AdminRequester);
|
|
36
|
+
list(options?: RequestOptions): Promise<SdkUsageListResponse>;
|
|
37
|
+
/** Marks every release of `sdk` within `versionScope` deprecated. */
|
|
38
|
+
putDeprecation(sdk: string, versionScope: string, body: SdkVersionDeprecationRequest, options?: RequestOptions): Promise<SdkVersionDeprecation>;
|
|
39
|
+
deleteDeprecation(sdk: string, versionScope: string, options?: RequestOptions): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK usage by release, as Custd observes it from the `X-Custd-Sdk` header, and the deprecations
|
|
3
|
+
* Custd announces for a release range.
|
|
4
|
+
*/
|
|
5
|
+
export class SdkUsageAdminClient {
|
|
6
|
+
constructor(request) {
|
|
7
|
+
this.request = request;
|
|
8
|
+
}
|
|
9
|
+
async list(options) {
|
|
10
|
+
const list = await this.request("GET", "/sdk-usage", undefined, options);
|
|
11
|
+
return { items: list.items ?? [] };
|
|
12
|
+
}
|
|
13
|
+
/** Marks every release of `sdk` within `versionScope` deprecated. */
|
|
14
|
+
putDeprecation(sdk, versionScope, body, options) {
|
|
15
|
+
return this.request("PUT", deprecationPath(sdk, versionScope), body, options);
|
|
16
|
+
}
|
|
17
|
+
deleteDeprecation(sdk, versionScope, options) {
|
|
18
|
+
return this.request("DELETE", deprecationPath(sdk, versionScope), undefined, options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function deprecationPath(sdk, versionScope) {
|
|
22
|
+
return `/sdk-usage/deprecations/${encodeURIComponent(sdk)}/${encodeURIComponent(versionScope)}`;
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type SiteAIMode = "off" | "platform" | "own-key";
|
|
2
|
+
export type SiteAIUsagePeriod = "day" | "month" | "previous-month";
|
|
3
|
+
export type SiteAIProduct = "hosting" | "custd" | "cb" | "awthy";
|
|
4
|
+
/** Grant requires the version the tenant explicitly accepted. */
|
|
5
|
+
export type SiteAIConsentRequest = {
|
|
6
|
+
action: "grant";
|
|
7
|
+
termsVersion: string;
|
|
8
|
+
} | {
|
|
9
|
+
action: "revoke";
|
|
10
|
+
};
|
|
11
|
+
export type SiteAIOwnerHandoffRequest = {
|
|
12
|
+
tenantSlug: string;
|
|
13
|
+
ownerSubject: string;
|
|
14
|
+
};
|
|
15
|
+
export type SiteAIOwnerHandoff = {
|
|
16
|
+
code: string;
|
|
17
|
+
redeemUrl: string;
|
|
18
|
+
};
|
|
19
|
+
export type SiteAISettings = {
|
|
20
|
+
aiMode: SiteAIMode;
|
|
21
|
+
monthlyCapUsdMicros: number;
|
|
22
|
+
keyConfigured: boolean;
|
|
23
|
+
ownKeyAvailable?: boolean;
|
|
24
|
+
keyRefused?: boolean;
|
|
25
|
+
currentTermsVersion?: string;
|
|
26
|
+
acceptedTermsVersion?: string;
|
|
27
|
+
consentAcceptedAt?: string;
|
|
28
|
+
};
|
|
29
|
+
export type SiteAISettingsRequest = {
|
|
30
|
+
aiMode: SiteAIMode;
|
|
31
|
+
monthlyCapUsdMicros: number;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
};
|
|
34
|
+
export type SiteAIUsageRow = {
|
|
35
|
+
tenantSlug?: string;
|
|
36
|
+
feature: string;
|
|
37
|
+
samplingProduct?: SiteAIProduct;
|
|
38
|
+
provider: string;
|
|
39
|
+
method: string;
|
|
40
|
+
model: string;
|
|
41
|
+
payer: string;
|
|
42
|
+
priceRevision: string;
|
|
43
|
+
attempts: number;
|
|
44
|
+
unsettledAttempts: number;
|
|
45
|
+
unknownCostAttempts: number;
|
|
46
|
+
failedAttempts: number;
|
|
47
|
+
notSentAttempts: number;
|
|
48
|
+
inputTokens: number;
|
|
49
|
+
cachedInputTokens: number;
|
|
50
|
+
outputTokens: number;
|
|
51
|
+
searches: number;
|
|
52
|
+
pages: number;
|
|
53
|
+
audioMilliseconds: number;
|
|
54
|
+
confirmedCostUsdMicros: number;
|
|
55
|
+
estimatedCostUsdMicros: number;
|
|
56
|
+
capAccountedUsdMicros: number;
|
|
57
|
+
};
|
|
58
|
+
export type SiteAIUsage = {
|
|
59
|
+
period: SiteAIUsagePeriod;
|
|
60
|
+
from: string;
|
|
61
|
+
until: string;
|
|
62
|
+
rows: SiteAIUsageRow[];
|
|
63
|
+
};
|
|
64
|
+
export type SiteAITenantUsage = SiteAIUsage & {
|
|
65
|
+
period: "month";
|
|
66
|
+
aiMode: SiteAIMode;
|
|
67
|
+
monthlyCapUsdMicros: number;
|
|
68
|
+
monthlyCapUsedUsdMicros?: number;
|
|
69
|
+
};
|
|
70
|
+
export type SiteAIPlatformUsage = SiteAIUsage & {
|
|
71
|
+
samplingMonthlyCapUsdMicros: number;
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SiteSearchConnectionStatus } from "./admin-site-domains.js";
|
|
2
|
+
/** A 400 on connectAnalytics: propertyId is not a GA4 property's numeric ID. */
|
|
3
|
+
export declare const SITE_ANALYTICS_PROPERTY_INVALID_CODE = "site_analytics_property_invalid";
|
|
4
|
+
/** A 404 on disconnectAnalytics: the domain is not connected to GA4. */
|
|
5
|
+
export declare const SITE_ANALYTICS_CONNECTION_NOT_FOUND_CODE = "site_analytics_connection_not_found";
|
|
6
|
+
/** The analytics provider a connection reads. */
|
|
7
|
+
export declare const SITE_ANALYTICS_PROVIDER_GA4 = "ga4";
|
|
8
|
+
/** A GA4 report Custd does not import, as SiteAnalyticsReport.unavailable names it. */
|
|
9
|
+
export declare const SiteAnalyticsUnavailableReport: {
|
|
10
|
+
readonly Ecommerce: "ecommerce";
|
|
11
|
+
readonly Audience: "audience";
|
|
12
|
+
};
|
|
13
|
+
export type SiteAnalyticsUnavailableReport = (typeof SiteAnalyticsUnavailableReport)[keyof typeof SiteAnalyticsUnavailableReport];
|
|
14
|
+
/** The GA4 property: 123456789 or properties/123456789. */
|
|
15
|
+
export type SiteAnalyticsConnectionRequest = {
|
|
16
|
+
propertyId: string;
|
|
17
|
+
};
|
|
18
|
+
export type SiteAnalyticsConnection = {
|
|
19
|
+
/** SITE_ANALYTICS_PROVIDER_GA4. */
|
|
20
|
+
provider: "ga4";
|
|
21
|
+
propertyId: string;
|
|
22
|
+
status: SiteSearchConnectionStatus;
|
|
23
|
+
lastImportedAt?: string;
|
|
24
|
+
lastFailure?: string;
|
|
25
|
+
};
|
|
26
|
+
/** One landing page, key event or channel. */
|
|
27
|
+
export type SiteAnalyticsRow = {
|
|
28
|
+
key: string;
|
|
29
|
+
sessions?: number;
|
|
30
|
+
engagedSessions?: number;
|
|
31
|
+
keyEvents?: number;
|
|
32
|
+
};
|
|
33
|
+
export type SiteAnalyticsUnavailable = {
|
|
34
|
+
/** A SiteAnalyticsUnavailableReport value. */
|
|
35
|
+
report: SiteAnalyticsUnavailableReport;
|
|
36
|
+
reason: string;
|
|
37
|
+
};
|
|
38
|
+
/** connection, windowFrom and windowTo are absent until the domain is connected and imported. */
|
|
39
|
+
export type SiteAnalyticsReport = {
|
|
40
|
+
domainUuid: string;
|
|
41
|
+
connection?: SiteAnalyticsConnection;
|
|
42
|
+
/** YYYY-MM-DD. */
|
|
43
|
+
windowFrom?: string;
|
|
44
|
+
/** YYYY-MM-DD. */
|
|
45
|
+
windowTo?: string;
|
|
46
|
+
/** false while the property records no key events, so rows carry no keyEvents. */
|
|
47
|
+
keyEventsRecorded: boolean;
|
|
48
|
+
landingPages: SiteAnalyticsRow[];
|
|
49
|
+
keyEvents: SiteAnalyticsRow[];
|
|
50
|
+
channels: SiteAnalyticsRow[];
|
|
51
|
+
unavailable: SiteAnalyticsUnavailable[];
|
|
52
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// A domain's GA4 reports: landing pages, key events and channels imported from
|
|
2
|
+
// the domain's GA4 property. SiteDomainAdminClient sends the calls. A number
|
|
3
|
+
// GA4 did not report is absent, never 0.
|
|
4
|
+
/** A 400 on connectAnalytics: propertyId is not a GA4 property's numeric ID. */
|
|
5
|
+
export const SITE_ANALYTICS_PROPERTY_INVALID_CODE = "site_analytics_property_invalid";
|
|
6
|
+
/** A 404 on disconnectAnalytics: the domain is not connected to GA4. */
|
|
7
|
+
export const SITE_ANALYTICS_CONNECTION_NOT_FOUND_CODE = "site_analytics_connection_not_found";
|
|
8
|
+
/** The analytics provider a connection reads. */
|
|
9
|
+
export const SITE_ANALYTICS_PROVIDER_GA4 = "ga4";
|
|
10
|
+
/** A GA4 report Custd does not import, as SiteAnalyticsReport.unavailable names it. */
|
|
11
|
+
export const SiteAnalyticsUnavailableReport = {
|
|
12
|
+
Ecommerce: "ecommerce",
|
|
13
|
+
Audience: "audience",
|
|
14
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { SiteDomainRequestOptions, SiteFinding } from "./admin-site-domains.js";
|
|
2
|
+
/** A 400 on setLighthousePages: each URL must be on the domain's host and not its home page. */
|
|
3
|
+
export declare const SITE_LIGHTHOUSE_PAGE_NOT_EXTRA_CODE = "site_lighthouse_page_not_extra";
|
|
4
|
+
/** listAuditPages returns this many pages when no limit is given. */
|
|
5
|
+
export declare const SITE_AUDIT_PAGES_DEFAULT_LIMIT = 50;
|
|
6
|
+
/** The most pages one listAuditPages call returns. */
|
|
7
|
+
export declare const SITE_AUDIT_PAGES_MAX_LIMIT = 200;
|
|
8
|
+
/** How many extra pages beside the home page Lighthouse may measure. */
|
|
9
|
+
export declare const SITE_LIGHTHOUSE_MAX_EXTRA_PAGES = 5;
|
|
10
|
+
/** Whether a crawled page can be indexed. */
|
|
11
|
+
export declare const SiteAuditPageIndexability: {
|
|
12
|
+
readonly Indexable: "indexable";
|
|
13
|
+
readonly Noindex: "noindex";
|
|
14
|
+
readonly Canonicalized: "canonicalized";
|
|
15
|
+
readonly Redirected: "redirected";
|
|
16
|
+
readonly Error: "error";
|
|
17
|
+
readonly NotHTML: "not_html";
|
|
18
|
+
};
|
|
19
|
+
export type SiteAuditPageIndexability = (typeof SiteAuditPageIndexability)[keyof typeof SiteAuditPageIndexability];
|
|
20
|
+
/** How the latest audit run ended. */
|
|
21
|
+
export declare const SiteAuditRun: {
|
|
22
|
+
readonly NotAudited: "not_audited";
|
|
23
|
+
readonly Failed: "failed";
|
|
24
|
+
readonly Truncated: "truncated";
|
|
25
|
+
readonly Complete: "complete";
|
|
26
|
+
};
|
|
27
|
+
export type SiteAuditRun = (typeof SiteAuditRun)[keyof typeof SiteAuditRun];
|
|
28
|
+
/** One crawled URL. depth and inboundLinks are absent when unknown; a present 0 is a real 0. */
|
|
29
|
+
export type SiteAuditPage = {
|
|
30
|
+
url: string;
|
|
31
|
+
/** Where the URL redirected to; absent when it did not redirect. */
|
|
32
|
+
finalUrl?: string;
|
|
33
|
+
/** HTTP status of the first response; 0 when the request failed. */
|
|
34
|
+
status: number;
|
|
35
|
+
/** A SiteAuditPageIndexability value. */
|
|
36
|
+
indexability: SiteAuditPageIndexability;
|
|
37
|
+
/** Clicks from the home page. */
|
|
38
|
+
depth?: number;
|
|
39
|
+
/** Crawled pages that link here; absent on a truncated crawl. */
|
|
40
|
+
inboundLinks?: number;
|
|
41
|
+
openFindings: number;
|
|
42
|
+
};
|
|
43
|
+
/** One page of the latest crawl's URLs; auditedAt is absent before the first audit. */
|
|
44
|
+
export type SiteAuditPageList = {
|
|
45
|
+
domainUuid: string;
|
|
46
|
+
auditedAt?: string;
|
|
47
|
+
/** The crawl stopped at its bound; depth and inbound links are left out. */
|
|
48
|
+
truncated: boolean;
|
|
49
|
+
offset: number;
|
|
50
|
+
limit: number;
|
|
51
|
+
total: number;
|
|
52
|
+
pages: SiteAuditPage[];
|
|
53
|
+
};
|
|
54
|
+
/** Findings the latest audit opened, reopened and fixed against the audit before it. */
|
|
55
|
+
export type SiteAuditDelta = {
|
|
56
|
+
domainUuid: string;
|
|
57
|
+
/** A SiteAuditRun value. */
|
|
58
|
+
run: SiteAuditRun;
|
|
59
|
+
auditedAt?: string;
|
|
60
|
+
failure?: string;
|
|
61
|
+
new: SiteFinding[];
|
|
62
|
+
reopened: SiteFinding[];
|
|
63
|
+
fixed: SiteFinding[];
|
|
64
|
+
};
|
|
65
|
+
/** The extra pages Lighthouse measures; the home page is always measured. */
|
|
66
|
+
export type SiteLighthousePages = {
|
|
67
|
+
domainUuid: string;
|
|
68
|
+
homePage: string;
|
|
69
|
+
/** The extra pages, in the order they were set. */
|
|
70
|
+
urls: string[];
|
|
71
|
+
maxPages: number;
|
|
72
|
+
};
|
|
73
|
+
/** getLighthouseHistory's options: `url` names an extra page to read instead of the home page. */
|
|
74
|
+
export type SiteLighthouseRequestOptions = SiteDomainRequestOptions & {
|
|
75
|
+
url?: string;
|
|
76
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The pages a domain's latest audit crawled, what changed since the audit
|
|
2
|
+
// before it, and the extra pages Lighthouse measures beside the home page.
|
|
3
|
+
// SiteDomainAdminClient sends them. A measurement Custd did not take is absent, never 0.
|
|
4
|
+
/** A 400 on setLighthousePages: each URL must be on the domain's host and not its home page. */
|
|
5
|
+
export const SITE_LIGHTHOUSE_PAGE_NOT_EXTRA_CODE = "site_lighthouse_page_not_extra";
|
|
6
|
+
/** listAuditPages returns this many pages when no limit is given. */
|
|
7
|
+
export const SITE_AUDIT_PAGES_DEFAULT_LIMIT = 50;
|
|
8
|
+
/** The most pages one listAuditPages call returns. */
|
|
9
|
+
export const SITE_AUDIT_PAGES_MAX_LIMIT = 200;
|
|
10
|
+
/** How many extra pages beside the home page Lighthouse may measure. */
|
|
11
|
+
export const SITE_LIGHTHOUSE_MAX_EXTRA_PAGES = 5;
|
|
12
|
+
/** Whether a crawled page can be indexed. */
|
|
13
|
+
export const SiteAuditPageIndexability = {
|
|
14
|
+
Indexable: "indexable",
|
|
15
|
+
Noindex: "noindex",
|
|
16
|
+
Canonicalized: "canonicalized",
|
|
17
|
+
Redirected: "redirected",
|
|
18
|
+
Error: "error",
|
|
19
|
+
NotHTML: "not_html",
|
|
20
|
+
};
|
|
21
|
+
/** How the latest audit run ended. */
|
|
22
|
+
export const SiteAuditRun = {
|
|
23
|
+
NotAudited: "not_audited",
|
|
24
|
+
Failed: "failed",
|
|
25
|
+
Truncated: "truncated",
|
|
26
|
+
Complete: "complete",
|
|
27
|
+
};
|