@rippling/rippling-sdk 0.2.0-alpha.34 → 0.2.0-alpha.36
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/examples/.keep +4 -0
- package/examples/manifest/dental-practice-management/dental-practice-management.ts +651 -0
- package/examples/manifest/dental-practice-management/manifest.json +1870 -0
- package/examples/manifest/gym-membership-management/gym-membership-management.ts +757 -0
- package/examples/manifest/gym-membership-management/manifest.json +1975 -0
- package/examples/sdui/sdui-crud-todo/rippling-function.ts +367 -0
- package/examples/sdui/sdui-crud-todo/sdui-crud-todo.ts +282 -0
- package/examples/sdui/sdui-showcase/rippling-function.ts +381 -0
- package/examples/sdui/sdui-showcase/sdui-showcase.ts +351 -0
- package/examples/sdui/sdui-tab-multi-view/rippling-function.ts +1061 -0
- package/examples/sdui/sdui-tab-multi-view/sdui-tab-multi-view.ts +924 -0
- package/examples/sdui/vote/rippling-function.ts +330 -0
- package/examples/sdui/vote/vote.ts +298 -0
- package/lib/manifest/app.d.mts +81 -13
- package/lib/manifest/app.d.mts.map +1 -1
- package/lib/manifest/app.d.ts +81 -13
- package/lib/manifest/app.d.ts.map +1 -1
- package/lib/manifest/app.js +37 -16
- package/lib/manifest/app.js.map +1 -1
- package/lib/manifest/app.mjs +37 -16
- package/lib/manifest/app.mjs.map +1 -1
- package/lib/manifest/category.d.mts +63 -7
- package/lib/manifest/category.d.mts.map +1 -1
- package/lib/manifest/category.d.ts +63 -7
- package/lib/manifest/category.d.ts.map +1 -1
- package/lib/manifest/category.js +45 -10
- package/lib/manifest/category.js.map +1 -1
- package/lib/manifest/category.mjs +43 -8
- package/lib/manifest/category.mjs.map +1 -1
- package/lib/manifest/custom-object-field-section.d.mts +56 -6
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
- package/lib/manifest/custom-object-field-section.d.ts +56 -6
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
- package/lib/manifest/custom-object-field-section.js +41 -14
- package/lib/manifest/custom-object-field-section.js.map +1 -1
- package/lib/manifest/custom-object-field-section.mjs +39 -12
- package/lib/manifest/custom-object-field-section.mjs.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.mts +201 -41
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +201 -41
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +76 -30
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +74 -28
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/custom-object.d.mts +128 -15
- package/lib/manifest/custom-object.d.mts.map +1 -1
- package/lib/manifest/custom-object.d.ts +128 -15
- package/lib/manifest/custom-object.d.ts.map +1 -1
- package/lib/manifest/custom-object.js +61 -26
- package/lib/manifest/custom-object.js.map +1 -1
- package/lib/manifest/custom-object.mjs +61 -26
- package/lib/manifest/custom-object.mjs.map +1 -1
- package/lib/manifest/field.d.mts +265 -54
- package/lib/manifest/field.d.mts.map +1 -1
- package/lib/manifest/field.d.ts +265 -54
- package/lib/manifest/field.d.ts.map +1 -1
- package/lib/manifest/field.js +100 -57
- package/lib/manifest/field.js.map +1 -1
- package/lib/manifest/field.mjs +100 -57
- package/lib/manifest/field.mjs.map +1 -1
- package/lib/manifest/list-view.d.mts +105 -14
- package/lib/manifest/list-view.d.mts.map +1 -1
- package/lib/manifest/list-view.d.ts +105 -14
- package/lib/manifest/list-view.d.ts.map +1 -1
- package/lib/manifest/list-view.js +50 -14
- package/lib/manifest/list-view.js.map +1 -1
- package/lib/manifest/list-view.mjs +48 -12
- package/lib/manifest/list-view.mjs.map +1 -1
- package/lib/manifest/manifest-builder.d.mts +77 -11
- package/lib/manifest/manifest-builder.d.mts.map +1 -1
- package/lib/manifest/manifest-builder.d.ts +77 -11
- package/lib/manifest/manifest-builder.d.ts.map +1 -1
- package/lib/manifest/manifest-builder.js +46 -24
- package/lib/manifest/manifest-builder.js.map +1 -1
- package/lib/manifest/manifest-builder.mjs +44 -22
- package/lib/manifest/manifest-builder.mjs.map +1 -1
- package/lib/manifest/manifest-function.d.mts +92 -12
- package/lib/manifest/manifest-function.d.mts.map +1 -1
- package/lib/manifest/manifest-function.d.ts +92 -12
- package/lib/manifest/manifest-function.d.ts.map +1 -1
- package/lib/manifest/manifest-function.js +40 -11
- package/lib/manifest/manifest-function.js.map +1 -1
- package/lib/manifest/manifest-function.mjs +38 -9
- package/lib/manifest/manifest-function.mjs.map +1 -1
- package/lib/manifest/rule.d.mts +94 -16
- package/lib/manifest/rule.d.mts.map +1 -1
- package/lib/manifest/rule.d.ts +94 -16
- package/lib/manifest/rule.d.ts.map +1 -1
- package/lib/manifest/rule.js +36 -15
- package/lib/manifest/rule.js.map +1 -1
- package/lib/manifest/rule.mjs +36 -15
- package/lib/manifest/rule.mjs.map +1 -1
- package/lib/manifest/sdui-page.d.mts +67 -11
- package/lib/manifest/sdui-page.d.mts.map +1 -1
- package/lib/manifest/sdui-page.d.ts +67 -11
- package/lib/manifest/sdui-page.d.ts.map +1 -1
- package/lib/manifest/sdui-page.js +44 -13
- package/lib/manifest/sdui-page.js.map +1 -1
- package/lib/manifest/sdui-page.mjs +42 -11
- package/lib/manifest/sdui-page.mjs.map +1 -1
- package/lib/manifest/validation.d.mts +87 -12
- package/lib/manifest/validation.d.mts.map +1 -1
- package/lib/manifest/validation.d.ts +87 -12
- package/lib/manifest/validation.d.ts.map +1 -1
- package/lib/manifest/validation.js +41 -15
- package/lib/manifest/validation.js.map +1 -1
- package/lib/manifest/validation.mjs +39 -13
- package/lib/manifest/validation.mjs.map +1 -1
- package/lib/sdui/actions.d.mts +25 -0
- package/lib/sdui/actions.d.mts.map +1 -0
- package/lib/sdui/actions.d.ts +25 -0
- package/lib/sdui/actions.d.ts.map +1 -0
- package/lib/sdui/actions.js +53 -0
- package/lib/sdui/actions.js.map +1 -0
- package/lib/sdui/actions.mjs +42 -0
- package/lib/sdui/actions.mjs.map +1 -0
- package/lib/sdui/component.d.mts +41 -0
- package/lib/sdui/component.d.mts.map +1 -0
- package/lib/sdui/component.d.ts +41 -0
- package/lib/sdui/component.d.ts.map +1 -0
- package/lib/sdui/component.js +95 -0
- package/lib/sdui/component.js.map +1 -0
- package/lib/sdui/component.mjs +91 -0
- package/lib/sdui/component.mjs.map +1 -0
- package/lib/sdui/components.d.mts +149 -0
- package/lib/sdui/components.d.mts.map +1 -0
- package/lib/sdui/components.d.ts +149 -0
- package/lib/sdui/components.d.ts.map +1 -0
- package/lib/sdui/components.js +303 -0
- package/lib/sdui/components.js.map +1 -0
- package/lib/sdui/components.mjs +298 -0
- package/lib/sdui/components.mjs.map +1 -0
- package/lib/sdui/conditions.d.mts +25 -0
- package/lib/sdui/conditions.d.mts.map +1 -0
- package/lib/sdui/conditions.d.ts +25 -0
- package/lib/sdui/conditions.d.ts.map +1 -0
- package/lib/sdui/conditions.js +47 -0
- package/lib/sdui/conditions.js.map +1 -0
- package/lib/sdui/conditions.mjs +35 -0
- package/lib/sdui/conditions.mjs.map +1 -0
- package/lib/sdui/directives.d.mts +18 -0
- package/lib/sdui/directives.d.mts.map +1 -0
- package/lib/sdui/directives.d.ts +18 -0
- package/lib/sdui/directives.d.ts.map +1 -0
- package/lib/sdui/directives.js +28 -0
- package/lib/sdui/directives.js.map +1 -0
- package/lib/sdui/directives.mjs +21 -0
- package/lib/sdui/directives.mjs.map +1 -0
- package/lib/sdui/index.d.mts +362 -0
- package/lib/sdui/index.d.mts.map +1 -0
- package/lib/sdui/index.d.ts +362 -0
- package/lib/sdui/index.d.ts.map +1 -0
- package/lib/sdui/index.js +375 -0
- package/lib/sdui/index.js.map +1 -0
- package/lib/sdui/index.mjs +199 -0
- package/lib/sdui/index.mjs.map +1 -0
- package/lib/sdui/props.d.mts +12 -0
- package/lib/sdui/props.d.mts.map +1 -0
- package/lib/sdui/props.d.ts +12 -0
- package/lib/sdui/props.d.ts.map +1 -0
- package/lib/sdui/props.js +25 -0
- package/lib/sdui/props.js.map +1 -0
- package/lib/sdui/props.mjs +21 -0
- package/lib/sdui/props.mjs.map +1 -0
- package/lib/sdui/render.d.mts +23 -0
- package/lib/sdui/render.d.mts.map +1 -0
- package/lib/sdui/render.d.ts +23 -0
- package/lib/sdui/render.d.ts.map +1 -0
- package/lib/sdui/render.js +40 -0
- package/lib/sdui/render.js.map +1 -0
- package/lib/sdui/render.mjs +37 -0
- package/lib/sdui/render.mjs.map +1 -0
- package/lib/sdui/state.d.mts +22 -0
- package/lib/sdui/state.d.mts.map +1 -0
- package/lib/sdui/state.d.ts +22 -0
- package/lib/sdui/state.d.ts.map +1 -0
- package/lib/sdui/state.js +57 -0
- package/lib/sdui/state.js.map +1 -0
- package/lib/sdui/state.mjs +53 -0
- package/lib/sdui/state.mjs.map +1 -0
- package/package.json +11 -1
- package/resources/company-legal-entity-workers.d.mts +79 -0
- package/resources/company-legal-entity-workers.d.mts.map +1 -0
- package/resources/company-legal-entity-workers.d.ts +79 -0
- package/resources/company-legal-entity-workers.d.ts.map +1 -0
- package/resources/company-legal-entity-workers.js +30 -0
- package/resources/company-legal-entity-workers.js.map +1 -0
- package/resources/company-legal-entity-workers.mjs +26 -0
- package/resources/company-legal-entity-workers.mjs.map +1 -0
- package/resources/draft-hires.d.mts +4 -0
- package/resources/draft-hires.d.mts.map +1 -1
- package/resources/draft-hires.d.ts +4 -0
- package/resources/draft-hires.d.ts.map +1 -1
- package/resources/files.d.mts +16 -1
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +16 -1
- package/resources/files.d.ts.map +1 -1
- package/resources/headcount-positions.d.mts +2 -2
- package/resources/headcount-positions.d.mts.map +1 -1
- package/resources/headcount-positions.d.ts +2 -2
- package/resources/headcount-positions.d.ts.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/legal-entities.d.mts +1 -1
- package/resources/legal-entities.d.mts.map +1 -1
- package/resources/legal-entities.d.ts +1 -1
- package/resources/legal-entities.d.ts.map +1 -1
- package/resources/location-factors.d.mts +2 -2
- package/resources/location-factors.d.mts.map +1 -1
- package/resources/location-factors.d.ts +2 -2
- package/resources/location-factors.d.ts.map +1 -1
- package/resources/shared.d.mts +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/workers.d.mts +2 -2
- package/resources/workers.d.mts.map +1 -1
- package/resources/workers.d.ts +2 -2
- package/resources/workers.d.ts.map +1 -1
- package/src/client.ts +20 -0
- package/src/lib/manifest/app.ts +81 -26
- package/src/lib/manifest/category.ts +63 -14
- package/src/lib/manifest/custom-object-field-section.ts +56 -17
- package/src/lib/manifest/custom-object-page-layout.ts +201 -66
- package/src/lib/manifest/custom-object.ts +128 -37
- package/src/lib/manifest/field.ts +265 -75
- package/src/lib/manifest/list-view.ts +105 -25
- package/src/lib/manifest/manifest-builder.ts +75 -32
- package/src/lib/manifest/manifest-function.ts +92 -22
- package/src/lib/manifest/rule.ts +95 -29
- package/src/lib/manifest/sdui-page.ts +67 -21
- package/src/lib/manifest/validation.ts +87 -24
- package/src/lib/sdui/actions.ts +58 -0
- package/src/lib/sdui/component.ts +122 -0
- package/src/lib/sdui/components.ts +308 -0
- package/src/lib/sdui/conditions.ts +59 -0
- package/src/lib/sdui/directives.ts +42 -0
- package/src/lib/sdui/index.ts +365 -0
- package/src/lib/sdui/props.ts +32 -0
- package/src/lib/sdui/render.ts +58 -0
- package/src/lib/sdui/state.ts +60 -0
- package/src/resources/company-legal-entity-workers.ts +115 -0
- package/src/resources/draft-hires.ts +5 -0
- package/src/resources/files.ts +18 -1
- package/src/resources/headcount-positions.ts +2 -0
- package/src/resources/index.ts +7 -0
- package/src/resources/legal-entities.ts +1 -0
- package/src/resources/location-factors.ts +2 -0
- package/src/resources/shared.ts +1 -0
- package/src/resources/workers.ts +2 -0
- 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
|
@@ -1,33 +1,89 @@
|
|
|
1
1
|
import type { ManifestFunction } from "./manifest-function.js";
|
|
2
2
|
import type { ManifestScope } from "./manifest-builder.js";
|
|
3
|
+
/**
|
|
4
|
+
* Initialization properties for {@link SduiPage}.
|
|
5
|
+
*/
|
|
3
6
|
export interface SduiPageProps {
|
|
4
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for this page within the package (e.g. `'gym_today_schedule'`).
|
|
9
|
+
*
|
|
10
|
+
* Required.
|
|
11
|
+
*/
|
|
5
12
|
sduiPageId: string;
|
|
6
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Display name shown as the tab label in the app (e.g. `'Today\'s schedule'`).
|
|
15
|
+
*
|
|
16
|
+
* Required.
|
|
17
|
+
*/
|
|
7
18
|
name: string;
|
|
8
19
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
20
|
+
* The function that renders this page. Pass a live {@link ManifestFunction} reference,
|
|
21
|
+
* or a raw api_name string for functions defined outside this manifest.
|
|
22
|
+
*
|
|
23
|
+
* Required.
|
|
12
24
|
*/
|
|
13
25
|
function: ManifestFunction | string;
|
|
14
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Human-readable description of what this page shows.
|
|
28
|
+
*
|
|
29
|
+
* Optional. @default `''`
|
|
30
|
+
*/
|
|
15
31
|
description?: string;
|
|
16
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Defines an SDUI page and registers it with the manifest.
|
|
35
|
+
*
|
|
36
|
+
* An SDUI page is a custom UI surface backed by a {@link ManifestFunction}. It appears
|
|
37
|
+
* as a tab in a Rippling {@link App}. You would normally define SDUI pages after the
|
|
38
|
+
* functions they reference, then pass them to an `App` via `pages`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const todaySchedulePage = new SduiPage(manifest, {
|
|
43
|
+
* sduiPageId: 'gym_today_schedule',
|
|
44
|
+
* name: 'Today\'s schedule',
|
|
45
|
+
* function: todayScheduleFn,
|
|
46
|
+
* description: 'SDUI list of class sessions for front desk',
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* new App(manifest, {
|
|
50
|
+
* apiName: 'gym_membership_management_app',
|
|
51
|
+
* name: 'Gym Membership Management',
|
|
52
|
+
* pages: [memberObj, trainerObj, todaySchedulePage],
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @see {@link ManifestFunction} — provides the handler that renders this page.
|
|
57
|
+
* @see {@link App} — hosts this page as a tab via `pages`.
|
|
58
|
+
*/
|
|
17
59
|
export declare class SduiPage {
|
|
18
60
|
private readonly _sduiPageId;
|
|
19
61
|
private readonly _name;
|
|
20
62
|
private readonly _functionApiName;
|
|
21
63
|
private readonly _description;
|
|
22
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* @param scope - The manifest to register this page with.
|
|
66
|
+
* @param props - Initialization properties.
|
|
67
|
+
* @throws {Error} If `sduiPageId`, `name`, or `function` is missing.
|
|
68
|
+
*/
|
|
23
69
|
constructor(scope: ManifestScope, props: SduiPageProps);
|
|
24
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Returns the unique page identifier (e.g. `'gym_today_schedule'`).
|
|
72
|
+
*/
|
|
25
73
|
getSduiPageId(): string;
|
|
26
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Returns the display name (tab label) of this page.
|
|
76
|
+
*/
|
|
27
77
|
getName(): string;
|
|
28
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* Returns the api_name of the function backing this page.
|
|
80
|
+
*/
|
|
29
81
|
getFunctionApiName(): string;
|
|
30
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Serializes this SDUI page to the wire format consumed by the manifest install endpoint.
|
|
84
|
+
*
|
|
85
|
+
* @returns A plain object with `type: 'SDUI_PAGE'`.
|
|
86
|
+
*/
|
|
31
87
|
toDict(): Record<string, any>;
|
|
32
88
|
}
|
|
33
89
|
//# sourceMappingURL=sdui-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdui-page.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdui-page.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,gBAAgB,EAAE;OACzB,KAAK,EAAE,aAAa,EAAE;AAE7B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAAC;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IAEtC;;;;OAIG;gBACS,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa;IAWtD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAI5B;;;;OAIG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAS9B"}
|
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SduiPage = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Defines an SDUI page and registers it with the manifest.
|
|
6
|
+
*
|
|
7
|
+
* An SDUI page is a custom UI surface backed by a {@link ManifestFunction}. It appears
|
|
8
|
+
* as a tab in a Rippling {@link App}. You would normally define SDUI pages after the
|
|
9
|
+
* functions they reference, then pass them to an `App` via `pages`.
|
|
4
10
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const todaySchedulePage = new SduiPage(manifest, {
|
|
14
|
+
* sduiPageId: 'gym_today_schedule',
|
|
15
|
+
* name: 'Today\'s schedule',
|
|
16
|
+
* function: todayScheduleFn,
|
|
17
|
+
* description: 'SDUI list of class sessions for front desk',
|
|
18
|
+
* });
|
|
8
19
|
*
|
|
9
|
-
*
|
|
20
|
+
* new App(manifest, {
|
|
21
|
+
* apiName: 'gym_membership_management_app',
|
|
22
|
+
* name: 'Gym Membership Management',
|
|
23
|
+
* pages: [memberObj, trainerObj, todaySchedulePage],
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link ManifestFunction} — provides the handler that renders this page.
|
|
28
|
+
* @see {@link App} — hosts this page as a tab via `pages`.
|
|
10
29
|
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SduiPage = void 0;
|
|
13
30
|
class SduiPage {
|
|
14
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @param scope - The manifest to register this page with.
|
|
33
|
+
* @param props - Initialization properties.
|
|
34
|
+
* @throws {Error} If `sduiPageId`, `name`, or `function` is missing.
|
|
35
|
+
*/
|
|
15
36
|
constructor(scope, props) {
|
|
16
37
|
if (!props.sduiPageId)
|
|
17
38
|
throw new Error('sduiPageId is required');
|
|
@@ -25,19 +46,29 @@ class SduiPage {
|
|
|
25
46
|
this._description = props.description ?? '';
|
|
26
47
|
scope._register(this);
|
|
27
48
|
}
|
|
28
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Returns the unique page identifier (e.g. `'gym_today_schedule'`).
|
|
51
|
+
*/
|
|
29
52
|
getSduiPageId() {
|
|
30
53
|
return this._sduiPageId;
|
|
31
54
|
}
|
|
32
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Returns the display name (tab label) of this page.
|
|
57
|
+
*/
|
|
33
58
|
getName() {
|
|
34
59
|
return this._name;
|
|
35
60
|
}
|
|
36
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Returns the api_name of the function backing this page.
|
|
63
|
+
*/
|
|
37
64
|
getFunctionApiName() {
|
|
38
65
|
return this._functionApiName;
|
|
39
66
|
}
|
|
40
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Serializes this SDUI page to the wire format consumed by the manifest install endpoint.
|
|
69
|
+
*
|
|
70
|
+
* @returns A plain object with `type: 'SDUI_PAGE'`.
|
|
71
|
+
*/
|
|
41
72
|
toDict() {
|
|
42
73
|
return {
|
|
43
74
|
type: 'SDUI_PAGE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdui-page.js","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"sdui-page.js","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":";;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,QAAQ;IAMnB;;;;OAIG;IACH,YAAY,KAAoB,EAAE,KAAoB;QACpD,IAAI,CAAC,KAAK,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC1G,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;QAC5C,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,YAAY,EAAE,IAAI,CAAC,WAAW;YAC9B,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;YACxC,WAAW,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC;IACJ,CAAC;CACF;AAzDD,4BAyDC"}
|
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Defines an SDUI page and registers it with the manifest.
|
|
3
3
|
*
|
|
4
|
-
* SDUI page
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
4
|
+
* An SDUI page is a custom UI surface backed by a {@link ManifestFunction}. It appears
|
|
5
|
+
* as a tab in a Rippling {@link App}. You would normally define SDUI pages after the
|
|
6
|
+
* functions they reference, then pass them to an `App` via `pages`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const todaySchedulePage = new SduiPage(manifest, {
|
|
11
|
+
* sduiPageId: 'gym_today_schedule',
|
|
12
|
+
* name: 'Today\'s schedule',
|
|
13
|
+
* function: todayScheduleFn,
|
|
14
|
+
* description: 'SDUI list of class sessions for front desk',
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* new App(manifest, {
|
|
18
|
+
* apiName: 'gym_membership_management_app',
|
|
19
|
+
* name: 'Gym Membership Management',
|
|
20
|
+
* pages: [memberObj, trainerObj, todaySchedulePage],
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @see {@link ManifestFunction} — provides the handler that renders this page.
|
|
25
|
+
* @see {@link App} — hosts this page as a tab via `pages`.
|
|
9
26
|
*/
|
|
10
27
|
export class SduiPage {
|
|
11
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* @param scope - The manifest to register this page with.
|
|
30
|
+
* @param props - Initialization properties.
|
|
31
|
+
* @throws {Error} If `sduiPageId`, `name`, or `function` is missing.
|
|
32
|
+
*/
|
|
12
33
|
constructor(scope, props) {
|
|
13
34
|
if (!props.sduiPageId)
|
|
14
35
|
throw new Error('sduiPageId is required');
|
|
@@ -22,19 +43,29 @@ export class SduiPage {
|
|
|
22
43
|
this._description = props.description ?? '';
|
|
23
44
|
scope._register(this);
|
|
24
45
|
}
|
|
25
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Returns the unique page identifier (e.g. `'gym_today_schedule'`).
|
|
48
|
+
*/
|
|
26
49
|
getSduiPageId() {
|
|
27
50
|
return this._sduiPageId;
|
|
28
51
|
}
|
|
29
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Returns the display name (tab label) of this page.
|
|
54
|
+
*/
|
|
30
55
|
getName() {
|
|
31
56
|
return this._name;
|
|
32
57
|
}
|
|
33
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Returns the api_name of the function backing this page.
|
|
60
|
+
*/
|
|
34
61
|
getFunctionApiName() {
|
|
35
62
|
return this._functionApiName;
|
|
36
63
|
}
|
|
37
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Serializes this SDUI page to the wire format consumed by the manifest install endpoint.
|
|
66
|
+
*
|
|
67
|
+
* @returns A plain object with `type: 'SDUI_PAGE'`.
|
|
68
|
+
*/
|
|
38
69
|
toDict() {
|
|
39
70
|
return {
|
|
40
71
|
type: 'SDUI_PAGE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdui-page.mjs","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdui-page.mjs","sourceRoot":"","sources":["../../src/lib/manifest/sdui-page.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,QAAQ;IAMnB;;;;OAIG;IACH,YAAY,KAAoB,EAAE,KAAoB;QACpD,IAAI,CAAC,KAAK,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,gBAAgB,GAAG,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QAC1G,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC;QAC5C,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,YAAY,EAAE,IAAI,CAAC,WAAW;YAC9B,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;YACxC,WAAW,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,24 +1,87 @@
|
|
|
1
1
|
import { type ValidationLevel, type ValidationState } from "./_helpers.mjs";
|
|
2
2
|
import type { CustomObject } from "./custom-object.mjs";
|
|
3
3
|
import type { Field } from "./field.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Initialization properties for {@link Validation}.
|
|
6
|
+
*/
|
|
4
7
|
export interface ValidationProps {
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Display name of this validation rule shown in the UI.
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
6
13
|
displayName: string;
|
|
7
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* RQL formula that returns `true` when the record is **invalid**.
|
|
16
|
+
*
|
|
17
|
+
* Required. Note the violation semantics: a truthy result triggers the error,
|
|
18
|
+
* not a passing check. Example: `'(end_time__c <= start_time__c)'` fires when
|
|
19
|
+
* end is not after start.
|
|
20
|
+
*/
|
|
8
21
|
rqlFormula: string;
|
|
9
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* User-facing error message shown when the validation fires.
|
|
24
|
+
*
|
|
25
|
+
* Required. Pass an empty string for no message.
|
|
26
|
+
*/
|
|
10
27
|
errorMessage: string;
|
|
11
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Whether this rule is active or inactive.
|
|
30
|
+
*
|
|
31
|
+
* Required. One of `'ACTIVE'` | `'INACTIVE'`.
|
|
32
|
+
*/
|
|
12
33
|
state: ValidationState;
|
|
13
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Whether the error is shown at the record level or on a specific field.
|
|
36
|
+
*
|
|
37
|
+
* Required. One of `'RECORD'` | `'FIELD'`. When `'FIELD'`, also set `fieldRef`.
|
|
38
|
+
*/
|
|
14
39
|
level: ValidationLevel;
|
|
15
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Internal description of this rule (for developer reference only).
|
|
42
|
+
*
|
|
43
|
+
* Required. Pass an empty string if unused.
|
|
44
|
+
*/
|
|
16
45
|
ruleDescription: string;
|
|
17
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Stable identifier for this rule. Pass a human-readable slug
|
|
48
|
+
* (e.g. `'gym_session_end_after_start'`) to keep it stable across regenerations.
|
|
49
|
+
*
|
|
50
|
+
* Optional. Auto-generated when omitted. @default generateId('rule')
|
|
51
|
+
*/
|
|
18
52
|
ruleId?: string;
|
|
19
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* The field the error is pinned to. Typically paired with `level: 'FIELD'`.
|
|
55
|
+
*
|
|
56
|
+
* Optional.
|
|
57
|
+
*/
|
|
20
58
|
fieldRef?: Field;
|
|
21
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Defines a validation rule and registers it with the manifest.
|
|
62
|
+
*
|
|
63
|
+
* A validation rule evaluates an RQL formula on save and blocks the operation
|
|
64
|
+
* when the formula returns `true`. You would normally define validations after
|
|
65
|
+
* the fields they reference.
|
|
66
|
+
*
|
|
67
|
+
* **Violation semantics:** the formula encodes the *invalid* condition, not the
|
|
68
|
+
* valid one. `'(end_time__c <= start_time__c)'` fires when end is before or equal
|
|
69
|
+
* to start — i.e., it is truthy when the record is wrong.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* new Validation(sessionObj, {
|
|
74
|
+
* ruleId: 'gym_session_end_after_start',
|
|
75
|
+
* displayName: 'End time must be after start',
|
|
76
|
+
* rqlFormula: '(end_time__c <= start_time__c)',
|
|
77
|
+
* errorMessage: 'End time must be after the start time.',
|
|
78
|
+
* ruleDescription: 'Prevents zero-length or inverted intervals',
|
|
79
|
+
* state: 'ACTIVE',
|
|
80
|
+
* level: 'FIELD',
|
|
81
|
+
* fieldRef: sessionEndField,
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
22
85
|
export declare class Validation {
|
|
23
86
|
private readonly _ruleId;
|
|
24
87
|
private readonly _customObjectApiName;
|
|
@@ -29,13 +92,25 @@ export declare class Validation {
|
|
|
29
92
|
private readonly _level;
|
|
30
93
|
private readonly _ruleDescription;
|
|
31
94
|
private readonly _fieldRef;
|
|
32
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* @param customObject - The custom object this rule applies to.
|
|
97
|
+
* @param props - Initialization properties.
|
|
98
|
+
*/
|
|
33
99
|
constructor(customObject: CustomObject, props: ValidationProps);
|
|
34
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Returns the stable identifier for this validation rule (e.g. `'gym_session_end_after_start'`).
|
|
102
|
+
*/
|
|
35
103
|
getRuleId(): string;
|
|
36
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Returns the api_name of the custom object this validation rule applies to.
|
|
106
|
+
*/
|
|
37
107
|
getCustomObjectApiName(): string;
|
|
38
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Serializes this validation rule to the wire format consumed by the manifest install endpoint.
|
|
110
|
+
*
|
|
111
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_VALIDATION_RULE'`.
|
|
112
|
+
* `field_rql_name` is omitted when `fieldRef` was not provided.
|
|
113
|
+
*/
|
|
39
114
|
toDict(): Record<string, any>;
|
|
40
115
|
}
|
|
41
116
|
//# sourceMappingURL=validation.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE;OAC1D,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAE9C;;;OAGG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe;IAa9D;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAe9B"}
|
|
@@ -1,24 +1,87 @@
|
|
|
1
1
|
import { type ValidationLevel, type ValidationState } from "./_helpers.js";
|
|
2
2
|
import type { CustomObject } from "./custom-object.js";
|
|
3
3
|
import type { Field } from "./field.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialization properties for {@link Validation}.
|
|
6
|
+
*/
|
|
4
7
|
export interface ValidationProps {
|
|
5
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Display name of this validation rule shown in the UI.
|
|
10
|
+
*
|
|
11
|
+
* Required.
|
|
12
|
+
*/
|
|
6
13
|
displayName: string;
|
|
7
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* RQL formula that returns `true` when the record is **invalid**.
|
|
16
|
+
*
|
|
17
|
+
* Required. Note the violation semantics: a truthy result triggers the error,
|
|
18
|
+
* not a passing check. Example: `'(end_time__c <= start_time__c)'` fires when
|
|
19
|
+
* end is not after start.
|
|
20
|
+
*/
|
|
8
21
|
rqlFormula: string;
|
|
9
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* User-facing error message shown when the validation fires.
|
|
24
|
+
*
|
|
25
|
+
* Required. Pass an empty string for no message.
|
|
26
|
+
*/
|
|
10
27
|
errorMessage: string;
|
|
11
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Whether this rule is active or inactive.
|
|
30
|
+
*
|
|
31
|
+
* Required. One of `'ACTIVE'` | `'INACTIVE'`.
|
|
32
|
+
*/
|
|
12
33
|
state: ValidationState;
|
|
13
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Whether the error is shown at the record level or on a specific field.
|
|
36
|
+
*
|
|
37
|
+
* Required. One of `'RECORD'` | `'FIELD'`. When `'FIELD'`, also set `fieldRef`.
|
|
38
|
+
*/
|
|
14
39
|
level: ValidationLevel;
|
|
15
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Internal description of this rule (for developer reference only).
|
|
42
|
+
*
|
|
43
|
+
* Required. Pass an empty string if unused.
|
|
44
|
+
*/
|
|
16
45
|
ruleDescription: string;
|
|
17
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Stable identifier for this rule. Pass a human-readable slug
|
|
48
|
+
* (e.g. `'gym_session_end_after_start'`) to keep it stable across regenerations.
|
|
49
|
+
*
|
|
50
|
+
* Optional. Auto-generated when omitted. @default generateId('rule')
|
|
51
|
+
*/
|
|
18
52
|
ruleId?: string;
|
|
19
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* The field the error is pinned to. Typically paired with `level: 'FIELD'`.
|
|
55
|
+
*
|
|
56
|
+
* Optional.
|
|
57
|
+
*/
|
|
20
58
|
fieldRef?: Field;
|
|
21
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Defines a validation rule and registers it with the manifest.
|
|
62
|
+
*
|
|
63
|
+
* A validation rule evaluates an RQL formula on save and blocks the operation
|
|
64
|
+
* when the formula returns `true`. You would normally define validations after
|
|
65
|
+
* the fields they reference.
|
|
66
|
+
*
|
|
67
|
+
* **Violation semantics:** the formula encodes the *invalid* condition, not the
|
|
68
|
+
* valid one. `'(end_time__c <= start_time__c)'` fires when end is before or equal
|
|
69
|
+
* to start — i.e., it is truthy when the record is wrong.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* new Validation(sessionObj, {
|
|
74
|
+
* ruleId: 'gym_session_end_after_start',
|
|
75
|
+
* displayName: 'End time must be after start',
|
|
76
|
+
* rqlFormula: '(end_time__c <= start_time__c)',
|
|
77
|
+
* errorMessage: 'End time must be after the start time.',
|
|
78
|
+
* ruleDescription: 'Prevents zero-length or inverted intervals',
|
|
79
|
+
* state: 'ACTIVE',
|
|
80
|
+
* level: 'FIELD',
|
|
81
|
+
* fieldRef: sessionEndField,
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
22
85
|
export declare class Validation {
|
|
23
86
|
private readonly _ruleId;
|
|
24
87
|
private readonly _customObjectApiName;
|
|
@@ -29,13 +92,25 @@ export declare class Validation {
|
|
|
29
92
|
private readonly _level;
|
|
30
93
|
private readonly _ruleDescription;
|
|
31
94
|
private readonly _fieldRef;
|
|
32
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* @param customObject - The custom object this rule applies to.
|
|
97
|
+
* @param props - Initialization properties.
|
|
98
|
+
*/
|
|
33
99
|
constructor(customObject: CustomObject, props: ValidationProps);
|
|
34
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* Returns the stable identifier for this validation rule (e.g. `'gym_session_end_after_start'`).
|
|
102
|
+
*/
|
|
35
103
|
getRuleId(): string;
|
|
36
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Returns the api_name of the custom object this validation rule applies to.
|
|
106
|
+
*/
|
|
37
107
|
getCustomObjectApiName(): string;
|
|
38
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Serializes this validation rule to the wire format consumed by the manifest install endpoint.
|
|
110
|
+
*
|
|
111
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_VALIDATION_RULE'`.
|
|
112
|
+
* `field_rql_name` is omitted when `fieldRef` was not provided.
|
|
113
|
+
*/
|
|
39
114
|
toDict(): Record<string, any>;
|
|
40
115
|
}
|
|
41
116
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE;OAC1D,KAAK,EAAE,YAAY,EAAE;OACrB,KAAK,EAAE,KAAK,EAAE;AAErB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAE9C;;;OAGG;gBACS,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe;IAa9D;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;;OAKG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAe9B"}
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* The contents of this file were inserted manually and are not generated by Stainless.
|
|
4
|
-
*
|
|
5
|
-
* Validation rules for custom objects (RQL formulas with violation semantics).
|
|
6
|
-
* Backend schema: CUSTOM_OBJECT_VALIDATION_RULE (v2)
|
|
7
|
-
*
|
|
8
|
-
* VIOLATION SEMANTICS: `rqlFormula` returns true when the record is INVALID.
|
|
9
|
-
* Construction is CDK-style: `new Validation(customObject, props)` — the CO
|
|
10
|
-
* is the first positional arg, and the validation auto-registers with the
|
|
11
|
-
* manifest via the CO's scope chain.
|
|
12
|
-
*/
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.Validation = void 0;
|
|
15
4
|
const _helpers_1 = require("./_helpers.js");
|
|
5
|
+
/**
|
|
6
|
+
* Defines a validation rule and registers it with the manifest.
|
|
7
|
+
*
|
|
8
|
+
* A validation rule evaluates an RQL formula on save and blocks the operation
|
|
9
|
+
* when the formula returns `true`. You would normally define validations after
|
|
10
|
+
* the fields they reference.
|
|
11
|
+
*
|
|
12
|
+
* **Violation semantics:** the formula encodes the *invalid* condition, not the
|
|
13
|
+
* valid one. `'(end_time__c <= start_time__c)'` fires when end is before or equal
|
|
14
|
+
* to start — i.e., it is truthy when the record is wrong.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* new Validation(sessionObj, {
|
|
19
|
+
* ruleId: 'gym_session_end_after_start',
|
|
20
|
+
* displayName: 'End time must be after start',
|
|
21
|
+
* rqlFormula: '(end_time__c <= start_time__c)',
|
|
22
|
+
* errorMessage: 'End time must be after the start time.',
|
|
23
|
+
* ruleDescription: 'Prevents zero-length or inverted intervals',
|
|
24
|
+
* state: 'ACTIVE',
|
|
25
|
+
* level: 'FIELD',
|
|
26
|
+
* fieldRef: sessionEndField,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
16
30
|
class Validation {
|
|
17
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* @param customObject - The custom object this rule applies to.
|
|
33
|
+
* @param props - Initialization properties.
|
|
34
|
+
*/
|
|
18
35
|
constructor(customObject, props) {
|
|
19
36
|
this._ruleId = props.ruleId ?? (0, _helpers_1.generateId)('rule');
|
|
20
37
|
this._customObjectApiName = customObject.getApiName();
|
|
@@ -27,15 +44,24 @@ class Validation {
|
|
|
27
44
|
this._fieldRef = props.fieldRef;
|
|
28
45
|
customObject._register(this);
|
|
29
46
|
}
|
|
30
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Returns the stable identifier for this validation rule (e.g. `'gym_session_end_after_start'`).
|
|
49
|
+
*/
|
|
31
50
|
getRuleId() {
|
|
32
51
|
return this._ruleId;
|
|
33
52
|
}
|
|
34
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Returns the api_name of the custom object this validation rule applies to.
|
|
55
|
+
*/
|
|
35
56
|
getCustomObjectApiName() {
|
|
36
57
|
return this._customObjectApiName;
|
|
37
58
|
}
|
|
38
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Serializes this validation rule to the wire format consumed by the manifest install endpoint.
|
|
61
|
+
*
|
|
62
|
+
* @returns A plain object with `type: 'CUSTOM_OBJECT_VALIDATION_RULE'`.
|
|
63
|
+
* `field_rql_name` is omitted when `fieldRef` was not provided.
|
|
64
|
+
*/
|
|
39
65
|
toDict() {
|
|
40
66
|
const component = {
|
|
41
67
|
type: 'CUSTOM_OBJECT_VALIDATION_RULE',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/lib/manifest/validation.ts"],"names":[],"mappings":";;;AAAA,4CAAoF;AA6DpF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,UAAU;IAWrB;;;OAGG;IACH,YAAY,YAA0B,EAAE,KAAsB;QAC5D,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC,UAAU,EAAE,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM;QACJ,MAAM,SAAS,GAAwB;YACrC,IAAI,EAAE,+BAA+B;YACrC,cAAc,EAAE,IAAI,CAAC,oBAAoB;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,oBAAoB,EAAE,IAAI,CAAC,aAAa;YACxC,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QACF,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QACtF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA/DD,gCA+DC"}
|