react-semaphor 0.1.590 → 0.1.591
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.js +254 -236
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/{aggregate-measure-field-BrkXsSJp.js → aggregate-measure-field-DHlDj0Pc.js} +2 -2
- package/dist/chunks/{assistant-chat-C_6dBLUk.js → assistant-chat-Cazikwyh.js} +13 -13
- package/dist/chunks/{bookmark-impact-DkZABEd3.js → bookmark-impact-rWjQgk8h.js} +2 -2
- package/dist/chunks/{bookmark-state-Bn7k3ttp.js → bookmark-state-Bt_eQEqt.js} +569 -537
- package/dist/chunks/{card-filter-builder-6vflbF9O.js → card-filter-builder-DFR-6Jpm.js} +929 -910
- package/dist/chunks/{comparison-window-caption-fqijZdVd.js → comparison-window-caption-CFaw-kIV.js} +6 -6
- package/dist/chunks/{dashboard-DpgRl65K.js → dashboard-DCh9hKnJ.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-BLbhONJz.js → dashboard-briefing-launcher-ob8G1b58.js} +91 -91
- package/dist/chunks/{dashboard-controls-kCTYEEsq.js → dashboard-controls-Nszg0k1A.js} +64 -64
- package/dist/chunks/{dashboard-json-CNIFresY.js → dashboard-json-BpwnG23b.js} +4 -4
- package/dist/chunks/{dates-BoeweqEo.js → dates-BOLBSBpn.js} +8 -8
- package/dist/chunks/{edit-dashboard-visual-D0eWTlPL.js → edit-dashboard-visual-BvM7br5P.js} +5501 -5475
- package/dist/chunks/filter-line-CYT7KIXb.js +133 -0
- package/dist/chunks/{filter-reach-copy-eMhDPTYH.js → filter-reach-copy-By3r7O3G.js} +11 -11
- package/dist/chunks/filter-value-text-CFiIZWJP.js +153 -0
- package/dist/chunks/{index-D8LFjI8j.js → index-CsQYlwhU.js} +5 -5
- package/dist/chunks/{layout-grid-BG__sPkb.js → layout-grid-DoFIfQGd.js} +1 -1
- package/dist/chunks/{list-filter-Cb8i7N8f.js → list-filter-BeTQxjNy.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-D9Ll_9R-.js → matrix-analytical-definition-CyWOwLmE.js} +17 -17
- package/dist/chunks/{matrix-member-presentation-DVBJR0MA.js → matrix-member-presentation-Bj2YcHAP.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-JSmproo9.js → matrix-operation-contract-CAanJeCj.js} +60 -60
- package/dist/chunks/{metric-comparison-xE_J6hkg.js → metric-comparison-BeKnUD08.js} +27 -31
- package/dist/chunks/{paintbrush-C310xSuR.js → paintbrush-KeaU1L1a.js} +1 -1
- package/dist/chunks/{palette-Ci5P91Zb.js → palette-BcFJLeXB.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-D-DfPAjb.js → pivot-header-presentation-gUxhdIdr.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-DbBahmgc.js → pivot-result-contract-expectations-BkMRCjzf.js} +111 -111
- package/dist/chunks/{pivot-result-identity-CUsMt_4r.js → pivot-result-identity-BKUjYO1u.js} +1 -1
- package/dist/chunks/raw-temporal-value-BzdgeDa7.js +454 -0
- package/dist/chunks/{report-preferences-dialog-dUlVLgEk.js → report-preferences-dialog-ChXt8wCt.js} +13 -13
- package/dist/chunks/{report-runtime-context-CrOgmuxO.js → report-runtime-context-g4Zp_TU9.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-NurwNg4I.js → resolve-dashboard-input-context-BlyFX8He.js} +5053 -4955
- package/dist/chunks/{save-BhhXfp4s.js → save-C9CZAk6V.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CPp--vXU.js → saved-dashboard-context-BPSdH2jW.js} +7 -7
- package/dist/chunks/{selection-filter-compiler-CHG-8xnW.js → selection-filter-compiler-BclSpK3P.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-CXojR95M.js → semaphor-ready-indicator-BZUMCHRU.js} +28962 -28917
- package/dist/chunks/{shelf-drop-preview-context-BDScAUdq.js → shelf-drop-preview-context-yJheoeTC.js} +5 -5
- package/dist/chunks/{stored-dashboard-KkH4zOhq.js → stored-dashboard-CxQl9g0l.js} +653 -657
- package/dist/chunks/{style-sheet-parts-CmXmKqGw.js → style-sheet-parts-DM_Mw_sm.js} +45 -42
- package/dist/chunks/{table-export-sheet-ClSgERQC.js → table-export-sheet-h7wm5TwP.js} +1 -1
- package/dist/chunks/{token-types-DTocOcwt.js → token-types-BB2ImFx6.js} +1 -1
- package/dist/chunks/{upload-DDYc1Qjj.js → upload-CMTCg47S.js} +1 -1
- package/dist/chunks/{validators-CrYXNnNE.js → validators-BlEWWX9O.js} +576 -562
- package/dist/chunks/{variable-draft-Bi3RlULA.js → variable-draft-OpYyaVCW.js} +4 -4
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1602 -1555
- package/dist/format-utils/index.js +14 -14
- package/dist/index.js +18 -18
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/surfboard/filter/types.d.ts +7 -5
- package/dist/types/index.js +5 -5
- package/dist/types/lib/dashboard-inputs/dashboard-date-comparison-plan.d.ts +0 -1
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +2 -1
- package/dist/types/shared/analytics-protocol/relative-date/sentence.d.ts +81 -0
- package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +0 -9
- package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +23 -2
- package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +20 -0
- package/dist/types/shared/dashboard-authoring/card-formats/detail-date-display.d.ts +84 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +36 -36
- package/dist/types/shared/dashboard-authoring/filter-model/date-filter-default.d.ts +37 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/format-utils/filter-line.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/filter-line-Dza3ee4w.js +0 -131
- package/dist/chunks/filter-value-text-DQw4v3nC.js +0 -146
- package/dist/chunks/raw-temporal-value-BnGCWJAL.js +0 -322
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { j as p, r as y } from "./validators-CrYXNnNE.js";
|
|
2
|
-
import { r as I } from "./metric-comparison-xE_J6hkg.js";
|
|
3
|
-
import "../value-format-preferences/index.js";
|
|
4
|
-
import { c as N } from "./raw-temporal-value-BnGCWJAL.js";
|
|
5
|
-
import { ak as k, ag as T } from "./pivot-result-contract-expectations-DbBahmgc.js";
|
|
6
|
-
const d = { kind: "plain" }, g = { kind: "temporal" }, D = {
|
|
7
|
-
"=": "=",
|
|
8
|
-
"!=": "!=",
|
|
9
|
-
">": ">",
|
|
10
|
-
">=": ">=",
|
|
11
|
-
"<": "<",
|
|
12
|
-
"<=": "<=",
|
|
13
|
-
in: "in",
|
|
14
|
-
"not in": "not in",
|
|
15
|
-
between: "between",
|
|
16
|
-
"not between": "not between",
|
|
17
|
-
contains: "contains (ignoring case)",
|
|
18
|
-
startsWith: "starts with (ignoring case)",
|
|
19
|
-
endsWith: "ends with (ignoring case)",
|
|
20
|
-
like: "matches the LIKE pattern (ignoring case)",
|
|
21
|
-
"not like": "does not match the LIKE pattern (ignoring case)",
|
|
22
|
-
isNull: "is empty",
|
|
23
|
-
isNotNull: "is not empty"
|
|
24
|
-
}, L = { between: "in", "not between": "not in" };
|
|
25
|
-
function O(t, n = {}) {
|
|
26
|
-
const { operator: e, values: i, reading: r } = t, o = r.kind === "bucket" ? `${t.subject} (${k(r.bucket)})` : t.subject, s = D[e], l = t.shownAs ? ` (shown as ${JSON.stringify(t.shownAs)})` : "", u = (a, m = 0) => ({ text: a, omittedValues: m });
|
|
27
|
-
if (e === "isNull" || e === "isNotNull") return u(`${o} ${s}`);
|
|
28
|
-
if (t.latestValue)
|
|
29
|
-
return u(`${o} ${s} the latest value of this field (resolved at run time)`);
|
|
30
|
-
if (e === "between" || e === "not between") {
|
|
31
|
-
const a = i.length === 2 ? S(i[0], i[1], r, n.timeZone) : void 0;
|
|
32
|
-
if (t.relative)
|
|
33
|
-
return u(`${o} ${L[e]} ${V(t.relative, a)}`);
|
|
34
|
-
if (a) {
|
|
35
|
-
const m = a.wholeDaysIn ? ` (whole days in ${a.wholeDaysIn})` : "";
|
|
36
|
-
return u(`${o} ${s} ${a.from} and ${a.to}${m}${l}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return e === "in" || e === "not in" || i.length !== 1 ? u(
|
|
40
|
-
`${o} ${s} (${w(i, r, n.maxListedValues)})${l}`,
|
|
41
|
-
$(i.length, n.maxListedValues)
|
|
42
|
-
) : u(`${o} ${s} ${c(i[0], r)}${l}`);
|
|
43
|
-
}
|
|
44
|
-
function P(t, n = {}) {
|
|
45
|
-
return t == null ? { text: "no value", omittedValues: 0 } : Array.isArray(t) ? {
|
|
46
|
-
text: w(t, d, n.maxListedValues),
|
|
47
|
-
omittedValues: $(t.length, n.maxListedValues)
|
|
48
|
-
} : { text: c(t), omittedValues: 0 };
|
|
49
|
-
}
|
|
50
|
-
function c(t, n = d) {
|
|
51
|
-
if (n.kind !== "plain") {
|
|
52
|
-
const e = b(t, n);
|
|
53
|
-
if (e !== void 0) return e;
|
|
54
|
-
}
|
|
55
|
-
return t instanceof Date ? b(t, g) ?? JSON.stringify(String(t)) : t === void 0 ? "null" : typeof t == "number" || typeof t == "boolean" || t === null ? String(t) : JSON.stringify(t) ?? String(t);
|
|
56
|
-
}
|
|
57
|
-
function w(t, n = d, e = Number.POSITIVE_INFINITY) {
|
|
58
|
-
const i = t.slice(0, Number.isFinite(e) ? e : void 0).map((o) => c(o, n)).join(", "), r = $(t.length, e);
|
|
59
|
-
return r > 0 ? `${i}, and ${r} more values` : i;
|
|
60
|
-
}
|
|
61
|
-
function $(t, n = Number.POSITIVE_INFINITY) {
|
|
62
|
-
return Math.max(0, t - n);
|
|
63
|
-
}
|
|
64
|
-
function f(t) {
|
|
65
|
-
if (t instanceof Date)
|
|
66
|
-
return Number.isNaN(t.getTime()) ? void 0 : { kind: "instant", instant: t };
|
|
67
|
-
if (typeof t != "string") return;
|
|
68
|
-
const n = N(t);
|
|
69
|
-
return n === "instant" ? { kind: n, instant: new Date(t) } : n ? { kind: n, text: t } : void 0;
|
|
70
|
-
}
|
|
71
|
-
function b(t, n) {
|
|
72
|
-
if (n.kind === "bucket")
|
|
73
|
-
return typeof t == "string" && T(t, n.bucket).ok ? t : void 0;
|
|
74
|
-
const e = f(t);
|
|
75
|
-
if (e)
|
|
76
|
-
return e.kind === "instant" ? e.instant.toISOString() : e.text;
|
|
77
|
-
}
|
|
78
|
-
function S(t, n, e, i) {
|
|
79
|
-
const r = e.kind === "temporal" ? f(t) : void 0, o = e.kind === "temporal" ? f(n) : void 0;
|
|
80
|
-
if (i && (r == null ? void 0 : r.kind) === "instant" && (o == null ? void 0 : o.kind) === "instant") {
|
|
81
|
-
const s = h(r.instant, i), l = h(o.instant, i);
|
|
82
|
-
if (s && l && s.time === "00:00:00" && r.instant.getUTCMilliseconds() === 0 && l.time === "23:59:59" && [0, 999].includes(o.instant.getUTCMilliseconds()))
|
|
83
|
-
return { from: s.date, to: l.date, wholeDaysIn: i };
|
|
84
|
-
}
|
|
85
|
-
return { from: c(t, e), to: c(n, e) };
|
|
86
|
-
}
|
|
87
|
-
function h(t, n) {
|
|
88
|
-
try {
|
|
89
|
-
const e = Object.fromEntries(
|
|
90
|
-
new Intl.DateTimeFormat("en-CA", {
|
|
91
|
-
timeZone: n,
|
|
92
|
-
year: "numeric",
|
|
93
|
-
month: "2-digit",
|
|
94
|
-
day: "2-digit",
|
|
95
|
-
hour: "2-digit",
|
|
96
|
-
minute: "2-digit",
|
|
97
|
-
second: "2-digit",
|
|
98
|
-
hourCycle: "h23"
|
|
99
|
-
}).formatToParts(t).map((i) => [i.type, i.value])
|
|
100
|
-
);
|
|
101
|
-
return {
|
|
102
|
-
date: `${e.year}-${e.month}-${e.day}`,
|
|
103
|
-
time: `${e.hour}:${e.minute}:${e.second}`
|
|
104
|
-
};
|
|
105
|
-
} catch {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function V(t, n) {
|
|
110
|
-
const { label: e, definition: i } = p(t), r = n && !I(t).dataAnchored ? `; last resolved here as ${n.from} to ${n.to}${n.wholeDaysIn ? `, whole days in ${n.wholeDaysIn}` : ""}` : "";
|
|
111
|
-
return `${e ? `${JSON.stringify(e)} ` : ""}(relative window: ${i}; resolved again at run time${r})`;
|
|
112
|
-
}
|
|
113
|
-
const A = {
|
|
114
|
-
"=": "=",
|
|
115
|
-
"!=": "!=",
|
|
116
|
-
">": ">",
|
|
117
|
-
">=": ">=",
|
|
118
|
-
"<": "<",
|
|
119
|
-
"<=": "<=",
|
|
120
|
-
in: "in",
|
|
121
|
-
"not in": "not in",
|
|
122
|
-
like: "like",
|
|
123
|
-
"not like": "not like",
|
|
124
|
-
between: "between",
|
|
125
|
-
"not between": "not between",
|
|
126
|
-
"is null": "isNull",
|
|
127
|
-
"is not null": "isNotNull"
|
|
128
|
-
};
|
|
129
|
-
function W(t, n, e = {}) {
|
|
130
|
-
const i = t.valueType === "date";
|
|
131
|
-
return O({
|
|
132
|
-
subject: n,
|
|
133
|
-
operator: A[t.operation],
|
|
134
|
-
values: t.values,
|
|
135
|
-
reading: i ? g : d,
|
|
136
|
-
...i ? { relative: y(t.relativeMeta) } : {}
|
|
137
|
-
}, e);
|
|
138
|
-
}
|
|
139
|
-
export {
|
|
140
|
-
d as P,
|
|
141
|
-
g as T,
|
|
142
|
-
O as a,
|
|
143
|
-
P as b,
|
|
144
|
-
W as d,
|
|
145
|
-
$ as o
|
|
146
|
-
};
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
var v = Object.defineProperty;
|
|
2
|
-
var k = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var C = (t, e, n) => k(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { R as O } from "./analytics-base-schemas-8wz9vqn_.js";
|
|
5
|
-
const D = /* @__PURE__ */ new Map();
|
|
6
|
-
function h(t, e) {
|
|
7
|
-
let n = D.get(e);
|
|
8
|
-
n || (n = new Intl.DateTimeFormat("en-CA", {
|
|
9
|
-
calendar: "gregory",
|
|
10
|
-
numberingSystem: "latn",
|
|
11
|
-
timeZone: e,
|
|
12
|
-
year: "numeric",
|
|
13
|
-
month: "2-digit",
|
|
14
|
-
day: "2-digit",
|
|
15
|
-
hour: "2-digit",
|
|
16
|
-
minute: "2-digit",
|
|
17
|
-
second: "2-digit",
|
|
18
|
-
hourCycle: "h23"
|
|
19
|
-
}), D.set(e, n));
|
|
20
|
-
const r = n.formatToParts(t), a = (o) => {
|
|
21
|
-
var s;
|
|
22
|
-
return Number((s = r.find((i) => i.type === o)) == null ? void 0 : s.value);
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
year: a("year"),
|
|
26
|
-
month: a("month"),
|
|
27
|
-
day: a("day"),
|
|
28
|
-
hour: a("hour"),
|
|
29
|
-
minute: a("minute"),
|
|
30
|
-
second: a("second")
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function u(t) {
|
|
34
|
-
const e = /* @__PURE__ */ new Date(0);
|
|
35
|
-
return e.setUTCFullYear(t.year, t.month - 1, t.day), e.setUTCHours(t.hour, t.minute, t.second, t.millisecond ?? 0), e.getTime();
|
|
36
|
-
}
|
|
37
|
-
function l(t, e) {
|
|
38
|
-
const n = t - (t % 1e3 + 1e3) % 1e3;
|
|
39
|
-
return u(h(new Date(n), e)) - n;
|
|
40
|
-
}
|
|
41
|
-
const T = 864e5;
|
|
42
|
-
function U(t, e) {
|
|
43
|
-
const n = I(t, e);
|
|
44
|
-
if (n.length) return n[0];
|
|
45
|
-
const r = u(t);
|
|
46
|
-
return new Date(r - l(r - T, e));
|
|
47
|
-
}
|
|
48
|
-
function I(t, e) {
|
|
49
|
-
const n = u(t), r = l(n - T, e), a = l(n + T, e);
|
|
50
|
-
return [.../* @__PURE__ */ new Set([r, a])].map((o) => n - o).filter((o) => l(o, e) === n - o).sort((o, s) => o - s).map((o) => new Date(o));
|
|
51
|
-
}
|
|
52
|
-
const p = 864e5, b = {
|
|
53
|
-
second: 1e3,
|
|
54
|
-
minute: 6e4,
|
|
55
|
-
hour: 36e5
|
|
56
|
-
};
|
|
57
|
-
function w(t, e) {
|
|
58
|
-
return {
|
|
59
|
-
...h(t, e),
|
|
60
|
-
millisecond: (t.getTime() % 1e3 + 1e3) % 1e3
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function d(t, e) {
|
|
64
|
-
return U(t, e);
|
|
65
|
-
}
|
|
66
|
-
function y(t) {
|
|
67
|
-
const e = new Date(t);
|
|
68
|
-
return {
|
|
69
|
-
year: e.getUTCFullYear(),
|
|
70
|
-
month: e.getUTCMonth() + 1,
|
|
71
|
-
day: e.getUTCDate(),
|
|
72
|
-
hour: e.getUTCHours(),
|
|
73
|
-
minute: e.getUTCMinutes(),
|
|
74
|
-
second: e.getUTCSeconds(),
|
|
75
|
-
millisecond: e.getUTCMilliseconds()
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function A(t, e) {
|
|
79
|
-
const n = /* @__PURE__ */ new Date(0);
|
|
80
|
-
return n.setUTCFullYear(t, e, 0), n.getUTCDate();
|
|
81
|
-
}
|
|
82
|
-
function f(t, e) {
|
|
83
|
-
const n = t.year * 12 + (t.month - 1) + e, r = Math.floor(n / 12), a = n - r * 12 + 1;
|
|
84
|
-
return { ...t, year: r, month: a, day: Math.min(t.day, A(r, a)) };
|
|
85
|
-
}
|
|
86
|
-
function m(t, e, n) {
|
|
87
|
-
if (e === 0) return t;
|
|
88
|
-
switch (n) {
|
|
89
|
-
case "second":
|
|
90
|
-
case "minute":
|
|
91
|
-
case "hour":
|
|
92
|
-
return y(
|
|
93
|
-
u(t) + e * b[n]
|
|
94
|
-
);
|
|
95
|
-
case "day":
|
|
96
|
-
return y(u(t) + e * p);
|
|
97
|
-
case "week":
|
|
98
|
-
return y(u(t) + e * 7 * p);
|
|
99
|
-
case "month":
|
|
100
|
-
return f(t, e);
|
|
101
|
-
case "quarter":
|
|
102
|
-
return f(t, e * 3);
|
|
103
|
-
case "year":
|
|
104
|
-
return f(t, e * 12);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function W(t) {
|
|
108
|
-
return new Date(
|
|
109
|
-
u({ ...t, hour: 0, minute: 0, second: 0 })
|
|
110
|
-
).getUTCDay();
|
|
111
|
-
}
|
|
112
|
-
function _(t) {
|
|
113
|
-
var n;
|
|
114
|
-
const e = (n = t.fiscalCalendar) == null ? void 0 : n.yearStartMonth;
|
|
115
|
-
return e && e >= 1 && e <= 12 ? e : 1;
|
|
116
|
-
}
|
|
117
|
-
function L(t, e, n) {
|
|
118
|
-
const r = { ...t, hour: 0, minute: 0, second: 0, millisecond: 0 };
|
|
119
|
-
switch (e) {
|
|
120
|
-
case "day":
|
|
121
|
-
return r;
|
|
122
|
-
case "week":
|
|
123
|
-
return m(
|
|
124
|
-
r,
|
|
125
|
-
-((W(t) - n.weekStart + 7) % 7),
|
|
126
|
-
"day"
|
|
127
|
-
);
|
|
128
|
-
case "month":
|
|
129
|
-
return { ...r, day: 1 };
|
|
130
|
-
case "quarter": {
|
|
131
|
-
const a = (t.month - _(n) + 12) % 12;
|
|
132
|
-
return f({ ...r, day: 1 }, -(a % 3));
|
|
133
|
-
}
|
|
134
|
-
case "year": {
|
|
135
|
-
const a = _(n);
|
|
136
|
-
return {
|
|
137
|
-
...r,
|
|
138
|
-
year: t.month >= a ? t.year : t.year - 1,
|
|
139
|
-
month: a,
|
|
140
|
-
day: 1
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function R(t, e, n, r = 0) {
|
|
146
|
-
const a = b[e];
|
|
147
|
-
if (a !== void 0) {
|
|
148
|
-
const i = w(t, n.tz), S = i.millisecond + (e === "second" ? 0 : i.second * 1e3) + (e === "hour" ? i.minute * 6e4 : 0), g = t.getTime() - S + r * a;
|
|
149
|
-
return { start: new Date(g), endExclusive: new Date(g + a) };
|
|
150
|
-
}
|
|
151
|
-
const o = e, s = m(
|
|
152
|
-
L(w(t, n.tz), o, n),
|
|
153
|
-
r,
|
|
154
|
-
e
|
|
155
|
-
);
|
|
156
|
-
return {
|
|
157
|
-
start: d(s, n.tz),
|
|
158
|
-
endExclusive: d(m(s, 1, e), n.tz)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
function B(t, e, n) {
|
|
162
|
-
return R(t, e, n).start;
|
|
163
|
-
}
|
|
164
|
-
function H(t, e, n) {
|
|
165
|
-
return new Date(R(t, e, n).endExclusive.getTime() - 1);
|
|
166
|
-
}
|
|
167
|
-
function V(t, e, n, r) {
|
|
168
|
-
return e === 0 ? t : d(
|
|
169
|
-
m(w(t, r.tz), e, n),
|
|
170
|
-
r.tz
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
function G(t, e, n) {
|
|
174
|
-
const r = (a) => {
|
|
175
|
-
const { year: o, month: s, day: i } = h(a, n);
|
|
176
|
-
return u({ year: o, month: s, day: i, hour: 0, minute: 0, second: 0 });
|
|
177
|
-
};
|
|
178
|
-
return Math.round((r(e) - r(t)) / p);
|
|
179
|
-
}
|
|
180
|
-
const P = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
181
|
-
function J(t, e) {
|
|
182
|
-
const { year: n, month: r, day: a } = h(t, e);
|
|
183
|
-
return `${String(n).padStart(4, "0")}-${String(r).padStart(2, "0")}-${String(a).padStart(2, "0")}`;
|
|
184
|
-
}
|
|
185
|
-
function K(t) {
|
|
186
|
-
const e = P.exec(t);
|
|
187
|
-
if (!e) return null;
|
|
188
|
-
const n = Number(e[1]), r = Number(e[2]), a = Number(e[3]);
|
|
189
|
-
return r < 1 || r > 12 || a < 1 || a > A(n, r) ? null : { year: n, month: r, day: a };
|
|
190
|
-
}
|
|
191
|
-
function Q(t, e) {
|
|
192
|
-
const n = K(t);
|
|
193
|
-
if (!n) return null;
|
|
194
|
-
const r = { ...n, hour: 0, minute: 0, second: 0, millisecond: 0 };
|
|
195
|
-
return {
|
|
196
|
-
start: d(r, e),
|
|
197
|
-
endExclusive: d(m(r, 1, "day"), e)
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
class c extends Error {
|
|
201
|
-
constructor(n) {
|
|
202
|
-
super(n);
|
|
203
|
-
C(this, "code");
|
|
204
|
-
this.name = "RawTemporalMetadataContractError", this.code = O.invalidMetadata;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function $(t) {
|
|
208
|
-
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
209
|
-
return !1;
|
|
210
|
-
const e = Object.getPrototypeOf(t);
|
|
211
|
-
return e === null || e === Object.prototype;
|
|
212
|
-
}
|
|
213
|
-
function x(t) {
|
|
214
|
-
if (!$(t))
|
|
215
|
-
throw new c(
|
|
216
|
-
"Raw temporal metadata must be an object."
|
|
217
|
-
);
|
|
218
|
-
const e = Object.keys(t);
|
|
219
|
-
if (e.length !== 2 || !e.includes("kind") || !e.includes("valueKind"))
|
|
220
|
-
throw new c(
|
|
221
|
-
"Raw temporal metadata must contain only kind and valueKind."
|
|
222
|
-
);
|
|
223
|
-
if (t.kind !== "raw_temporal")
|
|
224
|
-
throw new c(
|
|
225
|
-
"Raw temporal metadata kind must be raw_temporal."
|
|
226
|
-
);
|
|
227
|
-
if (t.valueKind !== "date" && t.valueKind !== "wall_datetime" && t.valueKind !== "instant")
|
|
228
|
-
throw new c(
|
|
229
|
-
"Raw temporal valueKind must be date, wall_datetime, or instant."
|
|
230
|
-
);
|
|
231
|
-
return {
|
|
232
|
-
kind: "raw_temporal",
|
|
233
|
-
valueKind: t.valueKind
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function X(t, e) {
|
|
237
|
-
if (!t.rawTemporal) {
|
|
238
|
-
if (e.metadataRequired)
|
|
239
|
-
throw new c(
|
|
240
|
-
"Activated raw temporal result is missing metadata."
|
|
241
|
-
);
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
if (t.temporalBucket)
|
|
245
|
-
throw new c(
|
|
246
|
-
"A result column cannot carry both raw and grouped temporal metadata."
|
|
247
|
-
);
|
|
248
|
-
const n = x(t.rawTemporal), r = n.valueKind === "date" ? "date" : "datetime";
|
|
249
|
-
if (t.dataType !== r)
|
|
250
|
-
throw new c(
|
|
251
|
-
`${n.valueKind} raw temporal values require dataType ${r}.`
|
|
252
|
-
);
|
|
253
|
-
return n;
|
|
254
|
-
}
|
|
255
|
-
const M = /^(\d{4})-(\d{2})-(\d{2})$/, N = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, E = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/;
|
|
256
|
-
function tt(t) {
|
|
257
|
-
if (M.test(t)) return "date";
|
|
258
|
-
if (E.test(t)) return "instant";
|
|
259
|
-
if (N.test(t)) return "wall_datetime";
|
|
260
|
-
}
|
|
261
|
-
function j(t) {
|
|
262
|
-
return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
|
|
263
|
-
}
|
|
264
|
-
function F(t, e) {
|
|
265
|
-
return e === 2 ? j(t) ? 29 : 28 : [4, 6, 9, 11].includes(e) ? 30 : 31;
|
|
266
|
-
}
|
|
267
|
-
function Y(t) {
|
|
268
|
-
return t.year >= 1 && t.year <= 9999 && t.month >= 1 && t.month <= 12 && t.day >= 1 && t.day <= F(t.year, t.month) && t.hour >= 0 && t.hour <= 23 && t.minute >= 0 && t.minute <= 59 && t.second >= 0 && t.second <= 59;
|
|
269
|
-
}
|
|
270
|
-
function q(t) {
|
|
271
|
-
return {
|
|
272
|
-
year: Number(t[1]),
|
|
273
|
-
month: Number(t[2]),
|
|
274
|
-
day: Number(t[3]),
|
|
275
|
-
hour: Number(t[4] ?? 0),
|
|
276
|
-
minute: Number(t[5] ?? 0),
|
|
277
|
-
second: Number(t[6] ?? 0),
|
|
278
|
-
fraction: t[7] ?? ""
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
function et(t, e) {
|
|
282
|
-
const n = e === "date" ? t.match(M) : e === "wall_datetime" ? t.match(N) : t.match(E);
|
|
283
|
-
if (!n) return { status: "invalid_shape" };
|
|
284
|
-
const r = q(n);
|
|
285
|
-
if (!Y(r)) return { status: "out_of_range" };
|
|
286
|
-
if (e === "instant") {
|
|
287
|
-
const a = n[8];
|
|
288
|
-
if (a && a !== "Z") {
|
|
289
|
-
const [s, i] = a.slice(1).split(":").map(Number);
|
|
290
|
-
if (s > 23 || i > 59) return { status: "out_of_range" };
|
|
291
|
-
}
|
|
292
|
-
const o = new Date(t.replace(" ", "T"));
|
|
293
|
-
return Number.isNaN(o.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: r, instant: o };
|
|
294
|
-
}
|
|
295
|
-
return { status: "valid", fields: r };
|
|
296
|
-
}
|
|
297
|
-
export {
|
|
298
|
-
b as E,
|
|
299
|
-
c as R,
|
|
300
|
-
et as a,
|
|
301
|
-
h as b,
|
|
302
|
-
tt as c,
|
|
303
|
-
u as d,
|
|
304
|
-
U as e,
|
|
305
|
-
A as f,
|
|
306
|
-
W as g,
|
|
307
|
-
L as h,
|
|
308
|
-
d as i,
|
|
309
|
-
R as j,
|
|
310
|
-
B as k,
|
|
311
|
-
H as l,
|
|
312
|
-
V as m,
|
|
313
|
-
G as n,
|
|
314
|
-
J as o,
|
|
315
|
-
x as p,
|
|
316
|
-
K as q,
|
|
317
|
-
Q as r,
|
|
318
|
-
m as s,
|
|
319
|
-
X as v,
|
|
320
|
-
w,
|
|
321
|
-
I as z
|
|
322
|
-
};
|