@droz-js/sdk 0.3.9 → 0.3.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.
- package/README.md +12 -0
- package/package.json +1 -1
- package/src/client/config.d.ts +6 -0
- package/src/client/config.js +32 -0
- package/src/client/helpers.d.ts +2 -2
- package/src/client/helpers.js +23 -7
- package/src/client/http.js +8 -2
- package/src/nucleus.d.ts +6 -0
- package/src/sdks/droznexo.d.ts +5 -4
- package/src/sdks/droznexo.js +1 -0
- package/src/sdks/nucleus.d.ts +22 -4
- package/src/sdks/nucleus.js +28 -2
package/README.md
CHANGED
|
@@ -23,6 +23,18 @@ DrozSdk.forTenant('dev');
|
|
|
23
23
|
DrozSdk.withAuthorization('Basic', 'username', 'password');
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Global Error Handling
|
|
27
|
+
|
|
28
|
+
The sdk will throw an error on every request that fails, but you can also catch the error globally by using the `on` method.
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { DrozSdk } from '@droz-js/sdk';
|
|
32
|
+
|
|
33
|
+
DrozSdk.on('error', (error) => {
|
|
34
|
+
console.log(error);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
26
38
|
## Websocket
|
|
27
39
|
|
|
28
40
|
For websockets we use `graphql-ws` protocol with `AsyncIterator` to handle the subscriptions. The sdk will automatically
|
package/package.json
CHANGED
package/src/client/config.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class DrozSdk {
|
|
|
18
18
|
private static defaultTenant?;
|
|
19
19
|
private static defaultAuthorizationProvider?;
|
|
20
20
|
private static readonly tenantConfigs;
|
|
21
|
+
private static readonly listeners;
|
|
21
22
|
static forTenant(tenant: string): typeof DrozSdk;
|
|
22
23
|
static withAuthorization(type?: string, ...values: string[]): void;
|
|
23
24
|
static withAuthorizationProvider(provider: () => Promise<string>): void;
|
|
@@ -25,5 +26,10 @@ export declare class DrozSdk {
|
|
|
25
26
|
static getTenantConfig(customTenant?: string): Promise<TenantConfig>;
|
|
26
27
|
private static getOrDiscoverTenantConfig;
|
|
27
28
|
private static discoverTenantConfig;
|
|
29
|
+
static on<T>(event: string, listener: (e: T) => void): void;
|
|
30
|
+
static off<T>(event: string, listener: (e: T) => void): void;
|
|
31
|
+
static emit(event: string, data: any): void;
|
|
32
|
+
private static addEventListener;
|
|
33
|
+
private static removeEventListener;
|
|
28
34
|
}
|
|
29
35
|
export {};
|
package/src/client/config.js
CHANGED
|
@@ -32,6 +32,7 @@ class DrozSdk {
|
|
|
32
32
|
static defaultTenant;
|
|
33
33
|
static defaultAuthorizationProvider;
|
|
34
34
|
static tenantConfigs = new Map();
|
|
35
|
+
static listeners = new Map();
|
|
35
36
|
static forTenant(tenant) {
|
|
36
37
|
this.defaultTenant = tenant;
|
|
37
38
|
this.tenantConfigs.delete(tenant);
|
|
@@ -81,5 +82,36 @@ class DrozSdk {
|
|
|
81
82
|
this.tenantConfigs.set(tenant, promise());
|
|
82
83
|
return this.tenantConfigs.get(tenant);
|
|
83
84
|
}
|
|
85
|
+
static on(event, listener) {
|
|
86
|
+
this.addEventListener(event, listener);
|
|
87
|
+
}
|
|
88
|
+
static off(event, listener) {
|
|
89
|
+
this.removeEventListener(event, listener);
|
|
90
|
+
}
|
|
91
|
+
static emit(event, data) {
|
|
92
|
+
if (this.listeners.has(event)) {
|
|
93
|
+
const listeners = this.listeners.get(event);
|
|
94
|
+
listeners.forEach(listener => listener(data));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
static addEventListener(event, listener) {
|
|
98
|
+
if (!this.listeners.has(event)) {
|
|
99
|
+
this.listeners.set(event, []);
|
|
100
|
+
}
|
|
101
|
+
const listeners = this.listeners.get(event);
|
|
102
|
+
const index = listeners.indexOf(listener);
|
|
103
|
+
if (index == -1) {
|
|
104
|
+
listeners.push(listener);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
static removeEventListener(event, listener) {
|
|
108
|
+
if (this.listeners.has(event)) {
|
|
109
|
+
const listeners = this.listeners.get(event);
|
|
110
|
+
const index = listeners.indexOf(listener);
|
|
111
|
+
if (index > -1) {
|
|
112
|
+
listeners.splice(index, 1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
84
116
|
}
|
|
85
117
|
exports.DrozSdk = DrozSdk;
|
package/src/client/helpers.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type GetSdk<Sdk> = (requester: Requester<Sdk>) => Sdk;
|
|
|
6
6
|
export declare class SdkError extends Error {
|
|
7
7
|
statusCode?: number;
|
|
8
8
|
errorCode?: string;
|
|
9
|
-
errors?: ReadonlyArray<GraphQLError
|
|
10
|
-
constructor(errors: ReadonlyArray<GraphQLError
|
|
9
|
+
errors?: ReadonlyArray<Partial<GraphQLError>>;
|
|
10
|
+
constructor(errors: ReadonlyArray<Partial<GraphQLError>>);
|
|
11
11
|
}
|
|
12
12
|
export declare class SdkConfigurationError extends Error {
|
|
13
13
|
constructor(message: string);
|
package/src/client/helpers.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapAsyncIterableGraphqlResponse = exports.mapGraphqlResponse = exports.resolveAuthorization = exports.toAuthorizationProvider = exports.SdkConfigurationError = exports.SdkError = exports.serviceDiscoveryEndpoint = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
4
5
|
exports.serviceDiscoveryEndpoint = 'https://root.droz.services';
|
|
5
6
|
class SdkError extends Error {
|
|
6
7
|
statusCode;
|
|
7
8
|
errorCode;
|
|
8
9
|
errors;
|
|
9
10
|
constructor(errors) {
|
|
10
|
-
const { message, extensions } = errors?.[0] ?? {};
|
|
11
|
-
super(message ?? 'Unknown Error'
|
|
11
|
+
const { message, extensions, originalError } = errors?.[0] ?? {};
|
|
12
|
+
super(message ?? 'Unknown Error', {
|
|
13
|
+
cause: originalError
|
|
14
|
+
});
|
|
12
15
|
this.errors = errors;
|
|
13
16
|
this.statusCode = extensions?.statusCode;
|
|
14
17
|
this.errorCode = extensions?.errorCode;
|
|
@@ -47,12 +50,25 @@ async function resolveAuthorization(provider) {
|
|
|
47
50
|
exports.resolveAuthorization = resolveAuthorization;
|
|
48
51
|
function mapGraphqlResponse(response) {
|
|
49
52
|
if (response) {
|
|
50
|
-
if (response && 'stack' in response && 'message' in response)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
if (response && 'stack' in response && 'message' in response) {
|
|
54
|
+
const error = new SdkError([
|
|
55
|
+
{
|
|
56
|
+
message: response.message,
|
|
57
|
+
originalError: response,
|
|
58
|
+
extensions: { errorCode: '500-unknown-error', statusCode: 500 }
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
config_1.DrozSdk.emit('error', error);
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
if ('errors' in response) {
|
|
65
|
+
const error = new SdkError(response.errors);
|
|
66
|
+
config_1.DrozSdk.emit('error', error);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
if ('data' in response) {
|
|
55
70
|
return response.data;
|
|
71
|
+
}
|
|
56
72
|
}
|
|
57
73
|
}
|
|
58
74
|
exports.mapGraphqlResponse = mapGraphqlResponse;
|
package/src/client/http.js
CHANGED
|
@@ -60,7 +60,9 @@ class HttpRequester {
|
|
|
60
60
|
return emptyAsyncIterator();
|
|
61
61
|
// extract operation name and enqueue the request to be executed in batches
|
|
62
62
|
const operationName = /(?:query|mutation) ([^({ ]*)/.exec(query)?.[1];
|
|
63
|
-
return this.inbatches({ query, variables, operationName })
|
|
63
|
+
return this.inbatches({ query, variables, operationName })
|
|
64
|
+
.catch(error => (0, helpers_1.mapGraphqlResponse)(error))
|
|
65
|
+
.then(data => (0, helpers_1.mapGraphqlResponse)(data));
|
|
64
66
|
}
|
|
65
67
|
async buildRequest() {
|
|
66
68
|
const [authorization, tenant] = await Promise.all([
|
|
@@ -94,7 +96,11 @@ class HttpRequester {
|
|
|
94
96
|
headers,
|
|
95
97
|
body
|
|
96
98
|
});
|
|
97
|
-
|
|
99
|
+
if (response.status === 200) {
|
|
100
|
+
return await response.json();
|
|
101
|
+
}
|
|
102
|
+
const error = await response.text();
|
|
103
|
+
return [].concat(request).map(() => new Error(error)); // one error per request
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
__decorate([
|
package/src/nucleus.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
|
|
|
23
23
|
createAgent(variables: import("./sdks/nucleus").Exact<{
|
|
24
24
|
input: import("./sdks/nucleus").CreateAgentInput;
|
|
25
25
|
}>, options?: unknown): Promise<import("./sdks/nucleus").CreateAgentMutation>;
|
|
26
|
+
createApiKeyAgent(variables: import("./sdks/nucleus").Exact<{
|
|
27
|
+
input: import("./sdks/nucleus").CreateApiKeyAgentInput;
|
|
28
|
+
}>, options?: unknown): Promise<import("./sdks/nucleus").CreateApiKeyAgentMutation>;
|
|
26
29
|
updateAgent(variables: import("./sdks/nucleus").Exact<{
|
|
27
30
|
input: import("./sdks/nucleus").UpdateAgentInput;
|
|
28
31
|
}>, options?: unknown): Promise<import("./sdks/nucleus").UpdateAgentMutation>;
|
|
@@ -154,6 +157,9 @@ export declare const Nucleus: new (options?: import("./client/http").HttpClientO
|
|
|
154
157
|
id: string;
|
|
155
158
|
versionId: string;
|
|
156
159
|
}>, options?: unknown): Promise<import("./sdks/nucleus").GetXStateMachineConfigQuery>;
|
|
160
|
+
isAppInstanceInUse(variables: import("./sdks/nucleus").Exact<{
|
|
161
|
+
drn: string;
|
|
162
|
+
}>, options?: unknown): Promise<import("./sdks/nucleus").IsAppInstanceInUseQuery>;
|
|
157
163
|
createStateMachineConfig(variables: import("./sdks/nucleus").Exact<{
|
|
158
164
|
input: import("./sdks/nucleus").CreateStateMachineConfigInput;
|
|
159
165
|
}>, options?: unknown): Promise<import("./sdks/nucleus").CreateStateMachineConfigMutation>;
|
package/src/sdks/droznexo.d.ts
CHANGED
|
@@ -128,6 +128,7 @@ export type DrozNexoConnectionConnection = {
|
|
|
128
128
|
};
|
|
129
129
|
export type DrozNexoConnectionSuggestion = {
|
|
130
130
|
destination: DrozNexoAppAndAppInstance;
|
|
131
|
+
title: Scalars['String']['output'];
|
|
131
132
|
trigger: DrozNexoAppAndAppInstance;
|
|
132
133
|
};
|
|
133
134
|
export type DrozNexoUsageStatistics = {
|
|
@@ -174,10 +175,10 @@ export type DrozNexoAppInstanceFragment = {
|
|
|
174
175
|
app: Pick<DrozNexoApp, 'id' | 'name' | 'description'>;
|
|
175
176
|
appInstance: Pick<DrozNexoAppInstance, 'drn' | 'name' | 'createdAt' | 'updatedAt'>;
|
|
176
177
|
};
|
|
177
|
-
export type DrozNexoSuggestionFragment = {
|
|
178
|
+
export type DrozNexoSuggestionFragment = (Pick<DrozNexoConnectionSuggestion, 'title'> & {
|
|
178
179
|
trigger: DrozNexoAppInstanceFragment;
|
|
179
180
|
destination: DrozNexoAppInstanceFragment;
|
|
180
|
-
};
|
|
181
|
+
});
|
|
181
182
|
export type DrozNexoConnectionFragment = (Pick<DrozNexoConnection, 'id' | 'versionId' | 'title' | 'description' | 'createdAt' | 'updatedAt'> & {
|
|
182
183
|
trigger: DrozNexoAppInstanceFragment;
|
|
183
184
|
destination: DrozNexoAppInstanceFragment;
|
|
@@ -216,9 +217,9 @@ export type RemoveDrozNexoConnectionMutation = {
|
|
|
216
217
|
removeDrozNexoConnection: DrozNexoConnectionFragment;
|
|
217
218
|
};
|
|
218
219
|
export declare const DrozNexoAppInstanceFragmentDoc = "\n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
219
|
-
export declare const DrozNexoSuggestionFragmentDoc = "\n fragment drozNexoSuggestion on DrozNexoConnectionSuggestion {\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
220
|
+
export declare const DrozNexoSuggestionFragmentDoc = "\n fragment drozNexoSuggestion on DrozNexoConnectionSuggestion {\n title\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
220
221
|
export declare const DrozNexoConnectionFragmentDoc = "\n fragment drozNexoConnection on DrozNexoConnection {\n id\n versionId\n title\n description\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n createdAt\n updatedAt\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
221
|
-
export declare const ListDrozNexoSuggestionsDocument = "\n query listDrozNexoSuggestions {\n listDrozNexoSuggestions {\n ...drozNexoSuggestion\n }\n}\n \n fragment drozNexoSuggestion on DrozNexoConnectionSuggestion {\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
222
|
+
export declare const ListDrozNexoSuggestionsDocument = "\n query listDrozNexoSuggestions {\n listDrozNexoSuggestions {\n ...drozNexoSuggestion\n }\n}\n \n fragment drozNexoSuggestion on DrozNexoConnectionSuggestion {\n title\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
222
223
|
export declare const ListDrozNexoConnectionsDocument = "\n query listDrozNexoConnections($next: Base64) {\n listDrozNexoConnections(next: $next) {\n nodes {\n ...drozNexoConnection\n }\n pageInfo {\n next\n hasNext\n }\n }\n}\n \n fragment drozNexoConnection on DrozNexoConnection {\n id\n versionId\n title\n description\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n createdAt\n updatedAt\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
|
223
224
|
export declare const GetUsageStatisticsDocument = "\n query getUsageStatistics {\n getUsageStatistics {\n totalSecrets\n totalAppInstances\n totalConnections\n }\n}\n ";
|
|
224
225
|
export declare const CreateDrozNexoConnectionDocument = "\n mutation createDrozNexoConnection($input: CreateDrozNexoConnectionInput!) {\n createDrozNexoConnection(input: $input) {\n ...drozNexoConnection\n }\n}\n \n fragment drozNexoConnection on DrozNexoConnection {\n id\n versionId\n title\n description\n trigger {\n ...drozNexoAppInstance\n }\n destination {\n ...drozNexoAppInstance\n }\n createdAt\n updatedAt\n}\n \n fragment drozNexoAppInstance on DrozNexoAppAndAppInstance {\n app {\n id\n name\n description\n }\n appInstance {\n drn\n name\n createdAt\n updatedAt\n }\n}\n ";
|
package/src/sdks/droznexo.js
CHANGED
package/src/sdks/nucleus.d.ts
CHANGED
|
@@ -419,7 +419,6 @@ export type Query = {
|
|
|
419
419
|
amplifyConfig?: Maybe<Scalars['JSON']['output']>;
|
|
420
420
|
app?: Maybe<Scalars['DRN']['output']>;
|
|
421
421
|
authInfo?: Maybe<AuthInfo>;
|
|
422
|
-
canUnregisterAppInstance: Scalars['Boolean']['output'];
|
|
423
422
|
countAppInstances: Scalars['Int']['output'];
|
|
424
423
|
countCredentials: Scalars['Int']['output'];
|
|
425
424
|
countLiveStateMachineConfigs: Scalars['Int']['output'];
|
|
@@ -436,6 +435,7 @@ export type Query = {
|
|
|
436
435
|
getStateMachineConfig?: Maybe<StateMachineConfig>;
|
|
437
436
|
getSystemRole?: Maybe<Role>;
|
|
438
437
|
getXStateMachineConfig?: Maybe<Scalars['JSON']['output']>;
|
|
438
|
+
isAppInstanceInUse: Scalars['Boolean']['output'];
|
|
439
439
|
listAgents: AgentConnection;
|
|
440
440
|
listApiKeyAgents: AgentConnection;
|
|
441
441
|
listAppInstances: Array<AppInstance>;
|
|
@@ -450,9 +450,6 @@ export type Query = {
|
|
|
450
450
|
listSystemRoles: Array<Role>;
|
|
451
451
|
version?: Maybe<Scalars['String']['output']>;
|
|
452
452
|
};
|
|
453
|
-
export type QueryCanUnregisterAppInstanceArgs = {
|
|
454
|
-
drn: Scalars['DRN']['input'];
|
|
455
|
-
};
|
|
456
453
|
export type QueryGetAgentArgs = {
|
|
457
454
|
id: Scalars['ID']['input'];
|
|
458
455
|
};
|
|
@@ -488,6 +485,9 @@ export type QueryGetXStateMachineConfigArgs = {
|
|
|
488
485
|
id: Scalars['ID']['input'];
|
|
489
486
|
versionId: Scalars['ID']['input'];
|
|
490
487
|
};
|
|
488
|
+
export type QueryIsAppInstanceInUseArgs = {
|
|
489
|
+
drn: Scalars['DRN']['input'];
|
|
490
|
+
};
|
|
491
491
|
export type QueryListAgentsArgs = {
|
|
492
492
|
next?: InputMaybe<Scalars['Base64']['input']>;
|
|
493
493
|
};
|
|
@@ -688,6 +688,9 @@ export type UpdateStateMachineConfigWithStateInput = {
|
|
|
688
688
|
stateId: Scalars['ID']['input'];
|
|
689
689
|
};
|
|
690
690
|
export type AgentFragment = Pick<Agent, 'id' | 'name' | 'email' | 'emailVerified' | 'picture' | 'apps' | 'roles' | 'cognitoUserStatus' | 'createdAt' | 'updatedAt'>;
|
|
691
|
+
export type ApiKeyFragment = (Pick<ApiKeyAgent, 'token'> & {
|
|
692
|
+
user: AgentFragment;
|
|
693
|
+
});
|
|
691
694
|
export type GetMeQueryVariables = Exact<{
|
|
692
695
|
[key: string]: never;
|
|
693
696
|
}>;
|
|
@@ -730,6 +733,12 @@ export type CreateAgentMutationVariables = Exact<{
|
|
|
730
733
|
export type CreateAgentMutation = {
|
|
731
734
|
createAgent?: Maybe<AgentFragment>;
|
|
732
735
|
};
|
|
736
|
+
export type CreateApiKeyAgentMutationVariables = Exact<{
|
|
737
|
+
input: CreateApiKeyAgentInput;
|
|
738
|
+
}>;
|
|
739
|
+
export type CreateApiKeyAgentMutation = {
|
|
740
|
+
createApiKeyAgent?: Maybe<ApiKeyFragment>;
|
|
741
|
+
};
|
|
733
742
|
export type UpdateAgentMutationVariables = Exact<{
|
|
734
743
|
input: UpdateAgentInput;
|
|
735
744
|
}>;
|
|
@@ -1015,6 +1024,10 @@ export type GetXStateMachineConfigQueryVariables = Exact<{
|
|
|
1015
1024
|
versionId: Scalars['ID']['input'];
|
|
1016
1025
|
}>;
|
|
1017
1026
|
export type GetXStateMachineConfigQuery = Pick<Query, 'getXStateMachineConfig'>;
|
|
1027
|
+
export type IsAppInstanceInUseQueryVariables = Exact<{
|
|
1028
|
+
drn: Scalars['DRN']['input'];
|
|
1029
|
+
}>;
|
|
1030
|
+
export type IsAppInstanceInUseQuery = Pick<Query, 'isAppInstanceInUse'>;
|
|
1018
1031
|
export type CreateStateMachineConfigMutationVariables = Exact<{
|
|
1019
1032
|
input: CreateStateMachineConfigInput;
|
|
1020
1033
|
}>;
|
|
@@ -1064,6 +1077,7 @@ export type RemoveStateMachineConfigStateMutation = {
|
|
|
1064
1077
|
removeStateMachineConfigState?: Maybe<StateMachineConfigFragment>;
|
|
1065
1078
|
};
|
|
1066
1079
|
export declare const AgentFragmentDoc = "\n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1080
|
+
export declare const ApiKeyFragmentDoc = "\n fragment apiKey on ApiKeyAgent {\n token\n user {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1067
1081
|
export declare const AppFragmentDoc = "\n fragment app on App {\n id\n type\n name\n description\n}\n ";
|
|
1068
1082
|
export declare const AppInstanceFragmentDoc = "\n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n createdAt\n updatedAt\n}\n ";
|
|
1069
1083
|
export declare const AppWithInstancesFragmentDoc = "\n fragment appWithInstances on App {\n ...app\n instances {\n ...appInstance\n }\n}\n \n fragment app on App {\n id\n type\n name\n description\n}\n \n\n fragment appInstance on AppInstance {\n appId\n appType\n drn\n name\n transitions\n createdAt\n updatedAt\n}\n ";
|
|
@@ -1083,6 +1097,7 @@ export declare const ListAgentsDocument = "\n query listAgents($next: Base64)
|
|
|
1083
1097
|
export declare const ListApiKeyAgentsDocument = "\n query listApiKeyAgents($next: Base64) {\n listApiKeyAgents(next: $next) {\n nodes {\n ...agent\n }\n pageInfo {\n hasNext\n next\n }\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1084
1098
|
export declare const UpdateMyProfileDocument = "\n mutation updateMyProfile($input: UpdateMyProfileInput!) {\n updateMyProfile(input: $input) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1085
1099
|
export declare const CreateAgentDocument = "\n mutation createAgent($input: CreateAgentInput!) {\n createAgent(input: $input) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1100
|
+
export declare const CreateApiKeyAgentDocument = "\n mutation createApiKeyAgent($input: CreateApiKeyAgentInput!) {\n createApiKeyAgent(input: $input) {\n ...apiKey\n }\n}\n \n fragment apiKey on ApiKeyAgent {\n token\n user {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1086
1101
|
export declare const UpdateAgentDocument = "\n mutation updateAgent($input: UpdateAgentInput!) {\n updateAgent(input: $input) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1087
1102
|
export declare const RemoveAgentDocument = "\n mutation removeAgent($input: RemoveAgentInput!) {\n removeAgent(input: $input) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
1088
1103
|
export declare const AddRoleToAgentDocument = "\n mutation addRoleToAgent($input: AddRoleToAgentInput!) {\n addRoleToAgent(input: $input) {\n ...agent\n }\n}\n \n fragment agent on Agent {\n id\n name\n email\n emailVerified\n picture\n apps\n roles\n cognitoUserStatus\n createdAt\n updatedAt\n}\n ";
|
|
@@ -1123,6 +1138,7 @@ export declare const ListLiveStateMachineConfigsDocument = "\n query listLive
|
|
|
1123
1138
|
export declare const ListDraftStateMachineConfigsDocument = "\n query listDraftStateMachineConfigs($createdByAppId: ID, $next: Base64) {\n listDraftStateMachineConfigs(createdByAppId: $createdByAppId, next: $next) {\n ...stateMachineConfigConnection\n }\n}\n \n fragment stateMachineConfigConnection on StateMachineConfigConnection {\n nodes {\n ...stateMachineConfig\n }\n pageInfo {\n hasNext\n next\n }\n}\n \n fragment stateMachineConfig on StateMachineConfig {\n id\n versionId\n stateMachineId\n title\n description\n status\n triggers\n states {\n ...stateMachineConfigState\n }\n createdAt\n updatedAt\n}\n \n fragment stateMachineConfigState on StateMachineConfigState {\n stateId\n on {\n ...stateMachineConfigStateOn\n }\n meta\n}\n \n fragment stateMachineConfigStateOn on StateMachineConfigStatesOn {\n event\n target\n}\n ";
|
|
1124
1139
|
export declare const ListStateMachineConfigVersionsDocument = "\n query listStateMachineConfigVersions($id: ID!) {\n listStateMachineConfigVersions(id: $id) {\n ...stateMachineConfig\n }\n}\n \n fragment stateMachineConfig on StateMachineConfig {\n id\n versionId\n stateMachineId\n title\n description\n status\n triggers\n states {\n ...stateMachineConfigState\n }\n createdAt\n updatedAt\n}\n \n fragment stateMachineConfigState on StateMachineConfigState {\n stateId\n on {\n ...stateMachineConfigStateOn\n }\n meta\n}\n \n fragment stateMachineConfigStateOn on StateMachineConfigStatesOn {\n event\n target\n}\n ";
|
|
1125
1140
|
export declare const GetXStateMachineConfigDocument = "\n query getXStateMachineConfig($id: ID!, $versionId: ID!) {\n getXStateMachineConfig(id: $id, versionId: $versionId)\n}\n ";
|
|
1141
|
+
export declare const IsAppInstanceInUseDocument = "\n query isAppInstanceInUse($drn: DRN!) {\n isAppInstanceInUse(drn: $drn)\n}\n ";
|
|
1126
1142
|
export declare const CreateStateMachineConfigDocument = "\n mutation createStateMachineConfig($input: CreateStateMachineConfigInput!) {\n createStateMachineConfig(input: $input) {\n ...stateMachineConfig\n }\n}\n \n fragment stateMachineConfig on StateMachineConfig {\n id\n versionId\n stateMachineId\n title\n description\n status\n triggers\n states {\n ...stateMachineConfigState\n }\n createdAt\n updatedAt\n}\n \n fragment stateMachineConfigState on StateMachineConfigState {\n stateId\n on {\n ...stateMachineConfigStateOn\n }\n meta\n}\n \n fragment stateMachineConfigStateOn on StateMachineConfigStatesOn {\n event\n target\n}\n ";
|
|
1127
1143
|
export declare const UpdateStateMachineConfigDocument = "\n mutation updateStateMachineConfig($input: UpdateStateMachineConfigInput!) {\n updateStateMachineConfig(input: $input) {\n ...stateMachineConfig\n }\n}\n \n fragment stateMachineConfig on StateMachineConfig {\n id\n versionId\n stateMachineId\n title\n description\n status\n triggers\n states {\n ...stateMachineConfigState\n }\n createdAt\n updatedAt\n}\n \n fragment stateMachineConfigState on StateMachineConfigState {\n stateId\n on {\n ...stateMachineConfigStateOn\n }\n meta\n}\n \n fragment stateMachineConfigStateOn on StateMachineConfigStatesOn {\n event\n target\n}\n ";
|
|
1128
1144
|
export declare const RemoveStateMachineConfigDocument = "\n mutation removeStateMachineConfig($input: RemoveStateMachineConfigInput!) {\n removeStateMachineConfig(input: $input) {\n ...stateMachineConfig\n }\n}\n \n fragment stateMachineConfig on StateMachineConfig {\n id\n versionId\n stateMachineId\n title\n description\n status\n triggers\n states {\n ...stateMachineConfigState\n }\n createdAt\n updatedAt\n}\n \n fragment stateMachineConfigState on StateMachineConfigState {\n stateId\n on {\n ...stateMachineConfigStateOn\n }\n meta\n}\n \n fragment stateMachineConfigStateOn on StateMachineConfigStatesOn {\n event\n target\n}\n ";
|
|
@@ -1139,6 +1155,7 @@ export declare function getSdk<C, E>(requester: Requester<C, E>): {
|
|
|
1139
1155
|
listApiKeyAgents(variables?: ListApiKeyAgentsQueryVariables, options?: C): Promise<ListApiKeyAgentsQuery>;
|
|
1140
1156
|
updateMyProfile(variables: UpdateMyProfileMutationVariables, options?: C): Promise<UpdateMyProfileMutation>;
|
|
1141
1157
|
createAgent(variables: CreateAgentMutationVariables, options?: C): Promise<CreateAgentMutation>;
|
|
1158
|
+
createApiKeyAgent(variables: CreateApiKeyAgentMutationVariables, options?: C): Promise<CreateApiKeyAgentMutation>;
|
|
1142
1159
|
updateAgent(variables: UpdateAgentMutationVariables, options?: C): Promise<UpdateAgentMutation>;
|
|
1143
1160
|
removeAgent(variables: RemoveAgentMutationVariables, options?: C): Promise<RemoveAgentMutation>;
|
|
1144
1161
|
addRoleToAgent(variables: AddRoleToAgentMutationVariables, options?: C): Promise<AddRoleToAgentMutation>;
|
|
@@ -1179,6 +1196,7 @@ export declare function getSdk<C, E>(requester: Requester<C, E>): {
|
|
|
1179
1196
|
listDraftStateMachineConfigs(variables?: ListDraftStateMachineConfigsQueryVariables, options?: C): Promise<ListDraftStateMachineConfigsQuery>;
|
|
1180
1197
|
listStateMachineConfigVersions(variables: ListStateMachineConfigVersionsQueryVariables, options?: C): Promise<ListStateMachineConfigVersionsQuery>;
|
|
1181
1198
|
getXStateMachineConfig(variables: GetXStateMachineConfigQueryVariables, options?: C): Promise<GetXStateMachineConfigQuery>;
|
|
1199
|
+
isAppInstanceInUse(variables: IsAppInstanceInUseQueryVariables, options?: C): Promise<IsAppInstanceInUseQuery>;
|
|
1182
1200
|
createStateMachineConfig(variables: CreateStateMachineConfigMutationVariables, options?: C): Promise<CreateStateMachineConfigMutation>;
|
|
1183
1201
|
updateStateMachineConfig(variables: UpdateStateMachineConfigMutationVariables, options?: C): Promise<UpdateStateMachineConfigMutation>;
|
|
1184
1202
|
removeStateMachineConfig(variables: RemoveStateMachineConfigMutationVariables, options?: C): Promise<RemoveStateMachineConfigMutation>;
|
package/src/sdks/nucleus.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* istanbul ignore file */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.serviceName = exports.getSdk = exports.RemoveStateMachineConfigStateDocument = exports.UpdateStateMachineConfigStateDocument = exports.CreateStateMachineConfigStateDocument = exports.PublishStateMachineConfigDocument = exports.EditStateMachineConfigDocument = exports.RemoveStateMachineConfigDocument = exports.UpdateStateMachineConfigDocument = exports.CreateStateMachineConfigDocument = exports.GetXStateMachineConfigDocument = exports.ListStateMachineConfigVersionsDocument = exports.ListDraftStateMachineConfigsDocument = exports.ListLiveStateMachineConfigsDocument = exports.CountLiveStateMachineConfigsDocument = exports.GetStateMachineDocument = exports.PatchSessionAttributesDocument = exports.SetSessionAttributeDocument = exports.GetSessionDocument = exports.StartSessionDocument = exports.GetSystemRoleDocument = exports.ListSystemRolesDocument = exports.RemoveCronJobDocument = exports.UpdateCronJobDocument = exports.CreateCronJobDocument = exports.ListCronJobsDocument = exports.GetCronJobDocument = void 0;
|
|
4
|
+
exports.GetCustomerDocument = exports.RemoveCredentialsDocument = exports.UpdateCredentialsDocument = exports.CreateCredentialsDocument = exports.CountCredentialsDocument = exports.ListCredentialsDocument = exports.GetCredentialsSecretDocument = exports.GetCredentialsDocument = exports.GetAuthInfoDocument = exports.GetAmplifyConfigDocument = exports.UnregisterAppInstanceDocument = exports.RegisterAppInstanceDocument = exports.CountAppInstancesDocument = exports.ListAppInstancesDocument = exports.GetAppInstanceDocument = exports.ListAppsDocument = exports.GetAppDocument = exports.RemoveRoleFromAgentDocument = exports.AddRoleToAgentDocument = exports.RemoveAgentDocument = exports.UpdateAgentDocument = exports.CreateApiKeyAgentDocument = exports.CreateAgentDocument = exports.UpdateMyProfileDocument = exports.ListApiKeyAgentsDocument = exports.ListAgentsDocument = exports.GetAgentDocument = exports.GetMeDocument = exports.StateMachineConfigConnectionFragmentDoc = exports.StateMachineConfigFragmentDoc = exports.StateMachineConfigStateFragmentDoc = exports.StateMachineConfigStateOnFragmentDoc = exports.SessionFragmentDoc = exports.RoleFragmentDoc = exports.PolicyFragmentDoc = exports.CronJobFragmentDoc = exports.CustomerFragmentDoc = exports.SafeCredentialsFragmentDoc = exports.AppWithInstancesFragmentDoc = exports.AppInstanceFragmentDoc = exports.AppFragmentDoc = exports.ApiKeyFragmentDoc = exports.AgentFragmentDoc = exports.Typenames = exports.StateMachineConfigStatus = exports.PatchOperation = exports.CustomerIndex = exports.CredentialsType = exports.AppType = exports.AppInstanceStatus = void 0;
|
|
5
|
+
exports.serviceName = exports.getSdk = exports.RemoveStateMachineConfigStateDocument = exports.UpdateStateMachineConfigStateDocument = exports.CreateStateMachineConfigStateDocument = exports.PublishStateMachineConfigDocument = exports.EditStateMachineConfigDocument = exports.RemoveStateMachineConfigDocument = exports.UpdateStateMachineConfigDocument = exports.CreateStateMachineConfigDocument = exports.IsAppInstanceInUseDocument = exports.GetXStateMachineConfigDocument = exports.ListStateMachineConfigVersionsDocument = exports.ListDraftStateMachineConfigsDocument = exports.ListLiveStateMachineConfigsDocument = exports.CountLiveStateMachineConfigsDocument = exports.GetStateMachineDocument = exports.PatchSessionAttributesDocument = exports.SetSessionAttributeDocument = exports.GetSessionDocument = exports.StartSessionDocument = exports.GetSystemRoleDocument = exports.ListSystemRolesDocument = exports.RemoveCronJobDocument = exports.UpdateCronJobDocument = exports.CreateCronJobDocument = exports.ListCronJobsDocument = exports.GetCronJobDocument = exports.GetOrCreateCustomerDocument = exports.ListCustomersDocument = void 0;
|
|
6
6
|
var AppInstanceStatus;
|
|
7
7
|
(function (AppInstanceStatus) {
|
|
8
8
|
AppInstanceStatus["Active"] = "Active";
|
|
@@ -74,6 +74,14 @@ exports.AgentFragmentDoc = `
|
|
|
74
74
|
updatedAt
|
|
75
75
|
}
|
|
76
76
|
`;
|
|
77
|
+
exports.ApiKeyFragmentDoc = `
|
|
78
|
+
fragment apiKey on ApiKeyAgent {
|
|
79
|
+
token
|
|
80
|
+
user {
|
|
81
|
+
...agent
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
${exports.AgentFragmentDoc}`;
|
|
77
85
|
exports.AppFragmentDoc = `
|
|
78
86
|
fragment app on App {
|
|
79
87
|
id
|
|
@@ -259,6 +267,13 @@ exports.CreateAgentDocument = `
|
|
|
259
267
|
}
|
|
260
268
|
}
|
|
261
269
|
${exports.AgentFragmentDoc}`;
|
|
270
|
+
exports.CreateApiKeyAgentDocument = `
|
|
271
|
+
mutation createApiKeyAgent($input: CreateApiKeyAgentInput!) {
|
|
272
|
+
createApiKeyAgent(input: $input) {
|
|
273
|
+
...apiKey
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
${exports.ApiKeyFragmentDoc}`;
|
|
262
277
|
exports.UpdateAgentDocument = `
|
|
263
278
|
mutation updateAgent($input: UpdateAgentInput!) {
|
|
264
279
|
updateAgent(input: $input) {
|
|
@@ -589,6 +604,11 @@ exports.GetXStateMachineConfigDocument = `
|
|
|
589
604
|
getXStateMachineConfig(id: $id, versionId: $versionId)
|
|
590
605
|
}
|
|
591
606
|
`;
|
|
607
|
+
exports.IsAppInstanceInUseDocument = `
|
|
608
|
+
query isAppInstanceInUse($drn: DRN!) {
|
|
609
|
+
isAppInstanceInUse(drn: $drn)
|
|
610
|
+
}
|
|
611
|
+
`;
|
|
592
612
|
exports.CreateStateMachineConfigDocument = `
|
|
593
613
|
mutation createStateMachineConfig($input: CreateStateMachineConfigInput!) {
|
|
594
614
|
createStateMachineConfig(input: $input) {
|
|
@@ -665,6 +685,9 @@ function getSdk(requester) {
|
|
|
665
685
|
createAgent(variables, options) {
|
|
666
686
|
return requester(exports.CreateAgentDocument, variables, options);
|
|
667
687
|
},
|
|
688
|
+
createApiKeyAgent(variables, options) {
|
|
689
|
+
return requester(exports.CreateApiKeyAgentDocument, variables, options);
|
|
690
|
+
},
|
|
668
691
|
updateAgent(variables, options) {
|
|
669
692
|
return requester(exports.UpdateAgentDocument, variables, options);
|
|
670
693
|
},
|
|
@@ -785,6 +808,9 @@ function getSdk(requester) {
|
|
|
785
808
|
getXStateMachineConfig(variables, options) {
|
|
786
809
|
return requester(exports.GetXStateMachineConfigDocument, variables, options);
|
|
787
810
|
},
|
|
811
|
+
isAppInstanceInUse(variables, options) {
|
|
812
|
+
return requester(exports.IsAppInstanceInUseDocument, variables, options);
|
|
813
|
+
},
|
|
788
814
|
createStateMachineConfig(variables, options) {
|
|
789
815
|
return requester(exports.CreateStateMachineConfigDocument, variables, options);
|
|
790
816
|
},
|