react-semaphor 0.1.567 → 0.1.569

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 (128) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +10 -12
  5. package/dist/briefings/index.js +4 -4
  6. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → _commonjsHelpers-Bid1ZNYj.js} +271 -222
  7. package/dist/chunks/{assistant-chat-D-IuHHwh.js → assistant-chat-Dzf2Mbph.js} +107 -109
  8. package/dist/chunks/{bookmark-impact-B0estCHn.js → bookmark-impact-Czg6FGt5.js} +2 -2
  9. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  10. package/dist/chunks/{card-filter-builder-DbSmzvem.js → card-filter-builder-BS982X7x.js} +1001 -1000
  11. package/dist/chunks/{code-editor-DJNOsgJH.js → code-editor-BsxHzm9u.js} +43 -45
  12. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-lLTgzOkM.js} +252 -253
  13. package/dist/chunks/{dashboard-f8J9DHh5.js → dashboard-BiYSbxZv.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-DunvZYsU.js → dashboard-briefing-launcher-Bdj7luOr.js} +119 -120
  15. package/dist/chunks/{dashboard-controls-B09cN2Dz.js → dashboard-controls-TViDsnb8.js} +17 -19
  16. package/dist/chunks/dashboard-json-Dg9dQd9U.js +66 -0
  17. package/dist/chunks/{dates-BsJcyoC_.js → dates-BsPrWZIP.js} +8 -8
  18. package/dist/chunks/{edit-dashboard-visual-Cwzbpty8.js → edit-dashboard-visual-C6hoIeEJ.js} +20 -21
  19. package/dist/chunks/{filter-reach-copy-P-kDwUpY.js → filter-reach-copy-hcQ4os0u.js} +862 -852
  20. package/dist/chunks/filter-value-text-CVxEEDVl.js +146 -0
  21. package/dist/chunks/{index-BcXw0CpM.js → index-G4q89J6O.js} +74 -76
  22. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-BIcoFfdS.js} +1 -1
  23. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C6tYkHyv.js} +1 -1
  24. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  25. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  26. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  27. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  28. package/dist/chunks/{palette-4vf2BEEg.js → palette-NjHOE_6B.js} +1 -1
  29. package/dist/chunks/pivot-result-contract-expectations-DkmueDTW.js +55 -0
  30. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  31. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  32. package/dist/chunks/{report-preferences-dialog-CbgmdWeZ.js → report-preferences-dialog-Xc8_GFju.js} +26 -28
  33. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  34. package/dist/chunks/{resolve-dashboard-input-context-DPKSF3qj.js → resolve-dashboard-input-context-KqvcLcTM.js} +5956 -5880
  35. package/dist/chunks/{save-D6pHmSSP.js → save-C6VmEJTA.js} +1 -1
  36. package/dist/chunks/{saved-dashboard-context-CNudmm9U.js → saved-dashboard-context-BeXXyoD4.js} +6 -6
  37. package/dist/chunks/{semaphor-ready-indicator-CQd-PCCZ.js → semaphor-ready-indicator-BNkaANsG.js} +31011 -30850
  38. package/dist/chunks/{shelf-drop-preview-context-CWS3e20y.js → shelf-drop-preview-context-C_issPBA.js} +18 -20
  39. package/dist/chunks/{stored-dashboard-CrQFT27O.js → stored-dashboard-B6_StAty.js} +232 -234
  40. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-BWP2joD1.js} +1 -1
  41. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-scSWQXAB.js} +4 -4
  42. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  43. package/dist/chunks/{upload-Cf3wXZT8.js → upload-BRW4Mwrd.js} +1 -1
  44. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  45. package/dist/chunks/{variable-draft-BDxlD0dM.js → variable-draft-BQ3OMjvy.js} +4 -4
  46. package/dist/dashboard/index.js +2 -2
  47. package/dist/dashboard-authoring/index.js +1778 -1741
  48. package/dist/format-utils/index.js +230 -231
  49. package/dist/index.js +236 -237
  50. package/dist/report-runtime-context/index.js +1 -1
  51. package/dist/style.css +1 -1
  52. package/dist/surfboard/index.js +2 -2
  53. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  54. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  55. package/dist/types/index.js +9 -9
  56. package/dist/types/lib/document/document-edits.d.ts +8 -3
  57. package/dist/types/lib/document/document-text-style.d.ts +54 -0
  58. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  59. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  60. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  61. package/dist/types/lib/types/index.d.ts +1 -1
  62. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  63. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  64. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  65. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  66. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  67. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  68. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +4 -4
  69. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  70. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  71. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  72. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  73. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  74. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  75. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  76. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  77. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  78. package/dist/types/shared/assistant-protocol/context.d.ts +12 -12
  79. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  80. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +176 -1756
  81. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  82. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +74 -74
  83. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  84. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +8 -2
  85. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  86. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  87. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  88. package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
  89. package/dist/types/shared/temporal/index.d.ts +0 -2
  90. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  91. package/package.json +2 -24
  92. package/DATA_APP_SDK.md +0 -339
  93. package/dist/chunks/dashboard-json-BNNCaKEc.js +0 -68
  94. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  95. package/dist/chunks/index-CuHybtft.js +0 -51
  96. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  97. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  98. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  99. package/dist/chunks/operators-B3zZoskU.js +0 -66
  100. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  101. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  102. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  103. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  104. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  105. package/dist/data-app-sdk/index.js +0 -1412
  106. package/dist/data-app-sdk-adapters/index.js +0 -361
  107. package/dist/data-app-sdk-validation/index.js +0 -1031
  108. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  109. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  110. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  111. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  112. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  113. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  114. package/dist/types/data-app-sdk/index.d.ts +0 -9
  115. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  116. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  117. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  118. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  119. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  120. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  121. package/dist/types/data-app-sdk.d.ts +0 -2
  122. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  123. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  124. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  125. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  126. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  127. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  128. package/src/data-app-sdk/README.md +0 -402
