@rippling/rippling-sdk 0.2.0-alpha.113 → 0.2.0-alpha.114
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 +23 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +23 -8
- package/client.d.ts.map +1 -1
- package/client.js +17 -0
- package/client.js.map +1 -1
- package/client.mjs +17 -0
- package/client.mjs.map +1 -1
- package/lib/manifest/app.d.mts +20 -1
- package/lib/manifest/app.d.mts.map +1 -1
- package/lib/manifest/app.d.ts +20 -1
- package/lib/manifest/app.d.ts.map +1 -1
- package/lib/manifest/app.js +50 -0
- package/lib/manifest/app.js.map +1 -1
- package/lib/manifest/app.mjs +51 -1
- package/lib/manifest/app.mjs.map +1 -1
- package/lib/manifest/composition.d.mts +3 -0
- package/lib/manifest/composition.d.mts.map +1 -1
- package/lib/manifest/composition.d.ts +3 -0
- package/lib/manifest/composition.d.ts.map +1 -1
- package/lib/manifest/composition.js.map +1 -1
- package/lib/manifest/composition.mjs.map +1 -1
- package/lib/manifest/definitions/app.js +4 -1
- package/lib/manifest/definitions/app.js.map +1 -1
- package/lib/manifest/definitions/app.mjs +4 -1
- package/lib/manifest/definitions/app.mjs.map +1 -1
- package/lib/manifest/definitions/function.d.mts.map +1 -1
- package/lib/manifest/definitions/function.d.ts.map +1 -1
- package/lib/manifest/definitions/function.js +1 -0
- package/lib/manifest/definitions/function.js.map +1 -1
- package/lib/manifest/definitions/function.mjs +1 -0
- package/lib/manifest/definitions/function.mjs.map +1 -1
- package/lib/manifest/definitions/group.d.mts +64 -0
- package/lib/manifest/definitions/group.d.mts.map +1 -0
- package/lib/manifest/definitions/group.d.ts +64 -0
- package/lib/manifest/definitions/group.d.ts.map +1 -0
- package/lib/manifest/definitions/group.js +57 -0
- package/lib/manifest/definitions/group.js.map +1 -0
- package/lib/manifest/definitions/group.mjs +50 -0
- package/lib/manifest/definitions/group.mjs.map +1 -0
- package/lib/manifest/definitions/index.d.mts +4 -0
- package/lib/manifest/definitions/index.d.mts.map +1 -1
- package/lib/manifest/definitions/index.d.ts +4 -0
- package/lib/manifest/definitions/index.d.ts.map +1 -1
- package/lib/manifest/definitions/index.js +7 -1
- package/lib/manifest/definitions/index.js.map +1 -1
- package/lib/manifest/definitions/index.mjs +2 -0
- package/lib/manifest/definitions/index.mjs.map +1 -1
- package/lib/manifest/definitions/saved-super-group.d.mts +12 -0
- package/lib/manifest/definitions/saved-super-group.d.mts.map +1 -0
- package/lib/manifest/definitions/saved-super-group.d.ts +12 -0
- package/lib/manifest/definitions/saved-super-group.d.ts.map +1 -0
- package/lib/manifest/definitions/saved-super-group.js +26 -0
- package/lib/manifest/definitions/saved-super-group.js.map +1 -0
- package/lib/manifest/definitions/saved-super-group.mjs +21 -0
- package/lib/manifest/definitions/saved-super-group.mjs.map +1 -0
- package/lib/manifest/existing-manifest-context.d.mts +3 -0
- package/lib/manifest/existing-manifest-context.d.mts.map +1 -1
- package/lib/manifest/existing-manifest-context.d.ts +3 -0
- package/lib/manifest/existing-manifest-context.d.ts.map +1 -1
- package/lib/manifest/existing-manifest-context.js +15 -0
- package/lib/manifest/existing-manifest-context.js.map +1 -1
- package/lib/manifest/existing-manifest-context.mjs +15 -0
- package/lib/manifest/existing-manifest-context.mjs.map +1 -1
- package/lib/manifest/group.d.mts +83 -0
- package/lib/manifest/group.d.mts.map +1 -0
- package/lib/manifest/group.d.ts +83 -0
- package/lib/manifest/group.d.ts.map +1 -0
- package/lib/manifest/group.js +207 -0
- package/lib/manifest/group.js.map +1 -0
- package/lib/manifest/group.mjs +203 -0
- package/lib/manifest/group.mjs.map +1 -0
- package/lib/manifest/index.d.mts +2 -0
- package/lib/manifest/index.d.mts.map +1 -1
- package/lib/manifest/index.d.ts +2 -0
- package/lib/manifest/index.d.ts.map +1 -1
- package/lib/manifest/index.js +5 -1
- package/lib/manifest/index.js.map +1 -1
- package/lib/manifest/index.mjs +2 -0
- package/lib/manifest/index.mjs.map +1 -1
- package/lib/manifest/manifest-builder.d.mts +1 -1
- package/lib/manifest/manifest-builder.d.mts.map +1 -1
- package/lib/manifest/manifest-builder.d.ts +1 -1
- package/lib/manifest/manifest-builder.d.ts.map +1 -1
- package/lib/manifest/manifest-builder.js.map +1 -1
- package/lib/manifest/manifest-builder.mjs.map +1 -1
- package/lib/manifest/manifest-function.d.mts +16 -0
- package/lib/manifest/manifest-function.d.mts.map +1 -1
- package/lib/manifest/manifest-function.d.ts +16 -0
- package/lib/manifest/manifest-function.d.ts.map +1 -1
- package/lib/manifest/manifest-function.js +67 -0
- package/lib/manifest/manifest-function.js.map +1 -1
- package/lib/manifest/manifest-function.mjs +68 -1
- package/lib/manifest/manifest-function.mjs.map +1 -1
- package/lib/manifest/saved-super-group.d.mts +43 -0
- package/lib/manifest/saved-super-group.d.mts.map +1 -0
- package/lib/manifest/saved-super-group.d.ts +43 -0
- package/lib/manifest/saved-super-group.d.ts.map +1 -0
- package/lib/manifest/saved-super-group.js +136 -0
- package/lib/manifest/saved-super-group.js.map +1 -0
- package/lib/manifest/saved-super-group.mjs +132 -0
- package/lib/manifest/saved-super-group.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/application-submissions.d.mts +261 -0
- package/resources/application-submissions.d.mts.map +1 -0
- package/resources/application-submissions.d.ts +261 -0
- package/resources/application-submissions.d.ts.map +1 -0
- package/resources/application-submissions.js +112 -0
- package/resources/application-submissions.js.map +1 -0
- package/resources/application-submissions.mjs +108 -0
- package/resources/application-submissions.mjs.map +1 -0
- package/resources/bills.d.mts +913 -12
- package/resources/bills.d.mts.map +1 -1
- package/resources/bills.d.ts +913 -12
- package/resources/bills.d.ts.map +1 -1
- package/resources/bills.js +221 -0
- package/resources/bills.js.map +1 -1
- package/resources/bills.mjs +221 -0
- package/resources/bills.mjs.map +1 -1
- package/resources/candidate-applications.d.mts +247 -9
- package/resources/candidate-applications.d.mts.map +1 -1
- package/resources/candidate-applications.d.ts +247 -9
- package/resources/candidate-applications.d.ts.map +1 -1
- package/resources/candidate-applications.js +37 -5
- package/resources/candidate-applications.js.map +1 -1
- package/resources/candidate-applications.mjs +37 -5
- package/resources/candidate-applications.mjs.map +1 -1
- package/resources/card-transactions.d.mts +1580 -30
- package/resources/card-transactions.d.mts.map +1 -1
- package/resources/card-transactions.d.ts +1580 -30
- package/resources/card-transactions.d.ts.map +1 -1
- package/resources/card-transactions.js +404 -4
- package/resources/card-transactions.js.map +1 -1
- package/resources/card-transactions.mjs +404 -4
- package/resources/card-transactions.mjs.map +1 -1
- package/resources/index.d.mts +6 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +6 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/job-posts.d.mts +345 -0
- package/resources/job-posts.d.mts.map +1 -0
- package/resources/job-posts.d.ts +345 -0
- package/resources/job-posts.d.ts.map +1 -0
- package/resources/job-posts.js +110 -0
- package/resources/job-posts.js.map +1 -0
- package/resources/job-posts.mjs +106 -0
- package/resources/job-posts.mjs.map +1 -0
- package/resources/job-requisitions.d.mts +96 -4
- package/resources/job-requisitions.d.mts.map +1 -1
- package/resources/job-requisitions.d.ts +96 -4
- package/resources/job-requisitions.d.ts.map +1 -1
- package/resources/job-requisitions.js +64 -3
- package/resources/job-requisitions.js.map +1 -1
- package/resources/job-requisitions.mjs +64 -3
- package/resources/job-requisitions.mjs.map +1 -1
- package/resources/reimbursements.d.mts +1106 -64
- package/resources/reimbursements.d.mts.map +1 -1
- package/resources/reimbursements.d.ts +1106 -64
- package/resources/reimbursements.d.ts.map +1 -1
- package/resources/reimbursements.js +208 -0
- package/resources/reimbursements.js.map +1 -1
- package/resources/reimbursements.mjs +208 -0
- package/resources/reimbursements.mjs.map +1 -1
- package/resources/scheduled-payouts.d.mts +0 -2
- package/resources/scheduled-payouts.d.mts.map +1 -1
- package/resources/scheduled-payouts.d.ts +0 -2
- package/resources/scheduled-payouts.d.ts.map +1 -1
- package/resources/scheduled-payouts.js +0 -2
- package/resources/scheduled-payouts.js.map +1 -1
- package/resources/scheduled-payouts.mjs +0 -2
- package/resources/scheduled-payouts.mjs.map +1 -1
- package/src/client.ts +66 -0
- package/src/lib/manifest/app.ts +72 -2
- package/src/lib/manifest/composition.ts +8 -2
- package/src/lib/manifest/definitions/app.ts +4 -1
- package/src/lib/manifest/definitions/function.ts +1 -0
- package/src/lib/manifest/definitions/group.ts +159 -0
- package/src/lib/manifest/definitions/index.ts +25 -0
- package/src/lib/manifest/definitions/saved-super-group.ts +28 -0
- package/src/lib/manifest/existing-manifest-context.ts +24 -0
- package/src/lib/manifest/group.ts +282 -0
- package/src/lib/manifest/index.ts +16 -0
- package/src/lib/manifest/manifest-builder.ts +1 -0
- package/src/lib/manifest/manifest-function.ts +91 -1
- package/src/lib/manifest/saved-super-group.ts +171 -0
- package/src/resources/application-submissions.ts +315 -0
- package/src/resources/bills.ts +1085 -12
- package/src/resources/candidate-applications.ts +282 -9
- package/src/resources/card-transactions.ts +1874 -32
- package/src/resources/index.ts +24 -0
- package/src/resources/job-posts.ts +415 -0
- package/src/resources/job-requisitions.ts +110 -3
- package/src/resources/reimbursements.ts +1299 -63
- package/src/resources/scheduled-payouts.ts +0 -2
- 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,159 @@
|
|
|
1
|
+
import type { APIPromise } from '../../../core/api-promise';
|
|
2
|
+
import type { PagePromise } from '../../../core/pagination';
|
|
3
|
+
import type { RequestOptions } from '../../../internal/request-options';
|
|
4
|
+
import type { RipplingSDK } from '../../../client';
|
|
5
|
+
import type * as Shared from '../../../resources/shared';
|
|
6
|
+
import type { GroupMembersPageCursorURL } from '../../../resources/shared';
|
|
7
|
+
import type {
|
|
8
|
+
ExclusionMemberListParams,
|
|
9
|
+
ExclusionMemberUpdateParams,
|
|
10
|
+
ExclusionMemberUpdateResponse,
|
|
11
|
+
} from '../../../resources/supergroups/exclusion-members';
|
|
12
|
+
import type {
|
|
13
|
+
InclusionMemberListParams,
|
|
14
|
+
InclusionMemberUpdateParams,
|
|
15
|
+
InclusionMemberUpdateResponse,
|
|
16
|
+
} from '../../../resources/supergroups/inclusion-members';
|
|
17
|
+
import type { MemberListParams } from '../../../resources/supergroups/members';
|
|
18
|
+
import type { SupergroupRetrieveResponse } from '../../../resources/supergroups/supergroups';
|
|
19
|
+
import { Group, type GroupProps } from '../group';
|
|
20
|
+
|
|
21
|
+
/** Authenticated supergroup resources supplied per call. */
|
|
22
|
+
export interface GroupOperationsContext {
|
|
23
|
+
readonly supergroups: {
|
|
24
|
+
readonly retrieve: RipplingSDK['supergroups']['retrieve'];
|
|
25
|
+
readonly members: Pick<RipplingSDK['supergroups']['members'], 'list'>;
|
|
26
|
+
readonly inclusionMembers: Pick<RipplingSDK['supergroups']['inclusionMembers'], 'list' | 'update'>;
|
|
27
|
+
readonly exclusionMembers: Pick<RipplingSDK['supergroups']['exclusionMembers'], 'list' | 'update'>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GroupMembers {
|
|
32
|
+
list(
|
|
33
|
+
ctx: GroupOperationsContext,
|
|
34
|
+
params?: MemberListParams,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GroupInclusionMembers {
|
|
40
|
+
list(
|
|
41
|
+
ctx: GroupOperationsContext,
|
|
42
|
+
params?: InclusionMemberListParams,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
45
|
+
update(
|
|
46
|
+
ctx: GroupOperationsContext,
|
|
47
|
+
body: InclusionMemberUpdateParams,
|
|
48
|
+
options?: RequestOptions,
|
|
49
|
+
): APIPromise<InclusionMemberUpdateResponse>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface GroupExclusionMembers {
|
|
53
|
+
list(
|
|
54
|
+
ctx: GroupOperationsContext,
|
|
55
|
+
params?: ExclusionMemberListParams,
|
|
56
|
+
options?: RequestOptions,
|
|
57
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
58
|
+
update(
|
|
59
|
+
ctx: GroupOperationsContext,
|
|
60
|
+
body: ExclusionMemberUpdateParams,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): APIPromise<ExclusionMemberUpdateResponse>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GroupOperations {
|
|
66
|
+
retrieve(ctx: GroupOperationsContext, options?: RequestOptions): APIPromise<SupergroupRetrieveResponse>;
|
|
67
|
+
readonly members: GroupMembers;
|
|
68
|
+
readonly inclusionMembers: GroupInclusionMembers;
|
|
69
|
+
readonly exclusionMembers: GroupExclusionMembers;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface GroupReference extends GroupOperations {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface GroupClient {
|
|
77
|
+
retrieve(options?: RequestOptions): APIPromise<SupergroupRetrieveResponse>;
|
|
78
|
+
readonly members: {
|
|
79
|
+
list(
|
|
80
|
+
params?: MemberListParams,
|
|
81
|
+
options?: RequestOptions,
|
|
82
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
83
|
+
};
|
|
84
|
+
readonly inclusionMembers: {
|
|
85
|
+
list(
|
|
86
|
+
params?: InclusionMemberListParams,
|
|
87
|
+
options?: RequestOptions,
|
|
88
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
89
|
+
update(
|
|
90
|
+
body: InclusionMemberUpdateParams,
|
|
91
|
+
options?: RequestOptions,
|
|
92
|
+
): APIPromise<InclusionMemberUpdateResponse>;
|
|
93
|
+
};
|
|
94
|
+
readonly exclusionMembers: {
|
|
95
|
+
list(
|
|
96
|
+
params?: ExclusionMemberListParams,
|
|
97
|
+
options?: RequestOptions,
|
|
98
|
+
): PagePromise<GroupMembersPageCursorURL, Shared.GroupMember>;
|
|
99
|
+
update(
|
|
100
|
+
body: ExclusionMemberUpdateParams,
|
|
101
|
+
options?: RequestOptions,
|
|
102
|
+
): APIPromise<ExclusionMemberUpdateResponse>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Create an unregistered group configuration for reuse or embedding. */
|
|
107
|
+
export function defineGroup(props: GroupProps): DefinedGroup {
|
|
108
|
+
return new DefinedGroup(props);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export class DefinedGroup extends Group {
|
|
112
|
+
withId(groupId: string): GroupReference {
|
|
113
|
+
return createGroupReference(groupId);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @internal Creates a credential-free runtime reference to a deployed supergroup. */
|
|
118
|
+
export function createGroupReference(groupId: string): GroupReference {
|
|
119
|
+
if (typeof groupId !== 'string' || !/^[a-f\d]{24}$/i.test(groupId)) {
|
|
120
|
+
throw new TypeError('Supergroup ID must be a 24-character hexadecimal string.');
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
id: groupId,
|
|
124
|
+
retrieve: (ctx, options) => ctx.supergroups.retrieve(groupId, options),
|
|
125
|
+
members: {
|
|
126
|
+
list: (ctx, params, options) => ctx.supergroups.members.list(groupId, params, options),
|
|
127
|
+
},
|
|
128
|
+
inclusionMembers: {
|
|
129
|
+
list: (ctx, params, options) => ctx.supergroups.inclusionMembers.list(groupId, params, options),
|
|
130
|
+
update: (ctx, body, options) => ctx.supergroups.inclusionMembers.update(groupId, body, options),
|
|
131
|
+
},
|
|
132
|
+
exclusionMembers: {
|
|
133
|
+
list: (ctx, params, options) => ctx.supergroups.exclusionMembers.list(groupId, params, options),
|
|
134
|
+
update: (ctx, body, options) => ctx.supergroups.exclusionMembers.update(groupId, body, options),
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** @internal Binds supergroup operations to an authenticated client context. */
|
|
140
|
+
export function createGroupClient(
|
|
141
|
+
ctx: GroupOperationsContext,
|
|
142
|
+
definition: GroupReference | string,
|
|
143
|
+
): GroupClient {
|
|
144
|
+
const reference = typeof definition === 'string' ? createGroupReference(definition) : definition;
|
|
145
|
+
return {
|
|
146
|
+
retrieve: (options) => reference.retrieve(ctx, options),
|
|
147
|
+
members: {
|
|
148
|
+
list: (params, options) => reference.members.list(ctx, params, options),
|
|
149
|
+
},
|
|
150
|
+
inclusionMembers: {
|
|
151
|
+
list: (params, options) => reference.inclusionMembers.list(ctx, params, options),
|
|
152
|
+
update: (body, options) => reference.inclusionMembers.update(ctx, body, options),
|
|
153
|
+
},
|
|
154
|
+
exclusionMembers: {
|
|
155
|
+
list: (params, options) => reference.exclusionMembers.list(ctx, params, options),
|
|
156
|
+
update: (body, options) => reference.exclusionMembers.update(ctx, body, options),
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -105,4 +105,29 @@ export {
|
|
|
105
105
|
type DefineRecordTriggeredFlowProps,
|
|
106
106
|
} from './record-triggered-flow';
|
|
107
107
|
export { defineValidation, type DefineValidationProps } from './validation';
|
|
108
|
+
export {
|
|
109
|
+
defineGroup,
|
|
110
|
+
DefinedGroup,
|
|
111
|
+
type GroupOperationsContext,
|
|
112
|
+
type GroupMembers,
|
|
113
|
+
type GroupInclusionMembers,
|
|
114
|
+
type GroupExclusionMembers,
|
|
115
|
+
type GroupOperations,
|
|
116
|
+
type GroupReference,
|
|
117
|
+
type GroupClient,
|
|
118
|
+
} from './group';
|
|
119
|
+
export type {
|
|
120
|
+
GroupConfig,
|
|
121
|
+
GroupCoreRqlRule,
|
|
122
|
+
GroupOrgRql,
|
|
123
|
+
GroupProps,
|
|
124
|
+
GroupRuleNode,
|
|
125
|
+
GroupRuleValue,
|
|
126
|
+
} from '../group';
|
|
127
|
+
export {
|
|
128
|
+
defineSavedSuperGroup,
|
|
129
|
+
DefinedSavedSuperGroup,
|
|
130
|
+
type DefinedSavedSuperGroupProps,
|
|
131
|
+
} from './saved-super-group';
|
|
132
|
+
export type { SavedSuperGroupProps, SavedSuperGroupSharingGrant } from '../saved-super-group';
|
|
108
133
|
export { defineWorkflow, workflowFunction, type DefineWorkflowProps } from './workflow';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SavedSuperGroup, type SavedSuperGroupProps } from '../saved-super-group';
|
|
2
|
+
import { createGroupReference, type GroupReference } from './group';
|
|
3
|
+
import { defineComponent, detachedManifestScope, type ComponentDefinition } from './component';
|
|
4
|
+
|
|
5
|
+
export type DefinedSavedSuperGroupProps = Omit<SavedSuperGroupProps, 'apiName'> & {
|
|
6
|
+
apiName: `${string}__c`;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/** Define a saved SUPERGROUP, identified by its company-local API name. */
|
|
10
|
+
export function defineSavedSuperGroup(props: DefinedSavedSuperGroupProps): DefinedSavedSuperGroup {
|
|
11
|
+
return savedSuperGroupComponent.register(new DefinedSavedSuperGroup(props), props);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class DefinedSavedSuperGroup extends SavedSuperGroup {
|
|
15
|
+
constructor(props: DefinedSavedSuperGroupProps) {
|
|
16
|
+
super(detachedManifestScope, props);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
withId(groupId: string): GroupReference {
|
|
20
|
+
return createGroupReference(groupId);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const savedSuperGroupComponent: ComponentDefinition<typeof defineSavedSuperGroup> = defineComponent({
|
|
25
|
+
type: 'SUPERGROUP',
|
|
26
|
+
define: defineSavedSuperGroup,
|
|
27
|
+
references: (definition) => () => definition.getReferencedGroups(),
|
|
28
|
+
});
|
|
@@ -14,6 +14,7 @@ import { ListViewDef } from './list-view';
|
|
|
14
14
|
import { ManifestBuilder, type ManifestComponent } from './manifest-builder';
|
|
15
15
|
import { ManifestFunction } from './manifest-function';
|
|
16
16
|
import { Rule } from './rule';
|
|
17
|
+
import { SavedSuperGroup } from './saved-super-group';
|
|
17
18
|
import { SduiPage } from './sdui-page';
|
|
18
19
|
import { Validation } from './validation';
|
|
19
20
|
import { Workflow } from './workflow';
|
|
@@ -313,6 +314,15 @@ export class ExistingManifestContext {
|
|
|
313
314
|
return this.loadFunctionComponent(component);
|
|
314
315
|
}
|
|
315
316
|
|
|
317
|
+
loadSavedSuperGroup(apiName: string): SavedSuperGroup {
|
|
318
|
+
const component = this.findUnique(
|
|
319
|
+
'SUPERGROUP',
|
|
320
|
+
(candidate) => candidate['api_name'] === apiName,
|
|
321
|
+
`SUPERGROUP ${apiName}`,
|
|
322
|
+
);
|
|
323
|
+
return this.loadSavedSuperGroupComponent(component);
|
|
324
|
+
}
|
|
325
|
+
|
|
316
326
|
loadCustomSkill(sourceSkillId: string): CustomSkill {
|
|
317
327
|
const component = this.findUnique(
|
|
318
328
|
'CUSTOM_SKILL',
|
|
@@ -405,6 +415,12 @@ export class ExistingManifestContext {
|
|
|
405
415
|
return this.loadAppComponent(component);
|
|
406
416
|
case 'WORKFLOW_DEFINITION':
|
|
407
417
|
return this.loadWorkflowComponent(component);
|
|
418
|
+
case 'SUPERGROUP':
|
|
419
|
+
if (component['group_type'] === 'ALIAS' && typeof component['api_name'] === 'string') {
|
|
420
|
+
return this.loadSavedSuperGroupComponent(component);
|
|
421
|
+
}
|
|
422
|
+
return this.loadRawComponent(component);
|
|
423
|
+
|
|
408
424
|
default:
|
|
409
425
|
return this.loadRawComponent(component);
|
|
410
426
|
}
|
|
@@ -602,6 +618,14 @@ export class ExistingManifestContext {
|
|
|
602
618
|
);
|
|
603
619
|
}
|
|
604
620
|
|
|
621
|
+
private loadSavedSuperGroupComponent(component: Record<string, any>): SavedSuperGroup {
|
|
622
|
+
const apiName = requireStringComponentField(component, 'api_name', SavedSuperGroup.componentType);
|
|
623
|
+
const cacheKey = this.cacheKey('SUPERGROUP', apiName);
|
|
624
|
+
return this.getOrLoad(cacheKey, () =>
|
|
625
|
+
SavedSuperGroup._fromExistingComponent(this.getManifestBuilder(), component),
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
|
|
605
629
|
private loadSduiPageComponent(component: Record<string, any>): SduiPage {
|
|
606
630
|
const sduiPageId = requireStringComponentField(component, 'sdui_page_id', SduiPage.componentType);
|
|
607
631
|
const cacheKey = this.cacheKey('SDUI_PAGE', sduiPageId);
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import type { SavedSuperGroup } from './saved-super-group';
|
|
2
|
+
|
|
3
|
+
export interface GroupProps {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string | null;
|
|
6
|
+
coreRqlRule?: GroupCoreRqlRule | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface GroupCoreRqlRule {
|
|
10
|
+
rqlRules?: GroupRuleNode | null;
|
|
11
|
+
rqlRulesForException?: GroupRuleNode | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Authored rules are discriminated; extracted wire rules remain opaque during hydration. */
|
|
15
|
+
export type GroupRuleNode = { id?: string | null } & (
|
|
16
|
+
| {
|
|
17
|
+
nodeType: 'Operator';
|
|
18
|
+
operator: 'AND' | 'OR';
|
|
19
|
+
rules: GroupRuleNode[];
|
|
20
|
+
value?: never;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
nodeType: 'Value';
|
|
24
|
+
value: GroupRuleValue;
|
|
25
|
+
operator?: never;
|
|
26
|
+
rules?: never;
|
|
27
|
+
}
|
|
28
|
+
| ({ nodeType: 'Alias'; value: GroupRuleValue } & (
|
|
29
|
+
| { operator?: never; rules?: never }
|
|
30
|
+
| { operator: 'AND' | 'OR'; rules: GroupRuleNode[] }
|
|
31
|
+
))
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export interface GroupRuleValue {
|
|
35
|
+
ruleType: string;
|
|
36
|
+
rqlCondition?: string | null;
|
|
37
|
+
orgRql?: GroupOrgRql | null;
|
|
38
|
+
inclusion?: string[] | null;
|
|
39
|
+
label?: string | null;
|
|
40
|
+
comment?: string | null;
|
|
41
|
+
id?: string | null;
|
|
42
|
+
visitorPath?: string | null;
|
|
43
|
+
conditionTree?: string | null;
|
|
44
|
+
conditionsTreeMap?: Record<string, string[] | null> | null;
|
|
45
|
+
aliasGroup?: SavedSuperGroup | string | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface GroupOrgRql {
|
|
49
|
+
roleIdForRelativeRelation?: string | null;
|
|
50
|
+
orgRelationId?: string | null;
|
|
51
|
+
orgRelation?: string | null;
|
|
52
|
+
baseObject?: string | null;
|
|
53
|
+
pathToAttribute?: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const COMPONENT_TYPE = 'SUPERGROUP' as const;
|
|
57
|
+
export type GroupConfig = Record<string, unknown> & { type: typeof COMPONENT_TYPE; name: string };
|
|
58
|
+
|
|
59
|
+
/** @internal Logical owner identity, separate from persisted destination IDs in extracted config. */
|
|
60
|
+
export type GroupIdentity = { savedApiName: string } | { meObjId: string; spokeOwnerHandle: string };
|
|
61
|
+
|
|
62
|
+
function groupOwnerKey(identity: GroupIdentity): string {
|
|
63
|
+
if ('savedApiName' in identity) return `SUPERGROUP:${identity.savedApiName}`;
|
|
64
|
+
return identity.meObjId;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function validateName(name: string): void {
|
|
68
|
+
if (typeof name !== 'string' || name.trim().length === 0) {
|
|
69
|
+
throw new Error('Group name must not be blank.');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function serializeOrgRql(orgRql: GroupOrgRql | null | undefined): Record<string, unknown> | null {
|
|
74
|
+
if (orgRql == null) return null;
|
|
75
|
+
return {
|
|
76
|
+
type: COMPONENT_TYPE,
|
|
77
|
+
role_id_for_relative_relation: orgRql.roleIdForRelativeRelation ?? null,
|
|
78
|
+
org_relation_id: orgRql.orgRelationId ?? null,
|
|
79
|
+
org_relation: orgRql.orgRelation ?? null,
|
|
80
|
+
base_object: orgRql.baseObject ?? null,
|
|
81
|
+
path_to_attribute: orgRql.pathToAttribute ?? null,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function serializeRuleValue(value: GroupRuleValue | null | undefined): Record<string, unknown> | null {
|
|
86
|
+
if (value == null) return null;
|
|
87
|
+
const aliasGroup = value.aliasGroup;
|
|
88
|
+
return {
|
|
89
|
+
type: COMPONENT_TYPE,
|
|
90
|
+
rql_condition: value.rqlCondition ?? null,
|
|
91
|
+
org_rql: serializeOrgRql(value.orgRql),
|
|
92
|
+
rule_type: value.ruleType,
|
|
93
|
+
inclusion: value.inclusion == null ? null : [...value.inclusion],
|
|
94
|
+
label: value.label ?? null,
|
|
95
|
+
comment: value.comment ?? null,
|
|
96
|
+
id: value.id ?? null,
|
|
97
|
+
visitor_path: value.visitorPath ?? null,
|
|
98
|
+
conditions_tree_map:
|
|
99
|
+
value.conditionsTreeMap == null ?
|
|
100
|
+
null
|
|
101
|
+
: Object.fromEntries(
|
|
102
|
+
Object.entries(value.conditionsTreeMap).map(([key, conditions]) => [
|
|
103
|
+
key,
|
|
104
|
+
conditions == null ? null : [...conditions],
|
|
105
|
+
]),
|
|
106
|
+
),
|
|
107
|
+
condition_tree: value.conditionTree ?? null,
|
|
108
|
+
alias_group:
|
|
109
|
+
aliasGroup == null ? null
|
|
110
|
+
: typeof aliasGroup === 'string' ? aliasGroup
|
|
111
|
+
: aliasGroup.getApiName(),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function serializeRuleNode(node: GroupRuleNode): Record<string, unknown> {
|
|
116
|
+
const { nodeType, operator, rules, value } = node;
|
|
117
|
+
const hasOperator = operator !== undefined;
|
|
118
|
+
const hasRules = rules !== undefined;
|
|
119
|
+
if (nodeType === 'Operator') {
|
|
120
|
+
if ((operator !== 'AND' && operator !== 'OR') || !Array.isArray(rules) || value !== undefined) {
|
|
121
|
+
throw new TypeError('Operator rules require an operator and child rules, without a value.');
|
|
122
|
+
}
|
|
123
|
+
} else if (nodeType === 'Value' || nodeType === 'Alias') {
|
|
124
|
+
if (value == null || typeof value !== 'object' || typeof value.ruleType !== 'string' || !value.ruleType) {
|
|
125
|
+
throw new TypeError('Value and Alias rules require a rule value.');
|
|
126
|
+
}
|
|
127
|
+
if (nodeType === 'Value' && (hasOperator || hasRules)) {
|
|
128
|
+
throw new TypeError('Value rules cannot contain operators or child rules.');
|
|
129
|
+
}
|
|
130
|
+
if (
|
|
131
|
+
nodeType === 'Alias' &&
|
|
132
|
+
(hasOperator !== hasRules ||
|
|
133
|
+
(hasOperator && ((operator !== 'AND' && operator !== 'OR') || !Array.isArray(rules))))
|
|
134
|
+
) {
|
|
135
|
+
throw new TypeError('Compound Alias rules require both an operator and child rules.');
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
throw new TypeError('Unknown group rule node type.');
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
type: COMPONENT_TYPE,
|
|
142
|
+
id: node.id ?? null,
|
|
143
|
+
node_type: node.nodeType,
|
|
144
|
+
operator: node.operator ?? null,
|
|
145
|
+
rules: node.rules == null ? null : node.rules.map(serializeRuleNode),
|
|
146
|
+
value: serializeRuleValue(node.value),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function serializeCoreRqlRule(rule: GroupCoreRqlRule | null | undefined): Record<string, unknown> | null {
|
|
151
|
+
if (rule == null) return null;
|
|
152
|
+
return {
|
|
153
|
+
type: COMPONENT_TYPE,
|
|
154
|
+
rql_rules: rule.rqlRules == null ? null : serializeRuleNode(rule.rqlRules),
|
|
155
|
+
rql_rules_for_exception:
|
|
156
|
+
rule.rqlRulesForException == null ? null : serializeRuleNode(rule.rqlRulesForException),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function isSavedSuperGroup(value: unknown): value is SavedSuperGroup {
|
|
161
|
+
if (typeof value !== 'object' || value === null || !('getApiName' in value)) return false;
|
|
162
|
+
return typeof value.getApiName === 'function';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function referencedGroups(rule: GroupCoreRqlRule | null | undefined): SavedSuperGroup[] {
|
|
166
|
+
const groups: SavedSuperGroup[] = [];
|
|
167
|
+
const seen = new Set<object>();
|
|
168
|
+
const visit = (node: GroupRuleNode | null | undefined): void => {
|
|
169
|
+
if (node == null) return;
|
|
170
|
+
const aliasGroup = node.value?.aliasGroup;
|
|
171
|
+
if (isSavedSuperGroup(aliasGroup) && !seen.has(aliasGroup)) {
|
|
172
|
+
seen.add(aliasGroup);
|
|
173
|
+
groups.push(aliasGroup);
|
|
174
|
+
}
|
|
175
|
+
node.rules?.forEach(visit);
|
|
176
|
+
};
|
|
177
|
+
visit(rule?.rqlRules);
|
|
178
|
+
visit(rule?.rqlRulesForException);
|
|
179
|
+
return groups;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** An unregistered SUPERGROUP configuration that can be embedded or saved. */
|
|
183
|
+
export class Group {
|
|
184
|
+
private _component: GroupConfig;
|
|
185
|
+
private _referencedGroups: SavedSuperGroup[];
|
|
186
|
+
private _sourceOwner: string | undefined;
|
|
187
|
+
|
|
188
|
+
constructor(props: GroupProps) {
|
|
189
|
+
validateName(props.name);
|
|
190
|
+
this._component = {
|
|
191
|
+
type: COMPONENT_TYPE,
|
|
192
|
+
spoke_id: null,
|
|
193
|
+
name: props.name,
|
|
194
|
+
display_name: null,
|
|
195
|
+
spoke_owner_handle: null,
|
|
196
|
+
group_type: null,
|
|
197
|
+
sub_group_type: null,
|
|
198
|
+
read_only: false,
|
|
199
|
+
description: props.description ?? null,
|
|
200
|
+
mutually_exclusive_key: null,
|
|
201
|
+
cumulatively_exhaustive_default: false,
|
|
202
|
+
core_rql_rule: serializeCoreRqlRule(props.coreRqlRule),
|
|
203
|
+
provision_role_state: null,
|
|
204
|
+
include_terminated: false,
|
|
205
|
+
allow_non_employees: false,
|
|
206
|
+
can_over_ride_role_states: false,
|
|
207
|
+
over_ride_role_states: null,
|
|
208
|
+
dynamic_role_inclusion_fields: null,
|
|
209
|
+
priority: null,
|
|
210
|
+
sync_enabled: false,
|
|
211
|
+
group_number: null,
|
|
212
|
+
is_invisible: false,
|
|
213
|
+
is_migrated_to_new_custom_fields: false,
|
|
214
|
+
ignore_prov_group_matching: false,
|
|
215
|
+
sharing_grant: null,
|
|
216
|
+
alias_access_type: null,
|
|
217
|
+
alias_type: null,
|
|
218
|
+
grant_type: null,
|
|
219
|
+
};
|
|
220
|
+
this._referencedGroups = referencedGroups(props.coreRqlRule);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** @internal Hydrates a shared group configuration without registering it. */
|
|
224
|
+
static _fromExistingConfig(config: Record<string, unknown>, identity: GroupIdentity): Group {
|
|
225
|
+
if (config['type'] !== COMPONENT_TYPE) {
|
|
226
|
+
throw new Error(`Group config type must be "${COMPONENT_TYPE}".`);
|
|
227
|
+
}
|
|
228
|
+
const name = config['name'];
|
|
229
|
+
if (typeof name !== 'string') {
|
|
230
|
+
throw new Error('SUPERGROUP component field "name" must be a string.');
|
|
231
|
+
}
|
|
232
|
+
const group = new Group({ name });
|
|
233
|
+
group._component = JSON.parse(JSON.stringify(config)) as GroupConfig;
|
|
234
|
+
group._referencedGroups = [];
|
|
235
|
+
group._sourceOwner = groupOwnerKey(identity);
|
|
236
|
+
return group;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
getName(): string {
|
|
240
|
+
return this._component['name'];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
setName(name: string): this {
|
|
244
|
+
validateName(name);
|
|
245
|
+
this._component['name'] = name;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
setDescription(description: string | null): this {
|
|
250
|
+
this._component['description'] = description;
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
setCoreRqlRule(rule: GroupCoreRqlRule | null): this {
|
|
255
|
+
this._component['core_rql_rule'] = serializeCoreRqlRule(rule);
|
|
256
|
+
this._referencedGroups = referencedGroups(rule);
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
getReferencedGroups(): SavedSuperGroup[] {
|
|
261
|
+
return [...this._referencedGroups];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** @internal Hydrated identity is preserved only for updates to its original logical owner. */
|
|
265
|
+
_toDict(identity: GroupIdentity): GroupConfig {
|
|
266
|
+
if (this._sourceOwner !== undefined && this._sourceOwner !== groupOwnerKey(identity)) {
|
|
267
|
+
throw new TypeError(
|
|
268
|
+
'A hydrated group cannot be reused under another owner or slot. Create a fresh Group instead.',
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
const config = JSON.parse(JSON.stringify(this._component)) as GroupConfig;
|
|
272
|
+
if ('meObjId' in identity) {
|
|
273
|
+
if (!Object.prototype.hasOwnProperty.call(config, 'me_obj_id')) {
|
|
274
|
+
config['me_obj_id'] = identity.meObjId;
|
|
275
|
+
}
|
|
276
|
+
if (config['spoke_owner_handle'] == null) {
|
|
277
|
+
config['spoke_owner_handle'] = identity.spokeOwnerHandle;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return config;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -247,6 +247,22 @@ export {
|
|
|
247
247
|
type RuleProps,
|
|
248
248
|
} from './rule';
|
|
249
249
|
|
|
250
|
+
export {
|
|
251
|
+
Group,
|
|
252
|
+
type GroupConfig,
|
|
253
|
+
type GroupCoreRqlRule,
|
|
254
|
+
type GroupOrgRql,
|
|
255
|
+
type GroupProps,
|
|
256
|
+
type GroupRuleNode,
|
|
257
|
+
type GroupRuleValue,
|
|
258
|
+
} from './group';
|
|
259
|
+
|
|
260
|
+
export {
|
|
261
|
+
SavedSuperGroup,
|
|
262
|
+
type SavedSuperGroupProps,
|
|
263
|
+
type SavedSuperGroupSharingGrant,
|
|
264
|
+
} from './saved-super-group';
|
|
265
|
+
|
|
250
266
|
export { SduiPage, type SduiPageProps } from './sdui-page';
|
|
251
267
|
|
|
252
268
|
export {
|