@credal/actions 0.1.29 → 0.1.30

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.
@@ -28,6 +28,7 @@ const getBasicFinancials_1 = __importDefault(require("./providers/finnhub/getBas
28
28
  const overwritePage_1 = __importDefault(require("./providers/confluence/overwritePage"));
29
29
  const fetchPageContent_1 = __importDefault(require("./providers/confluence/fetchPageContent"));
30
30
  const runSnowflakeQuery_1 = __importDefault(require("./providers/snowflake/runSnowflakeQuery"));
31
+ const enableUserByEmail_1 = __importDefault(require("./providers/looker/enableUserByEmail"));
31
32
  exports.ActionMapper = {
32
33
  math: {
33
34
  add: {
@@ -178,4 +179,11 @@ exports.ActionMapper = {
178
179
  outputSchema: types_1.finnhubGetBasicFinancialsOutputSchema,
179
180
  },
180
181
  },
182
+ looker: {
183
+ enableUserByEmail: {
184
+ fn: enableUserByEmail_1.default,
185
+ paramsSchema: types_1.lookerEnableUserByEmailParamsSchema,
186
+ outputSchema: types_1.lookerEnableUserByEmailOutputSchema,
187
+ },
188
+ },
181
189
  };
@@ -22,3 +22,4 @@ export declare const resendSendEmailDefinition: ActionTemplate;
22
22
  export declare const googleOauthCreateNewGoogleDocDefinition: ActionTemplate;
23
23
  export declare const finnhubSymbolLookupDefinition: ActionTemplate;
24
24
  export declare const finnhubGetBasicFinancialsDefinition: ActionTemplate;
25
+ export declare const lookerEnableUserByEmailDefinition: ActionTemplate;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.finnhubGetBasicFinancialsDefinition = exports.finnhubSymbolLookupDefinition = exports.googleOauthCreateNewGoogleDocDefinition = exports.resendSendEmailDefinition = exports.firecrawlScrapeTweetDataWithNitterDefinition = exports.firecrawlScrapeUrlDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeRunSnowflakeQueryDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.xCreateShareXPostUrlDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceFetchPageContentDefinition = exports.confluenceOverwritePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
3
+ exports.lookerEnableUserByEmailDefinition = exports.finnhubGetBasicFinancialsDefinition = exports.finnhubSymbolLookupDefinition = exports.googleOauthCreateNewGoogleDocDefinition = exports.resendSendEmailDefinition = exports.firecrawlScrapeTweetDataWithNitterDefinition = exports.firecrawlScrapeUrlDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeRunSnowflakeQueryDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.xCreateShareXPostUrlDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceFetchPageContentDefinition = exports.confluenceOverwritePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
4
4
  exports.slackSendMessageDefinition = {
5
5
  description: "Sends a message to a Slack channel",
6
6
  scopes: ["chat:write"],
@@ -1172,3 +1172,63 @@ exports.finnhubGetBasicFinancialsDefinition = {
1172
1172
  name: "getBasicFinancials",
1173
1173
  provider: "finnhub",
1174
1174
  };
1175
+ exports.lookerEnableUserByEmailDefinition = {
1176
+ description: "Search for a Looker user by email and enable them if disabled",
1177
+ scopes: [],
1178
+ parameters: {
1179
+ type: "object",
1180
+ required: ["userEmail"],
1181
+ properties: {
1182
+ userEmail: {
1183
+ type: "string",
1184
+ description: "The email address of the user to search for",
1185
+ },
1186
+ },
1187
+ },
1188
+ output: {
1189
+ type: "object",
1190
+ required: ["success", "message"],
1191
+ properties: {
1192
+ success: {
1193
+ type: "boolean",
1194
+ description: "Whether the operation was successful",
1195
+ },
1196
+ message: {
1197
+ type: "string",
1198
+ description: "Status message about the operation",
1199
+ },
1200
+ userId: {
1201
+ type: "string",
1202
+ description: "The ID of the user that was found",
1203
+ },
1204
+ userDetails: {
1205
+ type: "object",
1206
+ description: "Details about the user",
1207
+ properties: {
1208
+ id: {
1209
+ type: "string",
1210
+ description: "The ID of the user",
1211
+ },
1212
+ firstName: {
1213
+ type: "string",
1214
+ description: "The first name of the user",
1215
+ },
1216
+ lastName: {
1217
+ type: "string",
1218
+ description: "The last name of the user",
1219
+ },
1220
+ email: {
1221
+ type: "string",
1222
+ description: "The email of the user",
1223
+ },
1224
+ isDisabled: {
1225
+ type: "boolean",
1226
+ description: "Whether the user is disabled",
1227
+ },
1228
+ },
1229
+ },
1230
+ },
1231
+ },
1232
+ name: "enableUserByEmail",
1233
+ provider: "looker",
1234
+ };
@@ -1139,3 +1139,59 @@ export declare const finnhubGetBasicFinancialsOutputSchema: z.ZodObject<{
1139
1139
  }>;
1140
1140
  export type finnhubGetBasicFinancialsOutputType = z.infer<typeof finnhubGetBasicFinancialsOutputSchema>;
1141
1141
  export type finnhubGetBasicFinancialsFunction = ActionFunction<finnhubGetBasicFinancialsParamsType, AuthParamsType, finnhubGetBasicFinancialsOutputType>;
1142
+ export declare const lookerEnableUserByEmailParamsSchema: z.ZodObject<{
1143
+ userEmail: z.ZodString;
1144
+ }, "strip", z.ZodTypeAny, {
1145
+ userEmail: string;
1146
+ }, {
1147
+ userEmail: string;
1148
+ }>;
1149
+ export type lookerEnableUserByEmailParamsType = z.infer<typeof lookerEnableUserByEmailParamsSchema>;
1150
+ export declare const lookerEnableUserByEmailOutputSchema: z.ZodObject<{
1151
+ success: z.ZodBoolean;
1152
+ message: z.ZodString;
1153
+ userId: z.ZodOptional<z.ZodString>;
1154
+ userDetails: z.ZodOptional<z.ZodObject<{
1155
+ id: z.ZodString;
1156
+ firstName: z.ZodString;
1157
+ lastName: z.ZodString;
1158
+ email: z.ZodString;
1159
+ isDisabled: z.ZodBoolean;
1160
+ }, "strip", z.ZodTypeAny, {
1161
+ id: string;
1162
+ firstName: string;
1163
+ lastName: string;
1164
+ email: string;
1165
+ isDisabled: boolean;
1166
+ }, {
1167
+ id: string;
1168
+ firstName: string;
1169
+ lastName: string;
1170
+ email: string;
1171
+ isDisabled: boolean;
1172
+ }>>;
1173
+ }, "strip", z.ZodTypeAny, {
1174
+ message: string;
1175
+ success: boolean;
1176
+ userId?: string | undefined;
1177
+ userDetails?: {
1178
+ id: string;
1179
+ firstName: string;
1180
+ lastName: string;
1181
+ email: string;
1182
+ isDisabled: boolean;
1183
+ } | undefined;
1184
+ }, {
1185
+ message: string;
1186
+ success: boolean;
1187
+ userId?: string | undefined;
1188
+ userDetails?: {
1189
+ id: string;
1190
+ firstName: string;
1191
+ lastName: string;
1192
+ email: string;
1193
+ isDisabled: boolean;
1194
+ } | undefined;
1195
+ }>;
1196
+ export type lookerEnableUserByEmailOutputType = z.infer<typeof lookerEnableUserByEmailOutputSchema>;
1197
+ export type lookerEnableUserByEmailFunction = ActionFunction<lookerEnableUserByEmailParamsType, AuthParamsType, lookerEnableUserByEmailOutputType>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.finnhubGetBasicFinancialsOutputSchema = exports.finnhubGetBasicFinancialsParamsSchema = exports.finnhubSymbolLookupOutputSchema = exports.finnhubSymbolLookupParamsSchema = exports.googleOauthCreateNewGoogleDocOutputSchema = exports.googleOauthCreateNewGoogleDocParamsSchema = exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeTweetDataWithNitterOutputSchema = exports.firecrawlScrapeTweetDataWithNitterParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeRunSnowflakeQueryOutputSchema = exports.snowflakeRunSnowflakeQueryParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.xCreateShareXPostUrlOutputSchema = exports.xCreateShareXPostUrlParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceFetchPageContentOutputSchema = exports.confluenceFetchPageContentParamsSchema = exports.confluenceOverwritePageOutputSchema = exports.confluenceOverwritePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
3
+ exports.lookerEnableUserByEmailOutputSchema = exports.lookerEnableUserByEmailParamsSchema = exports.finnhubGetBasicFinancialsOutputSchema = exports.finnhubGetBasicFinancialsParamsSchema = exports.finnhubSymbolLookupOutputSchema = exports.finnhubSymbolLookupParamsSchema = exports.googleOauthCreateNewGoogleDocOutputSchema = exports.googleOauthCreateNewGoogleDocParamsSchema = exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeTweetDataWithNitterOutputSchema = exports.firecrawlScrapeTweetDataWithNitterParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeRunSnowflakeQueryOutputSchema = exports.snowflakeRunSnowflakeQueryParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.xCreateShareXPostUrlOutputSchema = exports.xCreateShareXPostUrlParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceFetchPageContentOutputSchema = exports.confluenceFetchPageContentParamsSchema = exports.confluenceOverwritePageOutputSchema = exports.confluenceOverwritePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.AuthParamsSchema = zod_1.z.object({
6
6
  authToken: zod_1.z.string().optional(),
@@ -373,3 +373,22 @@ exports.finnhubGetBasicFinancialsOutputSchema = zod_1.z.object({
373
373
  })
374
374
  .describe("The basic financials of the stock"),
375
375
  });
376
+ // Looker enableUserByEmail types
377
+ exports.lookerEnableUserByEmailParamsSchema = zod_1.z.object({
378
+ userEmail: zod_1.z.string().describe("The email address of the user to search for"),
379
+ });
380
+ exports.lookerEnableUserByEmailOutputSchema = zod_1.z.object({
381
+ success: zod_1.z.boolean().describe("Whether the operation was successful"),
382
+ message: zod_1.z.string().describe("Status message about the operation"),
383
+ userId: zod_1.z.string().describe("The ID of the user that was found").optional(),
384
+ userDetails: zod_1.z
385
+ .object({
386
+ id: zod_1.z.string().describe("The ID of the user"),
387
+ firstName: zod_1.z.string().describe("The first name of the user"),
388
+ lastName: zod_1.z.string().describe("The last name of the user"),
389
+ email: zod_1.z.string().describe("The email of the user"),
390
+ isDisabled: zod_1.z.boolean().describe("Whether the user is disabled"),
391
+ })
392
+ .describe("Details about the user")
393
+ .optional(),
394
+ });
@@ -71,4 +71,8 @@ exports.ACTION_GROUPS = {
71
71
  description: "Action for interacting with Finnhub for stock market data",
72
72
  actions: [templates_1.finnhubSymbolLookupDefinition, templates_1.finnhubGetBasicFinancialsDefinition],
73
73
  },
74
+ LOOKER: {
75
+ description: "Actions for interacting with Looker",
76
+ actions: [templates_1.lookerEnableUserByEmailDefinition],
77
+ },
74
78
  };
@@ -0,0 +1,3 @@
1
+ import { lookerEnableUserByEmailFunction } from "../../autogen/types";
2
+ declare const enableUserByEmail: lookerEnableUserByEmailFunction;
3
+ export default enableUserByEmail;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const axiosClient_1 = require("../../util/axiosClient");
13
+ const enableUserByEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
14
+ const { userEmail } = params;
15
+ const { baseUrl, clientId, clientSecret, authToken } = authParams;
16
+ if (!baseUrl) {
17
+ throw new Error("Base URL is required for Looker API");
18
+ }
19
+ // Check for authentication params
20
+ let accessToken = authToken;
21
+ if (!accessToken && (!clientId || !clientSecret)) {
22
+ throw new Error("Either authToken or both clientId and clientSecret are required for Looker API");
23
+ }
24
+ // Step 1: If no auth token is provided, authenticate using client_id and client_secret
25
+ if (!accessToken && clientId && clientSecret) {
26
+ console.log("Authenticating with Looker API:", baseUrl);
27
+ try {
28
+ // Use client_id and client_secret as URL query parameters
29
+ const loginUrl = `${baseUrl}/api/4.0/login?client_id=${encodeURIComponent(clientId)}&client_secret=${encodeURIComponent(clientSecret)}`;
30
+ const loginResponse = yield axiosClient_1.axiosClient.post(loginUrl, {});
31
+ accessToken = loginResponse.data.access_token;
32
+ if (!accessToken) {
33
+ throw new Error("Failed to obtain authentication token from Looker API");
34
+ }
35
+ }
36
+ catch (error) {
37
+ console.error("Error authenticating with Looker:", error);
38
+ return {
39
+ success: false,
40
+ message: "Failed to authenticate with Looker API",
41
+ };
42
+ }
43
+ }
44
+ const headers = {
45
+ Authorization: `Bearer ${accessToken}`,
46
+ "Content-Type": "application/json",
47
+ };
48
+ try {
49
+ // Step 2: Search for the user by email
50
+ const searchUrl = `${baseUrl}/api/4.0/users/search?email=${encodeURIComponent(userEmail)}`;
51
+ console.log("Searching for user:", searchUrl);
52
+ const searchResponse = yield axiosClient_1.axiosClient.get(searchUrl, { headers });
53
+ console.log("Search response:", searchResponse.data);
54
+ const users = searchResponse.data;
55
+ if (!users || users.length === 0) {
56
+ return {
57
+ success: false,
58
+ message: `No user found with email: ${userEmail}`,
59
+ };
60
+ }
61
+ const user = users[0]; // Take the first matching user
62
+ // Step 3: Check if user is disabled
63
+ if (!user.is_disabled) {
64
+ return {
65
+ success: true,
66
+ message: `User ${userEmail} is already enabled`,
67
+ userId: user.id,
68
+ userDetails: {
69
+ id: user.id,
70
+ firstName: user.first_name,
71
+ lastName: user.last_name,
72
+ email: user.email,
73
+ isDisabled: user.is_disabled,
74
+ },
75
+ };
76
+ }
77
+ // Step 4: Enable the user (no confirmation check, automatically enable)
78
+ const updateUrl = `${baseUrl}/api/4.0/users/${user.id}`;
79
+ console.log("Enabling user:", updateUrl);
80
+ const updateResponse = yield axiosClient_1.axiosClient.patch(updateUrl, {
81
+ is_disabled: false,
82
+ }, { headers });
83
+ console.log("Update response:", updateResponse.data);
84
+ const updatedUser = updateResponse.data;
85
+ return {
86
+ success: true,
87
+ message: `Successfully enabled user ${userEmail}`,
88
+ userId: updatedUser.id,
89
+ userDetails: {
90
+ id: updatedUser.id,
91
+ firstName: updatedUser.first_name,
92
+ lastName: updatedUser.last_name,
93
+ email: updatedUser.email,
94
+ isDisabled: updatedUser.is_disabled,
95
+ },
96
+ };
97
+ }
98
+ catch (error) {
99
+ console.error("Error in Looker enableUserByEmail action:", error);
100
+ return {
101
+ success: false,
102
+ message: error instanceof Error ? error.message : "Unknown error occurred",
103
+ };
104
+ }
105
+ });
106
+ exports.default = enableUserByEmail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",