@activepieces/piece-omnihr 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-omnihr",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "dependencies": {
5
5
  "@sinclair/typebox": "0.34.11",
6
6
  "axios": "1.13.1",
@@ -0,0 +1,46 @@
1
+ {
2
+ "Smart, all-in-one HR platform for managing employees, time tracking, and HR workflows": "Smart, all-in-one HR platform for managing employees, time tracking, and HR workflows",
3
+ "Username": "Username",
4
+ "Password": "Password",
5
+ "Origin": "Origin",
6
+ "Your OmniHR email address": "Your OmniHR email address",
7
+ "Your OmniHR password": "Your OmniHR password",
8
+ "Your OmniHR origin URL": "Your OmniHR origin URL",
9
+ "Enter your OmniHR credentials to authenticate:": "Enter your OmniHR credentials to authenticate:",
10
+ "Get Employee System ID by Email": "Get Employee System ID by Email",
11
+ "Get Employee Details by System ID": "Get Employee Details by System ID",
12
+ "Get Employee Organizational Chart": "Get Employee Organizational Chart",
13
+ "Get Employee Direct Reports": "Get Employee Direct Reports",
14
+ "Custom API Call": "Custom API Call",
15
+ "Searches for an employee by email and returns their system ID and user ID": "Searches for an employee by email and returns their system ID and user ID",
16
+ "Retrieves detailed employee information using their system ID": "Retrieves detailed employee information using their system ID",
17
+ "Retrieves employee organizational relationships including the complete management chain, direct reports, and peers": "Retrieves employee organizational relationships including the complete management chain, direct reports, and peers",
18
+ "Retrieves a list of employees who directly report to the specified employee": "Retrieves a list of employees who directly report to the specified employee",
19
+ "Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
20
+ "Employee Email": "Employee Email",
21
+ "System ID": "System ID",
22
+ "User ID": "User ID",
23
+ "Method": "Method",
24
+ "Headers": "Headers",
25
+ "Query Parameters": "Query Parameters",
26
+ "Body Type": "Body Type",
27
+ "Body": "Body",
28
+ "Response is Binary ?": "Response is Binary ?",
29
+ "No Error on Failure": "No Error on Failure",
30
+ "Timeout (in seconds)": "Timeout (in seconds)",
31
+ "The email address of the employee to look up": "The email address of the employee to look up",
32
+ "The system ID of the employee": "The system ID of the employee",
33
+ "The user ID of the employee": "The user ID of the employee",
34
+ "Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
35
+ "Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
36
+ "GET": "GET",
37
+ "POST": "POST",
38
+ "PATCH": "PATCH",
39
+ "PUT": "PUT",
40
+ "DELETE": "DELETE",
41
+ "HEAD": "HEAD",
42
+ "None": "None",
43
+ "JSON": "JSON",
44
+ "Form Data": "Form Data",
45
+ "Raw": "Raw"
46
+ }
@@ -4,4 +4,9 @@ export declare const getEmployeeSystemId: import("@activepieces/pieces-framework
4
4
  origin: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
5
  }>, {
6
6
  email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ employmentStatuses: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
8
+ username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
10
+ origin: import("@activepieces/pieces-framework").ShortTextProperty<true>;
11
+ }>>;
7
12
  }>;
@@ -17,29 +17,67 @@ exports.getEmployeeSystemId = (0, pieces_framework_1.createAction)({
17
17
  description: 'The email address of the employee to look up',
18
18
  required: true,
19
19
  }),
