@memberjunction/graphql-dataprovider 3.2.0 → 3.3.0
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/dist/index.cjs +115 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -3
- package/dist/index.d.mts +164 -3
- package/dist/index.mjs +114 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -544,6 +544,15 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
544
544
|
*/
|
|
545
545
|
get MJAPIKey(): string;
|
|
546
546
|
set MJAPIKey(key: string);
|
|
547
|
+
/**
|
|
548
|
+
* This optional parameter is used when authenticating with a MemberJunction user API key (format: mj_sk_*).
|
|
549
|
+
* When provided, it will be sent in the X-API-Key header. This authenticates as the specific user who owns the API key.
|
|
550
|
+
*
|
|
551
|
+
* Unlike MJAPIKey (system key), this is a user-specific key that can be used for automated access on behalf of a user.
|
|
552
|
+
* Use this when you want to make API calls as a specific user without requiring OAuth authentication.
|
|
553
|
+
*/
|
|
554
|
+
get UserAPIKey(): string;
|
|
555
|
+
set UserAPIKey(key: string);
|
|
547
556
|
/**
|
|
548
557
|
* URL is the URL to the GraphQL endpoint
|
|
549
558
|
*/
|
|
@@ -566,8 +575,9 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
566
575
|
* @param includeSchemas optional, an array of schema names to include in the metadata. If not passed, all schemas are included
|
|
567
576
|
* @param excludeSchemas optional, an array of schema names to exclude from the metadata. If not passed, no schemas are excluded
|
|
568
577
|
* @param mjAPIKey optional, a shared secret key that is static and provided by the publisher of the MJAPI server.
|
|
578
|
+
* @param userAPIKey optional, a user-specific API key (mj_sk_* format) for authenticating as a specific user
|
|
569
579
|
*/
|
|
570
|
-
constructor(token: string, url: string, wsurl: string, refreshTokenFunction: RefreshTokenFunction, MJCoreSchemaName?: string, includeSchemas?: string[], excludeSchemas?: string[], mjAPIKey?: string);
|
|
580
|
+
constructor(token: string, url: string, wsurl: string, refreshTokenFunction: RefreshTokenFunction, MJCoreSchemaName?: string, includeSchemas?: string[], excludeSchemas?: string[], mjAPIKey?: string, userAPIKey?: string);
|
|
571
581
|
}
|
|
572
582
|
/**
|
|
573
583
|
* The GraphQLDataProvider class is a data provider for MemberJunction that implements the IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider interfaces and connects to the
|
|
@@ -763,7 +773,7 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
763
773
|
RefreshToken(): Promise<void>;
|
|
764
774
|
private performTokenRefresh;
|
|
765
775
|
static RefreshToken(): Promise<void>;
|
|
766
|
-
protected CreateNewGraphQLClient(url: string, token: string, sessionId: string, mjAPIKey: string): GraphQLClient;
|
|
776
|
+
protected CreateNewGraphQLClient(url: string, token: string, sessionId: string, mjAPIKey: string, userAPIKey?: string): GraphQLClient;
|
|
767
777
|
private _innerCurrentUserQueryString;
|
|
768
778
|
private _currentUserQuery;
|
|
769
779
|
private userInfoString;
|
|
@@ -2222,6 +2232,157 @@ declare class GraphQLActionClient {
|
|
|
2222
2232
|
private handleEntityActionError;
|
|
2223
2233
|
}
|
|
2224
2234
|
|
|
2235
|
+
/**
|
|
2236
|
+
* Result of creating an API key
|
|
2237
|
+
*/
|
|
2238
|
+
interface CreateAPIKeyResult {
|
|
2239
|
+
/** Whether the operation succeeded */
|
|
2240
|
+
Success: boolean;
|
|
2241
|
+
/** The raw API key - show once and cannot be recovered */
|
|
2242
|
+
RawKey?: string;
|
|
2243
|
+
/** The database ID of the created key */
|
|
2244
|
+
APIKeyID?: string;
|
|
2245
|
+
/** Error message if operation failed */
|
|
2246
|
+
Error?: string;
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Parameters for creating an API key
|
|
2250
|
+
*/
|
|
2251
|
+
interface CreateAPIKeyParams {
|
|
2252
|
+
/** Human-readable label for the key */
|
|
2253
|
+
Label: string;
|
|
2254
|
+
/** Optional description */
|
|
2255
|
+
Description?: string;
|
|
2256
|
+
/** Optional expiration date */
|
|
2257
|
+
ExpiresAt?: Date;
|
|
2258
|
+
/** Optional scope IDs to assign */
|
|
2259
|
+
ScopeIDs?: string[];
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Result of revoking an API key
|
|
2263
|
+
*/
|
|
2264
|
+
interface RevokeAPIKeyResult {
|
|
2265
|
+
/** Whether the operation succeeded */
|
|
2266
|
+
Success: boolean;
|
|
2267
|
+
/** Error message if operation failed */
|
|
2268
|
+
Error?: string;
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Client for encryption-related GraphQL operations.
|
|
2272
|
+
*
|
|
2273
|
+
* This client provides methods for operations that require server-side
|
|
2274
|
+
* cryptographic processing, such as API key generation. These operations
|
|
2275
|
+
* cannot be performed client-side because they require secure random
|
|
2276
|
+
* number generation and cryptographic hashing that must match the
|
|
2277
|
+
* server's validation logic.
|
|
2278
|
+
*
|
|
2279
|
+
* @example
|
|
2280
|
+
* ```typescript
|
|
2281
|
+
* // Create the client
|
|
2282
|
+
* const encryptionClient = new GraphQLEncryptionClient(graphQLProvider);
|
|
2283
|
+
*
|
|
2284
|
+
* // Create a new API key
|
|
2285
|
+
* const result = await encryptionClient.CreateAPIKey({
|
|
2286
|
+
* Label: 'My Integration Key',
|
|
2287
|
+
* Description: 'Used for external service access',
|
|
2288
|
+
* ExpiresAt: new Date('2025-12-31'),
|
|
2289
|
+
* ScopeIDs: ['scope-id-1', 'scope-id-2']
|
|
2290
|
+
* });
|
|
2291
|
+
*
|
|
2292
|
+
* if (result.Success) {
|
|
2293
|
+
* // Show rawKey to user ONCE - cannot be recovered
|
|
2294
|
+
* console.log('Save this key:', result.RawKey);
|
|
2295
|
+
* }
|
|
2296
|
+
* ```
|
|
2297
|
+
*/
|
|
2298
|
+
declare class GraphQLEncryptionClient {
|
|
2299
|
+
/**
|
|
2300
|
+
* The GraphQLDataProvider instance used to execute GraphQL requests
|
|
2301
|
+
*/
|
|
2302
|
+
private _dataProvider;
|
|
2303
|
+
/**
|
|
2304
|
+
* Creates a new GraphQLEncryptionClient instance.
|
|
2305
|
+
* @param dataProvider The GraphQL data provider to use for queries
|
|
2306
|
+
*/
|
|
2307
|
+
constructor(dataProvider: GraphQLDataProvider);
|
|
2308
|
+
/**
|
|
2309
|
+
* Creates a new API key with secure server-side cryptographic hashing.
|
|
2310
|
+
*
|
|
2311
|
+
* This method calls the server to:
|
|
2312
|
+
* 1. Generate a cryptographically secure random API key
|
|
2313
|
+
* 2. Hash the key using SHA-256 for secure storage
|
|
2314
|
+
* 3. Store only the hash in the database
|
|
2315
|
+
* 4. Return the raw key ONCE
|
|
2316
|
+
*
|
|
2317
|
+
* **CRITICAL**: The raw key is returned only once and cannot be recovered.
|
|
2318
|
+
* Instruct users to save it immediately in a secure location.
|
|
2319
|
+
*
|
|
2320
|
+
* @param params Configuration for the new API key
|
|
2321
|
+
* @returns Result with raw key (show once!) and database ID
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```typescript
|
|
2325
|
+
* const result = await client.CreateAPIKey({
|
|
2326
|
+
* Label: 'Production Integration',
|
|
2327
|
+
* Description: 'API access for our CRM system',
|
|
2328
|
+
* ExpiresAt: new Date('2025-12-31'),
|
|
2329
|
+
* ScopeIDs: ['entities:read', 'entities:write']
|
|
2330
|
+
* });
|
|
2331
|
+
*
|
|
2332
|
+
* if (result.Success) {
|
|
2333
|
+
* alert(`Save this key now! It won't be shown again:\n${result.RawKey}`);
|
|
2334
|
+
* } else {
|
|
2335
|
+
* console.error('Failed to create key:', result.Error);
|
|
2336
|
+
* }
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2339
|
+
CreateAPIKey(params: CreateAPIKeyParams): Promise<CreateAPIKeyResult>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Creates the variables for the CreateAPIKey mutation
|
|
2342
|
+
* @param params The API key creation parameters
|
|
2343
|
+
* @returns The mutation variables
|
|
2344
|
+
*/
|
|
2345
|
+
private createAPIKeyVariables;
|
|
2346
|
+
/**
|
|
2347
|
+
* Executes the CreateAPIKey mutation
|
|
2348
|
+
* @param variables The mutation variables
|
|
2349
|
+
* @returns The GraphQL result
|
|
2350
|
+
*/
|
|
2351
|
+
private executeCreateAPIKeyMutation;
|
|
2352
|
+
/**
|
|
2353
|
+
* Processes the result of the CreateAPIKey mutation
|
|
2354
|
+
* @param result The GraphQL result
|
|
2355
|
+
* @returns The processed result
|
|
2356
|
+
*/
|
|
2357
|
+
private processCreateAPIKeyResult;
|
|
2358
|
+
/**
|
|
2359
|
+
* Handles errors in the CreateAPIKey operation
|
|
2360
|
+
* @param e The error
|
|
2361
|
+
* @returns An error result
|
|
2362
|
+
*/
|
|
2363
|
+
private handleCreateAPIKeyError;
|
|
2364
|
+
/**
|
|
2365
|
+
* Revokes an API key, permanently disabling it.
|
|
2366
|
+
*
|
|
2367
|
+
* Once revoked, an API key cannot be reactivated. Users must create a new key.
|
|
2368
|
+
*
|
|
2369
|
+
* @param apiKeyId The database ID of the API key to revoke
|
|
2370
|
+
* @returns Result indicating success or failure
|
|
2371
|
+
*
|
|
2372
|
+
* @example
|
|
2373
|
+
* ```typescript
|
|
2374
|
+
* const result = await client.RevokeAPIKey('key-uuid-here');
|
|
2375
|
+
*
|
|
2376
|
+
* if (result.Success) {
|
|
2377
|
+
* console.log('API key has been revoked');
|
|
2378
|
+
* } else {
|
|
2379
|
+
* console.error('Failed to revoke:', result.Error);
|
|
2380
|
+
* }
|
|
2381
|
+
* ```
|
|
2382
|
+
*/
|
|
2383
|
+
RevokeAPIKey(apiKeyId: string): Promise<RevokeAPIKeyResult>;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2225
2386
|
/**
|
|
2226
2387
|
* Parameters for running a test
|
|
2227
2388
|
*/
|
|
@@ -3199,4 +3360,4 @@ declare class BrowserIndexedDBStorageProvider extends BrowserStorageProviderBase
|
|
|
3199
3360
|
GetCategoryKeys(category: string): Promise<string[]>;
|
|
3200
3361
|
}
|
|
3201
3362
|
|
|
3202
|
-
export { type AccountSearchResult, ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CopyBetweenAccountsResult, type CreatePreAuthUploadUrlResult, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, type FileSearchOptions, type FileSearchResult, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLFileStorageClient, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchAcrossAccountsResult, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, type StorageListResult, type StorageObjectMetadata, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|
|
3363
|
+
export { type AccountSearchResult, ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CopyBetweenAccountsResult, type CreateAPIKeyParams, type CreateAPIKeyResult, type CreatePreAuthUploadUrlResult, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, type FileSearchOptions, type FileSearchResult, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLEncryptionClient, GraphQLFileStorageClient, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, type RevokeAPIKeyResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchAcrossAccountsResult, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, type StorageListResult, type StorageObjectMetadata, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|
package/dist/index.d.mts
CHANGED
|
@@ -544,6 +544,15 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
544
544
|
*/
|
|
545
545
|
get MJAPIKey(): string;
|
|
546
546
|
set MJAPIKey(key: string);
|
|
547
|
+
/**
|
|
548
|
+
* This optional parameter is used when authenticating with a MemberJunction user API key (format: mj_sk_*).
|
|
549
|
+
* When provided, it will be sent in the X-API-Key header. This authenticates as the specific user who owns the API key.
|
|
550
|
+
*
|
|
551
|
+
* Unlike MJAPIKey (system key), this is a user-specific key that can be used for automated access on behalf of a user.
|
|
552
|
+
* Use this when you want to make API calls as a specific user without requiring OAuth authentication.
|
|
553
|
+
*/
|
|
554
|
+
get UserAPIKey(): string;
|
|
555
|
+
set UserAPIKey(key: string);
|
|
547
556
|
/**
|
|
548
557
|
* URL is the URL to the GraphQL endpoint
|
|
549
558
|
*/
|
|
@@ -566,8 +575,9 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
566
575
|
* @param includeSchemas optional, an array of schema names to include in the metadata. If not passed, all schemas are included
|
|
567
576
|
* @param excludeSchemas optional, an array of schema names to exclude from the metadata. If not passed, no schemas are excluded
|
|
568
577
|
* @param mjAPIKey optional, a shared secret key that is static and provided by the publisher of the MJAPI server.
|
|
578
|
+
* @param userAPIKey optional, a user-specific API key (mj_sk_* format) for authenticating as a specific user
|
|
569
579
|
*/
|
|
570
|
-
constructor(token: string, url: string, wsurl: string, refreshTokenFunction: RefreshTokenFunction, MJCoreSchemaName?: string, includeSchemas?: string[], excludeSchemas?: string[], mjAPIKey?: string);
|
|
580
|
+
constructor(token: string, url: string, wsurl: string, refreshTokenFunction: RefreshTokenFunction, MJCoreSchemaName?: string, includeSchemas?: string[], excludeSchemas?: string[], mjAPIKey?: string, userAPIKey?: string);
|
|
571
581
|
}
|
|
572
582
|
/**
|
|
573
583
|
* The GraphQLDataProvider class is a data provider for MemberJunction that implements the IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider interfaces and connects to the
|
|
@@ -763,7 +773,7 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
763
773
|
RefreshToken(): Promise<void>;
|
|
764
774
|
private performTokenRefresh;
|
|
765
775
|
static RefreshToken(): Promise<void>;
|
|
766
|
-
protected CreateNewGraphQLClient(url: string, token: string, sessionId: string, mjAPIKey: string): GraphQLClient;
|
|
776
|
+
protected CreateNewGraphQLClient(url: string, token: string, sessionId: string, mjAPIKey: string, userAPIKey?: string): GraphQLClient;
|
|
767
777
|
private _innerCurrentUserQueryString;
|
|
768
778
|
private _currentUserQuery;
|
|
769
779
|
private userInfoString;
|
|
@@ -2222,6 +2232,157 @@ declare class GraphQLActionClient {
|
|
|
2222
2232
|
private handleEntityActionError;
|
|
2223
2233
|
}
|
|
2224
2234
|
|
|
2235
|
+
/**
|
|
2236
|
+
* Result of creating an API key
|
|
2237
|
+
*/
|
|
2238
|
+
interface CreateAPIKeyResult {
|
|
2239
|
+
/** Whether the operation succeeded */
|
|
2240
|
+
Success: boolean;
|
|
2241
|
+
/** The raw API key - show once and cannot be recovered */
|
|
2242
|
+
RawKey?: string;
|
|
2243
|
+
/** The database ID of the created key */
|
|
2244
|
+
APIKeyID?: string;
|
|
2245
|
+
/** Error message if operation failed */
|
|
2246
|
+
Error?: string;
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Parameters for creating an API key
|
|
2250
|
+
*/
|
|
2251
|
+
interface CreateAPIKeyParams {
|
|
2252
|
+
/** Human-readable label for the key */
|
|
2253
|
+
Label: string;
|
|
2254
|
+
/** Optional description */
|
|
2255
|
+
Description?: string;
|
|
2256
|
+
/** Optional expiration date */
|
|
2257
|
+
ExpiresAt?: Date;
|
|
2258
|
+
/** Optional scope IDs to assign */
|
|
2259
|
+
ScopeIDs?: string[];
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Result of revoking an API key
|
|
2263
|
+
*/
|
|
2264
|
+
interface RevokeAPIKeyResult {
|
|
2265
|
+
/** Whether the operation succeeded */
|
|
2266
|
+
Success: boolean;
|
|
2267
|
+
/** Error message if operation failed */
|
|
2268
|
+
Error?: string;
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Client for encryption-related GraphQL operations.
|
|
2272
|
+
*
|
|
2273
|
+
* This client provides methods for operations that require server-side
|
|
2274
|
+
* cryptographic processing, such as API key generation. These operations
|
|
2275
|
+
* cannot be performed client-side because they require secure random
|
|
2276
|
+
* number generation and cryptographic hashing that must match the
|
|
2277
|
+
* server's validation logic.
|
|
2278
|
+
*
|
|
2279
|
+
* @example
|
|
2280
|
+
* ```typescript
|
|
2281
|
+
* // Create the client
|
|
2282
|
+
* const encryptionClient = new GraphQLEncryptionClient(graphQLProvider);
|
|
2283
|
+
*
|
|
2284
|
+
* // Create a new API key
|
|
2285
|
+
* const result = await encryptionClient.CreateAPIKey({
|
|
2286
|
+
* Label: 'My Integration Key',
|
|
2287
|
+
* Description: 'Used for external service access',
|
|
2288
|
+
* ExpiresAt: new Date('2025-12-31'),
|
|
2289
|
+
* ScopeIDs: ['scope-id-1', 'scope-id-2']
|
|
2290
|
+
* });
|
|
2291
|
+
*
|
|
2292
|
+
* if (result.Success) {
|
|
2293
|
+
* // Show rawKey to user ONCE - cannot be recovered
|
|
2294
|
+
* console.log('Save this key:', result.RawKey);
|
|
2295
|
+
* }
|
|
2296
|
+
* ```
|
|
2297
|
+
*/
|
|
2298
|
+
declare class GraphQLEncryptionClient {
|
|
2299
|
+
/**
|
|
2300
|
+
* The GraphQLDataProvider instance used to execute GraphQL requests
|
|
2301
|
+
*/
|
|
2302
|
+
private _dataProvider;
|
|
2303
|
+
/**
|
|
2304
|
+
* Creates a new GraphQLEncryptionClient instance.
|
|
2305
|
+
* @param dataProvider The GraphQL data provider to use for queries
|
|
2306
|
+
*/
|
|
2307
|
+
constructor(dataProvider: GraphQLDataProvider);
|
|
2308
|
+
/**
|
|
2309
|
+
* Creates a new API key with secure server-side cryptographic hashing.
|
|
2310
|
+
*
|
|
2311
|
+
* This method calls the server to:
|
|
2312
|
+
* 1. Generate a cryptographically secure random API key
|
|
2313
|
+
* 2. Hash the key using SHA-256 for secure storage
|
|
2314
|
+
* 3. Store only the hash in the database
|
|
2315
|
+
* 4. Return the raw key ONCE
|
|
2316
|
+
*
|
|
2317
|
+
* **CRITICAL**: The raw key is returned only once and cannot be recovered.
|
|
2318
|
+
* Instruct users to save it immediately in a secure location.
|
|
2319
|
+
*
|
|
2320
|
+
* @param params Configuration for the new API key
|
|
2321
|
+
* @returns Result with raw key (show once!) and database ID
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```typescript
|
|
2325
|
+
* const result = await client.CreateAPIKey({
|
|
2326
|
+
* Label: 'Production Integration',
|
|
2327
|
+
* Description: 'API access for our CRM system',
|
|
2328
|
+
* ExpiresAt: new Date('2025-12-31'),
|
|
2329
|
+
* ScopeIDs: ['entities:read', 'entities:write']
|
|
2330
|
+
* });
|
|
2331
|
+
*
|
|
2332
|
+
* if (result.Success) {
|
|
2333
|
+
* alert(`Save this key now! It won't be shown again:\n${result.RawKey}`);
|
|
2334
|
+
* } else {
|
|
2335
|
+
* console.error('Failed to create key:', result.Error);
|
|
2336
|
+
* }
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2339
|
+
CreateAPIKey(params: CreateAPIKeyParams): Promise<CreateAPIKeyResult>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Creates the variables for the CreateAPIKey mutation
|
|
2342
|
+
* @param params The API key creation parameters
|
|
2343
|
+
* @returns The mutation variables
|
|
2344
|
+
*/
|
|
2345
|
+
private createAPIKeyVariables;
|
|
2346
|
+
/**
|
|
2347
|
+
* Executes the CreateAPIKey mutation
|
|
2348
|
+
* @param variables The mutation variables
|
|
2349
|
+
* @returns The GraphQL result
|
|
2350
|
+
*/
|
|
2351
|
+
private executeCreateAPIKeyMutation;
|
|
2352
|
+
/**
|
|
2353
|
+
* Processes the result of the CreateAPIKey mutation
|
|
2354
|
+
* @param result The GraphQL result
|
|
2355
|
+
* @returns The processed result
|
|
2356
|
+
*/
|
|
2357
|
+
private processCreateAPIKeyResult;
|
|
2358
|
+
/**
|
|
2359
|
+
* Handles errors in the CreateAPIKey operation
|
|
2360
|
+
* @param e The error
|
|
2361
|
+
* @returns An error result
|
|
2362
|
+
*/
|
|
2363
|
+
private handleCreateAPIKeyError;
|
|
2364
|
+
/**
|
|
2365
|
+
* Revokes an API key, permanently disabling it.
|
|
2366
|
+
*
|
|
2367
|
+
* Once revoked, an API key cannot be reactivated. Users must create a new key.
|
|
2368
|
+
*
|
|
2369
|
+
* @param apiKeyId The database ID of the API key to revoke
|
|
2370
|
+
* @returns Result indicating success or failure
|
|
2371
|
+
*
|
|
2372
|
+
* @example
|
|
2373
|
+
* ```typescript
|
|
2374
|
+
* const result = await client.RevokeAPIKey('key-uuid-here');
|
|
2375
|
+
*
|
|
2376
|
+
* if (result.Success) {
|
|
2377
|
+
* console.log('API key has been revoked');
|
|
2378
|
+
* } else {
|
|
2379
|
+
* console.error('Failed to revoke:', result.Error);
|
|
2380
|
+
* }
|
|
2381
|
+
* ```
|
|
2382
|
+
*/
|
|
2383
|
+
RevokeAPIKey(apiKeyId: string): Promise<RevokeAPIKeyResult>;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2225
2386
|
/**
|
|
2226
2387
|
* Parameters for running a test
|
|
2227
2388
|
*/
|
|
@@ -3199,4 +3360,4 @@ declare class BrowserIndexedDBStorageProvider extends BrowserStorageProviderBase
|
|
|
3199
3360
|
GetCategoryKeys(category: string): Promise<string[]>;
|
|
3200
3361
|
}
|
|
3201
3362
|
|
|
3202
|
-
export { type AccountSearchResult, ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CopyBetweenAccountsResult, type CreatePreAuthUploadUrlResult, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, type FileSearchOptions, type FileSearchResult, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLFileStorageClient, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchAcrossAccountsResult, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, type StorageListResult, type StorageObjectMetadata, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|
|
3363
|
+
export { type AccountSearchResult, ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CopyBetweenAccountsResult, type CreateAPIKeyParams, type CreateAPIKeyResult, type CreatePreAuthUploadUrlResult, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, type FileSearchOptions, type FileSearchResult, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLEncryptionClient, GraphQLFileStorageClient, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, type RevokeAPIKeyResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchAcrossAccountsResult, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, type StorageListResult, type StorageObjectMetadata, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|