@@ -1,58 +0,0 @@
1
- import { SemaphorAnalyticsExecutionResult, SemaphorAnalyticsIntent, SemaphorFieldRef, SemaphorSourceRef } from '../shared/analytics-protocol/index.js';
2
- import { SemaphorAnalysisQueryOptions, SemaphorQueryDefinition } from './contracts.js';
3
- import { SemaphorDataAppFieldCatalog } from './field-catalog-validation.js';
4
- export type { SemaphorAnalysisQueryOptions } from './contracts.js';
5
- export { fieldWithSelectedProjectionRole, findMatchingRelatedProjectionField, isAllowedRelatedProjectionRole, normalizeSemaphorFieldRole, relatedProjectionFieldCandidatesForIntent, type SemaphorRelatedProjectionFieldCandidate, type SemaphorRelatedProjectionRole, } from './relationship-aware-field-policy.js';
6
- export type SemaphorAnalysisTimezoneValidator = (tz: string) => string | null;
7
- export type SemaphorAnalysisQueryOptionsValidationIssue = {
8
- code: 'invalid_analysis_option';
9
- message: string;
10
- path: string;
11
- };
12
- export type SemaphorAnalysisQueryOptionsValidationResult = {
13
- ok: true;
14
- analysisOptions?: SemaphorAnalysisQueryOptions;
15
- } | {
16
- ok: false;
17
- issues: SemaphorAnalysisQueryOptionsValidationIssue[];
18
- };
19
- export type SemaphorDataAppQuerySpecEnvelope = {
20
- queryHook: 'useSemaphorQuery';
21
- spec: SemaphorQueryDefinition;
22
- };
23
- export type { SemaphorDataAppFieldCatalog } from './field-catalog-validation.js';
24
- export type SemaphorDataAppValidationDiagnostic = {
25
- severity: 'error' | 'warning';
26
- code: 'invalid_query_spec' | 'invalid_analytics_intent' | 'invalid_source_ref' | 'missing_field' | 'unsupported_input_filter_composition' | string;
27
- message: string;
28
- path?: string;
29
- queryHook?: SemaphorDataAppQuerySpecEnvelope['queryHook'];
30
- queryId?: string;
31
- intentId?: string;
32
- source?: SemaphorSourceRef;
33
- field?: SemaphorFieldRef;
34
- };
35
- export type SemaphorDataAppQueryValidation = {
36
- queryHook: SemaphorDataAppQuerySpecEnvelope['queryHook'];
37
- queryId?: string;
38
- intent?: SemaphorAnalyticsIntent;
39
- diagnostics: SemaphorDataAppValidationDiagnostic[];
40
- executionResult: SemaphorAnalyticsExecutionResult;
41
- };
42
- export type SemaphorDataAppValidationResult = {
43
- ok: boolean;
44
- diagnostics: SemaphorDataAppValidationDiagnostic[];
45
- queries: SemaphorDataAppQueryValidation[];
46
- intents: SemaphorAnalyticsIntent[];
47
- executionResults: SemaphorAnalyticsExecutionResult[];
48
- };
49
- export declare function normalizeSemaphorAnalysisQueryOptions(value: unknown, options?: {
50
- pathPrefix?: string;
51
- validateTimezone?: SemaphorAnalysisTimezoneValidator;
52
- }): SemaphorAnalysisQueryOptionsValidationResult;
53
- export declare function validateSemaphorDataAppQuerySpecs(input: {
54
- queries: SemaphorDataAppQuerySpecEnvelope[];
55
- fieldCatalogs?: SemaphorDataAppFieldCatalog[];
56
- requireFieldCatalog?: boolean;
57
- validateTimezone?: SemaphorAnalysisTimezoneValidator;
58
- }): SemaphorDataAppValidationResult;
@@ -1,2 +0,0 @@
1
- export * from './data-app-sdk/adapters.js'
2
- export {}
@@ -1,2 +0,0 @@
1
- export * from './data-app-sdk/validation.js'
2
- export {}
@@ -1,2 +0,0 @@
1
- export * from './data-app-sdk/index.js'
2
- export {}
@@ -1,68 +0,0 @@
1
- import { z } from 'zod';
2
- /** Calendar units a relative date can count in. */
3
- export type DateUnit = 'day' | 'week' | 'month' | 'quarter' | 'year';
4
- /** Sub-day units, used only by rolling `last` windows. */
5
- export type SubDayDateUnit = 'minute' | 'hour';
6
- export type RelativeDateUnit = DateUnit | SubDayDateUnit;
7
- /**
8
- * A date window stated relative to an anchor ("now" or a pinned instant).
9
- * Dashboard filters carry it as `TFilterValue.relativeMeta` and card filters as
10
- * `FilterCondition.relativeMeta`; the server resolves it on every run in the
11
- * governed calendar.
12
- */
13
- export type RelativeDateFilter = {
14
- mode: 'last';
15
- n: number;
16
- unit: SubDayDateUnit;
17
- complete?: false;
18
- relativeTo?: RelativeDateAnchor;
19
- } | {
20
- mode: 'last';
21
- n: number;
22
- unit: DateUnit;
23
- complete?: boolean;
24
- relativeTo?: RelativeDateAnchor;
25
- } | {
26
- mode: 'this';
27
- unit: DateUnit;
28
- toDate?: boolean;
29
- /** Only used with unit=month for single-day month-boundary presets. */
30
- boundary?: 'first_day' | 'last_day';
31
- } | {
32
- mode: 'previous';
33
- unit: DateUnit;
34
- } | {
35
- mode: 'between';
36
- unit: DateUnit;
37
- from: number;
38
- to: number;
39
- };
40
- /**
41
- * What a `last` window counts back from. Omitted means now (or a pinned
42
- * instant); `'latest_data'` means the latest value of the window's own field
43
- * in its lookup scope (analytics kernel K11). Only agents author it.
44
- */
45
- export type RelativeDateAnchor = 'latest_data';
46
- /** A `last` window that counts back from the latest data (K11). */
47
- export type DataRelativeDateFilter = Extract<RelativeDateFilter, {
48
- mode: 'last';
49
- }> & {
50
- relativeTo: 'latest_data';
51
- };
52
- /**
53
- * A window that counts back from the latest data instead of from now (K11):
54
- * the one test every reader uses. It reads any value, so callers can pass a
55
- * field they have not validated.
56
- */
57
- export declare function isDataRelativeDateFilter(meta: unknown): meta is DataRelativeDateFilter;
58
- /** A relative date belongs only on a range condition (plan D3). */
59
- export declare function allowsRelativeDate(operator: string): boolean;
60
- /** Strict schema for a persisted `RelativeDateFilter`. */
61
- export declare const relativeDateFilterSchema: z.ZodType<RelativeDateFilter>;
62
- /**
63
- * The one reader for a stored relative date (a filter's default, a saved or
64
- * replayed filter value): the window when every field a resolver needs is
65
- * present and valid, with unknown keys dropped; otherwise undefined, so the
66
- * caller keeps the value's fixed dates instead of throwing on a bad unit.
67
- */
68
- export declare function readRelativeDateFilter(value: unknown): RelativeDateFilter | undefined;
@@ -1,20 +0,0 @@
1
- import { RelativeDateFilter } from './relative-date-filter.js';
2
- /** The preset a relative date is, or null when it isn't one. */
3
- export declare function findPresetLabel(meta: RelativeDateFilter | undefined): string | null;
4
- /** One offset as an option label: "Today", "Last month", "6 days ago". */
5
- export declare function getRelativeOffsetLabel(offset: number, unit: RelativeDateFilter['unit']): string;
6
- /**
7
- * Format a `RelativeDateFilter` meta into a human-readable label.
8
- *
9
- * 1. First tries to reverse-match against `presetMetadata` so canonical
10
- * presets (Today, Last 7 days, This week, …) round-trip back to the
11
- * same wording the user originally clicked.
12
- * 2. Falls back to a generated label for ad-hoc relative ranges that
13
- * aren't in the preset list (e.g., from the Relative tab's custom
14
- * From/To dropdowns).
15
- *
16
- * Returns null if the meta can't be sensibly labelled.
17
- */
18
- export declare function getRelativeDateLabel(meta: RelativeDateFilter | undefined): string | null;
19
- export declare function relativeMetaEquals(a: RelativeDateFilter, b: RelativeDateFilter): boolean;
20
- export declare const presetMetadata: Record<string, RelativeDateFilter>;
@@ -1,314 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Zod schemas for `SemaphorTimeWindow`, built from the shared rules in
4
- * `time-window.ts`. `strict: true` rejects unknown keys; otherwise they are
5
- * dropped, as tool argument parsing expects.
6
- */
7
- export declare function semaphorTimeWindowSchemas(options?: {
8
- strict?: boolean;
9
- }): {
10
- relative: z.ZodEffects<z.ZodObject<{
11
- kind: z.ZodOptional<z.ZodLiteral<"relative">>;
12
- unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
13
- value: z.ZodNumber;
14
- anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
15
- completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
16
- }, "strip", z.ZodTypeAny, {
17
- value: number;
18
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
19
- kind?: "relative" | undefined;
20
- anchor?: "now" | "latest_available" | undefined;
21
- completeness?: "include_partial" | "complete_periods" | undefined;
22
- }, {
23
- value: number;
24
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
25
- kind?: "relative" | undefined;
26
- anchor?: "now" | "latest_available" | undefined;
27
- completeness?: "include_partial" | "complete_periods" | undefined;
28
- }>, {
29
- value: number;
30
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
31
- kind?: "relative" | undefined;
32
- anchor?: "now" | "latest_available" | undefined;
33
- completeness?: "include_partial" | "complete_periods" | undefined;
34
- }, {
35
- value: number;
36
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
37
- kind?: "relative" | undefined;
38
- anchor?: "now" | "latest_available" | undefined;
39
- completeness?: "include_partial" | "complete_periods" | undefined;
40
- }> | z.ZodEffects<z.ZodObject<{
41
- kind: z.ZodOptional<z.ZodLiteral<"relative">>;
42
- unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
43
- value: z.ZodNumber;
44
- anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
45
- completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
46
- }, "strict", z.ZodTypeAny, {
47
- value: number;
48
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
49
- kind?: "relative" | undefined;
50
- anchor?: "now" | "latest_available" | undefined;
51
- completeness?: "include_partial" | "complete_periods" | undefined;
52
- }, {
53
- value: number;
54
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
55
- kind?: "relative" | undefined;
56
- anchor?: "now" | "latest_available" | undefined;
57
- completeness?: "include_partial" | "complete_periods" | undefined;
58
- }>, {
59
- value: number;
60
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
61
- kind?: "relative" | undefined;
62
- anchor?: "now" | "latest_available" | undefined;
63
- completeness?: "include_partial" | "complete_periods" | undefined;
64
- }, {
65
- value: number;
66
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
67
- kind?: "relative" | undefined;
68
- anchor?: "now" | "latest_available" | undefined;
69
- completeness?: "include_partial" | "complete_periods" | undefined;
70
- }>;
71
- calendar: z.ZodEffects<z.ZodObject<{
72
- kind: z.ZodLiteral<"calendar">;
73
- unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
74
- period: z.ZodEnum<["this", "previous"]>;
75
- toDate: z.ZodOptional<z.ZodBoolean>;
76
- }, "strip", z.ZodTypeAny, {
77
- kind: "calendar";
78
- unit: "day" | "week" | "month" | "quarter" | "year";
79
- period: "this" | "previous";
80
- toDate?: boolean | undefined;
81
- }, {
82
- kind: "calendar";
83
- unit: "day" | "week" | "month" | "quarter" | "year";
84
- period: "this" | "previous";
85
- toDate?: boolean | undefined;
86
- }>, {
87
- kind: "calendar";
88
- unit: "day" | "week" | "month" | "quarter" | "year";
89
- period: "this" | "previous";
90
- toDate?: boolean | undefined;
91
- }, {
92
- kind: "calendar";
93
- unit: "day" | "week" | "month" | "quarter" | "year";
94
- period: "this" | "previous";
95
- toDate?: boolean | undefined;
96
- }> | z.ZodEffects<z.ZodObject<{
97
- kind: z.ZodLiteral<"calendar">;
98
- unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
99
- period: z.ZodEnum<["this", "previous"]>;
100
- toDate: z.ZodOptional<z.ZodBoolean>;
101
- }, "strict", z.ZodTypeAny, {
102
- kind: "calendar";
103
- unit: "day" | "week" | "month" | "quarter" | "year";
104
- period: "this" | "previous";
105
- toDate?: boolean | undefined;
106
- }, {
107
- kind: "calendar";
108
- unit: "day" | "week" | "month" | "quarter" | "year";
109
- period: "this" | "previous";
110
- toDate?: boolean | undefined;
111
- }>, {
112
- kind: "calendar";
113
- unit: "day" | "week" | "month" | "quarter" | "year";
114
- period: "this" | "previous";
115
- toDate?: boolean | undefined;
116
- }, {
117
- kind: "calendar";
118
- unit: "day" | "week" | "month" | "quarter" | "year";
119
- period: "this" | "previous";
120
- toDate?: boolean | undefined;
121
- }>;
122
- absolute: z.ZodEffects<z.ZodObject<{
123
- kind: z.ZodLiteral<"absolute">;
124
- start: z.ZodString;
125
- end: z.ZodString;
126
- }, "strip", z.ZodTypeAny, {
127
- kind: "absolute";
128
- start: string;
129
- end: string;
130
- }, {
131
- kind: "absolute";
132
- start: string;
133
- end: string;
134
- }>, {
135
- kind: "absolute";
136
- start: string;
137
- end: string;
138
- }, {
139
- kind: "absolute";
140
- start: string;
141
- end: string;
142
- }> | z.ZodEffects<z.ZodObject<{
143
- kind: z.ZodLiteral<"absolute">;
144
- start: z.ZodString;
145
- end: z.ZodString;
146
- }, "strict", z.ZodTypeAny, {
147
- kind: "absolute";
148
- start: string;
149
- end: string;
150
- }, {
151
- kind: "absolute";
152
- start: string;
153
- end: string;
154
- }>, {
155
- kind: "absolute";
156
- start: string;
157
- end: string;
158
- }, {
159
- kind: "absolute";
160
- start: string;
161
- end: string;
162
- }>;
163
- timeWindow: z.ZodUnion<readonly [z.ZodEffects<z.ZodObject<{
164
- kind: z.ZodOptional<z.ZodLiteral<"relative">>;
165
- unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
166
- value: z.ZodNumber;
167
- anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
168
- completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
169
- }, "strip", z.ZodTypeAny, {
170
- value: number;
171
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
172
- kind?: "relative" | undefined;
173
- anchor?: "now" | "latest_available" | undefined;
174
- completeness?: "include_partial" | "complete_periods" | undefined;
175
- }, {
176
- value: number;
177
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
178
- kind?: "relative" | undefined;
179
- anchor?: "now" | "latest_available" | undefined;
180
- completeness?: "include_partial" | "complete_periods" | undefined;
181
- }>, {
182
- value: number;
183
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
184
- kind?: "relative" | undefined;
185
- anchor?: "now" | "latest_available" | undefined;
186
- completeness?: "include_partial" | "complete_periods" | undefined;
187
- }, {
188
- value: number;
189
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
190
- kind?: "relative" | undefined;
191
- anchor?: "now" | "latest_available" | undefined;
192
- completeness?: "include_partial" | "complete_periods" | undefined;
193
- }> | z.ZodEffects<z.ZodObject<{
194
- kind: z.ZodOptional<z.ZodLiteral<"relative">>;
195
- unit: z.ZodEnum<["second", "minute", "hour", "day", "week", "month", "quarter", "year"]>;
196
- value: z.ZodNumber;
197
- anchor: z.ZodOptional<z.ZodEnum<["now", "latest_available"]>>;
198
- completeness: z.ZodOptional<z.ZodEnum<["include_partial", "complete_periods"]>>;
199
- }, "strict", z.ZodTypeAny, {
200
- value: number;
201
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
202
- kind?: "relative" | undefined;
203
- anchor?: "now" | "latest_available" | undefined;
204
- completeness?: "include_partial" | "complete_periods" | undefined;
205
- }, {
206
- value: number;
207
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
208
- kind?: "relative" | undefined;
209
- anchor?: "now" | "latest_available" | undefined;
210
- completeness?: "include_partial" | "complete_periods" | undefined;
211
- }>, {
212
- value: number;
213
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
214
- kind?: "relative" | undefined;
215
- anchor?: "now" | "latest_available" | undefined;
216
- completeness?: "include_partial" | "complete_periods" | undefined;
217
- }, {
218
- value: number;
219
- unit: "second" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year";
220
- kind?: "relative" | undefined;
221
- anchor?: "now" | "latest_available" | undefined;
222
- completeness?: "include_partial" | "complete_periods" | undefined;
223
- }>, z.ZodEffects<z.ZodObject<{
224
- kind: z.ZodLiteral<"calendar">;
225
- unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
226
- period: z.ZodEnum<["this", "previous"]>;
227
- toDate: z.ZodOptional<z.ZodBoolean>;
228
- }, "strip", z.ZodTypeAny, {
229
- kind: "calendar";
230
- unit: "day" | "week" | "month" | "quarter" | "year";
231
- period: "this" | "previous";
232
- toDate?: boolean | undefined;
233
- }, {
234
- kind: "calendar";
235
- unit: "day" | "week" | "month" | "quarter" | "year";
236
- period: "this" | "previous";
237
- toDate?: boolean | undefined;
238
- }>, {
239
- kind: "calendar";
240
- unit: "day" | "week" | "month" | "quarter" | "year";
241
- period: "this" | "previous";
242
- toDate?: boolean | undefined;
243
- }, {
244
- kind: "calendar";
245
- unit: "day" | "week" | "month" | "quarter" | "year";
246
- period: "this" | "previous";
247
- toDate?: boolean | undefined;
248
- }> | z.ZodEffects<z.ZodObject<{
249
- kind: z.ZodLiteral<"calendar">;
250
- unit: z.ZodEnum<["day", "week", "month", "quarter", "year"]>;
251
- period: z.ZodEnum<["this", "previous"]>;
252
- toDate: z.ZodOptional<z.ZodBoolean>;
253
- }, "strict", z.ZodTypeAny, {
254
- kind: "calendar";
255
- unit: "day" | "week" | "month" | "quarter" | "year";
256
- period: "this" | "previous";
257
- toDate?: boolean | undefined;
258
- }, {
259
- kind: "calendar";
260
- unit: "day" | "week" | "month" | "quarter" | "year";
261
- period: "this" | "previous";
262
- toDate?: boolean | undefined;
263
- }>, {
264
- kind: "calendar";
265
- unit: "day" | "week" | "month" | "quarter" | "year";
266
- period: "this" | "previous";
267
- toDate?: boolean | undefined;
268
- }, {
269
- kind: "calendar";
270
- unit: "day" | "week" | "month" | "quarter" | "year";
271
- period: "this" | "previous";
272
- toDate?: boolean | undefined;
273
- }>, z.ZodEffects<z.ZodObject<{
274
- kind: z.ZodLiteral<"absolute">;
275
- start: z.ZodString;
276
- end: z.ZodString;
277
- }, "strip", z.ZodTypeAny, {
278
- kind: "absolute";
279
- start: string;
280
- end: string;
281
- }, {
282
- kind: "absolute";
283
- start: string;
284
- end: string;
285
- }>, {
286
- kind: "absolute";
287
- start: string;
288
- end: string;
289
- }, {
290
- kind: "absolute";
291
- start: string;
292
- end: string;
293
- }> | z.ZodEffects<z.ZodObject<{
294
- kind: z.ZodLiteral<"absolute">;
295
- start: z.ZodString;
296
- end: z.ZodString;
297
- }, "strict", z.ZodTypeAny, {
298
- kind: "absolute";
299
- start: string;
300
- end: string;
301
- }, {
302
- kind: "absolute";
303
- start: string;
304
- end: string;
305
- }>, {
306
- kind: "absolute";
307
- start: string;
308
- end: string;
309
- }, {
310
- kind: "absolute";
311
- start: string;
312
- end: string;
313
- }>]>;
314
- };
@@ -1,52 +0,0 @@
1
- import { SemaphorCalendarTimeWindow, SemaphorRelativeTimeWindow, SemaphorTimeGrain, SemaphorTimeWindow } from './contracts.js';
2
- import { RelativeDateFilter } from './relative-date-filter.js';
3
- /** Units a calendar window ("this month", "previous quarter") can name. */
4
- export declare const SEMAPHOR_CALENDAR_TIME_WINDOW_UNITS: readonly ["day", "week", "month", "quarter", "year"];
5
- export declare const SEMAPHOR_CALENDAR_TIME_WINDOW_PERIODS: readonly ["this", "previous"];
6
- export declare const SEMAPHOR_TIME_WINDOW_ANCHORS: readonly ["now", "latest_available"];
7
- export declare const SEMAPHOR_TIME_WINDOW_COMPLETENESS: readonly ["include_partial", "complete_periods"];
8
- /** The largest rolling window per unit: ten years. */
9
- export declare const SEMAPHOR_TIME_WINDOW_MAX_VALUE: Readonly<Record<SemaphorTimeGrain, number>>;
10
- /**
11
- * The anchor a rolling window counts back from. An omitted anchor means the
12
- * latest available data; a saved card that should keep rolling states "now".
13
- */
14
- export declare function resolveTimeWindowAnchor(timeWindow: Pick<SemaphorRelativeTimeWindow, 'anchor'>): 'now' | 'latest_available';
15
- /** A rolling "last N units" window (`kind` "relative" or omitted). */
16
- export declare function isRelativeTimeWindow(timeWindow: SemaphorTimeWindow | null | undefined): timeWindow is SemaphorRelativeTimeWindow;
17
- /** A whole calendar period, such as this month or the previous quarter. */
18
- export declare function isCalendarTimeWindow(timeWindow: SemaphorTimeWindow | null | undefined): timeWindow is SemaphorCalendarTimeWindow;
19
- /**
20
- * A window as a dashboard filter's default. Filter defaults run to now (the
21
- * editor's presets and the filter runtime have no latest-data anchor), so a
22
- * rolling window without an anchor is anchored at now, and one anchored to
23
- * the latest available data is not a filter default (null), never quietly
24
- * moved to now. The one conversion every writer and checker of a filter
25
- * default uses.
26
- */
27
- export declare function timeWindowToFilterDefault(timeWindow: SemaphorTimeWindow): RelativeDateFilter | null;
28
- /** A rolling week, month, quarter or year that includes the current, partial one: no filter preset holds it. */
29
- export declare function isPartialRollingPeriod(timeWindow: SemaphorTimeWindow): boolean;
30
- /**
31
- * The time window a filter default states, the inverse of
32
- * `timeWindowToFilterDefault`, so what an agent reads back is what it would
33
- * write: the last N days with today (`between` days from 1-N to 0), complete
34
- * periods, this or the previous period; a rolling window saved before is
35
- * read as rolling. Null for any other stored default, such as `between` on
36
- * whole weeks or months, which no time window states.
37
- */
38
- export declare function filterDefaultToTimeWindow(meta: RelativeDateFilter): SemaphorTimeWindow | null;
39
- /**
40
- * The relative date an agent time window persists as (plan D10, amended by
41
- * analytics kernel K11), or null when it can't stay relative: absolute
42
- * windows, second units, and complete minute or hour periods. A window
43
- * anchored to the latest available data (an omitted anchor included) counts
44
- * back from its own field's data anchor (`relativeTo: 'latest_data'`).
45
- * `completeness` is the completeness the run used, when it was inferred.
46
- * Moved from semaphor-app's query-spec-filters so a card's date window and a
47
- * dashboard filter's default period convert through one owner (MCP dashboard
48
- * editing, ledger P3-04).
49
- */
50
- export declare function timeWindowToRelativeDateFilter(timeWindow: SemaphorTimeWindow, options?: {
51
- completeness?: 'include_partial' | 'complete_periods';
52
- }): RelativeDateFilter | null;
@@ -1,21 +0,0 @@
1
- import { RelativeDateFilter } from '../analytics-protocol/relative-date-filter.js';
2
- import { TemporalCalendar } from './calendar-periods.js';
3
- /** A resolved window: `end` is the inclusive last instant. */
4
- export type ResolvedRelativeDate = {
5
- start: Date;
6
- end: Date;
7
- };
8
- /**
9
- * The window a relative date names at `anchor` in the calendar:
10
- * - `last` n units: the n units back to the anchor, the same wall-clock time
11
- * n units earlier (minutes and hours count elapsed time); with `complete`,
12
- * the n whole periods before the one containing the anchor;
13
- * - `this`: the period containing the anchor, or up to the anchor with
14
- * `toDate`; a month `boundary` names its first or last day (months only);
15
- * - `previous`: the period before;
16
- * - `between` from/to: from the start of the `from` period to the end of the
17
- * `to` period, counted from the anchor's.
18
- * Weeks start on the calendar's week start; quarters and years follow its
19
- * fiscal calendar when it has one.
20
- */
21
- export declare function resolveRelativeDate(relative: RelativeDateFilter, calendar: TemporalCalendar, anchor: Date): ResolvedRelativeDate;
@@ -1,21 +0,0 @@
1
- import { TemporalCalendar, TemporalUnit } from './calendar-periods.js';
2
- /** A rolling window's length: `value` units. */
3
- export type TemporalSpan = {
4
- unit: TemporalUnit;
5
- value: number;
6
- };
7
- /**
8
- * Where a window of `span` ending at `end` starts: elapsed time for seconds,
9
- * minutes and hours; the same wall-clock time `value` units earlier for
10
- * calendar units.
11
- */
12
- export declare function subtractTimeSpan(end: Date, span: TemporalSpan, calendar: TemporalCalendar): Date;
13
- /** The `value` whole periods before the one containing `latest`. */
14
- export type CompletePeriodWindow = {
15
- windowStart: Date;
16
- /** The inclusive last instant: the millisecond before `latest`'s period. */
17
- windowEnd: Date;
18
- /** Whether `latest`'s own period, which is partial, was left out. */
19
- excludedPartialPeriod: boolean;
20
- };
21
- export declare function completePeriodWindow(latest: Date, span: TemporalSpan, calendar: TemporalCalendar): CompletePeriodWindow;