@flashbacktech/flashbackclient 0.2.9 → 0.2.11

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.
@@ -14,6 +14,7 @@ import { UpdateUserRoleResponse, UserRoleResponse } from './types/roles';
14
14
  import { UserProfileResponse } from './types/roles';
15
15
  import { CreateOrgUserRequest, CreateOrgUserResponse, DeleteOrgUserResponse, GetOrganizationResponse, ListOrgUsersResponse, OrgUserResponse, UpdateOrganizationBody, UpdateOrganizationResponse, UpdateOrgUserRequest, UpdateOrgUserResponse } from './types/organization';
16
16
  import { SystemEventQueryRequest, SystemEventQueryResponse } from './types/systemEvent';
17
+ import { UserUpdateRequest, UserUpdateResponse } from './types/user';
17
18
  interface ErrorResponse {
18
19
  message?: string;
19
20
  [key: string]: any;
@@ -91,6 +92,7 @@ export declare class ApiClient implements IApiClient {
91
92
  userActivate: () => Promise<ActivateResponse>;
92
93
  userDeactivate: () => Promise<DeactivateResponse>;
93
94
  getUserQuota: () => Promise<QuotaResponse>;
95
+ updateUser: (userId: string, data: UserUpdateRequest) => Promise<UserUpdateResponse>;
94
96
  requestPasswordReset: (email: string) => Promise<ActionResponse>;
95
97
  resetPassword: (data: ResetPasswordBody) => Promise<ActionResponse>;
96
98
  private validateDateRange;
@@ -231,6 +231,9 @@ class ApiClient {
231
231
  this.getUserQuota = async () => {
232
232
  return this.makeRequest('user/quota', 'GET', null);
233
233
  };
234
+ this.updateUser = async (userId, data) => {
235
+ return this.makeRequest(`user/${userId}`, 'PUT', data);
236
+ };
234
237
  this.requestPasswordReset = async (email) => {
235
238
  return this.makeRequest('user/request-reset-password', 'POST', { email });
236
239
  };
@@ -16,4 +16,9 @@ import * as OrganizationTypes from './types/organization';
16
16
  import * as NodeRegistrationTypes from './types/noderegistration';
17
17
  import * as SystemEventTypes from './types/systemEvent';
18
18
  import * as UserTypes from './types/user';
19
+ /**
20
+ * Generates an OpenAI-compatible API key/secret pair
21
+ * @returns Object containing apiKey and secretKey
22
+ */
23
+ export declare function generateOpenAICompatibleKey(): string;
19
24
  export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes, MFATypes, SettingsTypes, RolesTypes, WorkspaceTypes, OrganizationTypes, NodeRegistrationTypes, SystemEventTypes, UserTypes };
package/dist/api/index.js CHANGED
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.UserTypes = exports.SystemEventTypes = exports.NodeRegistrationTypes = exports.OrganizationTypes = exports.WorkspaceTypes = exports.RolesTypes = exports.SettingsTypes = exports.MFATypes = exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
37
+ exports.generateOpenAICompatibleKey = generateOpenAICompatibleKey;
37
38
  const client_1 = require("./client");
38
39
  Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
39
40
  Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
@@ -71,3 +72,23 @@ const SystemEventTypes = __importStar(require("./types/systemEvent"));
71
72
  exports.SystemEventTypes = SystemEventTypes;
72
73
  const UserTypes = __importStar(require("./types/user"));
73
74
  exports.UserTypes = UserTypes;
75
+ const crypto = __importStar(require("crypto"));
76
+ /**
77
+ * Generates an OpenAI-compatible API key/secret pair
78
+ * @returns Object containing apiKey and secretKey
79
+ */
80
+ function generateOpenAICompatibleKey() {
81
+ // Generate a random 32-byte key for the secret
82
+ const secretKey = crypto.randomBytes(32).toString('hex');
83
+ // Generate OpenAI-style API key (sk- prefix + 48 random characters)
84
+ const randomPart = crypto.randomBytes(24).toString('base64').replace(/[+/=]/g, (char) => {
85
+ switch (char) {
86
+ case '+': return 'A';
87
+ case '/': return 'B';
88
+ case '=': return 'C';
89
+ default: return char;
90
+ }
91
+ });
92
+ const apiKey = `sk-${randomPart}`;
93
+ return apiKey;
94
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,9 +26,10 @@
26
26
  "dependencies": {
27
27
  "@aws-sdk/client-sts": "^3.777.0",
28
28
  "@google-cloud/storage": "^7.15.0",
29
- "@stellar/stellar-sdk": "^14.0.0",
29
+ "@stellar/stellar-sdk": "^14.3.0",
30
30
  "formdata-node": "^6.0.3",
31
- "google-auth-library": "^9.15.1"
31
+ "google-auth-library": "^9.15.1",
32
+ "openai": "^6.6.0"
32
33
  },
33
34
  "bin": {
34
35
  "": "./dist/.min.js"
@@ -59,7 +60,7 @@
59
60
  "@azure/storage-blob": "^12.27.0",
60
61
  "@eslint/js": "^8.56.0",
61
62
  "@types/jest": "^29.5.14",
62
- "@types/node": "^22.10.1",
63
+ "@types/node": "^22.18.12",
63
64
  "@types/node-fetch": "^2.6.12",
64
65
  "@typescript-eslint/eslint-plugin": "^8.17.0",
65
66
  "@typescript-eslint/parser": "^8.17.0",