@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,149 @@
1
+ import type { RequestOptions } from "./index.js";
2
+ /** A parser family the ingestion dispatcher can execute. */
3
+ export type ParserType = "regex" | "json" | "xml" | "csv" | "syslog";
4
+ /** A stateless batch-framing mode applied before the application parser runs. */
5
+ export type ParserFramingType = "none" | "docker-json" | "k8s-cri" | "php-multiline";
6
+ /** Parser framing bounds. A caller may request a lower cap; these are hard limits. */
7
+ export declare const DEFAULT_PARSER_FRAMING_MAX_RECORD_BYTES: number;
8
+ export declare const DEFAULT_PARSER_FRAMING_MAX_LINES = 32;
9
+ export declare const MAX_PARSER_FRAMING_RECORD_BYTES: number;
10
+ export declare const MAX_PARSER_FRAMING_LINES = 256;
11
+ /** The visible per-record result of one framing pass. */
12
+ export type ParserFramingOutcome = "complete" | "malformed" | "incomplete" | "oversize";
13
+ /**
14
+ * Stateless framing configuration carried by a parser definition. Framing is
15
+ * revision-pinned with the parser and is the same configuration for preview and
16
+ * save. Multiline assembly is bounded by `maxRecordBytes`/`maxLines`; there is
17
+ * deliberately no idle timeout on stateless batch framing.
18
+ */
19
+ export type ParserFraming = {
20
+ type: ParserFramingType;
21
+ maxRecordBytes?: number;
22
+ maxLines?: number;
23
+ };
24
+ /** How a generated field is computed from source fields. */
25
+ export type ParserGeneratedFieldConfig = {
26
+ fields: string[];
27
+ namespace: string;
28
+ };
29
+ /** A tenant-owned parser. */
30
+ export type ParserDefinition = {
31
+ uuid: string;
32
+ code: string;
33
+ name: string;
34
+ parserType: ParserType;
35
+ pattern: string | null;
36
+ timestampFormat: string;
37
+ fieldMapping: Record<string, string>;
38
+ generatedFields?: Record<string, ParserGeneratedFieldConfig> | null;
39
+ /** Stateless framing configuration, revision-pinned with the parser. */
40
+ framing?: ParserFraming;
41
+ /**
42
+ * Newer server fields. Both are optional so a response from a server that
43
+ * predates them still decodes; when present they carry the server's value.
44
+ */
45
+ enabled?: boolean;
46
+ revision?: number;
47
+ };
48
+ /**
49
+ * The named parser-collection DTO. The route emits a bare JSON array; the
50
+ * client wraps it so callers never handle an untyped list.
51
+ */
52
+ export type ParserListResponse = {
53
+ parsers: ParserDefinition[];
54
+ };
55
+ /** One built-in reusable parser definition from the published catalog. */
56
+ export type ParserPreset = {
57
+ code: string;
58
+ name: string;
59
+ family: string;
60
+ description: string;
61
+ parserType: ParserType;
62
+ pattern: string;
63
+ timestampFormat: string;
64
+ fieldMapping: Record<string, string>;
65
+ sample: string;
66
+ variants: string[];
67
+ };
68
+ /** The named preset-catalog DTO for GET /parsers/presets. */
69
+ export type ParserPresetListResponse = {
70
+ presets: ParserPreset[];
71
+ };
72
+ /**
73
+ * The create/update body for a tenant-owned parser.
74
+ *
75
+ * `enabled` is optional: leaving it unset omits the field so the server keeps
76
+ * its default (an enabled parser), which also keeps the body valid against a
77
+ * server that does not yet accept the field.
78
+ */
79
+ export type ParserSaveRequest = {
80
+ code: string;
81
+ name: string;
82
+ parserType: ParserType;
83
+ pattern: string | null;
84
+ timestampFormat: string;
85
+ fieldMapping: Record<string, string>;
86
+ /** Stateless framing configuration, the same for save and preview. */
87
+ framing?: ParserFraming;
88
+ enabled?: boolean;
89
+ };
90
+ /**
91
+ * The parser shape a preview executes. It mirrors the saved definition minus
92
+ * the server-assigned uuid and the newer-only enabled/revision fields, because
93
+ * the preview route decodes strictly.
94
+ */
95
+ export type ParserPreviewDefinition = {
96
+ code: string;
97
+ name: string;
98
+ parserType: ParserType;
99
+ pattern: string | null;
100
+ timestampFormat: string;
101
+ fieldMapping: Record<string, string>;
102
+ /** The same framing configuration a save would carry. */
103
+ framing?: ParserFraming;
104
+ };
105
+ /** The dry-run body. The service bounds the sample to 256 KiB and maxLines to 100. */
106
+ export type ParserPreviewRequest = {
107
+ parser: ParserPreviewDefinition;
108
+ sample: string;
109
+ maxLines: number;
110
+ };
111
+ /** One sample line's result. `line` is 1-based in the original sample. */
112
+ export type ParserPreviewRow = {
113
+ line: number;
114
+ ok: boolean;
115
+ framing?: ParserFramingOutcome;
116
+ eventTypeSlug?: string;
117
+ timestamp?: string;
118
+ context?: Record<string, unknown>;
119
+ payload?: Record<string, unknown>;
120
+ error?: string;
121
+ };
122
+ /** The dry-run result. `parsed` and `failed` summarize `results`. */
123
+ export type ParserPreviewResponse = {
124
+ results: ParserPreviewRow[];
125
+ parsed: number;
126
+ failed: number;
127
+ };
128
+ /** The body of a successful parser deletion. */
129
+ export type ParserDeleteResponse = {
130
+ deleted: boolean;
131
+ };
132
+ type ParserRequester = <T>(method: string, path: string, body?: unknown, options?: RequestOptions) => Promise<T>;
133
+ export declare class ParserClient {
134
+ private readonly request;
135
+ constructor(request: ParserRequester);
136
+ /** List the built-in reusable parser catalog. */
137
+ listPresets(options?: RequestOptions): Promise<ParserPresetListResponse>;
138
+ /** List this tenant's own parsers, wrapped in the named ParserListResponse. */
139
+ list(options?: RequestOptions): Promise<ParserListResponse>;
140
+ /** Create a tenant-owned parser. */
141
+ create(request: ParserSaveRequest, options?: RequestOptions): Promise<ParserDefinition>;
142
+ /** Replace a tenant-owned parser addressed by its explicit UUID. */
143
+ update(uuid: string, request: ParserSaveRequest, options?: RequestOptions): Promise<ParserDefinition>;
144
+ /** Delete a tenant-owned parser addressed by its explicit UUID. */
145
+ delete(uuid: string, options?: RequestOptions): Promise<ParserDeleteResponse>;
146
+ /** Run a parser definition against a bounded sample. Writes and retains nothing. */
147
+ preview(request: ParserPreviewRequest, options?: RequestOptions): Promise<ParserPreviewResponse>;
148
+ }
149
+ export {};
@@ -0,0 +1,115 @@
1
+ // ParserClient owns the tenant parser routes served by the schema registry:
2
+ // the built-in preset catalog, tenant-owned parser CRUD, and the bounded
3
+ // dry-run preview. Every method returns a named DTO, never a bare array.
4
+ //
5
+ // The routes are authenticated by the caller's tenant credential, so no tenant
6
+ // slug is ever supplied. Create/update/delete require the tenant
7
+ // schema-management authority; list/presets/preview require authentication.
8
+ const PARSER_FRAMING_TYPES = ["none", "docker-json", "k8s-cri", "php-multiline"];
9
+ /** Parser framing bounds. A caller may request a lower cap; these are hard limits. */
10
+ export const DEFAULT_PARSER_FRAMING_MAX_RECORD_BYTES = 64 << 10;
11
+ export const DEFAULT_PARSER_FRAMING_MAX_LINES = 32;
12
+ export const MAX_PARSER_FRAMING_RECORD_BYTES = 1 << 20;
13
+ export const MAX_PARSER_FRAMING_LINES = 256;
14
+ export class ParserClient {
15
+ constructor(request) {
16
+ this.request = request;
17
+ }
18
+ /** List the built-in reusable parser catalog. */
19
+ listPresets(options) {
20
+ return this.request("GET", "/parsers/presets", undefined, options);
21
+ }
22
+ /** List this tenant's own parsers, wrapped in the named ParserListResponse. */
23
+ async list(options) {
24
+ const value = await this.request("GET", "/parsers", undefined, options);
25
+ if (!Array.isArray(value)) {
26
+ throw new TypeError("custd: parser list response must be a JSON array");
27
+ }
28
+ return { parsers: value };
29
+ }
30
+ /** Create a tenant-owned parser. */
31
+ async create(request, options) {
32
+ const body = parserSaveBody(request);
33
+ return this.request("POST", "/parsers", body, options);
34
+ }
35
+ /** Replace a tenant-owned parser addressed by its explicit UUID. */
36
+ async update(uuid, request, options) {
37
+ const body = parserSaveBody(request);
38
+ return this.request("PUT", `/parsers/${encodeURIComponent(uuid)}`, body, options);
39
+ }
40
+ /** Delete a tenant-owned parser addressed by its explicit UUID. */
41
+ delete(uuid, options) {
42
+ return this.request("DELETE", `/parsers/${encodeURIComponent(uuid)}`, undefined, options);
43
+ }
44
+ /** Run a parser definition against a bounded sample. Writes and retains nothing. */
45
+ async preview(request, options) {
46
+ const body = parserPreviewBody(request);
47
+ return this.request("POST", "/parser-preview", body, options);
48
+ }
49
+ }
50
+ // parserSaveBody rebuilds the body from the documented fields. An unset
51
+ // `enabled` is omitted rather than sent as undefined/null, and extra caller
52
+ // properties are kept off the wire by construction.
53
+ function parserSaveBody(request) {
54
+ const body = {
55
+ code: request.code,
56
+ name: request.name,
57
+ parserType: request.parserType,
58
+ pattern: request.pattern,
59
+ timestampFormat: request.timestampFormat,
60
+ fieldMapping: request.fieldMapping,
61
+ };
62
+ if (request.framing !== undefined) {
63
+ body.framing = framingBody(request.framing);
64
+ }
65
+ if (request.enabled !== undefined) {
66
+ body.enabled = request.enabled;
67
+ }
68
+ return body;
69
+ }
70
+ // parserPreviewBody projects the previewed definition onto exactly the fields
71
+ // the strictly-decoded preview route accepts. `framing` is carried because
72
+ // preview and save share one configuration; the create/update-only `enabled`
73
+ // cannot reach it.
74
+ function parserPreviewBody(request) {
75
+ const definition = request.parser;
76
+ const parser = {
77
+ code: definition.code,
78
+ name: definition.name,
79
+ parserType: definition.parserType,
80
+ pattern: definition.pattern,
81
+ timestampFormat: definition.timestampFormat,
82
+ fieldMapping: definition.fieldMapping,
83
+ };
84
+ if (definition.framing !== undefined) {
85
+ parser.framing = framingBody(definition.framing);
86
+ }
87
+ return {
88
+ parser,
89
+ sample: request.sample,
90
+ maxLines: request.maxLines,
91
+ };
92
+ }
93
+ // framingBody validates the framing type and rebuilds only the documented keys,
94
+ // so an unknown type never costs a round trip and an extra caller property never
95
+ // reaches the wire.
96
+ function framingBody(framing) {
97
+ if (!PARSER_FRAMING_TYPES.includes(framing.type)) {
98
+ throw new RangeError(`custd: parser framing type must be one of ${PARSER_FRAMING_TYPES.join(", ")}`);
99
+ }
100
+ if (framing.maxRecordBytes !== undefined &&
101
+ (framing.maxRecordBytes < 0 || framing.maxRecordBytes > MAX_PARSER_FRAMING_RECORD_BYTES)) {
102
+ throw new RangeError(`custd: parser framing maxRecordBytes must be 0..${MAX_PARSER_FRAMING_RECORD_BYTES}`);
103
+ }
104
+ if (framing.maxLines !== undefined && (framing.maxLines < 0 || framing.maxLines > MAX_PARSER_FRAMING_LINES)) {
105
+ throw new RangeError(`custd: parser framing maxLines must be 0..${MAX_PARSER_FRAMING_LINES}`);
106
+ }
107
+ const body = { type: framing.type };
108
+ if (framing.maxRecordBytes !== undefined) {
109
+ body.maxRecordBytes = framing.maxRecordBytes;
110
+ }
111
+ if (framing.maxLines !== undefined) {
112
+ body.maxLines = framing.maxLines;
113
+ }
114
+ return body;
115
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Calls that carry none of the client's own credentials: a hosted app's public discovery document, a
3
+ * shared site report opened by its link token, the auth-domain inventory an external checker probes
4
+ * with its monitoring key, and a published status page with its email subscriptions.
5
+ */
6
+ import type { SiteReport } from "./admin-site-insights.js";
7
+ import type { SiteStatusPage } from "./admin-site-status-page.js";
8
+ import type { RequestOptions } from "./index.js";
9
+ /** Carries the external checker's monitoring key, its only credential. */
10
+ export declare const AUTH_DOMAIN_MONITORING_KEY_HEADER = "X-Custd-Auth-Domain-Monitoring-Key";
11
+ /**
12
+ * A hosted app's browser sign-in registration. Pages use the authorization-code flow with PKCE and
13
+ * send the access token to the app item routes as X-Custd-User-Token.
14
+ */
15
+ export type AppDiscoverySignIn = {
16
+ issuer: string;
17
+ authorizationEndpoint: string;
18
+ tokenEndpoint: string;
19
+ endSessionEndpoint: string;
20
+ clientId: string;
21
+ audience: string;
22
+ redirectUri: string;
23
+ postLogoutRedirectUri: string;
24
+ };
25
+ /** A hosted app's public /.well-known/custd.json: where its API is, its public Site key and what it can do. */
26
+ export type AppDiscoveryDocument = {
27
+ apiBaseUrl: string;
28
+ host: string;
29
+ siteUuid: string;
30
+ browserKey: string;
31
+ environment: string;
32
+ capabilities: string[];
33
+ signIn?: AppDiscoverySignIn;
34
+ identityMode: string;
35
+ allowedOrigins: string[];
36
+ pageViewSchemaVersion?: string;
37
+ };
38
+ /**
39
+ * The realm hostnames the external checker probes. A host that leaves `hosts` without appearing in
40
+ * `retiredHosts` was lost, not retired.
41
+ */
42
+ export type AuthDomainMonitoringInventory = {
43
+ hosts: string[];
44
+ retiredHosts: string[];
45
+ };
46
+ /** Issues a GET with no client credential, adding only the headers given. */
47
+ export type PublicReader = <T>(path: string, headers: Record<string, string>, options?: RequestOptions) => Promise<T>;
48
+ /** Posts a JSON body with no client credential; the path and body are the only authority. */
49
+ export type PublicWriter = (path: string, body: unknown, options?: RequestOptions) => Promise<void>;
50
+ /** Asks a public status page to email its updates to one address. */
51
+ export type SiteStatusSubscriptionRequest = {
52
+ email: string;
53
+ };
54
+ /** The single-use token from a status page subscription email. */
55
+ export type SiteStatusSubscriptionToken = {
56
+ token: string;
57
+ };
58
+ export declare class PublicReadClient {
59
+ private readonly read;
60
+ private readonly write;
61
+ constructor(read: PublicReader, write?: PublicWriter);
62
+ /** Reads a hosted app's public discovery document by host. A host that serves no app answers 404. */
63
+ appDiscovery(host: string, options?: RequestOptions): Promise<AppDiscoveryDocument>;
64
+ /** Reads the site report a share link opens. The share token is the only authority. */
65
+ sharedSiteReport(token: string, options?: RequestOptions): Promise<SiteReport>;
66
+ /** Returns the realm hostnames the external checker may probe. */
67
+ authDomainMonitoringInventory(monitoringKey: string, options?: RequestOptions): Promise<AuthDomainMonitoringInventory>;
68
+ /** Reads a published status page by its public key. An unpublished key answers 404. */
69
+ statusPage(key: string, options?: RequestOptions): Promise<SiteStatusPage>;
70
+ /**
71
+ * Asks for a confirmation email. The server answers the same way for an unknown key, so success does
72
+ * not prove the page exists.
73
+ */
74
+ subscribeToStatusPage(key: string, request: SiteStatusSubscriptionRequest, options?: RequestOptions): Promise<void>;
75
+ /** Confirms a subscription with the emailed token. */
76
+ confirmStatusPageSubscription(key: string, token: SiteStatusSubscriptionToken, options?: RequestOptions): Promise<void>;
77
+ /** Ends a subscription with the emailed token. */
78
+ unsubscribeFromStatusPage(key: string, token: SiteStatusSubscriptionToken, options?: RequestOptions): Promise<void>;
79
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Calls that carry none of the client's own credentials: a hosted app's public discovery document, a
3
+ * shared site report opened by its link token, the auth-domain inventory an external checker probes
4
+ * with its monitoring key, and a published status page with its email subscriptions.
5
+ */
6
+ /** Carries the external checker's monitoring key, its only credential. */
7
+ export const AUTH_DOMAIN_MONITORING_KEY_HEADER = "X-Custd-Auth-Domain-Monitoring-Key";
8
+ export class PublicReadClient {
9
+ constructor(read, write = () => Promise.reject(new Error("custd: public writes need a writer"))) {
10
+ this.read = read;
11
+ this.write = write;
12
+ }
13
+ /** Reads a hosted app's public discovery document by host. A host that serves no app answers 404. */
14
+ async appDiscovery(host, options) {
15
+ const document = await this.read(`/app-hosts/${encodeURIComponent(host)}/discovery`, {}, options);
16
+ return { ...document, capabilities: document.capabilities ?? [], allowedOrigins: document.allowedOrigins ?? [] };
17
+ }
18
+ /** Reads the site report a share link opens. The share token is the only authority. */
19
+ sharedSiteReport(token, options) {
20
+ if (token.trim() === "")
21
+ return Promise.reject(new Error("custd: shared site report requires a share token"));
22
+ return this.read(`/shared-site-reports/${encodeURIComponent(token)}`, {}, options);
23
+ }
24
+ /** Returns the realm hostnames the external checker may probe. */
25
+ async authDomainMonitoringInventory(monitoringKey, options) {
26
+ if (monitoringKey.trim() === "") {
27
+ return Promise.reject(new Error("custd: auth domain monitoring requires a monitoring key"));
28
+ }
29
+ const inventory = await this.read("/auth-domain-monitoring/inventory", { [AUTH_DOMAIN_MONITORING_KEY_HEADER]: monitoringKey }, options);
30
+ return { hosts: inventory.hosts ?? [], retiredHosts: inventory.retiredHosts ?? [] };
31
+ }
32
+ /** Reads a published status page by its public key. An unpublished key answers 404. */
33
+ async statusPage(key, options) {
34
+ const page = await this.read(statusPagePath(key), {}, options);
35
+ return { ...page, components: page.components ?? [], updates: page.updates ?? [] };
36
+ }
37
+ /**
38
+ * Asks for a confirmation email. The server answers the same way for an unknown key, so success does
39
+ * not prove the page exists.
40
+ */
41
+ async subscribeToStatusPage(key, request, options) {
42
+ return this.write(`${statusPagePath(key)}/subscribe`, request, options);
43
+ }
44
+ /** Confirms a subscription with the emailed token. */
45
+ async confirmStatusPageSubscription(key, token, options) {
46
+ return this.write(`${statusPagePath(key)}/confirm-subscription`, token, options);
47
+ }
48
+ /** Ends a subscription with the emailed token. */
49
+ async unsubscribeFromStatusPage(key, token, options) {
50
+ return this.write(`${statusPagePath(key)}/unsubscribe`, token, options);
51
+ }
52
+ }
53
+ function statusPagePath(key) {
54
+ if (key.trim() === "")
55
+ throw new Error("custd: public status page requires its key");
56
+ return `/public-status-pages/${encodeURIComponent(key)}`;
57
+ }
@@ -0,0 +1,264 @@
1
+ /**
2
+ * Reporting reads and generations served by the analytics API: the dashboard catalogue, dashboard
3
+ * data generations, unpublished pack previews and completed time-plan run exports.
4
+ */
5
+ import type { PackDefinition, ReportingFilter, ReportingQueryRequest } from "./index.js";
6
+ /** The file formats a report export or dashboard can produce. */
7
+ export type ReportingExportFormat = "csv" | "xlsx" | "html" | "pdf" | "svg" | "png" | "parquet" | "manifest";
8
+ export type ReportingDashboardInteraction = "filter" | "drill_down";
9
+ export type ReportingDashboardCatalogueTrust = {
10
+ serverOwned: boolean;
11
+ tenantScoped: boolean;
12
+ };
13
+ /** One dashboard the tenant can open. */
14
+ export type ReportingDashboardCatalogueEntry = {
15
+ key: string;
16
+ title?: string;
17
+ description?: string;
18
+ group: string;
19
+ defaultRange: string;
20
+ refreshSeconds: number;
21
+ trust: ReportingDashboardCatalogueTrust;
22
+ interactions: ReportingDashboardInteraction[];
23
+ exportFormats: ReportingExportFormat[];
24
+ };
25
+ export type ReportingDashboardCatalogue = {
26
+ dashboards: ReportingDashboardCatalogueEntry[];
27
+ };
28
+ /** The range, filters and comparison a dashboard generation or export is built for. */
29
+ export type ReportingExportParameters = {
30
+ filters?: ReportingFilter[];
31
+ selections?: string[];
32
+ comparison?: "previous_period" | "previous_year";
33
+ from?: string;
34
+ to?: string;
35
+ rangeDays?: number;
36
+ maxRows?: number;
37
+ };
38
+ export type ReportingDashboardGenerationRequest = {
39
+ dashboardKey: string;
40
+ parameters: ReportingExportParameters;
41
+ };
42
+ export type ReportingDatasetRowCount = {
43
+ key: string;
44
+ count: number;
45
+ };
46
+ export type ReportingSnapshotColumnType = "text" | "integer" | "number" | "percentage" | "currency" | "date" | "datetime" | "duration" | "boolean" | "null";
47
+ export type ReportingSnapshotColumn = {
48
+ key: string;
49
+ label: string;
50
+ description?: string;
51
+ nullable: boolean;
52
+ type: ReportingSnapshotColumnType;
53
+ unit?: string;
54
+ };
55
+ export type ReportingSnapshotDatasetSchema = {
56
+ key: string;
57
+ label: string;
58
+ columns: ReportingSnapshotColumn[];
59
+ };
60
+ export type ReportingDashboardGenerationState = "building" | "ready" | "unavailable";
61
+ /**
62
+ * A dashboard data generation. While `building`, poll again after `pollAfterSeconds`; once `ready`, the
63
+ * snapshot downloads from `downloadUrl` until `urlExpiresAt`.
64
+ */
65
+ export type ReportingDashboardGeneration = {
66
+ generationId: string;
67
+ state: ReportingDashboardGenerationState;
68
+ pollAfterSeconds?: number;
69
+ snapshotSha256?: string;
70
+ contractVersion?: number;
71
+ mediaType?: string;
72
+ compression?: string;
73
+ byteLength?: number;
74
+ downloadUrl?: string;
75
+ urlExpiresAt?: string;
76
+ validUntil?: string;
77
+ datasetRowCounts: ReportingDatasetRowCount[];
78
+ datasetSchemas: ReportingSnapshotDatasetSchema[];
79
+ };
80
+ /**
81
+ * Renders one query against a pack definition that is not published. `tenantSlug` must be the
82
+ * credential's tenant unless the caller is a system administrator.
83
+ */
84
+ export type ReportingDraftPreviewRequest = {
85
+ tenantSlug: string;
86
+ definition: PackDefinition;
87
+ query: ReportingQueryRequest;
88
+ };
89
+ export type CompletedRunExportIdentity = {
90
+ tenantId: string;
91
+ runId: string;
92
+ planId: string;
93
+ versionId: string;
94
+ packKey: string;
95
+ packGeneration: number;
96
+ };
97
+ export type CompletedRunExportAllocation = {
98
+ block_uuid: string;
99
+ duration_ms: number;
100
+ sequence: number;
101
+ };
102
+ export type CompletedRunExportAllocationChange = {
103
+ block_uuid: string;
104
+ from_ms: number;
105
+ to_ms: number;
106
+ };
107
+ export type CompletedRunExportCalculationReceipt = {
108
+ allocator_version?: string;
109
+ changes?: CompletedRunExportAllocationChange[];
110
+ reason?: string;
111
+ result?: CompletedRunExportAllocation[];
112
+ source?: CompletedRunExportAllocation[];
113
+ summary?: string;
114
+ };
115
+ export type CompletedRunExportAdjustment = {
116
+ transition_uuid: string;
117
+ command_id: string;
118
+ type: string;
119
+ stream_version: number;
120
+ occurred_at: string;
121
+ receipt: CompletedRunExportCalculationReceipt;
122
+ actor_kind?: string;
123
+ actor_ref?: string;
124
+ allocator_version?: string;
125
+ client_occurred_at?: string;
126
+ current_status?: string;
127
+ previous_status?: string;
128
+ reason?: string;
129
+ schema_version?: string;
130
+ supersedes_transition_id?: string;
131
+ };
132
+ export type CompletedRunExportAnnotation = {
133
+ uuid: string;
134
+ type: string;
135
+ actor_kind: string;
136
+ recorded_at: string;
137
+ action_status?: string;
138
+ actor_ref?: string;
139
+ assignee_ref?: string;
140
+ block_uuid?: string;
141
+ decision_status?: string;
142
+ due_date?: string;
143
+ marker_label?: string;
144
+ redacted_at?: string;
145
+ supersedes_uuid?: string;
146
+ text?: string;
147
+ };
148
+ export type CompletedRunExportBlock = {
149
+ block_uuid: string;
150
+ semantic_key: string;
151
+ sequence: number;
152
+ status: string;
153
+ outcome: string;
154
+ planned_ms: number;
155
+ current_ms: number;
156
+ actual_ms?: number;
157
+ allocated_at_start_ms?: number;
158
+ category?: string;
159
+ tags?: string[];
160
+ wall_started_at?: string;
161
+ wall_ended_at?: string;
162
+ };
163
+ export type CompletedRunExportPredictionComparison = {
164
+ block_uuid: string;
165
+ method: string;
166
+ method_version: string;
167
+ input_hash: string;
168
+ point_ms: number;
169
+ predicted_at: string;
170
+ sample_count: number;
171
+ absolute_error_ms?: number;
172
+ actual_ms?: number;
173
+ interval_covered?: boolean;
174
+ p10_ms?: number;
175
+ p90_ms?: number;
176
+ warnings?: string[];
177
+ };
178
+ export type CompletedRunExportProvenance = {
179
+ adjustment_count: number;
180
+ annotation_count: number;
181
+ corrected: boolean;
182
+ generated_at: string;
183
+ input_hash: string;
184
+ prediction_count: number;
185
+ report_version: string;
186
+ forecast_evaluation_hash?: string;
187
+ measurement_input_hash?: string;
188
+ measurement_projection_version?: string;
189
+ };
190
+ export type CompletedRunExportSummary = {
191
+ plan_id: string;
192
+ run_id: string;
193
+ version_id: string;
194
+ run_status: string;
195
+ stream_version: number;
196
+ completed_at: string;
197
+ actual_block_count: number;
198
+ actual_complete: boolean;
199
+ actual_total_ms: number;
200
+ baseline_horizon_ms: number;
201
+ block_count: number;
202
+ cancelled_block_count: number;
203
+ censored_block_count: number;
204
+ completed_block_count: number;
205
+ current_total_ms: number;
206
+ final_variance_ms: number;
207
+ lost_ms: number;
208
+ not_run_block_count: number;
209
+ overrun_ms: number;
210
+ planned_total_ms: number;
211
+ skipped_block_count: number;
212
+ unused_ms: number;
213
+ effective_starts_at?: string;
214
+ effective_ends_at?: string;
215
+ executable_horizon_ms?: number;
216
+ scheduled_starts_at?: string;
217
+ scheduled_ends_at?: string;
218
+ };
219
+ export type CompletedRunExportSections = {
220
+ order: string[];
221
+ summary: CompletedRunExportSummary;
222
+ blocks: {
223
+ items: CompletedRunExportBlock[];
224
+ };
225
+ adjustments: {
226
+ items: CompletedRunExportAdjustment[];
227
+ };
228
+ annotationsActions: {
229
+ items: CompletedRunExportAnnotation[];
230
+ };
231
+ predictionComparison: {
232
+ items: CompletedRunExportPredictionComparison[];
233
+ };
234
+ provenance: CompletedRunExportProvenance;
235
+ };
236
+ export type CompletedRunExportRedaction = {
237
+ result: "not_required" | "applied";
238
+ redactedAnnotationCount: number;
239
+ };
240
+ export type CompletedRunExportMetadata = {
241
+ reportVersion: string;
242
+ generatedAt: string;
243
+ corrected: boolean;
244
+ };
245
+ export type CompletedRunExportIntegrity = {
246
+ sourceInputSha256: string;
247
+ sourceReportSha256: string;
248
+ exportSha256: string;
249
+ };
250
+ /** The frozen, integrity-checked content of one completed time-plan run, as the export renders it. */
251
+ export type CompletedRunExportSource = {
252
+ contractVersion: string;
253
+ identity: CompletedRunExportIdentity;
254
+ sections: CompletedRunExportSections;
255
+ redaction: CompletedRunExportRedaction;
256
+ metadata: CompletedRunExportMetadata;
257
+ integrity: CompletedRunExportIntegrity;
258
+ };
259
+ /** Exports a completed time-plan run in one to eight formats. */
260
+ export type CompletedRunExportRequest = {
261
+ source: CompletedRunExportSource;
262
+ formats: ReportingExportFormat[];
263
+ idempotencyKey?: string;
264
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Reporting reads and generations served by the analytics API: the dashboard catalogue, dashboard
3
+ * data generations, unpublished pack previews and completed time-plan run exports.
4
+ */
5
+ export {};