20
- },
21
- run(context) {
22
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
- const { email } = context.propsValue;
24
- const auth = context.auth;
25
- const headers = yield (0, client_1.getAuthHeaders)(auth);
26
- let nextUrl = 'https://api.omnihr.co/api/v1/employee/list';
27
- while (nextUrl) {
28
- const listResponse = yield pieces_common_1.httpClient.sendRequest({
20
+ employmentStatuses: pieces_framework_1.Property.MultiSelectDropdown({
21
+ auth: index_1.omnihrAuth,
22
+ displayName: 'Employment Statuses',
23
+ description: 'Select one or more status',
24
+ required: true,
25
+ refreshers: ['auth'],
26
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
27
+ if (!auth) {
28
+ return {
29
+ disabled: true,
30
+ placeholder: 'Please authenticate first',
31
+ options: [],
32
+ };
33
+ }
34
+ const headers = yield (0, client_1.getAuthHeaders)(auth);
35
+ const resp = yield pieces_common_1.httpClient.sendRequest({
29
36
  method: pieces_common_1.HttpMethod.GET,
30
- url: nextUrl,
37
+ url: 'https://api.omnihr.co/api/v1/employee/list/filters',
31
38
  headers,
32
39
  });
33
- const employee = listResponse.body.results.find((emp) => emp.primary_email.value.toLowerCase() === email.toLowerCase());
34
- if (employee) {
40
+ const statuses = resp.body.statuses;
41
+ const options = statuses.map((status) => {
42
+ // each element is a list
35
43
  return {
36
- system_id: employee.system_id,
37
- user_id: employee.id,
38
- full_name: employee.full_name,
39
- email: employee.primary_email.value,
44
+ label: status[1],
45
+ value: `${status[0]}`,
40
46
  };
41
- }
42
- nextUrl = listResponse.body.next;
47
+ });
48
+ return {
49
+ disabled: false,
50
+ options: options,
51
+ };
52
+ }),
53
+ }),
54
+ },
55
+ run(context) {
56
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
+ const { email, employmentStatuses } = context.propsValue;
58
+ const auth = context.auth;
59
+ const headers = yield (0, client_1.getAuthHeaders)(auth);
60
+ const queryParams = {
61
+ exclude_self: 'false',
62
+ };
63
+ if (employmentStatuses.length === 0) {
64
+ throw new Error('At least one Employment Status must be selected');
65
+ }
66
+ queryParams['employment_status'] = employmentStatuses.join(',');
67
+ const listResponse = yield pieces_common_1.httpClient.sendRequest({
68
+ method: pieces_common_1.HttpMethod.GET,
69
+ url: 'https://api.omnihr.co/api/v1/employee/list/min-v2',
70
+ headers,
71
+ queryParams: queryParams,
72
+ });
73
+ const employee = listResponse.body.find((emp) => emp.primary_email.value.toLowerCase() === email.toLowerCase());
74
+ if (employee) {
75
+ return {
76
+ system_id: employee.system_id,
77
+ user_id: employee.id,
78
+ full_name: employee.full_name,
79
+ email: employee.primary_email.value,
80
+ };
43
81
  }
44
82
  throw new Error(`Employee with email "${email}" not found`);
45
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"get-employee-system-id.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/omnihr/src/lib/actions/get-employee-system-id.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAAyC;AACzC,6CAA8D;AAEjD,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,kBAAU;IAChB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACrC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAkB,CAAC;YACxC,MAAM,OAAO,GAAG,MAAM,IAAA,uBAAc,EAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,OAAO,GAAkB,4CAA4C,CAAC;YAE1E,OAAO,OAAO,EAAE,CAAC;gBACf,MAAM,YAAY,GAAQ,MAAM,0BAAU,CAAC,WAAW,CAAC;oBACrD,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,GAAG,EAAE,OAAO;oBACZ,OAAO;iBACR,CAAC,CAAC;gBAEH,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAC7C,CAAC,GAAQ,EAAE,EAAE,CACX,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAChE,CAAC;gBAEF,IAAI,QAAQ,EAAE,CAAC;oBACb,OAAO;wBACL,SAAS,EAAE,QAAQ,CAAC,SAAS;wBAC7B,OAAO,EAAE,QAAQ,CAAC,EAAE;wBACpB,SAAS,EAAE,QAAQ,CAAC,SAAS;wBAC7B,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,KAAK;qBACpC,CAAC;gBACJ,CAAC;gBAED,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;YACnC,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,aAAa,CAAC,CAAC;QAC9D,CAAC;KAAA;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"get-employee-system-id.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/omnihr/src/lib/actions/get-employee-system-id.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,uCAAyC;AACzC,6CAA8D;AAEjD,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,kBAAU;IAChB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,iCAAiC;IAC9C,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,mBAAmB,CAAC;YAC/C,IAAI,EAAE,kBAAU;YAChB,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,CAAC,MAAM,CAAC;YACpB,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,E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