@uipath/uipath-typescript 1.5.0 → 1.5.1

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.
Files changed (45) hide show
  1. package/README.md +7 -1
  2. package/dist/assets/index.cjs +107 -6
  3. package/dist/assets/index.d.ts +12 -1
  4. package/dist/assets/index.mjs +107 -6
  5. package/dist/attachments/index.cjs +95 -3
  6. package/dist/attachments/index.mjs +95 -3
  7. package/dist/buckets/index.cjs +111 -6
  8. package/dist/buckets/index.d.ts +12 -1
  9. package/dist/buckets/index.mjs +111 -6
  10. package/dist/cases/index.cjs +434 -266
  11. package/dist/cases/index.d.ts +140 -3
  12. package/dist/cases/index.mjs +434 -266
  13. package/dist/conversational-agent/index.cjs +23 -1
  14. package/dist/conversational-agent/index.d.ts +117 -6
  15. package/dist/conversational-agent/index.mjs +23 -1
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/entities/index.cjs +423 -0
  19. package/dist/entities/index.d.ts +441 -1
  20. package/dist/entities/index.mjs +422 -1
  21. package/dist/index.cjs +974 -293
  22. package/dist/index.d.ts +1150 -43
  23. package/dist/index.mjs +975 -294
  24. package/dist/index.umd.js +974 -293
  25. package/dist/jobs/index.cjs +12 -5
  26. package/dist/jobs/index.d.ts +12 -1
  27. package/dist/jobs/index.mjs +12 -5
  28. package/dist/maestro-processes/index.cjs +344 -243
  29. package/dist/maestro-processes/index.d.ts +189 -5
  30. package/dist/maestro-processes/index.mjs +344 -243
  31. package/dist/notifications/index.cjs +2012 -0
  32. package/dist/notifications/index.d.ts +615 -0
  33. package/dist/notifications/index.mjs +2010 -0
  34. package/dist/processes/index.cjs +93 -9
  35. package/dist/processes/index.d.ts +12 -1
  36. package/dist/processes/index.mjs +93 -9
  37. package/dist/queues/index.cjs +106 -5
  38. package/dist/queues/index.d.ts +12 -1
  39. package/dist/queues/index.mjs +106 -5
  40. package/dist/tasks/index.cjs +100 -4
  41. package/dist/tasks/index.mjs +100 -4
  42. package/dist/traces/index.cjs +218 -4
  43. package/dist/traces/index.d.ts +357 -22
  44. package/dist/traces/index.mjs +219 -5
  45. package/package.json +14 -4
