@rippling/rippling-sdk 0.2.0-alpha.105 → 0.2.0-alpha.106
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/client.d.mts +6 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -0
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/lib/charts/builders.d.mts +43 -0
- package/lib/charts/builders.d.mts.map +1 -0
- package/lib/charts/builders.d.ts +43 -0
- package/lib/charts/builders.d.ts.map +1 -0
- package/lib/charts/builders.js +77 -0
- package/lib/charts/builders.js.map +1 -0
- package/lib/charts/builders.mjs +70 -0
- package/lib/charts/builders.mjs.map +1 -0
- package/lib/charts/describe.d.mts +12 -0
- package/lib/charts/describe.d.mts.map +1 -0
- package/lib/charts/describe.d.ts +12 -0
- package/lib/charts/describe.d.ts.map +1 -0
- package/lib/charts/describe.js +64 -0
- package/lib/charts/describe.js.map +1 -0
- package/lib/charts/describe.mjs +61 -0
- package/lib/charts/describe.mjs.map +1 -0
- package/lib/charts/errors.d.mts +35 -0
- package/lib/charts/errors.d.mts.map +1 -0
- package/lib/charts/errors.d.ts +35 -0
- package/lib/charts/errors.d.ts.map +1 -0
- package/lib/charts/errors.js +55 -0
- package/lib/charts/errors.js.map +1 -0
- package/lib/charts/errors.mjs +47 -0
- package/lib/charts/errors.mjs.map +1 -0
- package/lib/charts/evaluate.d.mts +16 -0
- package/lib/charts/evaluate.d.mts.map +1 -0
- package/lib/charts/evaluate.d.ts +16 -0
- package/lib/charts/evaluate.d.ts.map +1 -0
- package/lib/charts/evaluate.js +99 -0
- package/lib/charts/evaluate.js.map +1 -0
- package/lib/charts/evaluate.mjs +96 -0
- package/lib/charts/evaluate.mjs.map +1 -0
- package/lib/charts/guards.d.mts +15 -0
- package/lib/charts/guards.d.mts.map +1 -0
- package/lib/charts/guards.d.ts +15 -0
- package/lib/charts/guards.d.ts.map +1 -0
- package/lib/charts/guards.js +38 -0
- package/lib/charts/guards.js.map +1 -0
- package/lib/charts/guards.mjs +34 -0
- package/lib/charts/guards.mjs.map +1 -0
- package/lib/charts/schema.d.mts +101 -0
- package/lib/charts/schema.d.mts.map +1 -0
- package/lib/charts/schema.d.ts +101 -0
- package/lib/charts/schema.d.ts.map +1 -0
- package/lib/charts/schema.js +74 -0
- package/lib/charts/schema.js.map +1 -0
- package/lib/charts/schema.mjs +71 -0
- package/lib/charts/schema.mjs.map +1 -0
- package/lib/charts/types.d.mts +79 -0
- package/lib/charts/types.d.mts.map +1 -0
- package/lib/charts/types.d.ts +79 -0
- package/lib/charts/types.d.ts.map +1 -0
- package/lib/charts/types.js +25 -0
- package/lib/charts/types.js.map +1 -0
- package/lib/charts/types.mjs +22 -0
- package/lib/charts/types.mjs.map +1 -0
- package/lib/charts.d.mts +7 -0
- package/lib/charts.d.mts.map +1 -0
- package/lib/charts.d.ts +7 -0
- package/lib/charts.d.ts.map +1 -0
- package/lib/charts.js +32 -0
- package/lib/charts.js.map +1 -0
- package/lib/charts.mjs +7 -0
- package/lib/charts.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/hire-requirements.d.mts +8 -74
- package/resources/hire-requirements.d.mts.map +1 -1
- package/resources/hire-requirements.d.ts +8 -74
- package/resources/hire-requirements.d.ts.map +1 -1
- package/resources/hire-requirements.js +3 -19
- package/resources/hire-requirements.js.map +1 -1
- package/resources/hire-requirements.mjs +3 -19
- package/resources/hire-requirements.mjs.map +1 -1
- package/resources/hires.d.mts +677 -142
- package/resources/hires.d.mts.map +1 -1
- package/resources/hires.d.ts +677 -142
- package/resources/hires.d.ts.map +1 -1
- package/resources/hires.js +3 -4
- package/resources/hires.js.map +1 -1
- package/resources/hires.mjs +3 -4
- package/resources/hires.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/payroll-payment-mode-changes.d.mts +102 -0
- package/resources/payroll-payment-mode-changes.d.mts.map +1 -0
- package/resources/payroll-payment-mode-changes.d.ts +102 -0
- package/resources/payroll-payment-mode-changes.d.ts.map +1 -0
- package/resources/payroll-payment-mode-changes.js +54 -0
- package/resources/payroll-payment-mode-changes.js.map +1 -0
- package/resources/payroll-payment-mode-changes.mjs +50 -0
- package/resources/payroll-payment-mode-changes.mjs.map +1 -0
- package/resources/payroll-runs/index.d.mts +1 -0
- package/resources/payroll-runs/index.d.mts.map +1 -1
- package/resources/payroll-runs/index.d.ts +1 -0
- package/resources/payroll-runs/index.d.ts.map +1 -1
- package/resources/payroll-runs/index.js +3 -1
- package/resources/payroll-runs/index.js.map +1 -1
- package/resources/payroll-runs/index.mjs +1 -0
- package/resources/payroll-runs/index.mjs.map +1 -1
- package/resources/payroll-runs/off-cycle.d.mts +322 -0
- package/resources/payroll-runs/off-cycle.d.mts.map +1 -0
- package/resources/payroll-runs/off-cycle.d.ts +322 -0
- package/resources/payroll-runs/off-cycle.d.ts.map +1 -0
- package/resources/payroll-runs/off-cycle.js +112 -0
- package/resources/payroll-runs/off-cycle.js.map +1 -0
- package/resources/payroll-runs/off-cycle.mjs +108 -0
- package/resources/payroll-runs/off-cycle.mjs.map +1 -0
- package/resources/payroll-runs/payroll-runs.d.mts +4 -0
- package/resources/payroll-runs/payroll-runs.d.mts.map +1 -1
- package/resources/payroll-runs/payroll-runs.d.ts +4 -0
- package/resources/payroll-runs/payroll-runs.d.ts.map +1 -1
- package/resources/payroll-runs/payroll-runs.js +4 -0
- package/resources/payroll-runs/payroll-runs.js.map +1 -1
- package/resources/payroll-runs/payroll-runs.mjs +4 -0
- package/resources/payroll-runs/payroll-runs.mjs.map +1 -1
- package/resources/sandboxes.d.mts +17 -11
- package/resources/sandboxes.d.mts.map +1 -1
- package/resources/sandboxes.d.ts +17 -11
- package/resources/sandboxes.d.ts.map +1 -1
- package/resources/sandboxes.js +1 -3
- package/resources/sandboxes.js.map +1 -1
- package/resources/sandboxes.mjs +1 -3
- package/resources/sandboxes.mjs.map +1 -1
- package/resources/variable-compensation-payout-labels.d.mts +1 -1
- package/resources/variable-compensation-payout-labels.d.ts +1 -1
- package/resources/variable-compensation-payout-labels.js +1 -1
- package/resources/variable-compensation-payout-labels.mjs +1 -1
- package/resources/variable-compensation-payout-types.d.mts +1 -1
- package/resources/variable-compensation-payout-types.d.ts +1 -1
- package/resources/variable-compensation-payout-types.js +1 -1
- package/resources/variable-compensation-payout-types.mjs +1 -1
- package/resources/variable-compensation-payouts.d.mts +1 -1
- package/resources/variable-compensation-payouts.d.ts +1 -1
- package/resources/variable-compensation-payouts.js +1 -1
- package/resources/variable-compensation-payouts.mjs +1 -1
- package/src/client.ts +16 -0
- package/src/lib/charts/README.md +114 -0
- package/src/lib/charts/builders.ts +90 -0
- package/src/lib/charts/describe.ts +67 -0
- package/src/lib/charts/errors.ts +48 -0
- package/src/lib/charts/evaluate.ts +114 -0
- package/src/lib/charts/guards.ts +42 -0
- package/src/lib/charts/schema.ts +72 -0
- package/src/lib/charts/types.ts +113 -0
- package/src/lib/charts.ts +43 -0
- package/src/resources/hire-requirements.ts +8 -85
- package/src/resources/hires.ts +866 -213
- package/src/resources/index.ts +5 -0
- package/src/resources/payroll-payment-mode-changes.ts +121 -0
- package/src/resources/payroll-runs/index.ts +1 -0
- package/src/resources/payroll-runs/off-cycle.ts +372 -0
- package/src/resources/payroll-runs/payroll-runs.ts +10 -0
- package/src/resources/sandboxes.ts +17 -11
- package/src/resources/variable-compensation-payout-labels.ts +1 -1
- package/src/resources/variable-compensation-payout-types.ts +1 -1
- package/src/resources/variable-compensation-payouts.ts +1 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertRuleNode = assertRuleNode;
|
|
4
|
+
exports.literalValue = literalValue;
|
|
5
|
+
const errors_1 = require("./errors.js");
|
|
6
|
+
/**
|
|
7
|
+
* Runtime validation for one node of a deserialized, untrusted rule tree, shared
|
|
8
|
+
* by `evaluate` and `describe`. A rule can arrive from JSON that TypeScript never
|
|
9
|
+
* checked, so `null`, a non-object, or a node without a string `kind` would throw
|
|
10
|
+
* a native `TypeError` on the first field read — skipping the `ChartRuleError`
|
|
11
|
+
* escape hatch a caller relies on. Validate before reading fields.
|
|
12
|
+
*/
|
|
13
|
+
const SCALAR_TYPES = new Set(['number', 'string', 'boolean']);
|
|
14
|
+
/**
|
|
15
|
+
* Assert `node` is shaped like a rule node — an object carrying a string `kind`.
|
|
16
|
+
* An unrecognised `kind` is *not* rejected here; that is the caller's `switch`
|
|
17
|
+
* default (`UnknownNodeError`), the deliberate "configured in code" signal.
|
|
18
|
+
*/
|
|
19
|
+
function assertRuleNode(node) {
|
|
20
|
+
if (node === null ||
|
|
21
|
+
typeof node !== 'object' ||
|
|
22
|
+
Array.isArray(node) ||
|
|
23
|
+
typeof node.kind !== 'string') {
|
|
24
|
+
throw new errors_1.MalformedRuleError('a rule node must be an object with a string "kind"');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read a `literal` node's `value`, rejecting a missing or non-scalar one. Without
|
|
29
|
+
* this, `{ kind: 'literal' }` resolves to `undefined` and slips past the caller.
|
|
30
|
+
*/
|
|
31
|
+
function literalValue(node) {
|
|
32
|
+
const { value } = node;
|
|
33
|
+
if (value === null || SCALAR_TYPES.has(typeof value)) {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
throw new errors_1.MalformedRuleError(`a literal must carry a scalar value, got ${value === undefined ? 'undefined' : typeof value}`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/lib/charts/guards.ts"],"names":[],"mappings":";;AAkBA,wCASC;AAMD,oCAQC;AAzCD,wCAA8C;AAG9C;;;;;;GAMG;AAEH,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAEnF;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAa;IAC1C,IACE,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACnB,OAAQ,IAA2B,CAAC,IAAI,KAAK,QAAQ,EACrD,CAAC;QACD,MAAM,IAAI,2BAAkB,CAAC,oDAAoD,CAAC,CAAC;IACrF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAyB;IACpD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,KAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,2BAAkB,CAC1B,4CAA4C,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAC/F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MalformedRuleError } from "./errors.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime validation for one node of a deserialized, untrusted rule tree, shared
|
|
4
|
+
* by `evaluate` and `describe`. A rule can arrive from JSON that TypeScript never
|
|
5
|
+
* checked, so `null`, a non-object, or a node without a string `kind` would throw
|
|
6
|
+
* a native `TypeError` on the first field read — skipping the `ChartRuleError`
|
|
7
|
+
* escape hatch a caller relies on. Validate before reading fields.
|
|
8
|
+
*/
|
|
9
|
+
const SCALAR_TYPES = new Set(['number', 'string', 'boolean']);
|
|
10
|
+
/**
|
|
11
|
+
* Assert `node` is shaped like a rule node — an object carrying a string `kind`.
|
|
12
|
+
* An unrecognised `kind` is *not* rejected here; that is the caller's `switch`
|
|
13
|
+
* default (`UnknownNodeError`), the deliberate "configured in code" signal.
|
|
14
|
+
*/
|
|
15
|
+
export function assertRuleNode(node) {
|
|
16
|
+
if (node === null ||
|
|
17
|
+
typeof node !== 'object' ||
|
|
18
|
+
Array.isArray(node) ||
|
|
19
|
+
typeof node.kind !== 'string') {
|
|
20
|
+
throw new MalformedRuleError('a rule node must be an object with a string "kind"');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Read a `literal` node's `value`, rejecting a missing or non-scalar one. Without
|
|
25
|
+
* this, `{ kind: 'literal' }` resolves to `undefined` and slips past the caller.
|
|
26
|
+
*/
|
|
27
|
+
export function literalValue(node) {
|
|
28
|
+
const { value } = node;
|
|
29
|
+
if (value === null || SCALAR_TYPES.has(typeof value)) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
throw new MalformedRuleError(`a literal must carry a scalar value, got ${value === undefined ? 'undefined' : typeof value}`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=guards.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.mjs","sourceRoot":"","sources":["../../src/lib/charts/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAiB;AAG9C;;;;;;GAMG;AAEH,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAEnF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,IACE,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QACnB,OAAQ,IAA2B,CAAC,IAAI,KAAK,QAAQ,EACrD,CAAC;QACD,MAAM,IAAI,kBAAkB,CAAC,oDAAoD,CAAC,CAAC;IACrF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAyB;IACpD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,KAAK,KAAK,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,KAAe,CAAC;IACzB,CAAC;IACD,MAAM,IAAI,kBAAkB,CAC1B,4CAA4C,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CAC/F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Stable identifier for the published contract, versioned by the tag. */
|
|
2
|
+
export declare const CHART_RULE_SCHEMA_ID: string;
|
|
3
|
+
/**
|
|
4
|
+
* JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
|
|
5
|
+
*
|
|
6
|
+
* This is the contract. A consumer that keeps its own rule evaluator (rather
|
|
7
|
+
* than importing `evaluate`) can validate against this so the two never drift —
|
|
8
|
+
* every kind and operand shape the builders can emit is described here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const chartRuleSchema: {
|
|
11
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
12
|
+
readonly $id: string;
|
|
13
|
+
readonly title: "Chart rule placeholder";
|
|
14
|
+
readonly description: "A rule tree the chart agent emits into a chart option, marked with $rule.";
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly required: readonly ["$rule", "channel"];
|
|
17
|
+
readonly additionalProperties: false;
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly $rule: {
|
|
20
|
+
readonly $ref: "#/$defs/ifElse";
|
|
21
|
+
};
|
|
22
|
+
readonly channel: {
|
|
23
|
+
readonly const: "color";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly $defs: {
|
|
27
|
+
readonly scalar: {
|
|
28
|
+
readonly type: readonly ["number", "string", "boolean", "null"];
|
|
29
|
+
};
|
|
30
|
+
readonly node: {
|
|
31
|
+
readonly oneOf: readonly [{
|
|
32
|
+
readonly $ref: "#/$defs/ref";
|
|
33
|
+
}, {
|
|
34
|
+
readonly $ref: "#/$defs/literal";
|
|
35
|
+
}, {
|
|
36
|
+
readonly $ref: "#/$defs/comparison";
|
|
37
|
+
}, {
|
|
38
|
+
readonly $ref: "#/$defs/ifElse";
|
|
39
|
+
}];
|
|
40
|
+
};
|
|
41
|
+
readonly ref: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly required: readonly ["kind"];
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
readonly properties: {
|
|
46
|
+
readonly kind: {
|
|
47
|
+
readonly const: "value";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly literal: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly required: readonly ["kind", "value"];
|
|
54
|
+
readonly additionalProperties: false;
|
|
55
|
+
readonly properties: {
|
|
56
|
+
readonly kind: {
|
|
57
|
+
readonly const: "literal";
|
|
58
|
+
};
|
|
59
|
+
readonly value: {
|
|
60
|
+
readonly $ref: "#/$defs/scalar";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly comparison: {
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly required: readonly ["kind", "left", "right"];
|
|
67
|
+
readonly additionalProperties: false;
|
|
68
|
+
readonly properties: {
|
|
69
|
+
readonly kind: {
|
|
70
|
+
readonly enum: readonly ["equals", "isNot", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual"];
|
|
71
|
+
};
|
|
72
|
+
readonly left: {
|
|
73
|
+
readonly $ref: "#/$defs/node";
|
|
74
|
+
};
|
|
75
|
+
readonly right: {
|
|
76
|
+
readonly $ref: "#/$defs/node";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
readonly ifElse: {
|
|
81
|
+
readonly type: "object";
|
|
82
|
+
readonly required: readonly ["kind", "cond", "then", "else"];
|
|
83
|
+
readonly additionalProperties: false;
|
|
84
|
+
readonly properties: {
|
|
85
|
+
readonly kind: {
|
|
86
|
+
readonly const: "ifElse";
|
|
87
|
+
};
|
|
88
|
+
readonly cond: {
|
|
89
|
+
readonly $ref: "#/$defs/node";
|
|
90
|
+
};
|
|
91
|
+
readonly then: {
|
|
92
|
+
readonly $ref: "#/$defs/node";
|
|
93
|
+
};
|
|
94
|
+
readonly else: {
|
|
95
|
+
readonly $ref: "#/$defs/node";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=schema.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.mts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAEvG;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DlB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Stable identifier for the published contract, versioned by the tag. */
|
|
2
|
+
export declare const CHART_RULE_SCHEMA_ID: string;
|
|
3
|
+
/**
|
|
4
|
+
* JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
|
|
5
|
+
*
|
|
6
|
+
* This is the contract. A consumer that keeps its own rule evaluator (rather
|
|
7
|
+
* than importing `evaluate`) can validate against this so the two never drift —
|
|
8
|
+
* every kind and operand shape the builders can emit is described here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const chartRuleSchema: {
|
|
11
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
12
|
+
readonly $id: string;
|
|
13
|
+
readonly title: "Chart rule placeholder";
|
|
14
|
+
readonly description: "A rule tree the chart agent emits into a chart option, marked with $rule.";
|
|
15
|
+
readonly type: "object";
|
|
16
|
+
readonly required: readonly ["$rule", "channel"];
|
|
17
|
+
readonly additionalProperties: false;
|
|
18
|
+
readonly properties: {
|
|
19
|
+
readonly $rule: {
|
|
20
|
+
readonly $ref: "#/$defs/ifElse";
|
|
21
|
+
};
|
|
22
|
+
readonly channel: {
|
|
23
|
+
readonly const: "color";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly $defs: {
|
|
27
|
+
readonly scalar: {
|
|
28
|
+
readonly type: readonly ["number", "string", "boolean", "null"];
|
|
29
|
+
};
|
|
30
|
+
readonly node: {
|
|
31
|
+
readonly oneOf: readonly [{
|
|
32
|
+
readonly $ref: "#/$defs/ref";
|
|
33
|
+
}, {
|
|
34
|
+
readonly $ref: "#/$defs/literal";
|
|
35
|
+
}, {
|
|
36
|
+
readonly $ref: "#/$defs/comparison";
|
|
37
|
+
}, {
|
|
38
|
+
readonly $ref: "#/$defs/ifElse";
|
|
39
|
+
}];
|
|
40
|
+
};
|
|
41
|
+
readonly ref: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly required: readonly ["kind"];
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
readonly properties: {
|
|
46
|
+
readonly kind: {
|
|
47
|
+
readonly const: "value";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly literal: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly required: readonly ["kind", "value"];
|
|
54
|
+
readonly additionalProperties: false;
|
|
55
|
+
readonly properties: {
|
|
56
|
+
readonly kind: {
|
|
57
|
+
readonly const: "literal";
|
|
58
|
+
};
|
|
59
|
+
readonly value: {
|
|
60
|
+
readonly $ref: "#/$defs/scalar";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly comparison: {
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly required: readonly ["kind", "left", "right"];
|
|
67
|
+
readonly additionalProperties: false;
|
|
68
|
+
readonly properties: {
|
|
69
|
+
readonly kind: {
|
|
70
|
+
readonly enum: readonly ["equals", "isNot", "lessThan", "greaterThan", "lessOrEqual", "greaterOrEqual"];
|
|
71
|
+
};
|
|
72
|
+
readonly left: {
|
|
73
|
+
readonly $ref: "#/$defs/node";
|
|
74
|
+
};
|
|
75
|
+
readonly right: {
|
|
76
|
+
readonly $ref: "#/$defs/node";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
readonly ifElse: {
|
|
81
|
+
readonly type: "object";
|
|
82
|
+
readonly required: readonly ["kind", "cond", "then", "else"];
|
|
83
|
+
readonly additionalProperties: false;
|
|
84
|
+
readonly properties: {
|
|
85
|
+
readonly kind: {
|
|
86
|
+
readonly const: "ifElse";
|
|
87
|
+
};
|
|
88
|
+
readonly cond: {
|
|
89
|
+
readonly $ref: "#/$defs/node";
|
|
90
|
+
};
|
|
91
|
+
readonly then: {
|
|
92
|
+
readonly $ref: "#/$defs/node";
|
|
93
|
+
};
|
|
94
|
+
readonly else: {
|
|
95
|
+
readonly $ref: "#/$defs/node";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,QAAqE,CAAC;AAEvG;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DlB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chartRuleSchema = exports.CHART_RULE_SCHEMA_ID = void 0;
|
|
4
|
+
const types_1 = require("./types.js");
|
|
5
|
+
/** Stable identifier for the published contract, versioned by the tag. */
|
|
6
|
+
exports.CHART_RULE_SCHEMA_ID = `https://rippling.com/schemas/${types_1.CHART_RULE_CONTRACT_VERSION}.json`;
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
|
|
9
|
+
*
|
|
10
|
+
* This is the contract. A consumer that keeps its own rule evaluator (rather
|
|
11
|
+
* than importing `evaluate`) can validate against this so the two never drift —
|
|
12
|
+
* every kind and operand shape the builders can emit is described here.
|
|
13
|
+
*/
|
|
14
|
+
exports.chartRuleSchema = {
|
|
15
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
16
|
+
$id: exports.CHART_RULE_SCHEMA_ID,
|
|
17
|
+
title: 'Chart rule placeholder',
|
|
18
|
+
description: 'A rule tree the chart agent emits into a chart option, marked with $rule.',
|
|
19
|
+
type: 'object',
|
|
20
|
+
required: ['$rule', 'channel'],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
properties: {
|
|
23
|
+
// A colour rule's top-level tree is the conditional-value form (`when(...)`),
|
|
24
|
+
// matching what `color()` builds and accepts. A bare ref/comparison/literal
|
|
25
|
+
// resolves to a number/boolean/constant, not a colour decision.
|
|
26
|
+
$rule: { $ref: '#/$defs/ifElse' },
|
|
27
|
+
channel: { const: 'color' },
|
|
28
|
+
},
|
|
29
|
+
$defs: {
|
|
30
|
+
scalar: { type: ['number', 'string', 'boolean', 'null'] },
|
|
31
|
+
node: {
|
|
32
|
+
oneOf: [
|
|
33
|
+
{ $ref: '#/$defs/ref' },
|
|
34
|
+
{ $ref: '#/$defs/literal' },
|
|
35
|
+
{ $ref: '#/$defs/comparison' },
|
|
36
|
+
{ $ref: '#/$defs/ifElse' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
ref: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
required: ['kind'],
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
properties: { kind: { const: 'value' } },
|
|
44
|
+
},
|
|
45
|
+
literal: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
required: ['kind', 'value'],
|
|
48
|
+
additionalProperties: false,
|
|
49
|
+
properties: { kind: { const: 'literal' }, value: { $ref: '#/$defs/scalar' } },
|
|
50
|
+
},
|
|
51
|
+
comparison: {
|
|
52
|
+
type: 'object',
|
|
53
|
+
required: ['kind', 'left', 'right'],
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
properties: {
|
|
56
|
+
kind: { enum: ['equals', 'isNot', 'lessThan', 'greaterThan', 'lessOrEqual', 'greaterOrEqual'] },
|
|
57
|
+
left: { $ref: '#/$defs/node' },
|
|
58
|
+
right: { $ref: '#/$defs/node' },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
ifElse: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
required: ['kind', 'cond', 'then', 'else'],
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
properties: {
|
|
66
|
+
kind: { const: 'ifElse' },
|
|
67
|
+
cond: { $ref: '#/$defs/node' },
|
|
68
|
+
then: { $ref: '#/$defs/node' },
|
|
69
|
+
else: { $ref: '#/$defs/node' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":";;;AAAA,sCAAsD;AAEtD,0E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E;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;YACnC,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,CAAC,EAAE;gBAC/F,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;gBAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;aAChC;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAC1C,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACzB,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;gBAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;gBAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;aAC/B;SACF;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CHART_RULE_CONTRACT_VERSION } from "./types.mjs";
|
|
2
|
+
/** Stable identifier for the published contract, versioned by the tag. */
|
|
3
|
+
export const CHART_RULE_SCHEMA_ID = `https://rippling.com/schemas/${CHART_RULE_CONTRACT_VERSION}.json`;
|
|
4
|
+
/**
|
|
5
|
+
* JSON Schema (2020-12) for the `{$rule}` placeholder and its closed node set.
|
|
6
|
+
*
|
|
7
|
+
* This is the contract. A consumer that keeps its own rule evaluator (rather
|
|
8
|
+
* than importing `evaluate`) can validate against this so the two never drift —
|
|
9
|
+
* every kind and operand shape the builders can emit is described here.
|
|
10
|
+
*/
|
|
11
|
+
export const chartRuleSchema = {
|
|
12
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
13
|
+
$id: CHART_RULE_SCHEMA_ID,
|
|
14
|
+
title: 'Chart rule placeholder',
|
|
15
|
+
description: 'A rule tree the chart agent emits into a chart option, marked with $rule.',
|
|
16
|
+
type: 'object',
|
|
17
|
+
required: ['$rule', 'channel'],
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
properties: {
|
|
20
|
+
// A colour rule's top-level tree is the conditional-value form (`when(...)`),
|
|
21
|
+
// matching what `color()` builds and accepts. A bare ref/comparison/literal
|
|
22
|
+
// resolves to a number/boolean/constant, not a colour decision.
|
|
23
|
+
$rule: { $ref: '#/$defs/ifElse' },
|
|
24
|
+
channel: { const: 'color' },
|
|
25
|
+
},
|
|
26
|
+
$defs: {
|
|
27
|
+
scalar: { type: ['number', 'string', 'boolean', 'null'] },
|
|
28
|
+
node: {
|
|
29
|
+
oneOf: [
|
|
30
|
+
{ $ref: '#/$defs/ref' },
|
|
31
|
+
{ $ref: '#/$defs/literal' },
|
|
32
|
+
{ $ref: '#/$defs/comparison' },
|
|
33
|
+
{ $ref: '#/$defs/ifElse' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
ref: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
required: ['kind'],
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
properties: { kind: { const: 'value' } },
|
|
41
|
+
},
|
|
42
|
+
literal: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
required: ['kind', 'value'],
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
properties: { kind: { const: 'literal' }, value: { $ref: '#/$defs/scalar' } },
|
|
47
|
+
},
|
|
48
|
+
comparison: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
required: ['kind', 'left', 'right'],
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
properties: {
|
|
53
|
+
kind: { enum: ['equals', 'isNot', 'lessThan', 'greaterThan', 'lessOrEqual', 'greaterOrEqual'] },
|
|
54
|
+
left: { $ref: '#/$defs/node' },
|
|
55
|
+
right: { $ref: '#/$defs/node' },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
ifElse: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
required: ['kind', 'cond', 'then', 'else'],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
properties: {
|
|
63
|
+
kind: { const: 'ifElse' },
|
|
64
|
+
cond: { $ref: '#/$defs/node' },
|
|
65
|
+
then: { $ref: '#/$defs/node' },
|
|
66
|
+
else: { $ref: '#/$defs/node' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=schema.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.mjs","sourceRoot":"","sources":["../../src/lib/charts/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,oBAAgB;AAEtD,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,gCAAgC,2BAA2B,OAAO,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO,EAAE,8CAA8C;IACvD,GAAG,EAAE,oBAAoB;IACzB,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EAAE,2EAA2E;IACxF,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,8EAA8E;QAC9E,4EAA4E;QAC5E,gEAAgE;QAChE,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;QACjC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;KAC5B;IACD,KAAK,EAAE;QACL,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE;QACzD,IAAI,EAAE;YACJ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AAI,EAAE,cAAc,EAAE;gBAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;gBAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;aAC/B;SACF;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart rule vocabulary — shared types.
|
|
3
|
+
*
|
|
4
|
+
* A rule is a small, serializable tree of nodes discriminated by `kind`. The
|
|
5
|
+
* agent builds it with the helpers in `builders.ts`, which emit it wrapped in a
|
|
6
|
+
* `{$rule}` placeholder — the same idea as the `{$fn}` placeholders a chart
|
|
7
|
+
* already emits. The renderer resolves it with `evaluate`; the settings panel
|
|
8
|
+
* reads it with `describe`. All three agree because a node can only ever be one
|
|
9
|
+
* of the kinds defined here — the closed set the `chartRuleSchema` describes.
|
|
10
|
+
*
|
|
11
|
+
* v1 is scoped to conditional formatting: compare this datum's `value` against a
|
|
12
|
+
* constant, and (optionally) pick between two values. Richer pieces — aggregates,
|
|
13
|
+
* logic, more refs — are the documented roadmap in the README.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CHART_RULE_CONTRACT_VERSION: "chart_rule.v1";
|
|
16
|
+
export type ChartRuleContractVersion = typeof CHART_RULE_CONTRACT_VERSION;
|
|
17
|
+
/** A leaf value a rule can carry or resolve to. */
|
|
18
|
+
export type Scalar = number | string | boolean | null;
|
|
19
|
+
/** Reads a value out of the evaluation context — this datum's plotted value. */
|
|
20
|
+
export type RefNode = {
|
|
21
|
+
kind: 'value';
|
|
22
|
+
};
|
|
23
|
+
export interface LiteralNode {
|
|
24
|
+
kind: 'literal';
|
|
25
|
+
value: Scalar;
|
|
26
|
+
}
|
|
27
|
+
export type ComparisonKind = 'equals' | 'isNot' | 'lessThan' | 'greaterThan' | 'lessOrEqual' | 'greaterOrEqual';
|
|
28
|
+
export interface ComparisonNode {
|
|
29
|
+
kind: ComparisonKind;
|
|
30
|
+
left: RuleNode;
|
|
31
|
+
right: RuleNode;
|
|
32
|
+
}
|
|
33
|
+
/** The conditional-value form produced by `when(cond, then, else)`. */
|
|
34
|
+
export interface IfElseNode {
|
|
35
|
+
kind: 'ifElse';
|
|
36
|
+
cond: RuleNode;
|
|
37
|
+
then: RuleNode;
|
|
38
|
+
else: RuleNode;
|
|
39
|
+
}
|
|
40
|
+
/** Any node of a rule tree. */
|
|
41
|
+
export type RuleNode = RefNode | LiteralNode | ComparisonNode | IfElseNode;
|
|
42
|
+
/**
|
|
43
|
+
* The chart channel a rule drives. v1 supports colour only — a rule decides the
|
|
44
|
+
* colour of a series/datum. Other channels (opacity, label visibility, …) are
|
|
45
|
+
* the documented roadmap and would be added here.
|
|
46
|
+
*/
|
|
47
|
+
export type RuleChannel = 'color';
|
|
48
|
+
/**
|
|
49
|
+
* What a builder returns: a rule tree, marked so the renderer can find it, and
|
|
50
|
+
* tagged with the channel it targets. `channel: 'color'` says this resolves to a
|
|
51
|
+
* colour — so a reader sees the target without inferring it from where it sits.
|
|
52
|
+
*/
|
|
53
|
+
export interface RulePlaceholder {
|
|
54
|
+
$rule: RuleNode;
|
|
55
|
+
channel: RuleChannel;
|
|
56
|
+
}
|
|
57
|
+
/** A placeholder, or the bare tree — what `evaluate` and `describe` accept. */
|
|
58
|
+
export type Rule = RulePlaceholder | RuleNode;
|
|
59
|
+
/** What a rule is evaluated against: the current datum's value. */
|
|
60
|
+
export interface RuleContext {
|
|
61
|
+
value: number;
|
|
62
|
+
}
|
|
63
|
+
/** The result of evaluating a node. */
|
|
64
|
+
export type RuleValue = Scalar;
|
|
65
|
+
/**
|
|
66
|
+
* The deepest a rule may nest before `evaluate`/`describe` refuse it. Real rules
|
|
67
|
+
* are a handful of levels; this only stops a pathological deserialized tree from
|
|
68
|
+
* overflowing the stack. Far below the JS call-stack limit.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MAX_RULE_DEPTH = 256;
|
|
71
|
+
export type ControlRole = 'rule' | 'comparison' | 'ref' | 'literal';
|
|
72
|
+
/** A node as the panel should show it: a label, its editable value, its parts. */
|
|
73
|
+
export interface Control {
|
|
74
|
+
role: ControlRole;
|
|
75
|
+
label: string;
|
|
76
|
+
value?: Scalar;
|
|
77
|
+
parts?: Control[];
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/lib/charts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,2BAA2B,EAAG,eAAwB,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC;AAE1E,mDAAmD;AACnD,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAMtD,gFAAgF;AAChF,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,OAAO,GACP,UAAU,GACV,aAAa,GACb,aAAa,GACb,gBAAgB,CAAC;AACrB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED,uEAAuE;AACvE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,+BAA+B;AAC/B,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,cAAc,GAAG,UAAU,CAAC;AAM3E;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;AAElC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;CACtB;AAED,+EAA+E;AAC/E,MAAM,MAAM,IAAI,GAAG,eAAe,GAAG,QAAQ,CAAC;AAM9C,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;GAIG;AACH,eAAO,MAAM,cAAc,MAAM,CAAC;AAMlC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEpE,kFAAkF;AAClF,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;CACnB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart rule vocabulary — shared types.
|
|
3
|
+
*
|
|
4
|
+
* A rule is a small, serializable tree of nodes discriminated by `kind`. The
|
|
5
|
+
* agent builds it with the helpers in `builders.ts`, which emit it wrapped in a
|
|
6
|
+
* `{$rule}` placeholder — the same idea as the `{$fn}` placeholders a chart
|
|
7
|
+
* already emits. The renderer resolves it with `evaluate`; the settings panel
|
|
8
|
+
* reads it with `describe`. All three agree because a node can only ever be one
|
|
9
|
+
* of the kinds defined here — the closed set the `chartRuleSchema` describes.
|
|
10
|
+
*
|
|
11
|
+
* v1 is scoped to conditional formatting: compare this datum's `value` against a
|
|
12
|
+
* constant, and (optionally) pick between two values. Richer pieces — aggregates,
|
|
13
|
+
* logic, more refs — are the documented roadmap in the README.
|
|
14
|
+
*/
|
|
15
|
+
export declare const CHART_RULE_CONTRACT_VERSION: "chart_rule.v1";
|
|
16
|
+
export type ChartRuleContractVersion = typeof CHART_RULE_CONTRACT_VERSION;
|
|
17
|
+
/** A leaf value a rule can carry or resolve to. */
|
|
18
|
+
export type Scalar = number | string | boolean | null;
|
|
19
|
+
/** Reads a value out of the evaluation context — this datum's plotted value. */
|
|
20
|
+
export type RefNode = {
|
|
21
|
+
kind: 'value';
|
|
22
|
+
};
|
|
23
|
+
export interface LiteralNode {
|
|
24
|
+
kind: 'literal';
|
|
25
|
+
value: Scalar;
|
|
26
|
+
}
|
|
27
|
+
export type ComparisonKind = 'equals' | 'isNot' | 'lessThan' | 'greaterThan' | 'lessOrEqual' | 'greaterOrEqual';
|
|
28
|
+
export interface ComparisonNode {
|
|
29
|
+
kind: ComparisonKind;
|
|
30
|
+
left: RuleNode;
|
|
31
|
+
right: RuleNode;
|
|
32
|
+
}
|
|
33
|
+
/** The conditional-value form produced by `when(cond, then, else)`. */
|
|
34
|
+
export interface IfElseNode {
|
|
35
|
+
kind: 'ifElse';
|
|
36
|
+
cond: RuleNode;
|
|
37
|
+
then: RuleNode;
|
|
38
|
+
else: RuleNode;
|
|
39
|
+
}
|
|
40
|
+
/** Any node of a rule tree. */
|
|
41
|
+
export type RuleNode = RefNode | LiteralNode | ComparisonNode | IfElseNode;
|
|
42
|
+
/**
|
|
43
|
+
* The chart channel a rule drives. v1 supports colour only — a rule decides the
|
|
44
|
+
* colour of a series/datum. Other channels (opacity, label visibility, …) are
|
|
45
|
+
* the documented roadmap and would be added here.
|
|
46
|
+
*/
|
|
47
|
+
export type RuleChannel = 'color';
|
|
48
|
+
/**
|
|
49
|
+
* What a builder returns: a rule tree, marked so the renderer can find it, and
|
|
50
|
+
* tagged with the channel it targets. `channel: 'color'` says this resolves to a
|
|
51
|
+
* colour — so a reader sees the target without inferring it from where it sits.
|
|
52
|
+
*/
|
|
53
|
+
export interface RulePlaceholder {
|
|
54
|
+
$rule: RuleNode;
|
|
55
|
+
channel: RuleChannel;
|
|
56
|
+
}
|
|
57
|
+
/** A placeholder, or the bare tree — what `evaluate` and `describe` accept. */
|
|
58
|
+
export type Rule = RulePlaceholder | RuleNode;
|
|
59
|
+
/** What a rule is evaluated against: the current datum's value. */
|
|
60
|
+
export interface RuleContext {
|
|
61
|
+
value: number;
|
|
62
|
+
}
|
|
63
|
+
/** The result of evaluating a node. */
|
|
64
|
+
export type RuleValue = Scalar;
|
|
65
|
+
/**
|
|
66
|
+
* The deepest a rule may nest before `evaluate`/`describe` refuse it. Real rules
|
|
67
|
+
* are a handful of levels; this only stops a pathological deserialized tree from
|
|
68
|
+
* overflowing the stack. Far below the JS call-stack limit.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MAX_RULE_DEPTH = 256;
|
|
71
|
+
export type ControlRole = 'rule' | 'comparison' | 'ref' | 'literal';
|
|
72
|
+
/** A node as the panel should show it: a label, its editable value, its parts. */
|
|
73
|
+
export interface Control {
|
|
74
|
+
role: ControlRole;
|
|
75
|
+
label: string;
|
|
76
|
+
value?: Scalar;
|
|
77
|
+
parts?: Control[];
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/charts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,2BAA2B,EAAG,eAAwB,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC;AAE1E,mDAAmD;AACnD,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAMtD,gFAAgF;AAChF,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,OAAO,GACP,UAAU,GACV,aAAa,GACb,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ated by `kind`. The
|
|
6
|
+
* agent builds it with the helpers in `builders.ts`, which emit it wrapped in a
|
|
7
|
+
* `{$rule}` placeholder — the same idea as the `{$fn}` placeholders a chart
|
|
8
|
+
* already emits. The renderer resolves it with `evaluate`; the settings panel
|
|
9
|
+
* reads it with `describe`. All three agree because a node can only ever be one
|
|
10
|
+
* of the kinds defined here — the closed set the `chartRuleSchema` describes.
|
|
11
|
+
*
|
|
12
|
+
* v1 is scoped to conditional formatting: compare this datum's `value` against a
|
|
13
|
+
* constant, and (optionally) pick between two values. Richer pieces — aggregates,
|
|
14
|
+
* logic, more refs — are the documented roadmap in the README.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MAX_RULE_DEPTH = exports.CHART_RULE_CONTRACT_VERSION = void 0;
|
|
18
|
+
exports.CHART_RULE_CONTRACT_VERSION = 'chart_rule.v1';
|
|
19
|
+
/**
|
|
20
|
+
* The deepest a rule may nest before `evaluate`/`describe` refuse it. Real rules
|
|
21
|
+
* are a handful of levels; this only stops a pathological deserialized tree from
|
|
22
|
+
* overflowing the stack. Far below the JS call-stack limit.
|
|
23
|
+
*/
|
|
24
|
+
exports.MAX_RULE_DEPTH = 256;
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/charts/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEU,QAAA,2BAA2B,GAAG,eAAwB,CAAC;AA8EpE;;;;GAIG;AACU,QAAA,cAAc,GAAG,GAAG,CAAC"}
|