react-semaphor 0.1.526 → 0.1.527
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/DATA_APP_SDK.md +5 -1
- package/dist/analytics-protocol/index.js +1179 -296
- package/dist/brand-studio/index.js +15 -15
- package/dist/briefings/index.js +50 -49
- package/dist/chunks/{calculated-field-identity-D1ofR4KJ.js → calculated-field-identity-DEhjPSr-.js} +66 -65
- package/dist/chunks/{card-config-utils-9sv4e-Vb.js → card-config-utils-BlIbwkuD.js} +68 -65
- package/dist/chunks/{constants-DeLIHVAW.js → constants-DNWVy8Y3.js} +4 -4
- package/dist/chunks/dashboard-JNHR0_cZ.js +14 -0
- package/dist/chunks/{dashboard-briefing-launcher-DXz1GhFZ.js → dashboard-briefing-launcher-D9pFByPh.js} +372 -359
- package/dist/chunks/{dashboard-controls-Df8qOSrs.js → dashboard-controls-CJI5ZWMq.js} +739 -686
- package/dist/chunks/{dashboard-json-Xldp0qww.js → dashboard-json-DLdrFry-.js} +10 -10
- package/dist/chunks/{edit-dashboard-visual-COHBqyic.js → edit-dashboard-visual-D5LjWle1.js} +6603 -6572
- package/dist/chunks/{editor-action-buttons-DahlP57T.js → editor-action-buttons-G91NQKxU.js} +266 -267
- package/dist/chunks/{field-aggregations-BQjogiI1.js → field-aggregations-DeVQLIsP.js} +19 -19
- package/dist/chunks/{field-dependencies-v-lJNzC7.js → field-dependencies-CGYic38w.js} +1 -1
- package/dist/chunks/{index-CbjuruKe.js → index-BvJOYbNv.js} +755 -745
- package/dist/chunks/{matrix-analytical-definition-BimC4XIV.js → matrix-analytical-definition-BJyH5-99.js} +1 -1
- package/dist/chunks/{matrix-card-CIlz0Dnp.js → matrix-card-DY45yiUM.js} +7 -6
- package/dist/chunks/{matrix-control-sources-2VAzGlt8.js → matrix-control-sources-BypfLZsK.js} +11 -11
- package/dist/chunks/{matrix-definition-E5gXXSTZ.js → matrix-definition-Cdn3LoxW.js} +3 -3
- package/dist/chunks/{semantic-format-Baqp8kD_.js → matrix-formatter-BoKU3MzZ.js} +655 -511
- package/dist/chunks/{matrix-member-presentation-Bw7-JCrr.js → matrix-member-presentation-BBW0n1iY.js} +1 -1
- package/dist/chunks/matrix-operation-contract-BV02rLhu.js +809 -0
- package/dist/chunks/{metric-comparison-BphoJ9bq.js → metric-comparison-Crljx_XY.js} +15 -10
- package/dist/chunks/{numeric-presentation-VhMUHfrJ.js → numeric-presentation-LvnNY5Ma.js} +68 -68
- package/dist/chunks/pivot-header-presentation-D5v8uyjj.js +618 -0
- package/dist/chunks/{pivot-result-identity-BzUQiCEV.js → pivot-result-identity-CY__BuwI.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-BFO354lk.js → pivot-result-lifecycle-BWrPhlGT.js} +259 -204
- package/dist/chunks/{raw-temporal-7bFbXd2a.js → raw-temporal-CdnA_OXJ.js} +10 -10
- package/dist/chunks/{raw-temporal-contract-BQZIJ1fn.js → raw-temporal-contract-Bc9z83t-.js} +1 -1
- package/dist/chunks/relative-date-DAF9J7mt.js +456 -0
- package/dist/chunks/{report-preferences-dialog-BcH-0lR-.js → report-preferences-dialog-D3hxu4sE.js} +131 -132
- package/dist/chunks/{report-runtime-context-CxIoGyNM.js → report-runtime-context-CtaGGlit.js} +1 -1
- package/dist/chunks/{selection-reducer-NF5C07yM.js → selection-reducer-C7Um5XN-.js} +47 -26
- package/dist/chunks/semantic-format-BjBMOSoo.js +192 -0
- package/dist/chunks/{semaphor-ready-indicator-BLRDuLr4.js → semaphor-ready-indicator-D46I_4g7.js} +49895 -46141
- package/dist/chunks/{slider-BYIH4icg.js → slider-B6LELqx6.js} +81 -82
- package/dist/chunks/{source-entity-resolution-Bzefiive.js → source-entity-resolution-Bde29mqE.js} +25 -25
- package/dist/chunks/switch-_7uBAbYx.js +24003 -0
- package/dist/chunks/{temporal-bucket-PcLFSYWX.js → temporal-bucket-DlFuhCnT.js} +6 -6
- package/dist/chunks/{temporal-bucket-contract-DTLDRzgV.js → temporal-bucket-contract-C6lUGPS3.js} +1 -1
- package/dist/chunks/temporal-input-presentation-DyMWCZYh.js +195 -0
- package/dist/chunks/{token-types-BC6RcUY8.js → token-types-UjyNz95-.js} +1 -1
- package/dist/chunks/{validators-CsdOtZI6.js → validators-CQcG0EPN.js} +852 -731
- package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +46 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +138 -137
- package/dist/data-app-sdk/index.js +12 -12
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +27 -26
- package/dist/format-utils/index.js +247 -329
- package/dist/index.js +165 -168
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/briefings/index.d.ts +3 -0
- package/dist/types/components/explorer/filters/card-date-filter.d.ts +13 -5
- package/dist/types/components/explorer/filters/card-date-selection.d.ts +28 -0
- package/dist/types/components/sharing-and-management/dashboard-actions-menu.d.ts +1 -1
- package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +0 -1
- package/dist/types/components/surfboard/download-settings-dialog.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +8 -29
- package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +5 -1
- package/dist/types/components/ui-custom/date-range-picker.d.ts +18 -2
- package/dist/types/components/ui-custom/date-range-presets.d.ts +8 -21
- package/dist/types/components/ui-custom/report-calendar.d.ts +18 -0
- package/dist/types/components/visual/aggregated-table/utils/export-utils.d.ts +3 -5
- package/dist/types/components/visual/data-table/data-table-toolbar.d.ts +1 -1
- package/dist/types/components/visual/pivot-table/utils/pivot-table-export-utils.d.ts +3 -1
- package/dist/types/index.js +5 -5
- package/dist/types/lib/api/exports-api.d.ts +3 -0
- package/dist/types/lib/csv-download.d.ts +9 -0
- package/dist/types/lib/csv-encoding-options.d.ts +6 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +2 -1
- package/dist/types/lib/dashboard-navigation/build-carried-click-context.d.ts +0 -1
- package/dist/types/lib/document/document-input-runtime.d.ts +2 -1
- package/dist/types/lib/export-utils.d.ts +17 -15
- package/dist/types/lib/hooks/explorer/use-filter-builder.d.ts +2 -2
- package/dist/types/lib/hooks/use-relative-date-summarizer.d.ts +7 -0
- package/dist/types/lib/matrix-table/matrix-application-adapter.d.ts +3 -2
- package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-card-draft.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-dataset-history.d.ts +47 -0
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +7 -3
- package/dist/types/lib/matrix-table/matrix-execution-context.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-query-transport.d.ts +4 -1
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +105 -4
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +43 -2
- package/dist/types/lib/matrix-table/use-matrix.d.ts +6 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +5 -1
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +0 -1
- package/dist/types/lib/query-context/build-global-date-comparison-context.d.ts +1 -2
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +1 -2
- package/dist/types/lib/query-context/dashboard-card-query-key.d.ts +10 -0
- package/dist/types/lib/query-context/query-auth-scope.d.ts +5 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +9 -4
- package/dist/types/lib/temporal-filter/temporal-filter-utils.d.ts +9 -2
- package/dist/types/lib/types/common-types.d.ts +5 -0
- package/dist/types/lib/types/explorer-types.d.ts +14 -0
- package/dist/types/lib/types/token-types.d.ts +0 -1
- package/dist/types/lib/utils/card-definition.d.ts +1 -1
- package/dist/types/lib/utils/date-timezone-utils.d.ts +4 -46
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +8 -2
- package/dist/types/lib/utils/inline-filter-utils.d.ts +3 -2
- package/dist/types/lib/utils/relative-date-description.d.ts +38 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +10 -7
- package/dist/types/shared/analytics-protocol/index.d.ts +12 -1
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +20 -20
- package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +10 -10
- package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +8 -8
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +51 -5
- package/dist/types/shared/analytics-protocol/metric-comparison.d.ts +9 -3
- package/dist/types/shared/analytics-protocol/operation-temporal-state.d.ts +64 -0
- package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +61 -0
- package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +20 -0
- package/dist/types/shared/analytics-protocol/runtime-schemas.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +314 -0
- package/dist/types/shared/analytics-protocol/time-window.d.ts +13 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +8 -4
- package/dist/types/shared/format-utils/exporters/csv-utils.d.ts +46 -15
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -3
- package/dist/types/shared/format-utils/flat-table-export-totals.d.ts +2 -1
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +2 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +0 -42
- package/dist/types/shared/temporal/calendar-periods.d.ts +56 -0
- package/dist/types/shared/temporal/index.d.ts +5 -0
- package/dist/types/shared/temporal/relative-date.d.ts +21 -0
- package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +73 -0
- package/dist/types/shared/temporal/time-window-periods.d.ts +21 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +23 -0
- package/package.json +1 -17
- package/src/data-app-sdk/README.md +6 -3
- package/dist/chunks/code-highlight-994tgM9v.js +0 -22265
- package/dist/chunks/dashboard-CsHvEtjN.js +0 -15
- package/dist/chunks/dashboard-date-comparison-definition-BqNhECUr.js +0 -183
- package/dist/chunks/matrix-formatter-WBgtebUT.js +0 -341
- package/dist/chunks/matrix-operation-contract-D32U2CSw.js +0 -1802
- package/dist/chunks/mouse-pointer-2-BZvGk45-.js +0 -19
- package/dist/chunks/pivot-header-presentation-CGtudHo7.js +0 -661
- package/dist/chunks/pre-block-Cq1RqhZX.js +0 -3987
- package/dist/chunks/search-CJz-QQ0Q.js +0 -24
- package/dist/chunks/switch-XaAACBrJ.js +0 -2234
- package/dist/chunks/temporal-input-presentation-2RJrvmYL.js +0 -222
- package/dist/chunks/update-policy-DhAUtiC8.js +0 -913
- package/dist/data-app-builder/index.js +0 -3666
- package/dist/data-app-builder-browser-runtime/index.js +0 -8
- package/dist/data-app-codegen/index.js +0 -22
- package/dist/data-app-codegen-node/index.js +0 -1807
- package/dist/types/components/data-app-runtime/published-data-app-runtime.d.ts +0 -7
- package/dist/types/components/surfboard/json-to-csv.d.ts +0 -7
- package/dist/types/components/visual/data-table/utils/export-utils.d.ts +0 -31
- package/dist/types/data-app-builder/browser-runtime.d.ts +0 -174
- package/dist/types/data-app-builder/constants.d.ts +0 -14
- package/dist/types/data-app-builder/data-app-builder.d.ts +0 -14
- package/dist/types/data-app-builder/index.d.ts +0 -1
- package/dist/types/data-app-builder/lib/api.d.ts +0 -36
- package/dist/types/data-app-builder/lib/context-select.d.ts +0 -3
- package/dist/types/data-app-builder/lib/diagnostics.d.ts +0 -12
- package/dist/types/data-app-builder/lib/file-tree.d.ts +0 -2
- package/dist/types/data-app-builder/types.d.ts +0 -558
- package/dist/types/data-app-builder-browser-runtime.d.ts +0 -2
- package/dist/types/data-app-builder.d.ts +0 -2
- package/dist/types/data-app-codegen/generate-contract.d.ts +0 -26
- package/dist/types/data-app-codegen/generated-contract-files.d.ts +0 -7
- package/dist/types/data-app-codegen/generated-contract-validation.d.ts +0 -13
- package/dist/types/data-app-codegen/index.d.ts +0 -6
- package/dist/types/data-app-codegen/live-execution.d.ts +0 -42
- package/dist/types/data-app-codegen/node.d.ts +0 -2
- package/dist/types/data-app-codegen/update-policy.d.ts +0 -25
- package/dist/types/data-app-codegen/validation.d.ts +0 -8
- package/dist/types/data-app-codegen-node.d.ts +0 -2
- package/dist/types/data-app-codegen.d.ts +0 -2
- package/dist/types/shared/analytics-protocol/data-app-codegen-summary.d.ts +0 -418
- package/dist/types/shared/format-utils/exporters/pivot-exporter.d.ts +0 -13
- package/dist/types/shared/format-utils/exporters/table-exporter.d.ts +0 -10
|
@@ -1,913 +0,0 @@
|
|
|
1
|
-
import { S as Q, a as X, v as Z, Q as ee } from "./matrix-operation-contract-D32U2CSw.js";
|
|
2
|
-
import { toSemaphorInputOptionsIntent as te, toSemaphorAnalysisQueryOptions as re, toSemaphorAnalysisIntent as ne, toSemaphorMetricIntent as ae, toSemaphorRecordsIntent as se, toSemaphorMatrixIntent as ie, toSemaphorSqlIntent as oe } from "../data-app-sdk-adapters/index.js";
|
|
3
|
-
import "./validators-CsdOtZI6.js";
|
|
4
|
-
const Ye = Q, x = X, G = "semaphor-generated-data-app-contract/v1", T = "semaphor-generated-data-app-contract-manifest/v1";
|
|
5
|
-
function P(e) {
|
|
6
|
-
return w(e) ? [
|
|
7
|
-
...Z(e).issues,
|
|
8
|
-
...ce(e)
|
|
9
|
-
] : ["Plan artifact must be a Semaphor codegenSummary object."];
|
|
10
|
-
}
|
|
11
|
-
function Qe(e) {
|
|
12
|
-
const t = P(e);
|
|
13
|
-
if (t.length > 0)
|
|
14
|
-
throw new Error(`Invalid Semaphor codegenSummary:
|
|
15
|
-
- ${t.join(`
|
|
16
|
-
- `)}`);
|
|
17
|
-
}
|
|
18
|
-
function ce(e) {
|
|
19
|
-
var r;
|
|
20
|
-
const t = w(e);
|
|
21
|
-
if (!t)
|
|
22
|
-
return [];
|
|
23
|
-
const n = [];
|
|
24
|
-
return ((r = w(t.validation)) == null ? void 0 : r.status) === "blocked" && n.push(
|
|
25
|
-
"validation.status blocked cannot be generated. Resolve blocked semantic model gaps and replan before generating contract files."
|
|
26
|
-
), Array.isArray(t.unsupportedInsights) && t.unsupportedInsights.forEach((s, o) => {
|
|
27
|
-
var a;
|
|
28
|
-
((a = w(s)) == null ? void 0 : a.reason) === "missing_relationship" && n.push(
|
|
29
|
-
`unsupportedInsights.${o}.reason missing_relationship blocks contract generation. Call semaphor_propose_semantic_model_change, apply an approved semantic model patch, and replan before generating contract files.`
|
|
30
|
-
);
|
|
31
|
-
}), Array.isArray(t.views) && t.views.forEach((s, o) => {
|
|
32
|
-
var i;
|
|
33
|
-
const a = w((i = w(s)) == null ? void 0 : i.computation);
|
|
34
|
-
(a == null ? void 0 : a.kind) === "unsupported" && a.reason === "missing_relationship" && n.push(
|
|
35
|
-
`views.${o}.computation.reason missing_relationship blocks contract generation. Call semaphor_propose_semantic_model_change, apply an approved semantic model patch, and replan before generating contract files.`
|
|
36
|
-
);
|
|
37
|
-
}), n;
|
|
38
|
-
}
|
|
39
|
-
function w(e) {
|
|
40
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
41
|
-
}
|
|
42
|
-
const de = [
|
|
43
|
-
"sources.ts",
|
|
44
|
-
"fields.ts",
|
|
45
|
-
"inputs.ts",
|
|
46
|
-
"queries.ts",
|
|
47
|
-
"bindings.ts",
|
|
48
|
-
"accessors.ts",
|
|
49
|
-
"metadata.ts",
|
|
50
|
-
"index.ts"
|
|
51
|
-
], ue = [
|
|
52
|
-
"USAGE.md"
|
|
53
|
-
], fe = [
|
|
54
|
-
...de,
|
|
55
|
-
...ue,
|
|
56
|
-
"contract.manifest.json"
|
|
57
|
-
];
|
|
58
|
-
async function Xe({
|
|
59
|
-
manifest: e,
|
|
60
|
-
generatedFiles: t
|
|
61
|
-
}) {
|
|
62
|
-
const n = [], r = y(e);
|
|
63
|
-
if (!r)
|
|
64
|
-
return {
|
|
65
|
-
issues: [
|
|
66
|
-
{
|
|
67
|
-
message: "Generated contract manifest must be an object.",
|
|
68
|
-
repairHint: "Regenerate the generated contract instead of hand-editing the manifest."
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
};
|
|
72
|
-
r.schemaVersion !== T && n.push({
|
|
73
|
-
path: "schemaVersion",
|
|
74
|
-
message: `schemaVersion must be ${T}. Regenerate the contract with semaphor_create_data_app_contract.`,
|
|
75
|
-
repairHint: "Regenerate the contract with semaphor_create_data_app_contract."
|
|
76
|
-
}), r.generatedContractSchemaVersion !== G && n.push({
|
|
77
|
-
path: "generatedContractSchemaVersion",
|
|
78
|
-
message: `generatedContractSchemaVersion must be ${G}. Regenerate the contract with semaphor_generate_data_app_contract.`,
|
|
79
|
-
repairHint: "Regenerate the contract with semaphor_generate_data_app_contract."
|
|
80
|
-
});
|
|
81
|
-
const s = y(r.generator);
|
|
82
|
-
S(s == null ? void 0 : s.name) || n.push({
|
|
83
|
-
path: "generator.name",
|
|
84
|
-
message: "generator.name is required.",
|
|
85
|
-
repairHint: "Regenerate the generated contract so manifest generator metadata is written deterministically."
|
|
86
|
-
}), S(s == null ? void 0 : s.version) || n.push({
|
|
87
|
-
path: "generator.version",
|
|
88
|
-
message: "generator.version is required.",
|
|
89
|
-
repairHint: "Regenerate the generated contract so manifest generator metadata is written deterministically."
|
|
90
|
-
});
|
|
91
|
-
for (const a of P(r.codegenSummary))
|
|
92
|
-
n.push({
|
|
93
|
-
path: `codegenSummary.${a}`,
|
|
94
|
-
message: `codegenSummary.${a}`,
|
|
95
|
-
repairHint: "Regenerate the generated contract from a valid Data App codegenSummary."
|
|
96
|
-
});
|
|
97
|
-
if (r.codegenSummaryValidatorVersion !== x && n.push({
|
|
98
|
-
path: "codegenSummaryValidatorVersion",
|
|
99
|
-
message: `codegenSummaryValidatorVersion must be ${x}. Regenerate the contract with semaphor_generate_data_app_contract.`,
|
|
100
|
-
repairHint: "Regenerate the contract with semaphor_generate_data_app_contract."
|
|
101
|
-
}), typeof r.codegenSummaryHash != "string")
|
|
102
|
-
n.push({
|
|
103
|
-
path: "codegenSummaryHash",
|
|
104
|
-
message: "codegenSummaryHash is required.",
|
|
105
|
-
repairHint: "Regenerate the generated contract so manifest hashes are written deterministically."
|
|
106
|
-
});
|
|
107
|
-
else if (y(r.codegenSummary)) {
|
|
108
|
-
const a = await he(
|
|
109
|
-
r.codegenSummary
|
|
110
|
-
);
|
|
111
|
-
r.codegenSummaryHash !== a && n.push({
|
|
112
|
-
path: "codegenSummaryHash",
|
|
113
|
-
message: "codegenSummaryHash does not match codegenSummary. Regenerate the contract instead of editing the manifest.",
|
|
114
|
-
repairHint: "Regenerate the generated contract instead of editing the manifest."
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
n.push(...le(r.codegenSummary));
|
|
118
|
-
const o = t ? pe(t) : [];
|
|
119
|
-
if (n.push(...o), t && o.length === 0 && n.push(...ge(t)), typeof r.generatedContentHash != "string")
|
|
120
|
-
n.push({
|
|
121
|
-
path: "generatedContentHash",
|
|
122
|
-
message: "generatedContentHash is required.",
|
|
123
|
-
repairHint: "Regenerate the generated contract so manifest hashes are written deterministically."
|
|
124
|
-
});
|
|
125
|
-
else if (t && o.length === 0) {
|
|
126
|
-
const a = await me(t);
|
|
127
|
-
r.generatedContentHash !== a && n.push({
|
|
128
|
-
path: "generatedContentHash",
|
|
129
|
-
message: "generatedContentHash does not match generated TypeScript files. Regenerate the contract instead of hand-editing generated files.",
|
|
130
|
-
repairHint: "Regenerate the contract instead of hand-editing generated files."
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
return { issues: n };
|
|
134
|
-
}
|
|
135
|
-
function pe(e) {
|
|
136
|
-
var r;
|
|
137
|
-
const t = [], n = new Set(fe);
|
|
138
|
-
for (const s of Object.keys(e)) {
|
|
139
|
-
if (s.includes("/") || s.includes("\\")) {
|
|
140
|
-
const o = ((r = s.split("/").pop()) == null ? void 0 : r.split("\\").pop()) || s;
|
|
141
|
-
t.push({
|
|
142
|
-
path: `generatedFiles.${s}`,
|
|
143
|
-
message: `generatedFiles keys must be generated filenames such as "${o}", not path-qualified keys such as "${s}".`,
|
|
144
|
-
repairHint: 'Pass generatedFiles keyed by filename, for example "queries.ts", not "src/semaphor/generated/queries.ts".'
|
|
145
|
-
});
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
n.has(s) || t.push({
|
|
149
|
-
path: `generatedFiles.${s}`,
|
|
150
|
-
message: `generatedFiles contains unknown generated contract file "${s}".`,
|
|
151
|
-
repairHint: "Pass only the generated files returned by semaphor_generate_data_app_contract, keyed by filename."
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
return t;
|
|
155
|
-
}
|
|
156
|
-
function ge(e) {
|
|
157
|
-
const t = e["USAGE.md"];
|
|
158
|
-
return typeof t != "string" ? [{
|
|
159
|
-
path: "generatedFiles.USAGE.md",
|
|
160
|
-
message: "generatedFiles.USAGE.md is required.",
|
|
161
|
-
repairHint: "Regenerate the generated contract so the generated usage guide is written."
|
|
162
|
-
}] : [
|
|
163
|
-
"queries",
|
|
164
|
-
"queryOptionsForView",
|
|
165
|
-
"rowsForView",
|
|
166
|
-
"metricValuesForView",
|
|
167
|
-
"kpiPropsForView",
|
|
168
|
-
"roleValuesForView",
|
|
169
|
-
"appInputSpecs",
|
|
170
|
-
"inputOptionQueries"
|
|
171
|
-
].filter((r) => !t.includes(`\`${r}\``)).map((r) => ({
|
|
172
|
-
path: "generatedFiles.USAGE.md",
|
|
173
|
-
message: `generatedFiles.USAGE.md must document ${r}.`,
|
|
174
|
-
repairHint: "Regenerate the generated contract so the usage guide matches generated exports."
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
function le(e) {
|
|
178
|
-
const t = y(e);
|
|
179
|
-
if (!t)
|
|
180
|
-
return [];
|
|
181
|
-
const n = [], r = new Set(
|
|
182
|
-
C(t.inputs).map((o) => {
|
|
183
|
-
var a;
|
|
184
|
-
return (a = y(o)) == null ? void 0 : a.id;
|
|
185
|
-
}).filter(S)
|
|
186
|
-
), s = new Set(
|
|
187
|
-
C(t.views).map((o) => {
|
|
188
|
-
var a;
|
|
189
|
-
return (a = y(o)) == null ? void 0 : a.id;
|
|
190
|
-
}).filter(S)
|
|
191
|
-
);
|
|
192
|
-
return C(t.filterContracts).forEach((o, a) => {
|
|
193
|
-
const i = y(o), c = i == null ? void 0 : i.inputId;
|
|
194
|
-
(!S(c) || !r.has(c)) && n.push({
|
|
195
|
-
path: `codegenSummary.filterContracts.${a}.inputId`,
|
|
196
|
-
message: `codegenSummary.filterContracts.${a}.inputId must reference a generated input.`,
|
|
197
|
-
repairHint: "Regenerate the generated contract from a valid planner output."
|
|
198
|
-
}), Array.isArray(i == null ? void 0 : i.bindings) && i.bindings.forEach((u, f) => {
|
|
199
|
-
const p = y(u), m = p == null ? void 0 : p.viewId;
|
|
200
|
-
(!S(m) || !s.has(m)) && n.push({
|
|
201
|
-
path: `codegenSummary.filterContracts.${a}.bindings.${f}.viewId`,
|
|
202
|
-
message: `codegenSummary.filterContracts.${a}.bindings.${f}.viewId must reference a generated view.`,
|
|
203
|
-
repairHint: "Regenerate the generated contract from a valid planner output."
|
|
204
|
-
});
|
|
205
|
-
const h = y(p == null ? void 0 : p.fieldRef);
|
|
206
|
-
S(h == null ? void 0 : h.name) || n.push({
|
|
207
|
-
path: `codegenSummary.filterContracts.${a}.bindings.${f}.fieldRef`,
|
|
208
|
-
message: `codegenSummary.filterContracts.${a}.bindings.${f}.fieldRef is required.`,
|
|
209
|
-
repairHint: "Regenerate the generated contract from a valid planner output."
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
}), n;
|
|
213
|
-
}
|
|
214
|
-
async function me(e) {
|
|
215
|
-
const t = Object.keys(e).filter((r) => r.endsWith(".ts")).sort();
|
|
216
|
-
let n = "";
|
|
217
|
-
for (const r of t)
|
|
218
|
-
n += `${r}\0${e[r]}\0`;
|
|
219
|
-
return `sha256:${await L(n)}`;
|
|
220
|
-
}
|
|
221
|
-
async function he(e) {
|
|
222
|
-
return `sha256:${await L(H(e))}`;
|
|
223
|
-
}
|
|
224
|
-
function H(e) {
|
|
225
|
-
if (e === null || typeof e != "object")
|
|
226
|
-
return JSON.stringify(e);
|
|
227
|
-
if (Array.isArray(e))
|
|
228
|
-
return `[${e.map((r) => H(r)).join(",")}]`;
|
|
229
|
-
const t = e;
|
|
230
|
-
return `{${Object.keys(t).sort().filter((r) => t[r] !== void 0).map((r) => `${JSON.stringify(r)}:${H(t[r])}`).join(",")}}`;
|
|
231
|
-
}
|
|
232
|
-
async function L(e) {
|
|
233
|
-
var r;
|
|
234
|
-
if (!((r = globalThis.crypto) != null && r.subtle))
|
|
235
|
-
throw new Error("SHA-256 digest support is required for generated contract validation.");
|
|
236
|
-
const t = new TextEncoder().encode(e), n = await globalThis.crypto.subtle.digest("SHA-256", t);
|
|
237
|
-
return Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
238
|
-
}
|
|
239
|
-
function y(e) {
|
|
240
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
241
|
-
}
|
|
242
|
-
function C(e) {
|
|
243
|
-
return Array.isArray(e) ? e : [];
|
|
244
|
-
}
|
|
245
|
-
function S(e) {
|
|
246
|
-
return typeof e == "string" && e.length > 0;
|
|
247
|
-
}
|
|
248
|
-
function Ze(e) {
|
|
249
|
-
const t = d(e), n = V(t), r = [], s = [];
|
|
250
|
-
return R(t == null ? void 0 : t.views).filter((o) => {
|
|
251
|
-
var i;
|
|
252
|
-
const a = d((i = d(o)) == null ? void 0 : i.sdkSpec);
|
|
253
|
-
return !!(a != null && a.builder && (a != null && a.spec));
|
|
254
|
-
}).forEach((o, a) => {
|
|
255
|
-
var u;
|
|
256
|
-
const i = String(((u = d(o)) == null ? void 0 : u.id) || `view_${a}`), c = ye(
|
|
257
|
-
o,
|
|
258
|
-
n
|
|
259
|
-
);
|
|
260
|
-
if (c) {
|
|
261
|
-
r.push({ viewId: i, ...c });
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
s.push({
|
|
265
|
-
viewId: i,
|
|
266
|
-
path: `views.${i}.sdkSpec`,
|
|
267
|
-
message: `Generated view execution validation could not build intent for "${i}".`
|
|
268
|
-
});
|
|
269
|
-
}), { requests: r, issues: s };
|
|
270
|
-
}
|
|
271
|
-
function ye(e, t) {
|
|
272
|
-
const n = d(e), r = d(n == null ? void 0 : n.sdkSpec), s = d(r == null ? void 0 : r.spec);
|
|
273
|
-
if (!n || !(r != null && r.builder) || !s)
|
|
274
|
-
return null;
|
|
275
|
-
const o = Se(t) ? t : V(d(t)), a = ke(r.builder), i = d(_(s, o)) || {}, c = _e({
|
|
276
|
-
view: n,
|
|
277
|
-
builder: a,
|
|
278
|
-
rawSpec: s,
|
|
279
|
-
spec: {
|
|
280
|
-
...i,
|
|
281
|
-
id: n.id,
|
|
282
|
-
label: He(n, s)
|
|
283
|
-
},
|
|
284
|
-
context: o
|
|
285
|
-
});
|
|
286
|
-
try {
|
|
287
|
-
if (a === "analysis") {
|
|
288
|
-
const u = c;
|
|
289
|
-
return {
|
|
290
|
-
intent: ne(u),
|
|
291
|
-
resultShape: "analysis",
|
|
292
|
-
analysisOptions: re(u)
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
if (a === "metric")
|
|
296
|
-
return {
|
|
297
|
-
intent: ae(c),
|
|
298
|
-
resultShape: "metric"
|
|
299
|
-
};
|
|
300
|
-
if (a === "records")
|
|
301
|
-
return {
|
|
302
|
-
intent: se(c),
|
|
303
|
-
resultShape: "records"
|
|
304
|
-
};
|
|
305
|
-
if (a === "matrix")
|
|
306
|
-
return {
|
|
307
|
-
intent: ie(c),
|
|
308
|
-
matrixWindowRequest: ee.parse(c.matrixWindowRequest),
|
|
309
|
-
resultShape: "matrix"
|
|
310
|
-
};
|
|
311
|
-
if (a === "sql")
|
|
312
|
-
return {
|
|
313
|
-
intent: oe(c),
|
|
314
|
-
resultShape: "sql"
|
|
315
|
-
};
|
|
316
|
-
} catch {
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
return null;
|
|
320
|
-
}
|
|
321
|
-
function et({
|
|
322
|
-
input: e,
|
|
323
|
-
filterContract: t,
|
|
324
|
-
codegenSummary: n
|
|
325
|
-
}) {
|
|
326
|
-
const r = d(e), s = d(t), o = d(r == null ? void 0 : r.optionQuery) || d(s == null ? void 0 : s.optionQuery);
|
|
327
|
-
if (!r || !o)
|
|
328
|
-
return null;
|
|
329
|
-
const a = V(d(n)), i = d(o.spec), c = Ae(o, i, a), u = o.valueFieldRef || o.valueField || (i == null ? void 0 : i.valueField), f = o.labelFieldRef || o.labelField || (i == null ? void 0 : i.labelField);
|
|
330
|
-
if (!c || !u || !f)
|
|
331
|
-
return null;
|
|
332
|
-
const m = {
|
|
333
|
-
...d(
|
|
334
|
-
_(i || {}, a)
|
|
335
|
-
) || {},
|
|
336
|
-
id: o.id || (i == null ? void 0 : i.id) || `${r.id}-options`,
|
|
337
|
-
inputId: r.id,
|
|
338
|
-
source: c,
|
|
339
|
-
valueField: u,
|
|
340
|
-
labelField: f,
|
|
341
|
-
population: o.population || (i == null ? void 0 : i.population),
|
|
342
|
-
dependencies: o.dependencies || (i == null ? void 0 : i.dependencies),
|
|
343
|
-
limit: o.limit || (i == null ? void 0 : i.limit) || 100
|
|
344
|
-
};
|
|
345
|
-
try {
|
|
346
|
-
return te(
|
|
347
|
-
_(m, a)
|
|
348
|
-
);
|
|
349
|
-
} catch {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function tt({
|
|
354
|
-
input: e,
|
|
355
|
-
filterContract: t,
|
|
356
|
-
binding: n,
|
|
357
|
-
option: r,
|
|
358
|
-
codegenSummary: s
|
|
359
|
-
}) {
|
|
360
|
-
const o = V(d(s)), a = d(e), i = d(t), c = d(n), u = _(
|
|
361
|
-
(c == null ? void 0 : c.fieldRef) || (i == null ? void 0 : i.fieldRef) || (a == null ? void 0 : a.fieldRef),
|
|
362
|
-
o
|
|
363
|
-
), f = String(
|
|
364
|
-
(i == null ? void 0 : i.operator) || (a == null ? void 0 : a.operator) || "in"
|
|
365
|
-
), p = Ke(c);
|
|
366
|
-
return {
|
|
367
|
-
inputId: String((i == null ? void 0 : i.inputId) || (a == null ? void 0 : a.id) || ""),
|
|
368
|
-
kind: "filter",
|
|
369
|
-
operator: f,
|
|
370
|
-
value: xe(f, r.value),
|
|
371
|
-
isActive: !0,
|
|
372
|
-
...u ? { field: u } : {},
|
|
373
|
-
...p ? { relationshipHint: p } : {}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function V(e) {
|
|
377
|
-
return {
|
|
378
|
-
sourcesByKey: new Map(
|
|
379
|
-
R(e == null ? void 0 : e.sources).map(d).filter(Me).filter((t) => typeof t.sourceKey == "string").map((t) => [String(t.sourceKey), J(t)])
|
|
380
|
-
)
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
function Se(e) {
|
|
384
|
-
var t;
|
|
385
|
-
return e instanceof Object && ((t = d(e)) == null ? void 0 : t.sourcesByKey) instanceof Map;
|
|
386
|
-
}
|
|
387
|
-
function Ae(e, t, n) {
|
|
388
|
-
if (typeof e.sourceKey == "string")
|
|
389
|
-
return n.sourcesByKey.get(e.sourceKey) || { sourceKey: e.sourceKey };
|
|
390
|
-
if (e.source)
|
|
391
|
-
return e.source;
|
|
392
|
-
if (t != null && t.source)
|
|
393
|
-
return t.source;
|
|
394
|
-
if (typeof (t == null ? void 0 : t.sourceKey) == "string")
|
|
395
|
-
return n.sourcesByKey.get(t.sourceKey) || { sourceKey: t.sourceKey };
|
|
396
|
-
}
|
|
397
|
-
function _e({
|
|
398
|
-
view: e,
|
|
399
|
-
builder: t,
|
|
400
|
-
rawSpec: n,
|
|
401
|
-
spec: r,
|
|
402
|
-
context: s
|
|
403
|
-
}) {
|
|
404
|
-
var i;
|
|
405
|
-
if (t !== "records" && t !== "sql")
|
|
406
|
-
return r;
|
|
407
|
-
const o = d((i = d(e.visualSpec)) == null ? void 0 : i.tableBehavior);
|
|
408
|
-
if (!o)
|
|
409
|
-
return r;
|
|
410
|
-
const a = { ...r };
|
|
411
|
-
if (Ne(o) === "server" && (a.pagination = {
|
|
412
|
-
page: 1,
|
|
413
|
-
pageSize: we({ tableBehavior: o, spec: r })
|
|
414
|
-
}), t === "records" && Fe(o) === "server") {
|
|
415
|
-
const c = ve({
|
|
416
|
-
view: e,
|
|
417
|
-
rawSpec: n,
|
|
418
|
-
tableBehavior: o,
|
|
419
|
-
context: s
|
|
420
|
-
});
|
|
421
|
-
c && (a.orderBy = c);
|
|
422
|
-
}
|
|
423
|
-
return a;
|
|
424
|
-
}
|
|
425
|
-
function we({
|
|
426
|
-
tableBehavior: e,
|
|
427
|
-
spec: t
|
|
428
|
-
}) {
|
|
429
|
-
const n = d(e.pagination), r = d(t.pagination);
|
|
430
|
-
return N(n == null ? void 0 : n.pageSize) || N(r == null ? void 0 : r.pageSize) || N(t.limit) || 100;
|
|
431
|
-
}
|
|
432
|
-
function ve({
|
|
433
|
-
view: e,
|
|
434
|
-
rawSpec: t,
|
|
435
|
-
tableBehavior: n,
|
|
436
|
-
context: r
|
|
437
|
-
}) {
|
|
438
|
-
const s = d(n.sorting), o = g(s == null ? void 0 : s.defaultField);
|
|
439
|
-
if (!o)
|
|
440
|
-
return;
|
|
441
|
-
const i = Re({
|
|
442
|
-
view: e,
|
|
443
|
-
rawSpec: t,
|
|
444
|
-
context: r
|
|
445
|
-
}).filter(
|
|
446
|
-
(c) => Ie(c.lookup).includes(o)
|
|
447
|
-
);
|
|
448
|
-
if (i.length === 1)
|
|
449
|
-
return {
|
|
450
|
-
field: i[0].field,
|
|
451
|
-
direction: (s == null ? void 0 : s.defaultDirection) === "desc" ? "desc" : "asc"
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
function Re({
|
|
455
|
-
view: e,
|
|
456
|
-
rawSpec: t,
|
|
457
|
-
context: n
|
|
458
|
-
}) {
|
|
459
|
-
var s;
|
|
460
|
-
const r = [];
|
|
461
|
-
for (const o of R(t.fields)) $(r, o, n);
|
|
462
|
-
$(r, t.dateField, n), $(r, (s = d(t.orderBy)) == null ? void 0 : s.field, n);
|
|
463
|
-
for (const o of R(e.fields))
|
|
464
|
-
$(r, o, n);
|
|
465
|
-
return Ge(
|
|
466
|
-
r,
|
|
467
|
-
(o) => $e(o.lookup)
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
function $(e, t, n) {
|
|
471
|
-
const r = d(t);
|
|
472
|
-
if (typeof (r == null ? void 0 : r.name) != "string" || r.name.length === 0)
|
|
473
|
-
return;
|
|
474
|
-
const s = d(_(r, n)) || r;
|
|
475
|
-
e.push({
|
|
476
|
-
lookup: r,
|
|
477
|
-
field: s
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
function Ie(e) {
|
|
481
|
-
return Te([
|
|
482
|
-
g(e.name),
|
|
483
|
-
z(e),
|
|
484
|
-
Oe(e)
|
|
485
|
-
]);
|
|
486
|
-
}
|
|
487
|
-
function $e(e) {
|
|
488
|
-
return [
|
|
489
|
-
z(e),
|
|
490
|
-
g(e.name),
|
|
491
|
-
g(e.role),
|
|
492
|
-
g(e.aggregate)
|
|
493
|
-
].join("|");
|
|
494
|
-
}
|
|
495
|
-
function z(e) {
|
|
496
|
-
return [
|
|
497
|
-
g(e.sourceKey) || Ee(e.source),
|
|
498
|
-
g(e.name),
|
|
499
|
-
g(e.aggregate)
|
|
500
|
-
].filter(Boolean).join(":");
|
|
501
|
-
}
|
|
502
|
-
function Ee(e) {
|
|
503
|
-
const t = d(e);
|
|
504
|
-
if (!t)
|
|
505
|
-
return "";
|
|
506
|
-
if (typeof t.kind == "string" && typeof t.domainId == "string") {
|
|
507
|
-
if (typeof t.datasetId == "string")
|
|
508
|
-
return `${t.kind}:${t.domainId}:datasetId:${t.datasetId}`;
|
|
509
|
-
if (typeof t.datasetName == "string")
|
|
510
|
-
return `${t.kind}:${t.domainId}:datasetName:${t.datasetName}`;
|
|
511
|
-
}
|
|
512
|
-
return JSON.stringify(t);
|
|
513
|
-
}
|
|
514
|
-
function Oe(e) {
|
|
515
|
-
return qe([
|
|
516
|
-
Ve(e),
|
|
517
|
-
g(e.aggregate).toLowerCase(),
|
|
518
|
-
g(e.label) || g(e.name)
|
|
519
|
-
].filter(Boolean));
|
|
520
|
-
}
|
|
521
|
-
function Ve(e) {
|
|
522
|
-
return typeof e.sourceKey == "string" ? Ce(e.sourceKey) : be(e.source);
|
|
523
|
-
}
|
|
524
|
-
function be(e) {
|
|
525
|
-
const t = d(e);
|
|
526
|
-
return t ? g(t.datasetName) || g(t.datasetId) || g(t.name) || g(t.kind) : "";
|
|
527
|
-
}
|
|
528
|
-
function Ce(e) {
|
|
529
|
-
const t = String(e).split(":");
|
|
530
|
-
return t[t.length - 1] || String(e);
|
|
531
|
-
}
|
|
532
|
-
function Ne(e) {
|
|
533
|
-
var t;
|
|
534
|
-
return g((t = d(e.pagination)) == null ? void 0 : t.mode);
|
|
535
|
-
}
|
|
536
|
-
function Fe(e) {
|
|
537
|
-
var t;
|
|
538
|
-
return g((t = d(e.sorting)) == null ? void 0 : t.mode);
|
|
539
|
-
}
|
|
540
|
-
function _(e, t) {
|
|
541
|
-
if (!e || typeof e != "object")
|
|
542
|
-
return e;
|
|
543
|
-
if (Array.isArray(e))
|
|
544
|
-
return e.map((s) => _(s, t));
|
|
545
|
-
const n = e;
|
|
546
|
-
if (typeof n.sourceKey == "string" && typeof n.kind == "string" && (typeof n.datasetName == "string" || typeof n.datasetId == "string"))
|
|
547
|
-
return J(n);
|
|
548
|
-
const r = {};
|
|
549
|
-
for (const [s, o] of Object.entries(n))
|
|
550
|
-
s !== "sourceKey" && (r[s] = _(o, t));
|
|
551
|
-
if (typeof n.sourceKey == "string") {
|
|
552
|
-
const s = t.sourcesByKey.get(n.sourceKey);
|
|
553
|
-
s && !r.source && (r.source = s);
|
|
554
|
-
}
|
|
555
|
-
return r;
|
|
556
|
-
}
|
|
557
|
-
function J(e) {
|
|
558
|
-
const { sourceKey: t, ...n } = e;
|
|
559
|
-
return n;
|
|
560
|
-
}
|
|
561
|
-
function He(e, t) {
|
|
562
|
-
const n = d(e.visualSpec);
|
|
563
|
-
return (n == null ? void 0 : n.title) || e.title || t.label;
|
|
564
|
-
}
|
|
565
|
-
function ke(e) {
|
|
566
|
-
const t = String(e || "").replace(/^semaphor\./, "");
|
|
567
|
-
return ["metric", "records", "analysis", "matrix", "sql"].includes(t) ? t : "";
|
|
568
|
-
}
|
|
569
|
-
function Ke(e) {
|
|
570
|
-
if (e != null && e.relationshipHint)
|
|
571
|
-
return e.relationshipHint;
|
|
572
|
-
const t = R(e == null ? void 0 : e.relationshipsUsed).map((n) => {
|
|
573
|
-
var r;
|
|
574
|
-
return (r = d(n)) == null ? void 0 : r.id;
|
|
575
|
-
}).filter((n) => typeof n == "string" && n.length > 0);
|
|
576
|
-
return t.length > 0 ? { relationshipIds: t } : void 0;
|
|
577
|
-
}
|
|
578
|
-
function xe(e, t) {
|
|
579
|
-
return e === "in" || e === "not_in" ? [t] : e === "between" ? Array.isArray(t) ? t : [t, t] : t;
|
|
580
|
-
}
|
|
581
|
-
function N(e) {
|
|
582
|
-
return typeof e == "number" && Number.isFinite(e) ? e : void 0;
|
|
583
|
-
}
|
|
584
|
-
function g(e) {
|
|
585
|
-
return typeof e == "string" ? e : "";
|
|
586
|
-
}
|
|
587
|
-
function Ge(e, t) {
|
|
588
|
-
const n = /* @__PURE__ */ new Set(), r = [];
|
|
589
|
-
for (const s of e) {
|
|
590
|
-
const o = t(s);
|
|
591
|
-
!o || n.has(o) || (n.add(o), r.push(s));
|
|
592
|
-
}
|
|
593
|
-
return r;
|
|
594
|
-
}
|
|
595
|
-
function Te(e) {
|
|
596
|
-
return Array.from(new Set(e.filter(Boolean)));
|
|
597
|
-
}
|
|
598
|
-
function qe(e) {
|
|
599
|
-
return (Array.isArray(e) ? e.join(" ") : e).replace(/[^a-zA-Z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean).map((n, r) => {
|
|
600
|
-
const s = n.toLowerCase();
|
|
601
|
-
return r === 0 ? s : s.charAt(0).toUpperCase() + s.slice(1);
|
|
602
|
-
}).join("");
|
|
603
|
-
}
|
|
604
|
-
function d(e) {
|
|
605
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
606
|
-
}
|
|
607
|
-
function R(e) {
|
|
608
|
-
return Array.isArray(e) ? e : [];
|
|
609
|
-
}
|
|
610
|
-
function Me(e) {
|
|
611
|
-
return e !== void 0;
|
|
612
|
-
}
|
|
613
|
-
const je = /* @__PURE__ */ new Set([
|
|
614
|
-
"diagnostic_fix",
|
|
615
|
-
"fix_diagnostics",
|
|
616
|
-
"fix_inspector_warnings",
|
|
617
|
-
"fix_runtime_warnings",
|
|
618
|
-
"fix_warnings"
|
|
619
|
-
]), De = /* @__PURE__ */ new Set([
|
|
620
|
-
"add",
|
|
621
|
-
"edit",
|
|
622
|
-
"mixed",
|
|
623
|
-
"remove"
|
|
624
|
-
]), q = /* @__PURE__ */ new Set([
|
|
625
|
-
"fields",
|
|
626
|
-
"metricBindingKeys",
|
|
627
|
-
"sdkSpec"
|
|
628
|
-
]);
|
|
629
|
-
function rt({
|
|
630
|
-
beforeSummary: e,
|
|
631
|
-
afterSummary: t,
|
|
632
|
-
migrationReport: n,
|
|
633
|
-
operationIntent: r,
|
|
634
|
-
constraints: s,
|
|
635
|
-
preferences: o
|
|
636
|
-
}) {
|
|
637
|
-
const a = l(r), i = typeof (a == null ? void 0 : a.kind) == "string" ? a.kind.trim() : "";
|
|
638
|
-
return De.has(i) ? {
|
|
639
|
-
ok: !1,
|
|
640
|
-
policy: {
|
|
641
|
-
kind: i,
|
|
642
|
-
mode: "invalid_operation_kind",
|
|
643
|
-
reason: "Retired Data App operation aliases are not accepted. Use the hard-migrated analytics/layout/style operationIntent kinds."
|
|
644
|
-
},
|
|
645
|
-
violations: [
|
|
646
|
-
{
|
|
647
|
-
path: "operationIntent.kind",
|
|
648
|
-
reason: "Use analytics_add, analytics_edit, analytics_remove, input_add, input_edit, layout_only, style_only, runtime_debug, semantic_model_repair, save_or_publish, or greenfield_create."
|
|
649
|
-
}
|
|
650
|
-
]
|
|
651
|
-
} : M(o) ? {
|
|
652
|
-
ok: !1,
|
|
653
|
-
policy: {
|
|
654
|
-
kind: i,
|
|
655
|
-
mode: "invalid_update_constraints",
|
|
656
|
-
reason: "Metric aggregate override updates must use operationIntent.measureAggregateOverrides so deterministic update policy can guard the targeted edit."
|
|
657
|
-
},
|
|
658
|
-
violations: [
|
|
659
|
-
{
|
|
660
|
-
path: "preferences.measureAggregateOverrides",
|
|
661
|
-
reason: "preferences is retired. Move measureAggregateOverrides to operationIntent.measureAggregateOverrides for update calls."
|
|
662
|
-
}
|
|
663
|
-
]
|
|
664
|
-
} : M(s) ? {
|
|
665
|
-
ok: !1,
|
|
666
|
-
policy: {
|
|
667
|
-
kind: i,
|
|
668
|
-
mode: "invalid_update_constraints",
|
|
669
|
-
reason: "Metric aggregate override updates must use operationIntent.measureAggregateOverrides so deterministic update policy can guard the targeted edit."
|
|
670
|
-
},
|
|
671
|
-
violations: [
|
|
672
|
-
{
|
|
673
|
-
path: "constraints.measureAggregateOverrides",
|
|
674
|
-
reason: "Move measureAggregateOverrides to operationIntent.measureAggregateOverrides for update calls."
|
|
675
|
-
}
|
|
676
|
-
]
|
|
677
|
-
} : je.has(i) ? j({
|
|
678
|
-
beforeSummary: e,
|
|
679
|
-
afterSummary: t,
|
|
680
|
-
migrationReport: n,
|
|
681
|
-
operationIntent: a,
|
|
682
|
-
mode: "diagnostic_warning_fix",
|
|
683
|
-
allowedViewChangeReasons: q,
|
|
684
|
-
label: "Diagnostic warning fixes",
|
|
685
|
-
reason: "Diagnostic warning fixes are preserve-by-default and may not add/remove views, inputs, or filter contracts."
|
|
686
|
-
}) : i === "analytics_edit" && Array.isArray(a == null ? void 0 : a.measureAggregateOverrides) && a.measureAggregateOverrides.length > 0 ? j({
|
|
687
|
-
beforeSummary: e,
|
|
688
|
-
afterSummary: t,
|
|
689
|
-
migrationReport: n,
|
|
690
|
-
operationIntent: a,
|
|
691
|
-
mode: "metric_aggregate_override_edit",
|
|
692
|
-
allowedViewChangeReasons: q,
|
|
693
|
-
label: "Metric aggregate override edits",
|
|
694
|
-
reason: "Metric aggregate override edits are preserve-by-default and may only adjust fields/sdkSpec on targeted views."
|
|
695
|
-
}) : {
|
|
696
|
-
ok: !0,
|
|
697
|
-
policy: {
|
|
698
|
-
kind: i,
|
|
699
|
-
mode: "general_iterative_update",
|
|
700
|
-
reason: "General generated-contract edits are allowed to change the requested contract shape. Review the migration report for expected UI work."
|
|
701
|
-
},
|
|
702
|
-
violations: []
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
function M(e) {
|
|
706
|
-
var t;
|
|
707
|
-
return Array.isArray((t = l(e)) == null ? void 0 : t.measureAggregateOverrides);
|
|
708
|
-
}
|
|
709
|
-
function j({
|
|
710
|
-
beforeSummary: e,
|
|
711
|
-
afterSummary: t,
|
|
712
|
-
migrationReport: n,
|
|
713
|
-
operationIntent: r,
|
|
714
|
-
mode: s,
|
|
715
|
-
allowedViewChangeReasons: o,
|
|
716
|
-
label: a,
|
|
717
|
-
reason: i
|
|
718
|
-
}) {
|
|
719
|
-
const c = [], u = Ue(r == null ? void 0 : r.targetViewIds), f = l(n) || {};
|
|
720
|
-
u.size === 0 && c.push({
|
|
721
|
-
path: "operationIntent.targetViewIds",
|
|
722
|
-
reason: `${a} must declare targetViewIds so the update cannot broaden to unrelated views.`
|
|
723
|
-
}), F({
|
|
724
|
-
bucket: l(f.views),
|
|
725
|
-
label: "views",
|
|
726
|
-
operationLabel: a,
|
|
727
|
-
violations: c
|
|
728
|
-
}), F({
|
|
729
|
-
bucket: l(f.inputs),
|
|
730
|
-
label: "inputs",
|
|
731
|
-
operationLabel: a,
|
|
732
|
-
violations: c
|
|
733
|
-
}), B({
|
|
734
|
-
bucket: l(f.inputs),
|
|
735
|
-
label: "inputs",
|
|
736
|
-
operationLabel: a,
|
|
737
|
-
violations: c
|
|
738
|
-
}), F({
|
|
739
|
-
bucket: l(f.filterContracts),
|
|
740
|
-
label: "filterContracts",
|
|
741
|
-
operationLabel: a,
|
|
742
|
-
violations: c
|
|
743
|
-
}), B({
|
|
744
|
-
bucket: l(f.filterContracts),
|
|
745
|
-
label: "filterContracts",
|
|
746
|
-
operationLabel: a,
|
|
747
|
-
violations: c
|
|
748
|
-
});
|
|
749
|
-
for (const m of W(l(f.views))) {
|
|
750
|
-
u.size > 0 && !u.has(A(m.id)) && c.push({
|
|
751
|
-
path: `views.${A(m.id) || "<unknown>"}`,
|
|
752
|
-
reason: `${a} may only change explicitly targeted views.`
|
|
753
|
-
});
|
|
754
|
-
const h = Array.isArray(m.reasons) ? m.reasons.filter(
|
|
755
|
-
(v) => typeof v != "string" || !o.has(v)
|
|
756
|
-
) : [];
|
|
757
|
-
h.length > 0 && c.push({
|
|
758
|
-
path: `views.${A(m.id) || "<unknown>"}`,
|
|
759
|
-
reason: `${a} may only adjust fields/sdkSpec/metricBindingKeys; changed ${h.join(", ")}.`
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
const p = Be({
|
|
763
|
-
beforeSummary: e,
|
|
764
|
-
afterSummary: t,
|
|
765
|
-
targetViewIds: u,
|
|
766
|
-
label: a
|
|
767
|
-
});
|
|
768
|
-
return p && c.push(p), {
|
|
769
|
-
ok: c.length === 0,
|
|
770
|
-
policy: {
|
|
771
|
-
kind: A(r == null ? void 0 : r.kind) || "diagnostic_fix",
|
|
772
|
-
mode: s,
|
|
773
|
-
allowedViewChangeReasons: Array.from(o).sort(),
|
|
774
|
-
targetViewIds: Array.from(u).sort(),
|
|
775
|
-
reason: i
|
|
776
|
-
},
|
|
777
|
-
violations: c
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
function Be({
|
|
781
|
-
beforeSummary: e,
|
|
782
|
-
afterSummary: t,
|
|
783
|
-
targetViewIds: n,
|
|
784
|
-
label: r
|
|
785
|
-
}) {
|
|
786
|
-
const s = l(e), o = l(t);
|
|
787
|
-
if (!s || !o)
|
|
788
|
-
return {
|
|
789
|
-
path: "codegenSummary",
|
|
790
|
-
reason: `${r} require before/after codegen summaries for full-scope verification.`
|
|
791
|
-
};
|
|
792
|
-
const a = D(s), i = D(o), c = U(s.views), u = U(o.views), f = Array.isArray(a.views) ? a.views : [];
|
|
793
|
-
a.views = f;
|
|
794
|
-
for (const p of n) {
|
|
795
|
-
const m = c.get(p), h = u.get(p);
|
|
796
|
-
if (!m || !h)
|
|
797
|
-
continue;
|
|
798
|
-
const v = f.find(
|
|
799
|
-
(Y) => {
|
|
800
|
-
var K;
|
|
801
|
-
return ((K = l(Y)) == null ? void 0 : K.id) === p;
|
|
802
|
-
}
|
|
803
|
-
), I = l(h);
|
|
804
|
-
if (!v || !I)
|
|
805
|
-
continue;
|
|
806
|
-
const b = v;
|
|
807
|
-
b.fields = E(I.fields), b.metricBindingKeys = E(I.metricBindingKeys), b.sdkSpec = E(I.sdkSpec);
|
|
808
|
-
}
|
|
809
|
-
return O(a) === O(i) ? null : {
|
|
810
|
-
path: "codegenSummary",
|
|
811
|
-
reason: `${r} may only change fields/sdkSpec/metricBindingKeys on targetViewIds; another generated contract section changed.`
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
function D(e) {
|
|
815
|
-
const t = E(e);
|
|
816
|
-
for (const n of [
|
|
817
|
-
"implementationChecklist",
|
|
818
|
-
"assumptions",
|
|
819
|
-
"nextStep",
|
|
820
|
-
"nextRequiredTool",
|
|
821
|
-
"validation"
|
|
822
|
-
])
|
|
823
|
-
delete t[n];
|
|
824
|
-
return Le(t.unsupportedInsights) && delete t.unsupportedInsights, t;
|
|
825
|
-
}
|
|
826
|
-
function F({
|
|
827
|
-
bucket: e,
|
|
828
|
-
label: t,
|
|
829
|
-
operationLabel: n,
|
|
830
|
-
violations: r
|
|
831
|
-
}) {
|
|
832
|
-
for (const s of k(e == null ? void 0 : e.added))
|
|
833
|
-
r.push({
|
|
834
|
-
path: `${t}.${A(s.id) || "<unknown>"}`,
|
|
835
|
-
reason: `${n} may not add ${t}.`
|
|
836
|
-
});
|
|
837
|
-
for (const s of k(e == null ? void 0 : e.removed))
|
|
838
|
-
r.push({
|
|
839
|
-
path: `${t}.${A(s.id) || "<unknown>"}`,
|
|
840
|
-
reason: `${n} may not remove ${t}.`
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
function B({
|
|
844
|
-
bucket: e,
|
|
845
|
-
label: t,
|
|
846
|
-
operationLabel: n,
|
|
847
|
-
violations: r
|
|
848
|
-
}) {
|
|
849
|
-
for (const s of W(e))
|
|
850
|
-
r.push({
|
|
851
|
-
path: `${t}.${A(s.id) || "<unknown>"}`,
|
|
852
|
-
reason: `${n} may not change ${t}.`
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
function W(e) {
|
|
856
|
-
return k(e == null ? void 0 : e.changed);
|
|
857
|
-
}
|
|
858
|
-
function k(e) {
|
|
859
|
-
return Array.isArray(e) ? e.map(l).filter(Pe) : [];
|
|
860
|
-
}
|
|
861
|
-
function Ue(e) {
|
|
862
|
-
return Array.isArray(e) ? new Set(
|
|
863
|
-
e.filter((t) => typeof t == "string" && t.trim().length > 0).map((t) => t.trim())
|
|
864
|
-
) : /* @__PURE__ */ new Set();
|
|
865
|
-
}
|
|
866
|
-
function U(e) {
|
|
867
|
-
var n;
|
|
868
|
-
const t = /* @__PURE__ */ new Map();
|
|
869
|
-
for (const r of Array.isArray(e) ? e : []) {
|
|
870
|
-
const s = (n = l(r)) == null ? void 0 : n.id;
|
|
871
|
-
typeof s == "string" && s.trim() && t.set(s, r);
|
|
872
|
-
}
|
|
873
|
-
return t;
|
|
874
|
-
}
|
|
875
|
-
function E(e) {
|
|
876
|
-
return e === void 0 ? e : JSON.parse(JSON.stringify(e));
|
|
877
|
-
}
|
|
878
|
-
function O(e) {
|
|
879
|
-
if (e === null || typeof e != "object")
|
|
880
|
-
return JSON.stringify(e);
|
|
881
|
-
if (Array.isArray(e))
|
|
882
|
-
return `[${e.map((n) => O(n)).join(",")}]`;
|
|
883
|
-
const t = e;
|
|
884
|
-
return `{${Object.keys(t).sort().filter((n) => t[n] !== void 0).map((n) => `${JSON.stringify(n)}:${O(t[n])}`).join(",")}}`;
|
|
885
|
-
}
|
|
886
|
-
function l(e) {
|
|
887
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : void 0;
|
|
888
|
-
}
|
|
889
|
-
function Pe(e) {
|
|
890
|
-
return e !== void 0;
|
|
891
|
-
}
|
|
892
|
-
function Le(e) {
|
|
893
|
-
return Array.isArray(e) && e.length === 0;
|
|
894
|
-
}
|
|
895
|
-
function A(e) {
|
|
896
|
-
return typeof e == "string" ? e : "";
|
|
897
|
-
}
|
|
898
|
-
export {
|
|
899
|
-
Ye as C,
|
|
900
|
-
G,
|
|
901
|
-
fe as R,
|
|
902
|
-
x as a,
|
|
903
|
-
T as b,
|
|
904
|
-
Qe as c,
|
|
905
|
-
Xe as d,
|
|
906
|
-
de as e,
|
|
907
|
-
tt as f,
|
|
908
|
-
et as g,
|
|
909
|
-
ye as h,
|
|
910
|
-
Ze as i,
|
|
911
|
-
rt as j,
|
|
912
|
-
P as v
|
|
913
|
-
};
|