@@ -2016,6 +2016,14 @@ const DATA_FABRIC_ENDPOINTS = {
2016
2016
  UPDATE_BY_NAME: (choiceSetName, valueId) => `${DATAFABRIC_BASE}/api/EntityService/${choiceSetName}/choiceset/${valueId}/update`,
2017
2017
  DELETE_BY_ID: (choiceSetId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${choiceSetId}/choiceset/delete`,
2018
2018
  },
2019
+ ROLES: {
2020
+ GET_ALL: `${DATAFABRIC_BASE}/api/v2/Role`,
2021
+ },
2022
+ DIRECTORY: {
2023
+ GET_ALL: `${DATAFABRIC_BASE}/api/Directory`,
2024
+ ASSIGN_ROLES: `${DATAFABRIC_BASE}/api/Directory/Role`,
2025
+ REVOKE_ROLES: `${DATAFABRIC_BASE}/api/Directory/RevokeRole`,
2026
+ },
2019
2027
  };
2020
2028
 
2021
2029
  /**
@@ -3808,8 +3816,423 @@ __decorate([
3808
3816
  track('Choicesets.DeleteValuesById')
3809
3817
  ], ChoiceSetService.prototype, "deleteValuesById", null);
3810
3818
 
3819
+ /**
3820
+ * @internal
3821
+ */
3822
+ var DataFabricRoleType;
3823
+ (function (DataFabricRoleType) {
3824
+ DataFabricRoleType["System"] = "System";
3825
+ DataFabricRoleType["UserDefined"] = "UserDefined";
3826
+ })(DataFabricRoleType || (DataFabricRoleType = {}));
3827
+
3828
+ function isRecord$1(value) {
3829
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
3830
+ }
3831
+ function isDataFabricRole(value) {
3832
+ if (!isRecord$1(value)) {
3833
+ return false;
3834
+ }
3835
+ const { id, name, type, directoryEntityCount, folderId } = value;
3836
+ const hasValidDirectoryEntityCount = directoryEntityCount === undefined ||
3837
+ directoryEntityCount === null ||
3838
+ typeof directoryEntityCount === 'number';
3839
+ const hasValidFolderId = folderId === undefined || typeof folderId === 'string';
3840
+ return typeof id === 'string' &&
3841
+ typeof name === 'string' &&
3842
+ (type === DataFabricRoleType.System || type === DataFabricRoleType.UserDefined) &&
3843
+ hasValidDirectoryEntityCount &&
3844
+ hasValidFolderId;
3845
+ }
3846
+ function validateRolesResponse(data) {
3847
+ if (Array.isArray(data) && data.every(isDataFabricRole)) {
3848
+ return data;
3849
+ }
3850
+ throw new ServerError({
3851
+ message: 'Invalid Data Fabric roles response format.',
3852
+ });
3853
+ }
3854
+ /**
3855
+ * @internal
3856
+ */
3857
+ class DataFabricRoleService extends BaseService {
3858
+ /**
3859
+ * Lists Data Fabric access roles.
3860
+ *
3861
+ * Returns tenant Data Fabric roles such as Admin, Designer, DataWriter, and
3862
+ * DataReader. Role IDs from this method can be passed to
3863
+ * `DataFabricDirectoryService.assignRoles()`.
3864
+ *
3865
+ * @param options - Optional query options
3866
+ * @returns Promise resolving to an array of {@link DataFabricRole}
3867
+ *
3868
+ * @example
3869
+ * ```typescript
3870
+ * import { DataFabricRoleService } from '@uipath/uipath-typescript/entities';
3871
+ *
3872
+ * const roles = new DataFabricRoleService(sdk);
3873
+ * const allRoles = await roles.getAll();
3874
+ * const dataWriter = allRoles.find(role => role.name === 'DataWriter');
3875
+ * ```
3876
+ *
3877
+ * @example
3878
+ * ```typescript
3879
+ * const rolesWithoutStats = await roles.getAll({ stats: false });
3880
+ * ```
3881
+ *
3882
+ * @example
3883
+ * ```typescript
3884
+ * const folderRoles = await roles.getAll({ folderKey: '<folder-key>' });
3885
+ * ```
3886
+ *
3887
+ * @internal
3888
+ */
3889
+ async getAll(options = {}) {
3890
+ const params = createParams({
3891
+ stats: options.stats ?? true,
3892
+ });
3893
+ const headers = createHeaders({ [FOLDER_KEY]: options.folderKey });
3894
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.ROLES.GET_ALL, { params, headers });
3895
+ return validateRolesResponse(response.data);
3896
+ }
3897
+ }
3898
+ __decorate([
3899
+ track('DataFabricRoles.GetAll')
3900
+ ], DataFabricRoleService.prototype, "getAll", null);
3901
+
3902
+ /**
3903
+ * @internal
3904
+ */
3905
+ var DataFabricDirectoryEntityType;
3906
+ (function (DataFabricDirectoryEntityType) {
3907
+ /** Identity user, robot user, or directory robot principal. */
3908
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["User"] = 0] = "User";
3909
+ /** Identity group principal. */
3910
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Group"] = 1] = "Group";
3911
+ /** External application principal. */
3912
+ DataFabricDirectoryEntityType[DataFabricDirectoryEntityType["Application"] = 2] = "Application";
3913
+ })(DataFabricDirectoryEntityType || (DataFabricDirectoryEntityType = {}));
3914
+ /**
3915
+ * @internal
3916
+ */
3917
+ var DataFabricDirectoryEntityTypeName;
3918
+ (function (DataFabricDirectoryEntityTypeName) {
3919
+ DataFabricDirectoryEntityTypeName["User"] = "User";
3920
+ DataFabricDirectoryEntityTypeName["Group"] = "Group";
3921
+ DataFabricDirectoryEntityTypeName["Application"] = "Application";
3922
+ })(DataFabricDirectoryEntityTypeName || (DataFabricDirectoryEntityTypeName = {}));
3923
+
3924
+ const DEFAULT_DIRECTORY_PAGE_SIZE = 100;
3925
+ const MAX_DIRECTORY_PAGE_SIZE = 100;
3926
+ function validateDirectoryListResponse(data) {
3927
+ if (data === null || typeof data !== 'object' || Array.isArray(data)) {
3928
+ throw new ServerError({
3929
+ message: 'Invalid Data Fabric directory response format.',
3930
+ });
3931
+ }
3932
+ const response = data;
3933
+ if (typeof response.totalCount !== 'number' || !Array.isArray(response.results)) {
3934
+ throw new ServerError({
3935
+ message: 'Invalid Data Fabric directory response format.',
3936
+ });
3937
+ }
3938
+ return {
3939
+ totalCount: response.totalCount,
3940
+ results: response.results,
3941
+ };
3942
+ }
3943
+ function isRecord(value) {
3944
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
3945
+ }
3946
+ function isDirectoryEntityTypeName(value) {
3947
+ return value === DataFabricDirectoryEntityTypeName.User ||
3948
+ value === DataFabricDirectoryEntityTypeName.Group ||
3949
+ value === DataFabricDirectoryEntityTypeName.Application;
3950
+ }
3951
+ function isDirectoryRole(value) {
3952
+ if (!isRecord(value)) {
3953
+ return false;
3954
+ }
3955
+ return typeof value.id === 'string' && typeof value.name === 'string';
3956
+ }
3957
+ function normalizeDirectoryEntry(entry) {
3958
+ if (!isRecord(entry) ||
3959
+ typeof entry.externalId !== 'string' ||
3960
+ typeof entry.name !== 'string' ||
3961
+ !isDirectoryEntityTypeName(entry.type) ||
3962
+ (entry.email !== undefined && entry.email !== null && typeof entry.email !== 'string') ||
3963
+ (entry.objectType !== undefined && entry.objectType !== null && typeof entry.objectType !== 'string') ||
3964
+ (entry.isUIEnabled !== undefined && typeof entry.isUIEnabled !== 'boolean') ||
3965
+ (entry.roles !== undefined && entry.roles !== null && (!Array.isArray(entry.roles) || !entry.roles.every(isDirectoryRole)))) {
3966
+ throw new ServerError({
3967
+ message: 'Invalid Data Fabric directory entry response format.',
3968
+ });
3969
+ }
3970
+ const normalized = {
3971
+ externalId: entry.externalId,
3972
+ name: entry.name,
3973
+ type: entry.type,
3974
+ roles: entry.roles ?? [],
3975
+ isUIEnabled: entry.isUIEnabled ?? true,
3976
+ };
3977
+ if (entry.email !== undefined) {
3978
+ normalized.email = entry.email;
3979
+ }
3980
+ if (entry.objectType !== undefined) {
3981
+ normalized.objectType = entry.objectType;
3982
+ }
3983
+ return normalized;
3984
+ }
3985
+ function normalizePrincipalIds(principalIds) {
3986
+ const ids = Array.isArray(principalIds) ? principalIds : [principalIds];
3987
+ return [...new Set(ids.map(id => id.trim()).filter(Boolean))];
3988
+ }
3989
+ function normalizeRoleIds(roleIds) {
3990
+ return [...new Set(roleIds.map(id => id.trim()).filter(Boolean))];
3991
+ }
3992
+ function normalizePrincipalType(type) {
3993
+ if (typeof type === 'number') {
3994
+ if (type === DataFabricDirectoryEntityType.User ||
3995
+ type === DataFabricDirectoryEntityType.Group ||
3996
+ type === DataFabricDirectoryEntityType.Application) {
3997
+ return type;
3998
+ }
3999
+ throw new ValidationError({
4000
+ message: 'Invalid Data Fabric principal type.',
4001
+ });
4002
+ }
4003
+ switch (type) {
4004
+ case DataFabricDirectoryEntityTypeName.User:
4005
+ return DataFabricDirectoryEntityType.User;
4006
+ case DataFabricDirectoryEntityTypeName.Group:
4007
+ return DataFabricDirectoryEntityType.Group;
4008
+ case DataFabricDirectoryEntityTypeName.Application:
4009
+ return DataFabricDirectoryEntityType.Application;
4010
+ default:
4011
+ throw new ValidationError({
4012
+ message: 'Invalid Data Fabric principal type.',
4013
+ });
4014
+ }
4015
+ }
4016
+ function roleIdsFromEntry(entry) {
4017
+ if (!entry) {
4018
+ return [];
4019
+ }
4020
+ return normalizeRoleIds(entry.roles.map(role => role.id));
4021
+ }
4022
+ function clampDirectoryPageSize(pageSize) {
4023
+ return Math.max(1, Math.min(pageSize ?? DEFAULT_DIRECTORY_PAGE_SIZE, MAX_DIRECTORY_PAGE_SIZE));
4024
+ }
4025
+ /**
4026
+ * @internal
4027
+ */
4028
+ class DataFabricDirectoryService extends BaseService {
4029
+ async fetchAllEntries(options = {}) {
4030
+ const top = clampDirectoryPageSize(options.pageSize);
4031
+ const entries = [];
4032
+ let skip = 0;
4033
+ while (true) {
4034
+ const page = await this.list(skip === 0 ? { top } : { top, skip });
4035
+ entries.push(...page.results);
4036
+ if (page.results.length < top || (page.totalCount !== undefined && entries.length >= page.totalCount)) {
4037
+ return entries;
4038
+ }
4039
+ skip += top;
4040
+ }
4041
+ }
4042
+ /**
4043
+ * Lists one page of Data Fabric directory principals and their current roles.
4044
+ *
4045
+ * Returns directory entries with external IDs, principal metadata, and
4046
+ * assigned Data Fabric roles.
4047
+ *
4048
+ * @param options - Optional offset paging options
4049
+ * @returns Promise resolving to {@link DataFabricDirectoryListResponse}
4050
+ *
4051
+ * @example
4052
+ * ```typescript
4053
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
4054
+ *
4055
+ * const directory = new DataFabricDirectoryService(sdk);
4056
+ * const page = await directory.list({ skip: 0, top: 50 });
4057
+ * const firstPrincipal = page.results[0];
4058
+ * ```
4059
+ *
4060
+ * @internal
4061
+ */
4062
+ async list(options = {}) {
4063
+ const params = createParams({
4064
+ skip: options.skip,
4065
+ top: clampDirectoryPageSize(options.top),
4066
+ });
4067
+ const response = await this.get(DATA_FABRIC_ENDPOINTS.DIRECTORY.GET_ALL, { params });
4068
+ const data = validateDirectoryListResponse(response.data);
4069
+ const results = data.results.map(normalizeDirectoryEntry);
4070
+ return {
4071
+ totalCount: data.totalCount,
4072
+ results,
4073
+ };
4074
+ }
4075
+ /**
4076
+ * Lists all Data Fabric directory principals and their current roles.
4077
+ *
4078
+ * Follows the Data Fabric directory top/skip pagination and returns
4079
+ * normalized entries. Entries without assigned roles include an empty
4080
+ * `roles` array.
4081
+ *
4082
+ * @param options - Optional page-size options
4083
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryEntry}
4084
+ *
4085
+ * @example
4086
+ * ```typescript
4087
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
4088
+ *
4089
+ * const directory = new DataFabricDirectoryService(sdk);
4090
+ * const principals = await directory.getAll({ pageSize: 100 });
4091
+ * ```
4092
+ *
4093
+ * @internal
4094
+ */
4095
+ async getAll(options = {}) {
4096
+ return this.fetchAllEntries(options);
4097
+ }
4098
+ /**
4099
+ * Assigns Data Fabric roles to one or more principals.
4100
+ *
4101
+ * The Data Fabric API replaces the role set for each principal, so this
4102
+ * method preserves existing roles by default and posts the union of current
4103
+ * and requested role IDs.
4104
+ *
4105
+ * Role IDs can be discovered with `DataFabricRoleService.getAll()`. Set
4106
+ * `preserveExisting: false` only when intentionally replacing a principal's
4107
+ * Data Fabric role set.
4108
+ *
4109
+ * @param principalIds - Principal external ID or IDs
4110
+ * @param principalType - Principal type
4111
+ * @param roleIds - Data Fabric role IDs to assign
4112
+ * @param options - Optional assignment behavior
4113
+ * @returns Promise resolving to an array of {@link DataFabricDirectoryAssignmentResult}
4114
+ *
4115
+ * @example
4116
+ * ```typescript
4117
+ * import { DataFabricDirectoryEntityTypeName, DataFabricDirectoryService, DataFabricRoleService } from '@uipath/uipath-typescript/entities';
4118
+ *
4119
+ * const roles = new DataFabricRoleService(sdk);
4120
+ * const directory = new DataFabricDirectoryService(sdk);
4121
+ *
4122
+ * const dataWriter = (await roles.getAll()).find(role => role.name === 'DataWriter');
4123
+ * if (!dataWriter) {
4124
+ * throw new Error('DataWriter role not found');
4125
+ * }
4126
+ *
4127
+ * await directory.assignRoles('<identity-group-id>', DataFabricDirectoryEntityTypeName.Group, [dataWriter.id]);
4128
+ * ```
4129
+ *
4130
+ * @example
4131
+ * ```typescript
4132
+ * await directory.assignRoles('<identity-user-id>', DataFabricDirectoryEntityTypeName.User, ['<role-id>'], {
4133
+ * preserveExisting: false,
4134
+ * });
4135
+ * ```
4136
+ *
4137
+ * @internal
4138
+ */
4139
+ async assignRoles(principalIds, principalType, roleIds, options = {}) {
4140
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
4141
+ const normalizedRoleIds = normalizeRoleIds(roleIds);
4142
+ if (normalizedPrincipalIds.length === 0) {
4143
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
4144
+ }
4145
+ if (normalizedRoleIds.length === 0) {
4146
+ throw new ValidationError({ message: 'At least one Data Fabric role ID is required.' });
4147
+ }
4148
+ const type = normalizePrincipalType(principalType);
4149
+ const preserveExisting = options.preserveExisting ?? true;
4150
+ const existingById = new Map();
4151
+ if (preserveExisting) {
4152
+ for (const entry of await this.fetchAllEntries()) {
4153
+ existingById.set(entry.externalId.toLowerCase(), entry);
4154
+ }
4155
+ }
4156
+ return Promise.all(normalizedPrincipalIds.map(async (principalId) => {
4157
+ const existing = existingById.get(principalId.toLowerCase());
4158
+ const mergedRoleIds = preserveExisting
4159
+ ? normalizeRoleIds([...roleIdsFromEntry(existing), ...normalizedRoleIds])
4160
+ : normalizedRoleIds;
4161
+ const payload = {
4162
+ directoryEntities: [
4163
+ {
4164
+ externalId: principalId,
4165
+ type,
4166
+ resolved: true,
4167
+ },
4168
+ ],
4169
+ roles: mergedRoleIds,
4170
+ isUIEnabled: options.uiEnabled ?? true,
4171
+ };
4172
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.ASSIGN_ROLES, payload);
4173
+ return {
4174
+ principalId,
4175
+ roleIds: mergedRoleIds,
4176
+ };
4177
+ }));
4178
+ }
4179
+ /**
4180
+ * Revokes all direct Data Fabric roles from one or more principals.
4181
+ *
4182
+ * The Data Fabric API removes all role assignments for each supplied external
4183
+ * ID. Use this when a principal should no longer have direct Data Fabric
4184
+ * access. Inherited access through groups is not changed.
4185
+ *
4186
+ * @param principalIds - Principal external ID or IDs
4187
+ * @returns Promise resolving when the roles are revoked
4188
+ *
4189
+ * @example
4190
+ * ```typescript
4191
+ * import { DataFabricDirectoryService } from '@uipath/uipath-typescript/entities';
4192
+ *
4193
+ * const directory = new DataFabricDirectoryService(sdk);
4194
+ *
4195
+ * await directory.revokeRoles('<identity-user-id>');
4196
+ * ```
4197
+ *
4198
+ * @example
4199
+ * ```typescript
4200
+ * await directory.revokeRoles([
4201
+ * '<identity-user-id>',
4202
+ * '<identity-group-id>',
4203
+ * ]);
4204
+ * ```
4205
+ *
4206
+ * @internal
4207
+ */
4208
+ async revokeRoles(principalIds) {
4209
+ const normalizedPrincipalIds = normalizePrincipalIds(principalIds);
4210
+ if (normalizedPrincipalIds.length === 0) {
4211
+ throw new ValidationError({ message: 'At least one principal ID is required.' });
4212
+ }
4213
+ const payload = {
4214
+ externalIds: normalizedPrincipalIds,
4215
+ };
4216
+ await this.post(DATA_FABRIC_ENDPOINTS.DIRECTORY.REVOKE_ROLES, payload);
4217
+ }
4218
+ }
4219
+ __decorate([
4220
+ track('DataFabricDirectory.List')
4221
+ ], DataFabricDirectoryService.prototype, "list", null);
4222
+ __decorate([
4223
+ track('DataFabricDirectory.GetAll')
4224
+ ], DataFabricDirectoryService.prototype, "getAll", null);
4225
+ __decorate([
4226
+ track('DataFabricDirectory.AssignRoles')
4227
+ ], DataFabricDirectoryService.prototype, "assignRoles", null);
4228
+ __decorate([
4229
+ track('DataFabricDirectory.RevokeRoles')
4230
+ ], DataFabricDirectoryService.prototype, "revokeRoles", null);
4231
+
3811
4232
  exports.ChoiceSetService = ChoiceSetService;
3812
4233
  exports.ChoiceSets = ChoiceSetService;
4234
+ exports.DataFabricDirectoryService = DataFabricDirectoryService;
4235
+ exports.DataFabricRoleService = DataFabricRoleService;
3813
4236
  exports.Entities = EntityService;
3814
4237
  exports.EntityService = EntityService;
3815
4238
  exports.createEntityWithMethods = createEntityWithMethods;