@memberjunction/server 3.4.0 → 4.1.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/README.md +689 -513
- package/dist/agents/skip-agent.d.ts +65 -0
- package/dist/agents/skip-agent.d.ts.map +1 -1
- package/dist/agents/skip-agent.js +63 -5
- package/dist/agents/skip-agent.js.map +1 -1
- package/dist/agents/skip-sdk.d.ts +163 -0
- package/dist/agents/skip-sdk.d.ts.map +1 -1
- package/dist/agents/skip-sdk.js +143 -12
- package/dist/agents/skip-sdk.js.map +1 -1
- package/dist/apolloServer/index.d.ts +0 -1
- package/dist/apolloServer/index.d.ts.map +1 -1
- package/dist/auth/APIKeyScopeAuth.d.ts +82 -0
- package/dist/auth/APIKeyScopeAuth.d.ts.map +1 -1
- package/dist/auth/APIKeyScopeAuth.js +78 -0
- package/dist/auth/APIKeyScopeAuth.js.map +1 -1
- package/dist/auth/AuthProviderFactory.d.ts +35 -0
- package/dist/auth/AuthProviderFactory.d.ts.map +1 -1
- package/dist/auth/AuthProviderFactory.js +51 -4
- package/dist/auth/AuthProviderFactory.js.map +1 -1
- package/dist/auth/BaseAuthProvider.d.ts +21 -0
- package/dist/auth/BaseAuthProvider.d.ts.map +1 -1
- package/dist/auth/BaseAuthProvider.js +24 -9
- package/dist/auth/BaseAuthProvider.js.map +1 -1
- package/dist/auth/IAuthProvider.d.ts +32 -0
- package/dist/auth/IAuthProvider.d.ts.map +1 -1
- package/dist/auth/exampleNewUserSubClass.d.ts +5 -1
- package/dist/auth/exampleNewUserSubClass.d.ts.map +1 -1
- package/dist/auth/exampleNewUserSubClass.js +21 -6
- package/dist/auth/exampleNewUserSubClass.js.map +1 -1
- package/dist/auth/index.d.ts +14 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +35 -22
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/initializeProviders.d.ts +3 -0
- package/dist/auth/initializeProviders.d.ts.map +1 -1
- package/dist/auth/initializeProviders.js +6 -0
- package/dist/auth/initializeProviders.js.map +1 -1
- package/dist/auth/newUsers.d.ts.map +1 -1
- package/dist/auth/newUsers.js +14 -3
- package/dist/auth/newUsers.js.map +1 -1
- package/dist/auth/providers/Auth0Provider.d.ts +9 -0
- package/dist/auth/providers/Auth0Provider.d.ts.map +1 -1
- package/dist/auth/providers/Auth0Provider.js +10 -0
- package/dist/auth/providers/Auth0Provider.js.map +1 -1
- package/dist/auth/providers/CognitoProvider.d.ts +9 -0
- package/dist/auth/providers/CognitoProvider.d.ts.map +1 -1
- package/dist/auth/providers/CognitoProvider.js +10 -0
- package/dist/auth/providers/CognitoProvider.js.map +1 -1
- package/dist/auth/providers/GoogleProvider.d.ts +9 -0
- package/dist/auth/providers/GoogleProvider.d.ts.map +1 -1
- package/dist/auth/providers/GoogleProvider.js +11 -1
- package/dist/auth/providers/GoogleProvider.js.map +1 -1
- package/dist/auth/providers/MSALProvider.d.ts +9 -0
- package/dist/auth/providers/MSALProvider.d.ts.map +1 -1
- package/dist/auth/providers/MSALProvider.js +10 -0
- package/dist/auth/providers/MSALProvider.js.map +1 -1
- package/dist/auth/providers/OktaProvider.d.ts +9 -0
- package/dist/auth/providers/OktaProvider.d.ts.map +1 -1
- package/dist/auth/providers/OktaProvider.js +10 -0
- package/dist/auth/providers/OktaProvider.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +42 -8
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +8 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +26 -4
- package/dist/context.js.map +1 -1
- package/dist/directives/Public.js +2 -0
- package/dist/directives/Public.js.map +1 -1
- package/dist/entitySubclasses/entityPermissions.server.d.ts +7 -2
- package/dist/entitySubclasses/entityPermissions.server.d.ts.map +1 -1
- package/dist/entitySubclasses/entityPermissions.server.js +26 -8
- package/dist/entitySubclasses/entityPermissions.server.js.map +1 -1
- package/dist/generated/generated.d.ts +539 -2
- package/dist/generated/generated.d.ts.map +1 -1
- package/dist/generated/generated.js +9985 -14951
- package/dist/generated/generated.js.map +1 -1
- package/dist/generic/DeleteOptionsInput.d.ts +3 -0
- package/dist/generic/DeleteOptionsInput.d.ts.map +1 -1
- package/dist/generic/DeleteOptionsInput.js +3 -2
- package/dist/generic/DeleteOptionsInput.js.map +1 -1
- package/dist/generic/KeyInputOutputTypes.js +0 -6
- package/dist/generic/KeyInputOutputTypes.js.map +1 -1
- package/dist/generic/KeyValuePairInput.d.ts +4 -0
- package/dist/generic/KeyValuePairInput.d.ts.map +1 -1
- package/dist/generic/KeyValuePairInput.js +4 -2
- package/dist/generic/KeyValuePairInput.js.map +1 -1
- package/dist/generic/PushStatusResolver.js +0 -3
- package/dist/generic/PushStatusResolver.js.map +1 -1
- package/dist/generic/ResolverBase.d.ts +58 -0
- package/dist/generic/ResolverBase.d.ts.map +1 -1
- package/dist/generic/ResolverBase.js +203 -18
- package/dist/generic/ResolverBase.js.map +1 -1
- package/dist/generic/RunViewResolver.d.ts +22 -0
- package/dist/generic/RunViewResolver.d.ts.map +1 -1
- package/dist/generic/RunViewResolver.js +42 -108
- package/dist/generic/RunViewResolver.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -37
- package/dist/index.js.map +1 -1
- package/dist/orm.d.ts.map +1 -1
- package/dist/orm.js +2 -1
- package/dist/orm.js.map +1 -1
- package/dist/resolvers/APIKeyResolver.d.ts +74 -0
- package/dist/resolvers/APIKeyResolver.d.ts.map +1 -1
- package/dist/resolvers/APIKeyResolver.js +49 -10
- package/dist/resolvers/APIKeyResolver.js.map +1 -1
- package/dist/resolvers/ActionResolver.d.ts +189 -0
- package/dist/resolvers/ActionResolver.d.ts.map +1 -1
- package/dist/resolvers/ActionResolver.js +152 -21
- package/dist/resolvers/ActionResolver.js.map +1 -1
- package/dist/resolvers/ColorResolver.js +0 -5
- package/dist/resolvers/ColorResolver.js.map +1 -1
- package/dist/resolvers/ComponentRegistryResolver.d.ts +65 -0
- package/dist/resolvers/ComponentRegistryResolver.d.ts.map +1 -1
- package/dist/resolvers/ComponentRegistryResolver.js +118 -40
- package/dist/resolvers/ComponentRegistryResolver.js.map +1 -1
- package/dist/resolvers/CreateQueryResolver.d.ts +47 -0
- package/dist/resolvers/CreateQueryResolver.d.ts.map +1 -1
- package/dist/resolvers/CreateQueryResolver.js +92 -116
- package/dist/resolvers/CreateQueryResolver.js.map +1 -1
- package/dist/resolvers/DatasetResolver.js +2 -14
- package/dist/resolvers/DatasetResolver.js.map +1 -1
- package/dist/resolvers/EntityCommunicationsResolver.d.ts +40 -0
- package/dist/resolvers/EntityCommunicationsResolver.d.ts.map +1 -1
- package/dist/resolvers/EntityCommunicationsResolver.js +2 -36
- package/dist/resolvers/EntityCommunicationsResolver.js.map +1 -1
- package/dist/resolvers/EntityRecordNameResolver.js +0 -7
- package/dist/resolvers/EntityRecordNameResolver.js.map +1 -1
- package/dist/resolvers/FileCategoryResolver.d.ts +1 -1
- package/dist/resolvers/FileCategoryResolver.d.ts.map +1 -1
- package/dist/resolvers/FileCategoryResolver.js +15 -3
- package/dist/resolvers/FileCategoryResolver.js.map +1 -1
- package/dist/resolvers/FileResolver.d.ts +16 -0
- package/dist/resolvers/FileResolver.d.ts.map +1 -1
- package/dist/resolvers/FileResolver.js +59 -74
- package/dist/resolvers/FileResolver.js.map +1 -1
- package/dist/resolvers/GetDataContextDataResolver.d.ts +18 -1
- package/dist/resolvers/GetDataContextDataResolver.d.ts.map +1 -1
- package/dist/resolvers/GetDataContextDataResolver.js +17 -9
- package/dist/resolvers/GetDataContextDataResolver.js.map +1 -1
- package/dist/resolvers/GetDataResolver.d.ts +19 -0
- package/dist/resolvers/GetDataResolver.d.ts.map +1 -1
- package/dist/resolvers/GetDataResolver.js +35 -35
- package/dist/resolvers/GetDataResolver.js.map +1 -1
- package/dist/resolvers/InfoResolver.d.ts +2 -2
- package/dist/resolvers/InfoResolver.d.ts.map +1 -1
- package/dist/resolvers/InfoResolver.js +17 -20
- package/dist/resolvers/InfoResolver.js.map +1 -1
- package/dist/resolvers/MCPResolver.d.ts +325 -1
- package/dist/resolvers/MCPResolver.d.ts.map +1 -1
- package/dist/resolvers/MCPResolver.js +931 -24
- package/dist/resolvers/MCPResolver.js.map +1 -1
- package/dist/resolvers/MergeRecordsResolver.js +3 -29
- package/dist/resolvers/MergeRecordsResolver.js.map +1 -1
- package/dist/resolvers/PotentialDuplicateRecordResolver.d.ts.map +1 -1
- package/dist/resolvers/PotentialDuplicateRecordResolver.js +0 -3
- package/dist/resolvers/PotentialDuplicateRecordResolver.js.map +1 -1
- package/dist/resolvers/QueryResolver.d.ts +20 -0
- package/dist/resolvers/QueryResolver.d.ts.map +1 -1
- package/dist/resolvers/QueryResolver.js +44 -36
- package/dist/resolvers/QueryResolver.js.map +1 -1
- package/dist/resolvers/ReportResolver.d.ts +3 -0
- package/dist/resolvers/ReportResolver.d.ts.map +1 -1
- package/dist/resolvers/ReportResolver.js +9 -10
- package/dist/resolvers/ReportResolver.js.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.d.ts +54 -0
- package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.js +116 -40
- package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
- package/dist/resolvers/RunAIPromptResolver.d.ts +42 -0
- package/dist/resolvers/RunAIPromptResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIPromptResolver.js +95 -22
- package/dist/resolvers/RunAIPromptResolver.js.map +1 -1
- package/dist/resolvers/RunTemplateResolver.js +9 -6
- package/dist/resolvers/RunTemplateResolver.js.map +1 -1
- package/dist/resolvers/RunTestResolver.d.ts +12 -0
- package/dist/resolvers/RunTestResolver.d.ts.map +1 -1
- package/dist/resolvers/RunTestResolver.js +35 -21
- package/dist/resolvers/RunTestResolver.js.map +1 -1
- package/dist/resolvers/SqlLoggingConfigResolver.d.ts +312 -0
- package/dist/resolvers/SqlLoggingConfigResolver.d.ts.map +1 -1
- package/dist/resolvers/SqlLoggingConfigResolver.js +295 -45
- package/dist/resolvers/SqlLoggingConfigResolver.js.map +1 -1
- package/dist/resolvers/SyncDataResolver.d.ts +21 -0
- package/dist/resolvers/SyncDataResolver.d.ts.map +1 -1
- package/dist/resolvers/SyncDataResolver.js +36 -22
- package/dist/resolvers/SyncDataResolver.js.map +1 -1
- package/dist/resolvers/SyncRolesUsersResolver.d.ts +14 -0
- package/dist/resolvers/SyncRolesUsersResolver.d.ts.map +1 -1
- package/dist/resolvers/SyncRolesUsersResolver.js +54 -21
- package/dist/resolvers/SyncRolesUsersResolver.js.map +1 -1
- package/dist/resolvers/TaskResolver.d.ts +13 -0
- package/dist/resolvers/TaskResolver.d.ts.map +1 -1
- package/dist/resolvers/TaskResolver.js +22 -7
- package/dist/resolvers/TaskResolver.js.map +1 -1
- package/dist/resolvers/TelemetryResolver.d.ts +22 -0
- package/dist/resolvers/TelemetryResolver.d.ts.map +1 -1
- package/dist/resolvers/TelemetryResolver.js +45 -79
- package/dist/resolvers/TelemetryResolver.js.map +1 -1
- package/dist/resolvers/TransactionGroupResolver.js +11 -13
- package/dist/resolvers/TransactionGroupResolver.js.map +1 -1
- package/dist/resolvers/UserFavoriteResolver.js +3 -12
- package/dist/resolvers/UserFavoriteResolver.js.map +1 -1
- package/dist/resolvers/UserResolver.js +10 -0
- package/dist/resolvers/UserResolver.js.map +1 -1
- package/dist/resolvers/UserViewResolver.js +4 -0
- package/dist/resolvers/UserViewResolver.js.map +1 -1
- package/dist/resolvers/VersionHistoryResolver.d.ts +39 -0
- package/dist/resolvers/VersionHistoryResolver.d.ts.map +1 -0
- package/dist/resolvers/VersionHistoryResolver.js +208 -0
- package/dist/resolvers/VersionHistoryResolver.js.map +1 -0
- package/dist/rest/EntityCRUDHandler.d.ts +19 -0
- package/dist/rest/EntityCRUDHandler.d.ts.map +1 -1
- package/dist/rest/EntityCRUDHandler.js +55 -0
- package/dist/rest/EntityCRUDHandler.js.map +1 -1
- package/dist/rest/OAuthCallbackHandler.d.ts +143 -0
- package/dist/rest/OAuthCallbackHandler.d.ts.map +1 -0
- package/dist/rest/OAuthCallbackHandler.js +634 -0
- package/dist/rest/OAuthCallbackHandler.js.map +1 -0
- package/dist/rest/RESTEndpointHandler.d.ts +120 -0
- package/dist/rest/RESTEndpointHandler.d.ts.map +1 -1
- package/dist/rest/RESTEndpointHandler.js +213 -24
- package/dist/rest/RESTEndpointHandler.js.map +1 -1
- package/dist/rest/ViewOperationsHandler.d.ts +19 -0
- package/dist/rest/ViewOperationsHandler.d.ts.map +1 -1
- package/dist/rest/ViewOperationsHandler.js +39 -0
- package/dist/rest/ViewOperationsHandler.js.map +1 -1
- package/dist/rest/index.d.ts +1 -0
- package/dist/rest/index.d.ts.map +1 -1
- package/dist/rest/index.js +1 -0
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/setupRESTEndpoints.d.ts +35 -0
- package/dist/rest/setupRESTEndpoints.d.ts.map +1 -1
- package/dist/rest/setupRESTEndpoints.js +15 -1
- package/dist/rest/setupRESTEndpoints.js.map +1 -1
- package/dist/services/ScheduledJobsService.d.ts +31 -0
- package/dist/services/ScheduledJobsService.d.ts.map +1 -1
- package/dist/services/ScheduledJobsService.js +38 -4
- package/dist/services/ScheduledJobsService.js.map +1 -1
- package/dist/services/TaskOrchestrator.d.ts +73 -0
- package/dist/services/TaskOrchestrator.d.ts.map +1 -1
- package/dist/services/TaskOrchestrator.js +137 -15
- package/dist/services/TaskOrchestrator.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -13
- package/dist/types.js.map +1 -1
- package/dist/util.d.ts +37 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +55 -8
- package/dist/util.js.map +1 -1
- package/package.json +83 -78
- package/src/auth/exampleNewUserSubClass.ts +1 -5
- package/src/auth/newUsers.ts +4 -2
- package/src/entitySubclasses/entityPermissions.server.ts +1 -3
- package/src/generated/generated.ts +4707 -2664
- package/src/index.ts +73 -62
- package/src/resolvers/FileCategoryResolver.ts +1 -1
- package/src/resolvers/InfoResolver.ts +10 -6
- package/src/resolvers/MCPResolver.ts +910 -10
- package/src/resolvers/PotentialDuplicateRecordResolver.ts +0 -4
- package/src/resolvers/VersionHistoryResolver.ts +177 -0
- package/src/rest/OAuthCallbackHandler.ts +766 -0
- package/src/rest/RESTEndpointHandler.ts +58 -35
- package/src/rest/index.ts +2 -1
- package/src/rest/setupRESTEndpoints.ts +13 -12
|
@@ -1,24 +1,98 @@
|
|
|
1
1
|
import { AppContext } from "../types.js";
|
|
2
2
|
import { ResolverBase } from "../generic/ResolverBase.js";
|
|
3
|
+
/**
|
|
4
|
+
* Input type for creating a new API key
|
|
5
|
+
*/
|
|
3
6
|
export declare class CreateAPIKeyInput {
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable label for the API key
|
|
9
|
+
*/
|
|
4
10
|
Label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Optional description of what the key is used for
|
|
13
|
+
*/
|
|
5
14
|
Description?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional expiration date for the key
|
|
17
|
+
*/
|
|
6
18
|
ExpiresAt?: Date;
|
|
19
|
+
/**
|
|
20
|
+
* Optional array of scope IDs to assign to this key
|
|
21
|
+
*/
|
|
7
22
|
ScopeIDs?: string[];
|
|
8
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Result type for API key creation
|
|
26
|
+
* Returns the raw key ONCE - it cannot be recovered after this
|
|
27
|
+
*/
|
|
9
28
|
export declare class CreateAPIKeyResult {
|
|
29
|
+
/**
|
|
30
|
+
* Whether the key was created successfully
|
|
31
|
+
*/
|
|
10
32
|
Success: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The raw API key - show this to the user ONCE
|
|
35
|
+
* This cannot be recovered after the initial response
|
|
36
|
+
*/
|
|
11
37
|
RawKey?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The database ID of the created API key
|
|
40
|
+
*/
|
|
12
41
|
APIKeyID?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Error message if creation failed
|
|
44
|
+
*/
|
|
13
45
|
Error?: string;
|
|
14
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Result type for API key revocation
|
|
49
|
+
*/
|
|
15
50
|
export declare class RevokeAPIKeyResult {
|
|
51
|
+
/**
|
|
52
|
+
* Whether the key was revoked successfully
|
|
53
|
+
*/
|
|
16
54
|
Success: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Error message if revocation failed
|
|
57
|
+
*/
|
|
17
58
|
Error?: string;
|
|
18
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolver for API key operations
|
|
62
|
+
* Handles secure server-side API key generation
|
|
63
|
+
*/
|
|
19
64
|
export declare class APIKeyResolver extends ResolverBase {
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new API key with proper server-side cryptographic hashing.
|
|
67
|
+
*
|
|
68
|
+
* This mutation:
|
|
69
|
+
* 1. Generates a cryptographically secure API key using APIKeyEngine
|
|
70
|
+
* 2. Stores only the SHA-256 hash in the database (never the raw key)
|
|
71
|
+
* 3. Returns the raw key ONCE - it cannot be recovered after this call
|
|
72
|
+
* 4. Optionally assigns scope permissions to the key
|
|
73
|
+
*
|
|
74
|
+
* @param input The creation parameters
|
|
75
|
+
* @param ctx The GraphQL context with authenticated user
|
|
76
|
+
* @returns The raw key (show once!) and database ID
|
|
77
|
+
*/
|
|
20
78
|
CreateAPIKey(input: CreateAPIKeyInput, ctx: AppContext): Promise<CreateAPIKeyResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Revokes an API key, permanently disabling it.
|
|
81
|
+
*
|
|
82
|
+
* Once revoked, an API key cannot be reactivated. Users must create a new key.
|
|
83
|
+
* This uses APIKeyEngine.RevokeAPIKey() for consistency.
|
|
84
|
+
*
|
|
85
|
+
* @param apiKeyId The database ID of the API key to revoke
|
|
86
|
+
* @param ctx The GraphQL context with authenticated user
|
|
87
|
+
* @returns Success status
|
|
88
|
+
*/
|
|
21
89
|
RevokeAPIKey(apiKeyId: string, ctx: AppContext): Promise<RevokeAPIKeyResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Saves scope associations for the newly created API key
|
|
92
|
+
* @param apiKeyId The ID of the created API key
|
|
93
|
+
* @param scopeIds Array of scope IDs to associate
|
|
94
|
+
* @param user The context user
|
|
95
|
+
*/
|
|
22
96
|
private saveScopeAssociations;
|
|
23
97
|
}
|
|
24
98
|
//# sourceMappingURL=APIKeyResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIKeyResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/APIKeyResolver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"APIKeyResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/APIKeyResolver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AACH,qBACa,iBAAiB;IAC1B;;OAEG;IAEH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IAEH,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB;;OAEG;IAEH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;GAGG;AACH,qBACa,kBAAkB;IAC3B;;OAEG;IAEH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IAEH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IAEH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBACa,kBAAkB;IAC3B;;OAEG;IAEH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IAEH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,qBACa,cAAe,SAAQ,YAAY;IAC5C;;;;;;;;;;;;OAYG;IAEG,YAAY,CACA,KAAK,EAAE,iBAAiB,EAC/B,GAAG,EAAE,UAAU,GACvB,OAAO,CAAC,kBAAkB,CAAC;IAqD9B;;;;;;;;;OASG;IAEG,YAAY,CACG,QAAQ,EAAE,MAAM,EAC1B,GAAG,EAAE,UAAU,GACvB,OAAO,CAAC,kBAAkB,CAAC;IAkC9B;;;;;OAKG;YACW,qBAAqB;CAsBtC"}
|
|
@@ -15,11 +15,10 @@ import { Field, InputType, ObjectType } from "type-graphql";
|
|
|
15
15
|
import { LogError, Metadata } from "@memberjunction/core";
|
|
16
16
|
import { GetAPIKeyEngine } from "@memberjunction/api-keys";
|
|
17
17
|
import { ResolverBase } from "../generic/ResolverBase.js";
|
|
18
|
+
/**
|
|
19
|
+
* Input type for creating a new API key
|
|
20
|
+
*/
|
|
18
21
|
let CreateAPIKeyInput = class CreateAPIKeyInput {
|
|
19
|
-
Label;
|
|
20
|
-
Description;
|
|
21
|
-
ExpiresAt;
|
|
22
|
-
ScopeIDs;
|
|
23
22
|
};
|
|
24
23
|
__decorate([
|
|
25
24
|
Field(),
|
|
@@ -41,11 +40,11 @@ CreateAPIKeyInput = __decorate([
|
|
|
41
40
|
InputType()
|
|
42
41
|
], CreateAPIKeyInput);
|
|
43
42
|
export { CreateAPIKeyInput };
|
|
43
|
+
/**
|
|
44
|
+
* Result type for API key creation
|
|
45
|
+
* Returns the raw key ONCE - it cannot be recovered after this
|
|
46
|
+
*/
|
|
44
47
|
let CreateAPIKeyResult = class CreateAPIKeyResult {
|
|
45
|
-
Success;
|
|
46
|
-
RawKey;
|
|
47
|
-
APIKeyID;
|
|
48
|
-
Error;
|
|
49
48
|
};
|
|
50
49
|
__decorate([
|
|
51
50
|
Field(),
|
|
@@ -67,9 +66,10 @@ CreateAPIKeyResult = __decorate([
|
|
|
67
66
|
ObjectType()
|
|
68
67
|
], CreateAPIKeyResult);
|
|
69
68
|
export { CreateAPIKeyResult };
|
|
69
|
+
/**
|
|
70
|
+
* Result type for API key revocation
|
|
71
|
+
*/
|
|
70
72
|
let RevokeAPIKeyResult = class RevokeAPIKeyResult {
|
|
71
|
-
Success;
|
|
72
|
-
Error;
|
|
73
73
|
};
|
|
74
74
|
__decorate([
|
|
75
75
|
Field(),
|
|
@@ -83,10 +83,29 @@ RevokeAPIKeyResult = __decorate([
|
|
|
83
83
|
ObjectType()
|
|
84
84
|
], RevokeAPIKeyResult);
|
|
85
85
|
export { RevokeAPIKeyResult };
|
|
86
|
+
/**
|
|
87
|
+
* Resolver for API key operations
|
|
88
|
+
* Handles secure server-side API key generation
|
|
89
|
+
*/
|
|
86
90
|
let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
91
|
+
/**
|
|
92
|
+
* Creates a new API key with proper server-side cryptographic hashing.
|
|
93
|
+
*
|
|
94
|
+
* This mutation:
|
|
95
|
+
* 1. Generates a cryptographically secure API key using APIKeyEngine
|
|
96
|
+
* 2. Stores only the SHA-256 hash in the database (never the raw key)
|
|
97
|
+
* 3. Returns the raw key ONCE - it cannot be recovered after this call
|
|
98
|
+
* 4. Optionally assigns scope permissions to the key
|
|
99
|
+
*
|
|
100
|
+
* @param input The creation parameters
|
|
101
|
+
* @param ctx The GraphQL context with authenticated user
|
|
102
|
+
* @returns The raw key (show once!) and database ID
|
|
103
|
+
*/
|
|
87
104
|
async CreateAPIKey(input, ctx) {
|
|
105
|
+
// Check API key scope authorization for API key creation
|
|
88
106
|
await this.CheckAPIKeyScopeAuthorization('apikey:create', '*', ctx.userPayload);
|
|
89
107
|
try {
|
|
108
|
+
// Get the authenticated user
|
|
90
109
|
const user = ctx.userPayload.userRecord;
|
|
91
110
|
if (!user) {
|
|
92
111
|
return {
|
|
@@ -94,6 +113,7 @@ let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
|
94
113
|
Error: "User is not authenticated"
|
|
95
114
|
};
|
|
96
115
|
}
|
|
116
|
+
// Use APIKeyEngine to create the API key with proper server-side crypto
|
|
97
117
|
const apiKeyEngine = GetAPIKeyEngine();
|
|
98
118
|
const result = await apiKeyEngine.CreateAPIKey({
|
|
99
119
|
UserId: user.ID,
|
|
@@ -107,6 +127,7 @@ let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
|
107
127
|
Error: result.Error || "Failed to create API key"
|
|
108
128
|
};
|
|
109
129
|
}
|
|
130
|
+
// Save scope associations if provided
|
|
110
131
|
if (input.ScopeIDs && input.ScopeIDs.length > 0 && result.APIKeyId) {
|
|
111
132
|
await this.saveScopeAssociations(result.APIKeyId, input.ScopeIDs, user);
|
|
112
133
|
}
|
|
@@ -125,7 +146,18 @@ let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
|
125
146
|
};
|
|
126
147
|
}
|
|
127
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Revokes an API key, permanently disabling it.
|
|
151
|
+
*
|
|
152
|
+
* Once revoked, an API key cannot be reactivated. Users must create a new key.
|
|
153
|
+
* This uses APIKeyEngine.RevokeAPIKey() for consistency.
|
|
154
|
+
*
|
|
155
|
+
* @param apiKeyId The database ID of the API key to revoke
|
|
156
|
+
* @param ctx The GraphQL context with authenticated user
|
|
157
|
+
* @returns Success status
|
|
158
|
+
*/
|
|
128
159
|
async RevokeAPIKey(apiKeyId, ctx) {
|
|
160
|
+
// Check API key scope authorization for API key revocation
|
|
129
161
|
await this.CheckAPIKeyScopeAuthorization('apikey:revoke', apiKeyId, ctx.userPayload);
|
|
130
162
|
try {
|
|
131
163
|
const user = ctx.userPayload.userRecord;
|
|
@@ -156,6 +188,12 @@ let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
|
156
188
|
};
|
|
157
189
|
}
|
|
158
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Saves scope associations for the newly created API key
|
|
193
|
+
* @param apiKeyId The ID of the created API key
|
|
194
|
+
* @param scopeIds Array of scope IDs to associate
|
|
195
|
+
* @param user The context user
|
|
196
|
+
*/
|
|
159
197
|
async saveScopeAssociations(apiKeyId, scopeIds, user) {
|
|
160
198
|
const md = new Metadata();
|
|
161
199
|
for (const scopeId of scopeIds) {
|
|
@@ -167,6 +205,7 @@ let APIKeyResolver = class APIKeyResolver extends ResolverBase {
|
|
|
167
205
|
}
|
|
168
206
|
catch (error) {
|
|
169
207
|
LogError(`Error saving scope association for API key ${apiKeyId}, scope ${scopeId}: ${error}`);
|
|
208
|
+
// Continue with other scopes even if one fails
|
|
170
209
|
}
|
|
171
210
|
}
|
|
172
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIKeyResolver.js","sourceRoot":"","sources":["../../src/resolvers/APIKeyResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"APIKeyResolver.js","sourceRoot":"","sources":["../../src/resolvers/APIKeyResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,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
|
|
3
3
|
import { ResolverBase } from "../generic/ResolverBase.js";
|
|
4
|
+
/**
|
|
5
|
+
* Input type for action parameters
|
|
6
|
+
* Used to pass parameters to actions when invoking them
|
|
7
|
+
*/
|
|
4
8
|
export declare class ActionParamInput {
|
|
9
|
+
/**
|
|
10
|
+
* The name of the parameter
|
|
11
|
+
*/
|
|
5
12
|
Name: string;
|
|
13
|
+
/**
|
|
14
|
+
* The value of the parameter
|
|
15
|
+
* Complex objects should be serialized to JSON strings
|
|
16
|
+
*/
|
|
6
17
|
Value: string;
|
|
18
|
+
/**
|
|
19
|
+
* The data type of the parameter
|
|
20
|
+
* Used for type conversion on the server
|
|
21
|
+
*/
|
|
7
22
|
Type: string;
|
|
8
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Input type for running an action
|
|
26
|
+
*/
|
|
9
27
|
export declare class RunActionInput {
|
|
28
|
+
/**
|
|
29
|
+
* The ID of the action to run
|
|
30
|
+
*/
|
|
10
31
|
ActionID: string;
|
|
32
|
+
/**
|
|
33
|
+
* Parameters to pass to the action
|
|
34
|
+
*/
|
|
11
35
|
Params?: ActionParamInput[];
|
|
36
|
+
/**
|
|
37
|
+
* Whether to skip logging the action execution
|
|
38
|
+
* Defaults to false
|
|
39
|
+
*/
|
|
12
40
|
SkipActionLog?: boolean;
|
|
13
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Represents a collection of key-value pairs that make up a composite key
|
|
44
|
+
* Used for both primary keys and foreign keys
|
|
45
|
+
*/
|
|
14
46
|
export declare class CompositeKeyInput {
|
|
47
|
+
/**
|
|
48
|
+
* The collection of key-value pairs that make up the composite key
|
|
49
|
+
*/
|
|
15
50
|
KeyValuePairs: KeyValuePairInput[];
|
|
16
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Input type for running entity actions
|
|
54
|
+
*/
|
|
17
55
|
export declare class EntityActionInput {
|
|
56
|
+
/**
|
|
57
|
+
* The ID of the entity action to run
|
|
58
|
+
*/
|
|
18
59
|
EntityActionID: string;
|
|
60
|
+
/**
|
|
61
|
+
* The type of invocation (SingleRecord, View, List, etc.)
|
|
62
|
+
*/
|
|
19
63
|
InvocationType: string;
|
|
64
|
+
/**
|
|
65
|
+
* The name of the entity
|
|
66
|
+
* This is the preferred way to identify an entity as it's more human-readable than EntityID
|
|
67
|
+
*/
|
|
20
68
|
EntityName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The ID of the entity
|
|
71
|
+
* Use EntityName instead when possible for better code readability
|
|
72
|
+
* @deprecated Use EntityName instead when possible
|
|
73
|
+
*/
|
|
21
74
|
EntityID?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The primary key of the entity record to act on
|
|
77
|
+
* This is used for SingleRecord invocation types
|
|
78
|
+
*/
|
|
22
79
|
PrimaryKey?: CompositeKeyInput;
|
|
80
|
+
/**
|
|
81
|
+
* The ID of the list to operate on
|
|
82
|
+
* This is used for List invocation types
|
|
83
|
+
*/
|
|
23
84
|
ListID?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The ID of the view to operate on
|
|
87
|
+
* This is used for View invocation types
|
|
88
|
+
*/
|
|
24
89
|
ViewID?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Additional parameters to pass to the action
|
|
92
|
+
*/
|
|
25
93
|
Params?: ActionParamInput[];
|
|
26
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Output type for action results
|
|
97
|
+
* Used to return results from actions to clients
|
|
98
|
+
*/
|
|
27
99
|
export declare class ActionResultOutput {
|
|
100
|
+
/**
|
|
101
|
+
* Whether the action was executed successfully
|
|
102
|
+
*/
|
|
28
103
|
Success: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Optional message describing the result of the action
|
|
106
|
+
*/
|
|
29
107
|
Message?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Optional result code from the action
|
|
110
|
+
*/
|
|
30
111
|
ResultCode?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Optional result data from the action
|
|
114
|
+
* Complex objects are serialized to JSON strings
|
|
115
|
+
*/
|
|
31
116
|
ResultData?: string;
|
|
32
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Resolver for action-related GraphQL operations
|
|
120
|
+
* Handles running actions and entity actions through GraphQL
|
|
121
|
+
*/
|
|
33
122
|
export declare class ActionResolver extends ResolverBase {
|
|
123
|
+
/**
|
|
124
|
+
* Mutation for running an action
|
|
125
|
+
* @param input The input parameters for running the action
|
|
126
|
+
* @param ctx The GraphQL context containing user authentication information
|
|
127
|
+
* @returns The result of running the action
|
|
128
|
+
*/
|
|
34
129
|
RunAction(input: RunActionInput, ctx: AppContext): Promise<ActionResultOutput>;
|
|
130
|
+
/**
|
|
131
|
+
* Finds an action by its ID
|
|
132
|
+
* @param actionID The ID of the action to find
|
|
133
|
+
* @returns The action
|
|
134
|
+
* @throws Error if the action is not found
|
|
135
|
+
* @private
|
|
136
|
+
*/
|
|
35
137
|
private findActionById;
|
|
138
|
+
/**
|
|
139
|
+
* Parses action parameters from the input
|
|
140
|
+
* @param inputParams The input parameters
|
|
141
|
+
* @returns The parsed parameters
|
|
142
|
+
* @private
|
|
143
|
+
*/
|
|
36
144
|
private parseActionParameters;
|
|
145
|
+
/**
|
|
146
|
+
* Executes an action
|
|
147
|
+
* @param action The action to execute
|
|
148
|
+
* @param user The user context
|
|
149
|
+
* @param params The action parameters
|
|
150
|
+
* @param skipActionLog Whether to skip action logging
|
|
151
|
+
* @returns The action result
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
37
154
|
private executeAction;
|
|
155
|
+
/**
|
|
156
|
+
* Creates an action result from the execution result
|
|
157
|
+
* @param result The execution result
|
|
158
|
+
* @returns The formatted action result
|
|
159
|
+
* @private
|
|
160
|
+
*/
|
|
38
161
|
private createActionResult;
|
|
162
|
+
/**
|
|
163
|
+
* Handles errors in the action resolver
|
|
164
|
+
* @param e The error
|
|
165
|
+
* @returns An error result
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
39
168
|
private handleActionError;
|
|
169
|
+
/**
|
|
170
|
+
* Mutation for running an entity action
|
|
171
|
+
* @param input The input parameters for running the entity action
|
|
172
|
+
* @param ctx The GraphQL context containing user authentication information
|
|
173
|
+
* @returns The result of running the entity action
|
|
174
|
+
*/
|
|
40
175
|
RunEntityAction(input: EntityActionInput, ctx: AppContext): Promise<ActionResultOutput>;
|
|
176
|
+
/**
|
|
177
|
+
* Gets an entity action by ID
|
|
178
|
+
* @param actionID The ID of the entity action
|
|
179
|
+
* @returns The entity action
|
|
180
|
+
* @throws Error if entity action is not found
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
41
183
|
private getEntityAction;
|
|
184
|
+
/**
|
|
185
|
+
* Creates the base parameters for the entity action
|
|
186
|
+
* @param entityAction The entity action
|
|
187
|
+
* @param invocationTypeName The invocation type name
|
|
188
|
+
* @param user The authenticated user
|
|
189
|
+
* @returns The base parameters
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
42
192
|
private createBaseParams;
|
|
193
|
+
/**
|
|
194
|
+
* Adds the entity object to the parameters
|
|
195
|
+
* @param params The parameters to add to
|
|
196
|
+
* @param input The input parameters
|
|
197
|
+
* @param user The authenticated user
|
|
198
|
+
* @private
|
|
199
|
+
*/
|
|
43
200
|
private addEntityObject;
|
|
201
|
+
/**
|
|
202
|
+
* Creates a composite key from the input
|
|
203
|
+
* @param entity The entity information
|
|
204
|
+
* @param primaryKey The primary key input
|
|
205
|
+
* @returns The composite key
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
44
208
|
private createCompositeKey;
|
|
209
|
+
/**
|
|
210
|
+
* Converts a value to the proper type based on the field information
|
|
211
|
+
* @param value The value to convert
|
|
212
|
+
* @param field The field information
|
|
213
|
+
* @returns The converted value
|
|
214
|
+
* @private
|
|
215
|
+
*/
|
|
45
216
|
private convertValueToProperType;
|
|
217
|
+
/**
|
|
218
|
+
* Adds optional parameters to the entity action parameters
|
|
219
|
+
* @param params The parameters to add to
|
|
220
|
+
* @param input The input parameters
|
|
221
|
+
* @private
|
|
222
|
+
*/
|
|
46
223
|
private addOptionalParams;
|
|
224
|
+
/**
|
|
225
|
+
* Converts a parameter value to the proper format
|
|
226
|
+
* @param p The parameter to convert
|
|
227
|
+
* @returns The converted parameter
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
47
230
|
private convertParameterValue;
|
|
231
|
+
/**
|
|
232
|
+
* Handles errors in the entity action resolver
|
|
233
|
+
* @param e The error
|
|
234
|
+
* @returns An error result
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
48
237
|
private handleError;
|
|
49
238
|
}
|
|
50
239
|
//# sourceMappingURL=ActionResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/ActionResolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/ActionResolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;GAGG;AACH,qBACa,gBAAgB;IAC3B;;OAEG;IAEH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IAEH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBACa,cAAc;IACzB;;OAEG;IAEH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IAEH,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAE5B;;;OAGG;IAEH,a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