react-semaphor 0.1.573 → 0.1.574

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.
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { QueryTrigger } from './catalog.js';
3
+ /**
4
+ * What the browser adds to a query body to say where a query came from
5
+ * (usage-events TECH-SPEC §2.1, M7). A label, never input: a missing,
6
+ * malformed or oversized field parses as absent and never rejects a request.
7
+ */
8
+ export type UsageAttributionFields = {
9
+ operationId?: string;
10
+ trigger?: QueryTrigger;
11
+ dashboardId?: string;
12
+ /** The dashboard's name as the runtime shows it (Phase 3 sends it). */
13
+ dashboardTitle?: string;
14
+ sheetId?: string;
15
+ /** The sheet's name as the runtime shows it (Phase 3 sends it). */
16
+ sheetTitle?: string;
17
+ };
18
+ export declare const USAGE_ATTRIBUTION_ID_MAX_LENGTH = 128;
19
+ export declare const USAGE_ATTRIBUTION_TITLE_MAX_LENGTH = 500;
20
+ /**
21
+ * Not strict, so a `.strict()` request schema extends it with
22
+ * `.extend(usageAttributionFieldsSchema.shape)` and other keys pass through
23
+ * where the route allows them.
24
+ */
25
+ export declare const usageAttributionFieldsSchema: z.ZodObject<{
26
+ operationId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
27
+ trigger: z.ZodCatch<z.ZodOptional<z.ZodEnum<["initial_load", "input_change", "click_filter", "drill", "page", "sort", "refresh"]>>>;
28
+ dashboardId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
29
+ dashboardTitle: z.ZodCatch<z.ZodOptional<z.ZodString>>;
30
+ sheetId: z.ZodCatch<z.ZodOptional<z.ZodString>>;
31
+ sheetTitle: z.ZodCatch<z.ZodOptional<z.ZodString>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ dashboardId?: string | undefined;
34
+ sheetId?: string | undefined;
35
+ sheetTitle?: string | undefined;
36
+ trigger?: "sort" | "page" | "refresh" | "drill" | "initial_load" | "input_change" | "click_filter" | undefined;
37
+ dashboardTitle?: string | undefined;
38
+ operationId?: string | undefined;
39
+ }, {
40
+ dashboardId?: unknown;
41
+ sheetId?: unknown;
42
+ sheetTitle?: unknown;
43
+ trigger?: unknown;
44
+ dashboardTitle?: unknown;
45
+ operationId?: unknown;
46
+ }>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The usage events catalog (usage-events TECH-SPEC §2.1). Phase Q holds only
3
+ * the query vocabulary, which query tags and the query routes need before any
4
+ * event exists; the event types, envelope and schemas land with their
5
+ * producers (Phases 1, 2 and 6).
6
+ */
7
+ /** What a query run was for, derived on the server from its own inputs. */
8
+ export declare const QUERY_KINDS: readonly ["card", "matrix_window", "filter_options", "control_options", "sql", "export"];
9
+ export type QueryKind = (typeof QUERY_KINDS)[number];
10
+ /** One data-service call inside a query run. */
11
+ export declare const QUERY_STATEMENTS: readonly ["main", "row_count", "totals"];
12
+ export type QueryStatement = (typeof QUERY_STATEMENTS)[number];
13
+ /** The gesture the browser says a query followed (Phase 3 sends it). */
14
+ export declare const QUERY_TRIGGERS: readonly ["initial_load", "input_change", "click_filter", "drill", "page", "sort", "refresh"];
15
+ export type QueryTrigger = (typeof QUERY_TRIGGERS)[number];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `react-semaphor/usage-events`: the usage events contract (usage-events
3
+ * TECH-SPEC §2.1, AL-D5). Server-safe: no React, store or component module.
4
+ */
5
+ export * from './catalog.js';
6
+ export * from './attribution.js';
@@ -0,0 +1,2 @@
1
+ export * from './shared/usage-events/index.js'
2
+ export {}
@@ -0,0 +1,32 @@
1
+ import { z as t } from "zod";
2
+ const r = [
3
+ "card",
4
+ "matrix_window",
5
+ "filter_options",
6
+ "control_options",
7
+ "sql",
8
+ "export"
9
+ ], s = ["main", "row_count", "totals"], n = [
10
+ "initial_load",
11
+ "input_change",
12
+ "click_filter",
13
+ "drill",
14
+ "page",
15
+ "sort",
16
+ "refresh"
17
+ ], a = 128, c = 500, o = t.string().max(a).optional().catch(void 0), i = t.string().max(c).optional().catch(void 0), l = t.object({
18
+ operationId: o,
19
+ trigger: t.enum(n).optional().catch(void 0),
20
+ dashboardId: o,
21
+ dashboardTitle: i,
22
+ sheetId: o,
23
+ sheetTitle: i
24
+ });
25
+ export {
26
+ r as QUERY_KINDS,
27
+ s as QUERY_STATEMENTS,
28
+ n as QUERY_TRIGGERS,
29
+ a as USAGE_ATTRIBUTION_ID_MAX_LENGTH,
30
+ c as USAGE_ATTRIBUTION_TITLE_MAX_LENGTH,
31
+ l as usageAttributionFieldsSchema
32
+ };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.573",
8
+ "version": "0.1.574",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -78,6 +78,10 @@
78
78
  "types": "./dist/types/activity.d.ts",
79
79
  "import": "./dist/activity/index.js"
80
80
  },
81
+ "./usage-events": {
82
+ "types": "./dist/types/usage-events.d.ts",
83
+ "import": "./dist/usage-events/index.js"
84
+ },
81
85
  "./live-channel": {
82
86
  "types": "./dist/types/live-channel.d.ts",
83
87
  "import": "./dist/live-channel/index.js"