@haakco/custd-sdk 0.0.0-stage → 3.71.1

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.
Files changed (196) hide show
  1. package/README.md +958 -2
  2. package/dist/admin-accounting-evidence.d.ts +48 -0
  3. package/dist/admin-accounting-evidence.js +24 -0
  4. package/dist/admin-app-releases.d.ts +116 -0
  5. package/dist/admin-app-releases.js +8 -0
  6. package/dist/admin-apps.d.ts +120 -0
  7. package/dist/admin-apps.js +47 -0
  8. package/dist/admin-auth-project-domain.d.ts +125 -0
  9. package/dist/admin-auth-project-domain.js +37 -0
  10. package/dist/admin-auth-projects.d.ts +989 -0
  11. package/dist/admin-auth-projects.js +527 -0
  12. package/dist/admin-campaign-email.d.ts +120 -0
  13. package/dist/admin-campaign-email.js +64 -0
  14. package/dist/admin-client-setup.d.ts +122 -0
  15. package/dist/admin-client-setup.js +408 -0
  16. package/dist/admin-data-labels.d.ts +124 -0
  17. package/dist/admin-data-labels.js +51 -0
  18. package/dist/admin-data-scopes.d.ts +93 -0
  19. package/dist/admin-data-scopes.js +154 -0
  20. package/dist/admin-email-relay.d.ts +66 -0
  21. package/dist/admin-email-relay.js +25 -0
  22. package/dist/admin-environment-policy.d.ts +32 -0
  23. package/dist/admin-environment-policy.js +26 -0
  24. package/dist/admin-error-issues.d.ts +91 -0
  25. package/dist/admin-error-issues.js +52 -0
  26. package/dist/admin-event-types.d.ts +57 -0
  27. package/dist/admin-event-types.js +28 -0
  28. package/dist/admin-impersonation.d.ts +48 -0
  29. package/dist/admin-impersonation.js +27 -0
  30. package/dist/admin-ingest-claims.d.ts +35 -0
  31. package/dist/admin-ingest-claims.js +26 -0
  32. package/dist/admin-managed-audit.d.ts +13 -0
  33. package/dist/admin-managed-audit.js +13 -0
  34. package/dist/admin-measurement-projects.d.ts +166 -0
  35. package/dist/admin-measurement-projects.js +120 -0
  36. package/dist/admin-notification-destinations.d.ts +31 -0
  37. package/dist/admin-notification-destinations.js +19 -0
  38. package/dist/admin-notification-webhooks.d.ts +64 -0
  39. package/dist/admin-notification-webhooks.js +42 -0
  40. package/dist/admin-oauth-client-admissions.d.ts +65 -0
  41. package/dist/admin-oauth-client-admissions.js +46 -0
  42. package/dist/admin-offboarding.d.ts +123 -0
  43. package/dist/admin-offboarding.js +129 -0
  44. package/dist/admin-predictions.d.ts +266 -0
  45. package/dist/admin-predictions.js +93 -0
  46. package/dist/admin-privacy-erasures.d.ts +74 -0
  47. package/dist/admin-privacy-erasures.js +73 -0
  48. package/dist/admin-retention.d.ts +99 -0
  49. package/dist/admin-retention.js +60 -0
  50. package/dist/admin-rls.d.ts +94 -0
  51. package/dist/admin-rls.js +33 -0
  52. package/dist/admin-sdk-usage.d.ts +41 -0
  53. package/dist/admin-sdk-usage.js +23 -0
  54. package/dist/admin-site-ai.d.ts +72 -0
  55. package/dist/admin-site-ai.js +1 -0
  56. package/dist/admin-site-analytics.d.ts +52 -0
  57. package/dist/admin-site-analytics.js +14 -0
  58. package/dist/admin-site-audit-pages.d.ts +76 -0
  59. package/dist/admin-site-audit-pages.js +27 -0
  60. package/dist/admin-site-campaign-links.d.ts +40 -0
  61. package/dist/admin-site-campaign-links.js +9 -0
  62. package/dist/admin-site-domains.d.ts +733 -0
  63. package/dist/admin-site-domains.js +768 -0
  64. package/dist/admin-site-export.d.ts +76 -0
  65. package/dist/admin-site-export.js +15 -0
  66. package/dist/admin-site-insights-tasks.d.ts +44 -0
  67. package/dist/admin-site-insights-tasks.js +28 -0
  68. package/dist/admin-site-insights.d.ts +527 -0
  69. package/dist/admin-site-insights.js +61 -0
  70. package/dist/admin-site-links.d.ts +87 -0
  71. package/dist/admin-site-links.js +16 -0
  72. package/dist/admin-site-monitors.d.ts +110 -0
  73. package/dist/admin-site-monitors.js +25 -0
  74. package/dist/admin-site-next-actions.d.ts +93 -0
  75. package/dist/admin-site-next-actions.js +36 -0
  76. package/dist/admin-site-page-queries.d.ts +63 -0
  77. package/dist/admin-site-page-queries.js +20 -0
  78. package/dist/admin-site-rankings.d.ts +98 -0
  79. package/dist/admin-site-rankings.js +46 -0
  80. package/dist/admin-site-regional-trends.d.ts +30 -0
  81. package/dist/admin-site-regional-trends.js +1 -0
  82. package/dist/admin-site-saved-reports.d.ts +45 -0
  83. package/dist/admin-site-saved-reports.js +13 -0
  84. package/dist/admin-site-search-pool.d.ts +77 -0
  85. package/dist/admin-site-search-pool.js +41 -0
  86. package/dist/admin-site-search-value.d.ts +97 -0
  87. package/dist/admin-site-search-value.js +29 -0
  88. package/dist/admin-site-status-page.d.ts +57 -0
  89. package/dist/admin-site-status-page.js +10 -0
  90. package/dist/admin-site-traffic.d.ts +145 -0
  91. package/dist/admin-site-traffic.js +32 -0
  92. package/dist/admin-site-web-data.d.ts +258 -0
  93. package/dist/admin-site-web-data.js +60 -0
  94. package/dist/admin-subject-exports.d.ts +79 -0
  95. package/dist/admin-subject-exports.js +44 -0
  96. package/dist/admin-support-access.d.ts +32 -0
  97. package/dist/admin-support-access.js +21 -0
  98. package/dist/admin-system.d.ts +283 -0
  99. package/dist/admin-system.js +65 -0
  100. package/dist/admin-tenant-storage.d.ts +35 -0
  101. package/dist/admin-tenant-storage.js +24 -0
  102. package/dist/admin-timeplans.d.ts +512 -0
  103. package/dist/admin-timeplans.js +200 -0
  104. package/dist/admin-uncertainty-models.d.ts +42 -0
  105. package/dist/admin-uncertainty-models.js +53 -0
  106. package/dist/admin-usage.d.ts +124 -0
  107. package/dist/admin-usage.js +169 -0
  108. package/dist/admin-users.d.ts +124 -0
  109. package/dist/admin-users.js +82 -0
  110. package/dist/admin-workflow-timings.d.ts +367 -0
  111. package/dist/admin-workflow-timings.js +117 -0
  112. package/dist/analytics-events.d.ts +167 -0
  113. package/dist/analytics-events.js +197 -0
  114. package/dist/analytics-reads.d.ts +81 -0
  115. package/dist/analytics-reads.js +5 -0
  116. package/dist/app-account.d.ts +84 -0
  117. package/dist/app-account.js +177 -0
  118. package/dist/app-alerts.d.ts +120 -0
  119. package/dist/app-alerts.js +44 -0
  120. package/dist/app-items.d.ts +786 -0
  121. package/dist/app-items.js +524 -0
  122. package/dist/app-live.d.ts +84 -0
  123. package/dist/app-live.js +228 -0
  124. package/dist/app-meetings.d.ts +95 -0
  125. package/dist/app-meetings.js +26 -0
  126. package/dist/app-models.d.ts +271 -0
  127. package/dist/app-models.js +83 -0
  128. package/dist/app-push.d.ts +64 -0
  129. package/dist/app-push.js +178 -0
  130. package/dist/backend-lifecycle.d.ts +85 -0
  131. package/dist/backend-lifecycle.js +212 -0
  132. package/dist/browser-manifest.json +7 -0
  133. package/dist/browser-script-BWnwDjAC.js +711 -0
  134. package/dist/browser-script.d.ts +1 -0
  135. package/dist/browser-script.js +5 -0
  136. package/dist/browser-sign-in.d.ts +153 -0
  137. package/dist/browser-sign-in.js +410 -0
  138. package/dist/browser-tracker.d.ts +142 -0
  139. package/dist/browser-tracker.js +775 -0
  140. package/dist/browser-web-vitals.d.ts +22 -0
  141. package/dist/browser-web-vitals.js +116 -0
  142. package/dist/browser.d.ts +10 -0
  143. package/dist/browser.js +10 -0
  144. package/dist/download-stream.d.ts +16 -0
  145. package/dist/download-stream.js +55 -0
  146. package/dist/error-capture.d.ts +62 -0
  147. package/dist/error-capture.js +168 -0
  148. package/dist/hosted-app.d.ts +115 -0
  149. package/dist/hosted-app.js +275 -0
  150. package/dist/index.d.ts +2324 -0
  151. package/dist/index.js +2226 -0
  152. package/dist/ingest-operations.d.ts +483 -0
  153. package/dist/ingest-operations.js +154 -0
  154. package/dist/measurement.d.ts +164 -0
  155. package/dist/measurement.js +104 -0
  156. package/dist/mobile-adapter.d.ts +25 -0
  157. package/dist/mobile-adapter.js +57 -0
  158. package/dist/mobile-context.d.ts +32 -0
  159. package/dist/mobile-context.js +156 -0
  160. package/dist/mobile-queue.d.ts +22 -0
  161. package/dist/mobile-queue.js +73 -0
  162. package/dist/oauth.d.ts +1 -0
  163. package/dist/oauth.js +8 -0
  164. package/dist/parsers.d.ts +149 -0
  165. package/dist/parsers.js +115 -0
  166. package/dist/public-reads.d.ts +79 -0
  167. package/dist/public-reads.js +57 -0
  168. package/dist/reporting-catalogue.d.ts +264 -0
  169. package/dist/reporting-catalogue.js +5 -0
  170. package/dist/reporting-state.d.ts +46 -0
  171. package/dist/reporting-state.js +76 -0
  172. package/dist/response-lists.d.ts +16 -0
  173. package/dist/response-lists.generated.d.ts +7 -0
  174. package/dist/response-lists.generated.js +1927 -0
  175. package/dist/response-lists.js +70 -0
  176. package/dist/response-validation.d.ts +30 -0
  177. package/dist/response-validation.js +94 -0
  178. package/dist/runtime-readiness.d.ts +30 -0
  179. package/dist/runtime-readiness.js +150 -0
  180. package/dist/schema-registry.d.ts +45 -0
  181. package/dist/schema-registry.js +9 -0
  182. package/dist/secure-url.d.ts +4 -0
  183. package/dist/secure-url.js +23 -0
  184. package/dist/site-ai-owner.d.ts +34 -0
  185. package/dist/site-ai-owner.js +99 -0
  186. package/dist/site-monitor-reports.d.ts +15 -0
  187. package/dist/site-monitor-reports.js +87 -0
  188. package/dist/testing/fake-custd.d.ts +150 -0
  189. package/dist/testing/fake-custd.js +842 -0
  190. package/dist/testing/fake-results.d.ts +30 -0
  191. package/dist/testing/fake-results.js +293 -0
  192. package/dist/testing.d.ts +2 -0
  193. package/dist/testing.js +3 -0
  194. package/dist/version.d.ts +10 -0
  195. package/dist/version.js +10 -0
  196. package/package.json +57 -4
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Grouped error issues captured from a tenant's apps: list, read with the latest event, and set state.
3
+ */
4
+ export class ErrorIssueAdminClient {
5
+ constructor(request) {
6
+ this.request = request;
7
+ }
8
+ async list(query = {}) {
9
+ const params = new URLSearchParams();
10
+ for (const [name, value] of Object.entries(query)) {
11
+ if (value !== undefined && value !== "")
12
+ params.set(name, String(value));
13
+ }
14
+ const search = params.toString();
15
+ const response = await this.request("GET", search ? `/error-issues?${search}` : "/error-issues");
16
+ return { ...response, issues: (response.issues ?? []).map(issue) };
17
+ }
18
+ async get(issueUuid, companySlug) {
19
+ const detail = await this.request("GET", scoped(issuePath(issueUuid), companySlug));
20
+ return {
21
+ issue: issue(detail.issue),
22
+ latestEventUuid: detail.latestEventUuid,
23
+ latestEvent: event(detail.latestEvent),
24
+ };
25
+ }
26
+ async setState(issueUuid, state, companySlug) {
27
+ const body = { state };
28
+ return issue(await this.request("POST", scoped(`${issuePath(issueUuid)}/state`, companySlug), body));
29
+ }
30
+ }
31
+ function issue(wire) {
32
+ return { ...wire, environments: wire.environments ?? [] };
33
+ }
34
+ function event(wire) {
35
+ return {
36
+ ...wire,
37
+ exceptions: (wire.exceptions ?? []).map((exception) => ({
38
+ ...exception,
39
+ frames: (exception.frames ?? []).map((frame) => ({
40
+ ...frame,
41
+ preContext: frame.preContext ?? [],
42
+ postContext: frame.postContext ?? [],
43
+ })),
44
+ })),
45
+ };
46
+ }
47
+ function issuePath(issueUuid) {
48
+ return `/error-issues/${encodeURIComponent(issueUuid)}`;
49
+ }
50
+ function scoped(path, companySlug) {
51
+ return companySlug ? `${path}?companySlug=${encodeURIComponent(companySlug)}` : path;
52
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Admin event types and event categories: retention and rollup dimensions. An event type inherits its
3
+ * category's retention when its own retentionDays is null. Categories are platform-wide and need a
4
+ * system administrator.
5
+ */
6
+ import type { RequestOptions } from "./index.js";
7
+ type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
8
+ /** One rollup slot and the lookups that fill it. */
9
+ export type EventRollupDimension = {
10
+ slot: string;
11
+ lookups: string[];
12
+ };
13
+ export type EventRollupDimensionProfile = {
14
+ dimensions?: EventRollupDimension[];
15
+ };
16
+ export type EventTypeConfig = {
17
+ slug: string;
18
+ name: string;
19
+ categorySlug: string;
20
+ rollupDimensions?: EventRollupDimensionProfile;
21
+ retentionDays: number | null;
22
+ categoryRetentionDays: number | null;
23
+ categoryIsAudit: boolean;
24
+ };
25
+ export type EventTypeConfigListResponse = {
26
+ eventTypes: EventTypeConfig[];
27
+ };
28
+ export type EventCategoryConfig = {
29
+ slug: string;
30
+ name: string;
31
+ rollupDimensions?: EventRollupDimensionProfile;
32
+ retentionDays: number | null;
33
+ isAudit: boolean;
34
+ };
35
+ export type EventCategoryConfigListResponse = {
36
+ eventCategories: EventCategoryConfig[];
37
+ };
38
+ /** retentionDays null inherits the category default. */
39
+ export type EventTypeConfigUpdateRequest = {
40
+ retentionDays: number | null;
41
+ rollupDimensions?: EventRollupDimensionProfile;
42
+ };
43
+ export type EventCategoryConfigUpdateRequest = {
44
+ retentionDays: number | null;
45
+ isAudit: boolean;
46
+ rollupDimensions?: EventRollupDimensionProfile;
47
+ };
48
+ export declare class EventTypeAdminClient {
49
+ private readonly request;
50
+ constructor(request: AdminRequester);
51
+ /** A system administrator names the tenant; a tenant administrator always reads its own. */
52
+ list(companySlug?: string): Promise<EventTypeConfigListResponse>;
53
+ update(slug: string, body: EventTypeConfigUpdateRequest, companySlug?: string): Promise<void>;
54
+ listCategories(): Promise<EventCategoryConfigListResponse>;
55
+ updateCategory(slug: string, body: EventCategoryConfigUpdateRequest): Promise<void>;
56
+ }
57
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Admin event types and event categories: retention and rollup dimensions. An event type inherits its
3
+ * category's retention when its own retentionDays is null. Categories are platform-wide and need a
4
+ * system administrator.
5
+ */
6
+ export class EventTypeAdminClient {
7
+ constructor(request) {
8
+ this.request = request;
9
+ }
10
+ /** A system administrator names the tenant; a tenant administrator always reads its own. */
11
+ async list(companySlug) {
12
+ const response = await this.request("GET", scoped("/event-types", companySlug));
13
+ return { eventTypes: response.eventTypes ?? [] };
14
+ }
15
+ update(slug, body, companySlug) {
16
+ return this.request("PATCH", scoped(`/event-types/${encodeURIComponent(slug)}`, companySlug), body);
17
+ }
18
+ async listCategories() {
19
+ const response = await this.request("GET", "/event-categories");
20
+ return { eventCategories: response.eventCategories ?? [] };
21
+ }
22
+ updateCategory(slug, body) {
23
+ return this.request("PATCH", `/event-categories/${encodeURIComponent(slug)}`, body);
24
+ }
25
+ }
26
+ function scoped(path, companySlug) {
27
+ return companySlug ? `${path}?companySlug=${encodeURIComponent(companySlug)}` : path;
28
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Operator impersonation sessions. A session lets a system administrator act as a named user for a
3
+ * bounded window. Consent is server-owned: the returned `consentState` is the answer, so a caller
4
+ * must not assume a session is usable because the start call returned.
5
+ */
6
+ import type { RequestOptions } from "./index.js";
7
+ /** Asks for a session. The operator is taken from the credential, never from the request. */
8
+ export type ImpersonationSessionCreateRequest = {
9
+ companySlug: string;
10
+ targetUserUuid: string;
11
+ reason: string;
12
+ /** RFC3339 end of the window. */
13
+ expiresAt: string;
14
+ };
15
+ /** One operator acting as one user. `stoppedAt` is null while the session is live. */
16
+ export type ImpersonationSession = {
17
+ sessionUuid: string;
18
+ companySlug: string;
19
+ targetUserUuid: string;
20
+ targetUserEmail?: string;
21
+ reason: string;
22
+ consentState: string;
23
+ startedAt: string;
24
+ expiresAt: string;
25
+ stoppedAt: string | null;
26
+ stopReason?: string;
27
+ };
28
+ export type ImpersonationSessionListResponse = {
29
+ sessions: ImpersonationSession[];
30
+ };
31
+ /** The state a stop or terminate left the session in. */
32
+ export type ImpersonationSessionEnded = {
33
+ sessionUuid: string;
34
+ state: "stopped" | "terminated";
35
+ };
36
+ type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
37
+ export declare class ImpersonationAdminClient {
38
+ private readonly request;
39
+ constructor(request: AdminRequester);
40
+ start(body: ImpersonationSessionCreateRequest, options?: RequestOptions): Promise<ImpersonationSession>;
41
+ /** The caller's most recent sessions. */
42
+ list(options?: RequestOptions): Promise<ImpersonationSessionListResponse>;
43
+ /** Ends the session as its holder. */
44
+ stop(sessionUuid: string, options?: RequestOptions): Promise<ImpersonationSessionEnded>;
45
+ /** Ends the session as an operator action, recorded distinctly from a stop. */
46
+ terminate(sessionUuid: string, options?: RequestOptions): Promise<ImpersonationSessionEnded>;
47
+ }
48
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Operator impersonation sessions. A session lets a system administrator act as a named user for a
3
+ * bounded window. Consent is server-owned: the returned `consentState` is the answer, so a caller
4
+ * must not assume a session is usable because the start call returned.
5
+ */
6
+ const sessionsPath = "/impersonation-sessions";
7
+ export class ImpersonationAdminClient {
8
+ constructor(request) {
9
+ this.request = request;
10
+ }
11
+ start(body, options) {
12
+ return this.request("POST", sessionsPath, body, options);
13
+ }
14
+ /** The caller's most recent sessions. */
15
+ async list(options) {
16
+ const list = await this.request("GET", sessionsPath, undefined, options);
17
+ return { sessions: list.sessions ?? [] };
18
+ }
19
+ /** Ends the session as its holder. */
20
+ stop(sessionUuid, options) {
21
+ return this.request("POST", `${sessionsPath}/${encodeURIComponent(sessionUuid)}/stop`, undefined, options);
22
+ }
23
+ /** Ends the session as an operator action, recorded distinctly from a stop. */
24
+ terminate(sessionUuid, options) {
25
+ return this.request("POST", `${sessionsPath}/${encodeURIComponent(sessionUuid)}/terminate`, undefined, options);
26
+ }
27
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Accepted-event landing claims: the durable objects ingest landed for a tenant and their processing
3
+ * state. An operator can retry a claim or mark it terminal with a failure class.
4
+ */
5
+ import type { RequestOptions } from "./index.js";
6
+ export type IngestClaim = {
7
+ objectId: number;
8
+ objectUuid: string;
9
+ windowStart: string;
10
+ eventCount: number;
11
+ byteCount: number;
12
+ processingState: string;
13
+ claimAttempts: number;
14
+ claimExpiresAt?: string;
15
+ processedAt?: string;
16
+ failedAt?: string;
17
+ failureClass?: string;
18
+ };
19
+ /** A bounded page of claims; `truncated` is true when more exist than were returned. */
20
+ export type IngestClaimListResponse = {
21
+ claims: IngestClaim[];
22
+ truncated: boolean;
23
+ };
24
+ export type IngestClaimTerminalRequest = {
25
+ failureClass: string;
26
+ };
27
+ type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
28
+ export declare class IngestClaimAdminClient {
29
+ private readonly request;
30
+ constructor(request: AdminRequester);
31
+ list(tenantSlug: string, limit?: number, options?: RequestOptions): Promise<IngestClaimListResponse>;
32
+ retry(tenantSlug: string, objectUuid: string, options?: RequestOptions): Promise<IngestClaim>;
33
+ markTerminal(tenantSlug: string, objectUuid: string, body: IngestClaimTerminalRequest, options?: RequestOptions): Promise<IngestClaim>;
34
+ }
35
+ export {};
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Accepted-event landing claims: the durable objects ingest landed for a tenant and their processing
3
+ * state. An operator can retry a claim or mark it terminal with a failure class.
4
+ */
5
+ export class IngestClaimAdminClient {
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ async list(tenantSlug, limit, options) {
10
+ const query = limit === undefined ? "" : `?limit=${encodeURIComponent(String(limit))}`;
11
+ const list = await this.request("GET", `${tenantPath(tenantSlug)}${query}`, undefined, options);
12
+ return { ...list, claims: list.claims ?? [] };
13
+ }
14
+ retry(tenantSlug, objectUuid, options) {
15
+ return this.request("POST", `${claimPath(tenantSlug, objectUuid)}/retry`, undefined, options);
16
+ }
17
+ markTerminal(tenantSlug, objectUuid, body, options) {
18
+ return this.request("POST", `${claimPath(tenantSlug, objectUuid)}/terminal`, body, options);
19
+ }
20
+ }
21
+ function tenantPath(tenantSlug) {
22
+ return `/ingest/claims/${encodeURIComponent(tenantSlug)}`;
23
+ }
24
+ function claimPath(tenantSlug, objectUuid) {
25
+ return `${tenantPath(tenantSlug)}/${encodeURIComponent(objectUuid)}`;
26
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Managed audit producer provisioning: the provisioning broker mints a producer credential for a
3
+ * managed-audit tenant. The request and the returned bundle are the producer-provisioning contract.
4
+ */
5
+ import type { ProducerProvisionCreate, ProvisionedProducerCredentials, RequestOptions } from "./index.js";
6
+ type NonAdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
7
+ export declare class ManagedAuditAdminClient {
8
+ private readonly request;
9
+ constructor(request: NonAdminRequester);
10
+ /** The returned bundle holds the client secret; it is shown only once. */
11
+ provisionProducer(body: ProducerProvisionCreate, options?: RequestOptions): Promise<ProvisionedProducerCredentials>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Managed audit producer provisioning: the provisioning broker mints a producer credential for a
3
+ * managed-audit tenant. The request and the returned bundle are the producer-provisioning contract.
4
+ */
5
+ export class ManagedAuditAdminClient {
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ /** The returned bundle holds the client secret; it is shown only once. */
10
+ provisionProducer(body, options) {
11
+ return this.request("POST", "/managed-audit/provision", body, options);
12
+ }
13
+ }
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Admin measurement projects: create, read, configure and close a project, and feed it
3
+ * observations, series, targets, runs, estimates, calibration exercises and decision models.
4
+ */
5
+ import type { AppEstimateCreateRequest, AppForecastMethod, AppProjectEstimate, AppProjectEstimateList, AppRunCreateRequest } from "./app-items.js";
6
+ import type { MeasurementCSVImportResponse, MeasurementObservationBulkRequest, MeasurementObservationBulkResponse, MeasurementObservationInput, MeasurementObservationResult, MeasurementProject, MeasurementProjectCreate, MeasurementProjectListResponse, MeasurementSeries, MeasurementSeriesCreate, MeasurementTarget, MeasurementTargetCreate, RequestOptions } from "./index.js";
7
+ type AdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
8
+ /** Changes to a project's name, status, delivery or forecast settings; absent fields are kept. */
9
+ export type MeasurementProjectUpdate = {
10
+ name?: string;
11
+ description?: string;
12
+ status?: string;
13
+ definitionOfDone?: string;
14
+ deliveryTargetDate?: string;
15
+ forecastMethod?: AppForecastMethod;
16
+ runSimilar?: boolean;
17
+ };
18
+ export type MeasurementProjectComplete = {
19
+ completedAt: string;
20
+ };
21
+ /** One stored import of observations, with each row's outcome. */
22
+ export type MeasurementImportRun = {
23
+ importId: string;
24
+ projectCode: string;
25
+ source: string;
26
+ rowCount: number;
27
+ accepted: number;
28
+ rejected: number;
29
+ results: MeasurementObservationResult[];
30
+ createdAt: string;
31
+ completedAt?: string;
32
+ };
33
+ export type MeasurementCalibrationExerciseCreate = {
34
+ question: string;
35
+ confidence: number;
36
+ lowerBound: number;
37
+ upperBound: number;
38
+ actualValue?: number;
39
+ contained?: boolean;
40
+ resolvedAt?: string;
41
+ priorUuid?: string;
42
+ metadata?: Record<string, unknown>;
43
+ };
44
+ export type MeasurementCalibrationExercise = {
45
+ exerciseUuid: string;
46
+ projectCode: string;
47
+ question: string;
48
+ confidence: number;
49
+ lowerBound: number;
50
+ upperBound: number;
51
+ actualValue?: number;
52
+ contained?: boolean;
53
+ resolvedAt?: string;
54
+ status: string;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ };
58
+ /** A choice's value expression: a constant, a variable reference, or an operator over children. */
59
+ export type MeasurementDecisionExpression = {
60
+ kind: string;
61
+ value?: number;
62
+ variableCode?: string;
63
+ children?: MeasurementDecisionExpression[] | null;
64
+ };
65
+ export type MeasurementDecisionDistributionParameters = {
66
+ value?: number;
67
+ min?: number;
68
+ max?: number;
69
+ mode?: number;
70
+ mean?: number;
71
+ "std-dev"?: number;
72
+ };
73
+ export type MeasurementDecisionVariableCreate = {
74
+ variableCode: string;
75
+ name: string;
76
+ distributionSlug: string;
77
+ parameters?: MeasurementDecisionDistributionParameters;
78
+ unitSlug?: string;
79
+ measurementCost?: number;
80
+ };
81
+ export type MeasurementDecisionVariable = {
82
+ variableUuid: string;
83
+ variableCode: string;
84
+ name: string;
85
+ distributionSlug: string;
86
+ parameters?: MeasurementDecisionDistributionParameters;
87
+ unitSlug: string;
88
+ measurementCost: number;
89
+ };
90
+ export type MeasurementDecisionChoiceCreate = {
91
+ choiceCode: string;
92
+ name: string;
93
+ description?: string;
94
+ expression: MeasurementDecisionExpression;
95
+ };
96
+ export type MeasurementDecisionChoice = {
97
+ choiceUuid: string;
98
+ choiceCode: string;
99
+ name: string;
100
+ description: string;
101
+ expression?: MeasurementDecisionExpression;
102
+ };
103
+ export type MeasurementDecisionModelCreate = {
104
+ decisionCode: string;
105
+ name: string;
106
+ description?: string;
107
+ objective?: string;
108
+ status: string;
109
+ variables: MeasurementDecisionVariableCreate[];
110
+ choices: MeasurementDecisionChoiceCreate[];
111
+ };
112
+ export type MeasurementDecisionModelUpdate = {
113
+ name?: string;
114
+ description?: string;
115
+ objective?: string;
116
+ status?: string;
117
+ };
118
+ export type MeasurementDecisionModel = {
119
+ decisionUuid: string;
120
+ decisionCode: string;
121
+ projectCode: string;
122
+ name: string;
123
+ description: string;
124
+ objective: string;
125
+ status: string;
126
+ variables: MeasurementDecisionVariable[];
127
+ choices: MeasurementDecisionChoice[];
128
+ createdAt: string;
129
+ updatedAt: string;
130
+ };
131
+ export type MeasurementDecisionModelList = {
132
+ decisions: MeasurementDecisionModel[];
133
+ };
134
+ export declare class AdminMeasurementNamespace {
135
+ readonly projects: AdminMeasurementProjectNamespace;
136
+ constructor(request: AdminRequester);
137
+ }
138
+ export declare class AdminMeasurementProjectNamespace {
139
+ private readonly request;
140
+ constructor(request: AdminRequester);
141
+ create(project: MeasurementProjectCreate, companySlug?: string): Promise<MeasurementProject>;
142
+ list(companySlug?: string): Promise<MeasurementProjectListResponse>;
143
+ get(projectUuid: string, companySlug?: string): Promise<MeasurementProject>;
144
+ update(projectUuid: string, body: MeasurementProjectUpdate, companySlug?: string): Promise<MeasurementProject>;
145
+ complete(projectUuid: string, body: MeasurementProjectComplete, companySlug?: string): Promise<MeasurementProject>;
146
+ cancel(projectUuid: string, companySlug?: string): Promise<MeasurementProject>;
147
+ /** Starts a new run of the project: a sibling project that shares its series. */
148
+ addRun(projectUuid: string, body: AppRunCreateRequest, companySlug?: string): Promise<MeasurementProject>;
149
+ addSeries(projectUuid: string, body: MeasurementSeriesCreate, companySlug?: string): Promise<MeasurementSeries>;
150
+ addTarget(projectUuid: string, body: MeasurementTargetCreate, companySlug?: string): Promise<MeasurementTarget>;
151
+ reopenTarget(projectUuid: string, targetUuid: string, companySlug?: string): Promise<MeasurementTarget>;
152
+ addEstimate(projectUuid: string, body: AppEstimateCreateRequest, companySlug?: string): Promise<AppProjectEstimate>;
153
+ listEstimates(projectUuid: string, companySlug?: string): Promise<AppProjectEstimateList>;
154
+ getImportRun(projectUuid: string, importUuid: string, companySlug?: string): Promise<MeasurementImportRun>;
155
+ createCalibrationExercise(projectUuid: string, body: MeasurementCalibrationExerciseCreate, companySlug?: string): Promise<MeasurementCalibrationExercise>;
156
+ createDecisionModel(projectUuid: string, body: MeasurementDecisionModelCreate, companySlug?: string): Promise<MeasurementDecisionModel>;
157
+ listDecisions(projectUuid: string, companySlug?: string): Promise<MeasurementDecisionModelList>;
158
+ getDecision(projectUuid: string, decisionUuid: string, companySlug?: string): Promise<MeasurementDecisionModel>;
159
+ updateDecision(projectUuid: string, decisionUuid: string, body: MeasurementDecisionModelUpdate, companySlug?: string): Promise<MeasurementDecisionModel>;
160
+ /** Archives the decision model; its simulation runs stay readable. */
161
+ deleteDecision(projectUuid: string, decisionUuid: string, companySlug?: string): Promise<void>;
162
+ submitObservation(projectUuid: string, observation: MeasurementObservationInput): Promise<MeasurementObservationBulkResponse>;
163
+ submitObservations(projectUuid: string, request: MeasurementObservationBulkRequest): Promise<MeasurementObservationBulkResponse>;
164
+ importCSVString(projectUuid: string, csv: string, expectedRows: number): Promise<MeasurementCSVImportResponse>;
165
+ }
166
+ export {};
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Admin measurement projects: create, read, configure and close a project, and feed it
3
+ * observations, series, targets, runs, estimates, calibration exercises and decision models.
4
+ */
5
+ export class AdminMeasurementNamespace {
6
+ constructor(request) {
7
+ this.projects = new AdminMeasurementProjectNamespace(request);
8
+ }
9
+ }
10
+ export class AdminMeasurementProjectNamespace {
11
+ constructor(request) {
12
+ this.request = request;
13
+ }
14
+ async create(project, companySlug) {
15
+ return readProject(await this.request("POST", projectPath("", companySlug), project));
16
+ }
17
+ async list(companySlug) {
18
+ const response = await this.request("GET", projectPath("", companySlug));
19
+ return { projects: (response.projects ?? []).map(readProject) };
20
+ }
21
+ async get(projectUuid, companySlug) {
22
+ return readProject(await this.request("GET", projectPath(`/${encodeURIComponent(projectUuid)}`, companySlug)));
23
+ }
24
+ async update(projectUuid, body, companySlug) {
25
+ return readProject(await this.request("PATCH", projectPath(`/${encodeURIComponent(projectUuid)}`, companySlug), body));
26
+ }
27
+ async complete(projectUuid, body, companySlug) {
28
+ return readProject(await this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/complete`, companySlug), body));
29
+ }
30
+ async cancel(projectUuid, companySlug) {
31
+ return readProject(await this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/cancel`, companySlug)));
32
+ }
33
+ /** Starts a new run of the project: a sibling project that shares its series. */
34
+ async addRun(projectUuid, body, companySlug) {
35
+ return readProject(await this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/runs`, companySlug), body));
36
+ }
37
+ addSeries(projectUuid, body, companySlug) {
38
+ return this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/series`, companySlug), body);
39
+ }
40
+ addTarget(projectUuid, body, companySlug) {
41
+ return this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/targets`, companySlug), body);
42
+ }
43
+ reopenTarget(projectUuid, targetUuid, companySlug) {
44
+ const path = `/${encodeURIComponent(projectUuid)}/targets/${encodeURIComponent(targetUuid)}/reopen`;
45
+ return this.request("POST", projectPath(path, companySlug));
46
+ }
47
+ addEstimate(projectUuid, body, companySlug) {
48
+ return this.request("POST", projectPath(`/${encodeURIComponent(projectUuid)}/estimates`, companySlug), body);
49
+ }
50
+ async listEstimates(projectUuid, companySlug) {
51
+ const list = await this.request("GET", projectPath(`/${encodeURIComponent(projectUuid)}/estimates`, companySlug));
52
+ return { ...list, estimates: list.estimates ?? [] };
53
+ }
54
+ async getImportRun(projectUuid, importUuid, companySlug) {
55
+ const path = `/${encodeURIComponent(projectUuid)}/imports/${encodeURIComponent(importUuid)}`;
56
+ const run = await this.request("GET", projectPath(path, companySlug));
57
+ return { ...run, results: run.results ?? [] };
58
+ }
59
+ createCalibrationExercise(projectUuid, body, companySlug) {
60
+ const path = `/${encodeURIComponent(projectUuid)}/calibration-exercises`;
61
+ return this.request("POST", projectPath(path, companySlug), body);
62
+ }
63
+ async createDecisionModel(projectUuid, body, companySlug) {
64
+ const path = `/${encodeURIComponent(projectUuid)}/decisions`;
65
+ return decisionModel(await this.request("POST", projectPath(path, companySlug), body));
66
+ }
67
+ async listDecisions(projectUuid, companySlug) {
68
+ const path = `/${encodeURIComponent(projectUuid)}/decisions`;
69
+ const list = await this.request("GET", projectPath(path, companySlug));
70
+ return { decisions: (list.decisions ?? []).map(decisionModel) };
71
+ }
72
+ async getDecision(projectUuid, decisionUuid, companySlug) {
73
+ return decisionModel(await this.request("GET", projectPath(decisionPath(projectUuid, decisionUuid), companySlug)));
74
+ }
75
+ async updateDecision(projectUuid, decisionUuid, body, companySlug) {
76
+ const path = projectPath(decisionPath(projectUuid, decisionUuid), companySlug);
77
+ return decisionModel(await this.request("PATCH", path, body));
78
+ }
79
+ /** Archives the decision model; its simulation runs stay readable. */
80
+ async deleteDecision(projectUuid, decisionUuid, companySlug) {
81
+ await this.request("DELETE", projectPath(decisionPath(projectUuid, decisionUuid), companySlug));
82
+ }
83
+ submitObservation(projectUuid, observation) {
84
+ return this.submitObservations(projectUuid, { rows: [observation] });
85
+ }
86
+ async submitObservations(projectUuid, request) {
87
+ const response = await this.request("POST", `/measurement/projects/${encodeURIComponent(projectUuid)}/observations:bulk`, request);
88
+ validateMeasurementResults(response.results, request.rows.length);
89
+ return response;
90
+ }
91
+ async importCSVString(projectUuid, csv, expectedRows) {
92
+ const response = await this.request("POST", `/measurement/projects/${encodeURIComponent(projectUuid)}/observations:csv`, { csv });
93
+ validateMeasurementResults(response.results, expectedRows);
94
+ return response;
95
+ }
96
+ }
97
+ function decisionModel(wire) {
98
+ return { ...wire, variables: wire.variables ?? [], choices: wire.choices ?? [] };
99
+ }
100
+ function decisionPath(projectUuid, decisionUuid) {
101
+ return `/${encodeURIComponent(projectUuid)}/decisions/${encodeURIComponent(decisionUuid)}`;
102
+ }
103
+ /** A project's series list is null when it has none; the SDK returns it as empty. */
104
+ function readProject(project) {
105
+ return { ...project, series: project.series ?? [] };
106
+ }
107
+ function projectPath(path, companySlug) {
108
+ const query = companySlug ? `?companySlug=${encodeURIComponent(companySlug)}` : "";
109
+ return `/measurement/projects${path}${query}`;
110
+ }
111
+ function validateMeasurementResults(results, submittedRows) {
112
+ if (results.length !== submittedRows) {
113
+ throw new Error(`custd: measurement result count ${results.length} does not match submitted row count ${submittedRows}`);
114
+ }
115
+ results.forEach((result, index) => {
116
+ if (result.success && !result.observationUuid) {
117
+ throw new Error(`custd: measurement result ${index} missing observationUuid`);
118
+ }
119
+ });
120
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Where each tenant notification event is delivered: by email to one recipient, or to the tenant's
3
+ * webhook or Slack subscriptions.
4
+ */
5
+ import type { RequestOptions } from "./index.js";
6
+ type NonAdminRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
7
+ /** The notification events a tenant routes itself. */
8
+ export type NotificationDestinationEvent = "error_issue_alert" | "site_finding_opened" | "site_incident" | "site_ai_allowance";
9
+ /** Every notification event slug Custd reports on a destination. */
10
+ export type NotificationEventSlug = NotificationDestinationEvent | "email_relay_test_send" | "identity_verify_email" | "identity_reset_password" | "user_welcome" | "application_invitation" | "site_status_page_confirm" | "site_status_page_update";
11
+ export type NotificationChannel = "email" | "webhook" | "slack";
12
+ export type NotificationDestination = {
13
+ eventSlug: NotificationEventSlug;
14
+ channel: NotificationChannel;
15
+ enabled: boolean;
16
+ /** False until the tenant saves a destination for this event. */
17
+ configured: boolean;
18
+ emailRecipient?: string;
19
+ };
20
+ export type NotificationDestinationRequest = {
21
+ channel: NotificationChannel;
22
+ enabled: boolean;
23
+ emailRecipient?: string;
24
+ };
25
+ export declare class NotificationDestinationAdminClient {
26
+ private readonly request;
27
+ constructor(request: NonAdminRequester);
28
+ get(eventSlug: NotificationDestinationEvent, companySlug?: string): Promise<NotificationDestination>;
29
+ put(eventSlug: NotificationDestinationEvent, body: NotificationDestinationRequest, companySlug?: string): Promise<NotificationDestination>;
30
+ }
31
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Where each tenant notification event is delivered: by email to one recipient, or to the tenant's
3
+ * webhook or Slack subscriptions.
4
+ */
5
+ export class NotificationDestinationAdminClient {
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ get(eventSlug, companySlug) {
10
+ return this.request("GET", destinationPath(eventSlug, companySlug));
11
+ }
12
+ put(eventSlug, body, companySlug) {
13
+ return this.request("PUT", destinationPath(eventSlug, companySlug), body);
14
+ }
15
+ }
16
+ function destinationPath(eventSlug, companySlug) {
17
+ const path = `/notification-destinations/${encodeURIComponent(eventSlug)}`;
18
+ return companySlug ? `${path}?companySlug=${encodeURIComponent(companySlug)}` : path;
19
+ }