@rippling/rippling-sdk 0.2.0-alpha.36 → 0.2.0-alpha.38
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 +7 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -1
- package/client.d.ts.map +1 -1
- package/client.js +7 -1
- package/client.js.map +1 -1
- package/client.mjs +7 -1
- package/client.mjs.map +1 -1
- package/examples/manifest/dental-practice-management/dental-practice-management.ts +21 -34
- package/examples/manifest/gym-membership-management/gym-membership-management.ts +27 -38
- package/examples/manifest/gym-membership-management/manifest.json +1 -1
- package/examples/sdui/sdui-crud-todo/sdui-crud-todo.ts +3 -3
- package/examples/sdui/sdui-showcase/sdui-showcase.ts +6 -11
- package/examples/sdui/sdui-tab-multi-view/sdui-tab-multi-view.ts +14 -24
- package/examples/sdui/vote/vote.ts +7 -11
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/lib/manifest/category.d.mts +4 -2
- package/lib/manifest/category.d.mts.map +1 -1
- package/lib/manifest/category.d.ts +4 -2
- package/lib/manifest/category.d.ts.map +1 -1
- package/lib/manifest/category.js +2 -2
- package/lib/manifest/category.js.map +1 -1
- package/lib/manifest/category.mjs +2 -2
- package/lib/manifest/category.mjs.map +1 -1
- package/lib/manifest/custom-object-field-section.d.mts +4 -0
- package/lib/manifest/custom-object-field-section.d.mts.map +1 -1
- package/lib/manifest/custom-object-field-section.d.ts +4 -0
- package/lib/manifest/custom-object-field-section.d.ts.map +1 -1
- package/lib/manifest/custom-object-field-section.js +6 -0
- package/lib/manifest/custom-object-field-section.js.map +1 -1
- package/lib/manifest/custom-object-field-section.mjs +6 -0
- package/lib/manifest/custom-object-field-section.mjs.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.mts +23 -13
- package/lib/manifest/custom-object-page-layout.d.mts.map +1 -1
- package/lib/manifest/custom-object-page-layout.d.ts +23 -13
- package/lib/manifest/custom-object-page-layout.d.ts.map +1 -1
- package/lib/manifest/custom-object-page-layout.js +122 -9
- package/lib/manifest/custom-object-page-layout.js.map +1 -1
- package/lib/manifest/custom-object-page-layout.mjs +122 -9
- package/lib/manifest/custom-object-page-layout.mjs.map +1 -1
- package/lib/manifest/custom-object.d.mts +30 -1
- package/lib/manifest/custom-object.d.mts.map +1 -1
- package/lib/manifest/custom-object.d.ts +30 -1
- package/lib/manifest/custom-object.d.ts.map +1 -1
- package/lib/manifest/custom-object.js +15 -1
- package/lib/manifest/custom-object.js.map +1 -1
- package/lib/manifest/custom-object.mjs +15 -1
- package/lib/manifest/custom-object.mjs.map +1 -1
- package/lib/manifest/field.d.mts +25 -3
- package/lib/manifest/field.d.mts.map +1 -1
- package/lib/manifest/field.d.ts +25 -3
- package/lib/manifest/field.d.ts.map +1 -1
- package/lib/manifest/field.js +28 -2
- package/lib/manifest/field.js.map +1 -1
- package/lib/manifest/field.mjs +28 -2
- package/lib/manifest/field.mjs.map +1 -1
- package/lib/manifest/index.d.mts +1 -1
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +1 -1
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs.map +1 -1
- package/lib/manifest/manifest-builder.d.mts +1 -1
- package/lib/manifest/manifest-builder.d.ts +1 -1
- package/lib/manifest/manifest-builder.js +1 -1
- package/lib/manifest/manifest-builder.mjs +1 -1
- package/lib/manifest/manifest-function.d.mts +8 -2
- package/lib/manifest/manifest-function.d.mts.map +1 -1
- package/lib/manifest/manifest-function.d.ts +8 -2
- package/lib/manifest/manifest-function.d.ts.map +1 -1
- package/lib/manifest/manifest-function.js +8 -2
- package/lib/manifest/manifest-function.js.map +1 -1
- package/lib/manifest/manifest-function.mjs +8 -2
- package/lib/manifest/manifest-function.mjs.map +1 -1
- package/lib/sdui/actions.d.mts.map +1 -1
- package/lib/sdui/actions.d.ts.map +1 -1
- package/lib/sdui/actions.js +23 -13
- package/lib/sdui/actions.js.map +1 -1
- package/lib/sdui/actions.mjs +23 -13
- package/lib/sdui/actions.mjs.map +1 -1
- package/lib/sdui/component.d.mts +28 -11
- package/lib/sdui/component.d.mts.map +1 -1
- package/lib/sdui/component.d.ts +28 -11
- package/lib/sdui/component.d.ts.map +1 -1
- package/lib/sdui/component.js +69 -36
- package/lib/sdui/component.js.map +1 -1
- package/lib/sdui/component.mjs +69 -36
- package/lib/sdui/component.mjs.map +1 -1
- package/lib/sdui/components.d.mts +1141 -132
- package/lib/sdui/components.d.mts.map +1 -1
- package/lib/sdui/components.d.ts +1141 -132
- package/lib/sdui/components.d.ts.map +1 -1
- package/lib/sdui/components.js +834 -206
- package/lib/sdui/components.js.map +1 -1
- package/lib/sdui/components.mjs +830 -203
- package/lib/sdui/components.mjs.map +1 -1
- package/lib/sdui/directives.d.mts.map +1 -1
- package/lib/sdui/directives.d.ts.map +1 -1
- package/lib/sdui/directives.js +4 -1
- package/lib/sdui/directives.js.map +1 -1
- package/lib/sdui/directives.mjs +4 -1
- package/lib/sdui/directives.mjs.map +1 -1
- package/lib/sdui/index.d.mts +314 -261
- package/lib/sdui/index.d.mts.map +1 -1
- package/lib/sdui/index.d.ts +314 -261
- package/lib/sdui/index.d.ts.map +1 -1
- package/lib/sdui/index.js +255 -204
- package/lib/sdui/index.js.map +1 -1
- package/lib/sdui/index.mjs +128 -103
- package/lib/sdui/index.mjs.map +1 -1
- package/lib/sdui/propTypes.d.mts +6330 -0
- package/lib/sdui/propTypes.d.mts.map +1 -0
- package/lib/sdui/propTypes.d.ts +6330 -0
- package/lib/sdui/propTypes.d.ts.map +1 -0
- package/lib/sdui/propTypes.js +14 -0
- package/lib/sdui/propTypes.js.map +1 -0
- package/lib/sdui/propTypes.mjs +13 -0
- package/lib/sdui/propTypes.mjs.map +1 -0
- package/lib/sdui/render.d.mts +1 -1
- package/lib/sdui/render.d.mts.map +1 -1
- package/lib/sdui/render.d.ts +1 -1
- package/lib/sdui/render.d.ts.map +1 -1
- package/lib/sdui/render.js +11 -3
- package/lib/sdui/render.js.map +1 -1
- package/lib/sdui/render.mjs +11 -3
- package/lib/sdui/render.mjs.map +1 -1
- package/lib/sdui/state.d.mts.map +1 -1
- package/lib/sdui/state.d.ts.map +1 -1
- package/lib/sdui/state.js +3 -1
- package/lib/sdui/state.js.map +1 -1
- package/lib/sdui/state.mjs +3 -1
- package/lib/sdui/state.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/company-legal-entities.d.mts +180 -0
- package/resources/company-legal-entities.d.mts.map +1 -0
- package/resources/company-legal-entities.d.ts +180 -0
- package/resources/company-legal-entities.d.ts.map +1 -0
- package/resources/company-legal-entities.js +30 -0
- package/resources/company-legal-entities.js.map +1 -0
- package/resources/company-legal-entities.mjs +26 -0
- package/resources/company-legal-entities.mjs.map +1 -0
- package/resources/earning-types.d.mts +1 -6
- package/resources/earning-types.d.mts.map +1 -1
- package/resources/earning-types.d.ts +1 -6
- package/resources/earning-types.d.ts.map +1 -1
- package/resources/earning-types.js +1 -1
- package/resources/earning-types.mjs +1 -1
- package/resources/earnings-inputs.d.mts +1 -1
- package/resources/earnings-inputs.d.ts +1 -1
- package/resources/earnings-inputs.js +1 -1
- package/resources/earnings-inputs.mjs +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- 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/payroll-runs/index.d.mts +3 -0
- package/resources/payroll-runs/index.d.mts.map +1 -0
- package/resources/payroll-runs/index.d.ts +3 -0
- package/resources/payroll-runs/index.d.ts.map +1 -0
- package/resources/payroll-runs/index.js +9 -0
- package/resources/payroll-runs/index.js.map +1 -0
- package/resources/payroll-runs/index.mjs +4 -0
- package/resources/payroll-runs/index.mjs.map +1 -0
- package/resources/payroll-runs/payroll-runs.d.mts +199 -0
- package/resources/payroll-runs/payroll-runs.d.mts.map +1 -0
- package/resources/payroll-runs/payroll-runs.d.ts +199 -0
- package/resources/payroll-runs/payroll-runs.d.ts.map +1 -0
- package/resources/payroll-runs/payroll-runs.js +40 -0
- package/resources/payroll-runs/payroll-runs.js.map +1 -0
- package/resources/payroll-runs/payroll-runs.mjs +35 -0
- package/resources/payroll-runs/payroll-runs.mjs.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.d.mts +200 -0
- package/resources/payroll-runs/worker-payroll-records.d.mts.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.d.ts +200 -0
- package/resources/payroll-runs/worker-payroll-records.d.ts.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.js +23 -0
- package/resources/payroll-runs/worker-payroll-records.js.map +1 -0
- package/resources/payroll-runs/worker-payroll-records.mjs +19 -0
- package/resources/payroll-runs/worker-payroll-records.mjs.map +1 -0
- package/resources/payroll-runs.d.mts +1 -194
- package/resources/payroll-runs.d.mts.map +1 -1
- package/resources/payroll-runs.d.ts +1 -194
- package/resources/payroll-runs.d.ts.map +1 -1
- package/resources/payroll-runs.js +2 -28
- package/resources/payroll-runs.js.map +1 -1
- package/resources/payroll-runs.mjs +1 -26
- package/resources/payroll-runs.mjs.map +1 -1
- package/src/client.ts +27 -7
- package/src/internal/utils/log.ts +2 -0
- package/src/lib/manifest/category.ts +7 -5
- package/src/lib/manifest/custom-object-field-section.ts +7 -0
- package/src/lib/manifest/custom-object-page-layout.ts +225 -18
- package/src/lib/manifest/custom-object.ts +30 -1
- package/src/lib/manifest/field.ts +29 -3
- package/src/lib/manifest/index.ts +2 -0
- package/src/lib/manifest/manifest-builder.ts +1 -1
- package/src/lib/manifest/manifest-function.ts +8 -2
- package/src/lib/sdui/actions.ts +23 -10
- package/src/lib/sdui/component.ts +84 -44
- package/src/lib/sdui/components.ts +1627 -212
- package/src/lib/sdui/directives.ts +4 -1
- package/src/lib/sdui/index.ts +565 -200
- package/src/lib/sdui/propTypes.ts +8470 -0
- package/src/lib/sdui/render.ts +13 -5
- package/src/lib/sdui/state.ts +8 -2
- package/src/resources/company-legal-entities.ts +237 -0
- package/src/resources/earning-types.ts +1 -7
- package/src/resources/earnings-inputs.ts +1 -1
- package/src/resources/index.ts +8 -1
- package/src/resources/legal-entities.ts +1 -1
- package/src/resources/payroll-runs/index.ts +15 -0
- package/src/resources/payroll-runs/payroll-runs.ts +270 -0
- package/src/resources/payroll-runs/worker-payroll-records.ts +255 -0
- package/src/resources/payroll-runs.ts +1 -249
- 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,25 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* component() — creates a stateful component boundary.
|
|
3
3
|
*
|
|
4
|
-
* Provides ctx.
|
|
5
|
-
*
|
|
4
|
+
* Provides ctx.localState (scoped local state slot) and ctx.onMount (an
|
|
5
|
+
* action that fires once when the component mounts on the client). The
|
|
6
|
+
* runtime handles state setup and mount firing; consumers don't need to
|
|
7
|
+
* know how the wrapping is implemented.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: these are NOT React hooks. The factory runs ONCE at spec-build
|
|
10
|
+
* time, producing a JSON description of the UI. `localState` returns a
|
|
11
|
+
* path-builder proxy (not a [value, setter] tuple); `onMount` registers
|
|
12
|
+
* a JSON action that fires on first client render (not an effect that
|
|
13
|
+
* re-runs).
|
|
6
14
|
*
|
|
7
15
|
* Usage:
|
|
8
16
|
* function MembersGrid(props) {
|
|
9
17
|
* return component((ctx) => {
|
|
10
|
-
* const local = ctx.
|
|
11
|
-
* ctx.
|
|
12
|
-
* return { element: DataGrid({ ... })
|
|
18
|
+
* const local = ctx.localState({ data: [], loading: true })
|
|
19
|
+
* ctx.onMount(fetchAction)
|
|
20
|
+
* return { element: DataGrid({ ... }) }
|
|
13
21
|
* })
|
|
14
22
|
* }
|
|
15
23
|
*/
|
|
16
24
|
|
|
17
|
-
import type { SpecNode } from './components';
|
|
18
25
|
import type { ActionBinding } from './actions';
|
|
26
|
+
import type { SpecNode } from './components';
|
|
19
27
|
|
|
20
28
|
let _idCounter = 0;
|
|
29
|
+
// Counter-only IDs (no Date.now()) so the same factory body produces the
|
|
30
|
+
// same paths across runs. The counter is monotonic per process; calling
|
|
31
|
+
// `_resetIdCounter()` (tests only) brings it back to 0 so snapshot tests
|
|
32
|
+
// stay stable.
|
|
21
33
|
function generateId(): string {
|
|
22
|
-
|
|
34
|
+
_idCounter += 1;
|
|
35
|
+
return `auto_${_idCounter.toString(36)}`;
|
|
23
36
|
}
|
|
24
37
|
|
|
25
38
|
// Reset counter (for testing)
|
|
@@ -37,15 +50,25 @@ export interface StateScope {
|
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
interface ComponentContext {
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Declare a scoped local state slot. Returns a path-builder proxy whose
|
|
55
|
+
* property accesses produce `{ $state: '/path' }` references for reading
|
|
56
|
+
* and `.$bind` for two-way binding. Not a React hook — runs once when
|
|
57
|
+
* the factory is invoked, never returns `[value, setter]`.
|
|
58
|
+
*/
|
|
59
|
+
localState<T extends Record<string, unknown>>(initial: T): StateScope;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Register a JSON action to fire once when the component mounts on the
|
|
63
|
+
* client. Not a React effect — does not re-run, has no dependency
|
|
64
|
+
* tracking. Pass an `ActionBinding` (e.g. from `set(...)`, `callFunction(...)`)
|
|
65
|
+
* or an array of them.
|
|
66
|
+
*/
|
|
67
|
+
onMount(action: ActionBinding | ActionBinding[]): void;
|
|
44
68
|
}
|
|
45
69
|
|
|
46
70
|
interface ComponentResult {
|
|
47
71
|
element: SpecNode;
|
|
48
|
-
[key: string]: any; // exposed actions like refresh, reset, etc.
|
|
49
72
|
}
|
|
50
73
|
|
|
51
74
|
function createScopeProxy(basePath: string): StateScope {
|
|
@@ -65,58 +88,75 @@ function createScopeProxy(basePath: string): StateScope {
|
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
export function component(factory: (ctx: ComponentContext) => ComponentResult): ComponentResult {
|
|
68
|
-
|
|
69
|
-
|
|
91
|
+
const states: { path: string; initial: unknown }[] = [];
|
|
92
|
+
const mountActions: (ActionBinding | ActionBinding[])[] = [];
|
|
70
93
|
|
|
71
94
|
const ctx: ComponentContext = {
|
|
72
|
-
|
|
95
|
+
localState<T extends Record<string, unknown>>(initial: T): StateScope {
|
|
73
96
|
const path = `/${generateId()}`;
|
|
74
|
-
|
|
97
|
+
states.push({ path, initial });
|
|
75
98
|
return createScopeProxy(path);
|
|
76
99
|
},
|
|
77
|
-
|
|
78
|
-
|
|
100
|
+
onMount(action: ActionBinding | ActionBinding[]) {
|
|
101
|
+
mountActions.push(action);
|
|
79
102
|
},
|
|
80
103
|
};
|
|
81
104
|
|
|
82
105
|
const result = factory(ctx);
|
|
83
106
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
const capturedMount = mountAction;
|
|
87
|
-
|
|
88
|
-
// If no local state and no effects, return as-is
|
|
89
|
-
if (!capturedState && !capturedMount) {
|
|
107
|
+
// No state, no effects → return as-is.
|
|
108
|
+
if (states.length === 0 && mountActions.length === 0) {
|
|
90
109
|
return result;
|
|
91
110
|
}
|
|
92
111
|
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
providerProps['onMountAction'] = capturedMount;
|
|
112
|
+
// Collapse zero/one/many mount actions for the single onMountAction slot
|
|
113
|
+
// on the innermost wrapper.
|
|
114
|
+
let combinedMount: ActionBinding | ActionBinding[] | undefined;
|
|
115
|
+
if (mountActions.length === 1) {
|
|
116
|
+
combinedMount = mountActions[0];
|
|
117
|
+
} else if (mountActions.length > 1) {
|
|
118
|
+
combinedMount = mountActions.flatMap((a) => (Array.isArray(a) ? a : [a]));
|
|
101
119
|
}
|
|
102
120
|
|
|
103
|
-
|
|
104
|
-
type: '_LocalStateProvider',
|
|
105
|
-
props: providerProps,
|
|
106
|
-
children: [result.element],
|
|
107
|
-
};
|
|
121
|
+
let wrapped: SpecNode = result.element;
|
|
108
122
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
if (states.length === 0) {
|
|
124
|
+
// Mount-only: a single state-provider wrapper carries onMountAction.
|
|
125
|
+
wrapped = {
|
|
126
|
+
type: '_LocalStateProvider',
|
|
127
|
+
props: combinedMount ? { onMountAction: combinedMount } : {},
|
|
128
|
+
children: [wrapped],
|
|
115
129
|
};
|
|
130
|
+
} else {
|
|
131
|
+
// One state-provider wrapper per localState() call, nested
|
|
132
|
+
// innermost-first. Mount actions attach to the innermost wrapper so
|
|
133
|
+
// every state slot is initialized before any action fires.
|
|
134
|
+
for (let i = states.length - 1; i >= 0; i--) {
|
|
135
|
+
const state = states[i];
|
|
136
|
+
if (state) {
|
|
137
|
+
const isInnermost = i === states.length - 1;
|
|
138
|
+
const props: Record<string, unknown> = {
|
|
139
|
+
statePath: state.path,
|
|
140
|
+
initialValue: state.initial,
|
|
141
|
+
...(isInnermost && combinedMount ? { onMountAction: combinedMount } : {}),
|
|
142
|
+
};
|
|
143
|
+
const wrapper: SpecNode = {
|
|
144
|
+
type: '_LocalStateProvider',
|
|
145
|
+
props,
|
|
146
|
+
children: [wrapped],
|
|
147
|
+
};
|
|
148
|
+
// render() picks up this marker to populate spec.state.
|
|
149
|
+
(wrapper as any)._localStateRegistration = {
|
|
150
|
+
path: state.path,
|
|
151
|
+
initial: state.initial,
|
|
152
|
+
};
|
|
153
|
+
wrapped = wrapper;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
116
156
|
}
|
|
117
157
|
|
|
118
158
|
return {
|
|
119
159
|
...result,
|
|
120
|
-
element:
|
|
160
|
+
element: wrapped,
|
|
121
161
|
};
|
|
122
162
|
}
|