@memberjunction/graphql-dataprovider 2.20.3 → 2.22.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.d.cts CHANGED
@@ -1,71 +1,9 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
2
  export { gql } from 'graphql-request';
3
- import { CompositeKey, ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunViewParams, RunViewResult, EntityInfo, ProviderType, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider } from '@memberjunction/core';
3
+ import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunViewParams, RunViewResult, EntityInfo, ProviderType, CompositeKey, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider } from '@memberjunction/core';
4
4
  import { UserViewEntityExtended } from '@memberjunction/core-entities';
5
5
  import { Observable } from 'rxjs';
6
6
 
7
- declare class RoleInput {
8
- ID: string;
9
- Name: string;
10
- Description: string;
11
- }
12
- declare class UserInput {
13
- ID: string;
14
- Name: string;
15
- Email: string;
16
- Type: 'Owner' | 'User';
17
- FirstName: string;
18
- LastName: string;
19
- Title: string;
20
- Roles?: RoleInput[];
21
- }
22
- declare class RolesAndUsersInput {
23
- Users: UserInput[];
24
- Roles: RoleInput[];
25
- }
26
- declare enum SyncDataActionType {
27
- Create = "Create",
28
- Update = "Update",
29
- CreateOrUpdate = "CreateOrUpdate",
30
- Delete = "Delete",
31
- DeleteWithFilter = "DeleteWithFilter"
32
- }
33
- declare class ActionItemInput {
34
- /**
35
- * The name of the entity where action is to be taken
36
- */
37
- EntityName: string;
38
- /**
39
- * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
40
- */
41
- PrimaryKey?: CompositeKey;
42
- /**
43
- * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
44
- */
45
- AlternateKey?: CompositeKey;
46
- /**
47
- * The type of action requested. The possible values are Create, Update, CreateOrUpdate, Delete, DeleteWithFilter
48
- */
49
- Type: SyncDataActionType;
50
- /**
51
- * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
52
- */
53
- RecordJSON?: string;
54
- /**
55
- * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
56
- */
57
- DeleteFilter?: string;
58
- }
59
- declare class SyncDataResult {
60
- Success: boolean;
61
- Results: ActionItemOutput[];
62
- }
63
- declare class ActionItemOutput {
64
- input: ActionItemInput;
65
- success: boolean;
66
- errorMessage: string;
67
- }
68
-
69
7
  /**************************************************************************************************************
70
8
  * The graphQLDataProvider provides a data provider for the entities framework that uses GraphQL to communicate
71
9
  * with the server.
@@ -259,16 +197,6 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
259
197
  private _wsClient;
260
198
  private _pushStatusRequests;
261
199
  PushStatusUpdates(sessionId?: string): Observable<string>;
262
- /**
263
- * Utility method to call the Sync Roles and Users mutation on the MJ API server, this can only be invoked by the system user
264
- * @param data
265
- */
266
- SyncRolesAndUsers(data: RolesAndUsersInput): Promise<boolean>;
267
- /**
268
- * Utility method to call the Sync Roles and Users mutation on the MJ API server, this can only be invoked by the system user
269
- * @param data
270
- */
271
- SyncData(items: ActionItemInput[]): Promise<SyncDataResult>;
272
200
  }
273
201
 
274
202
  /**
@@ -312,4 +240,219 @@ declare class FieldMapper {
312
240
  ReverseMapFields(obj: Record<string, unknown>): Record<string, unknown>;
313
241
  }
314
242
 
315
- export { ActionItemInput, ActionItemOutput, FieldMapper, GraphQLDataProvider, GraphQLProviderConfigData, RoleInput, RolesAndUsersInput, SyncDataActionType, SyncDataResult, UserInput, setupGraphQLClient };
243
+ declare class SyncRolesAndUsersResult {
244
+ Success: boolean;
245
+ }
246
+ declare class RoleInput {
247
+ ID: string;
248
+ Name: string;
249
+ Description: string;
250
+ }
251
+ declare class UserInput {
252
+ ID: string;
253
+ Name: string;
254
+ Email: string;
255
+ Type: 'Owner' | 'User';
256
+ FirstName: string;
257
+ LastName: string;
258
+ Title: string;
259
+ Roles?: RoleInput[];
260
+ }
261
+ declare class RolesAndUsersInput {
262
+ Users: UserInput[];
263
+ Roles: RoleInput[];
264
+ }
265
+ /**
266
+ * This type defines the possible list of actions that can be taken in syncing data: Create, Update, CreateOrUpdate, Delete, or DeleteWithFilter
267
+ * DeleteWithFilter is where you specify a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
268
+ * this can be used to ensure cleaning out data from a subset of a given table.
269
+ */
270
+ declare enum SyncDataAction {
271
+ Create = "Create",
272
+ Update = "Update",
273
+ CreateOrUpdate = "CreateOrUpdate",
274
+ Delete = "Delete",
275
+ DeleteWithFilter = "DeleteWithFilter"
276
+ }
277
+ declare class ActionItemInput {
278
+ /**
279
+ * The name of the entity where action is to be taken
280
+ */
281
+ EntityName: string;
282
+ /**
283
+ * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
284
+ */
285
+ PrimaryKey?: CompositeKey;
286
+ /**
287
+ * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
288
+ */
289
+ AlternateKey?: CompositeKey;
290
+ /**
291
+ * The type of action requested. The possible values are Create, Update, CreateOrUpdate, Delete, DeleteWithFilter
292
+ */
293
+ Type: SyncDataAction;
294
+ /**
295
+ * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
296
+ */
297
+ RecordJSON?: string;
298
+ /**
299
+ * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
300
+ */
301
+ DeleteFilter?: string;
302
+ }
303
+ declare class SyncDataResult {
304
+ Success: boolean;
305
+ Results: ActionItemOutput[];
306
+ }
307
+ declare class ActionItemOutput {
308
+ Success: boolean;
309
+ ErrorMessage: string;
310
+ EntityName: string;
311
+ PrimaryKey?: CompositeKey;
312
+ AlternateKey?: CompositeKey;
313
+ Type: SyncDataAction;
314
+ /**
315
+ * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
316
+ */
317
+ RecordJSON?: string;
318
+ /**
319
+ * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
320
+ */
321
+ DeleteFilter?: string;
322
+ }
323
+
324
+ /**
325
+ * Specialized client that is designed to be used exclusively on the server side
326
+ * by the System User using the MJ API KEY. This is designed to allow server side
327
+ * code such as within the context of an MJAPI server to talk to another MAJPI server
328
+ * but as the client.
329
+ *
330
+ * It is possible for a server to use the regular @GraphQLDataProvider client to talk
331
+ * to another MJAPI server, but that would require the server to have a user account
332
+ * and the server would have to be able to log in as that user via a JWT token. This
333
+ * is not always possible or convenient in the flow.
334
+ *
335
+ * Also the standard client configuration process has a certain amount over overhead
336
+ * in always loading up certain metadata that is not necessary for many system user
337
+ * operations.
338
+ *
339
+ * Finaly, this client can be used in parallel with the regular client to allow a server
340
+ * to mix and match the two as needed.
341
+ */
342
+ declare class GraphQLSystemUserClient {
343
+ private _client;
344
+ /**
345
+ * Returns the underlying GraphQL client which is an instance of the GraphQLClient object
346
+ * from the graphql-request package. This is useful if you want to perform any operation
347
+ * that is not directly supported by this class via specialized methods.
348
+ */
349
+ get Client(): GraphQLClient;
350
+ /**
351
+ * @param url MJAPI server URL
352
+ * @param token Optional, JWT token that is used for a normal user authentication flow. This is required if mjAPIKey is not provided.
353
+ * @param sessionId Optional, UUID that is used to track a session. This can be any string.
354
+ * @param mjAPIKey Shared Secret key that is provided for system user authentication. This is required if token is not provided.
355
+ * @returns
356
+ */
357
+ constructor(url: string, token: string, sessionId: string, mjAPIKey: string);
358
+ /**
359
+ * Calls the GetData() query on the server to execute any number of provided SQL queries in parallel and returns the results.
360
+ * The queries MUST BE read only and not perform any DML operations. The remote server will execute the queries using a special
361
+ * lower-privilege user that is not allowed to perform any form of write operations.
362
+ * @param queries an array of SQL queries to execute on the remote server
363
+ * @param accessToken the short-lived access token that is required to perform this operation. This is different from the MJAPI key and is used for a second factor and is a short-lived token. You will receive this token
364
+ * when an MJAPI calls your server to request something along with the URL to call back.
365
+ * @returns
366
+ */
367
+ GetData(queries: string[], accessToken: string): Promise<GetDataOutput>;
368
+ /**
369
+ * This method will return a list of all entities that are available on the remote server. This is a lightweight call that only returns the basic metadata for each entity and does not include all of the attributes at
370
+ * either the entity or the field level. This is useful for getting a list of entities that are available on the remote server and knowing their IDs and Entity Field IDs on the remote server. For core MemberJunction
371
+ * entities and entity fields, the ID values are globally unique and set by the MemberJunction distribution, however, for other entities that are generated on each target system they can vary so it is best to use
372
+ * lookups name or a combination of SchemaName and BaseTable to uniquely identify an entity.
373
+ * @param client
374
+ * @returns
375
+ */
376
+ GetAllRemoteEntities(): Promise<SimpleRemoteEntityOutput>;
377
+ /**
378
+ * This method is used to invoke the data synchronization mutation on the remote server. This method is used to create, update, or delete records in the remote server. The method takes an array of ActionItemInput objects
379
+ * Each of the ActionItemInput objects represents a single action to take on a single entity. The action can be Create, Update, CreateOrUpdate, Delete, or DeleteWithFilter. The RecordJSON field is used for Create, CreateOrUpdate and Update whereas
380
+ * the DeleteFilter field is used for DeleteWithFilter. The PrimaryKey and AlternateKey fields are used to identify the record to be acted upon.
381
+ *
382
+ * Use of the AlternateKey is important for situations where you might have divergent primary keys across systems. For example for user entities that are individually generated on each system by CodeGen, the primary key will
383
+ * be different per system, so you would use the combination of the SchemaName and BaseTable to identify the entity and then use the AlternateKey to provide the combination of these fields to uniquely identify the record for updates.
384
+ * @param items
385
+ * @returns
386
+ */
387
+ SyncData(items: ActionItemInput[]): Promise<SyncDataResult>;
388
+ /**
389
+ * This method will sync the roles and users on the remote server. This method is used to create, update, or delete roles and users on the remote server.
390
+ * The method takes a RolesAndUsersInput object that contains an array of RoleInput objects. Note that this will not result in the removal of roles on the
391
+ * remote server that are deemed to be built-in MemberJunction roles such as Developer, Integration and UI.
392
+ * @param data
393
+ * @returns
394
+ */
395
+ SyncRolesAndUsers(data: RolesAndUsersInput): Promise<SyncRolesAndUsersResult>;
396
+ }
397
+ /**
398
+ * Output type for GetData calls
399
+ */
400
+ declare class GetDataOutput {
401
+ /**
402
+ * Indicates if the operation was successful overall. If any individual query failed, this will be false. However, any successful queries will still be returned in the Results array.
403
+ */
404
+ Success: boolean;
405
+ /**
406
+ * The original input of Queries that were run
407
+ */
408
+ Queries: string[];
409
+ /**
410
+ * An ordered array of error messages for each query that was run. This array will always have the same # of entries as Queries. If a query was successful, the corresponding entry will be null.
411
+ */
412
+ ErrorMessages: (string | null)[];
413
+ /**
414
+ * An ordered array of results for each query that was run. This array will always have the same # of entries as Queries. If a query failed, the corresponding entry will be null.
415
+ */
416
+ Results: (string | null)[];
417
+ }
418
+ /**
419
+ * Return type for calls to the GetAllRemoteEntities query
420
+ */
421
+ declare class SimpleRemoteEntityOutput {
422
+ Success: boolean;
423
+ ErrorMessage?: string;
424
+ /**
425
+ * An array of simple entity types that are returned from the remote server
426
+ */
427
+ Results: SimpleRemoteEntity[];
428
+ }
429
+ /**
430
+ * Represents a simple entity type that is used for lightweight retrieval of partial remote entity metadata
431
+ */
432
+ declare class SimpleRemoteEntity {
433
+ /**
434
+ * ID of the entity on the remote server
435
+ */
436
+ ID: string;
437
+ Name: string;
438
+ Description?: string;
439
+ SchemaName: string;
440
+ BaseView: string;
441
+ BaseTable: string;
442
+ CodeName?: string;
443
+ ClassName?: string;
444
+ Fields: SimpleRemoteEntityField[];
445
+ }
446
+ declare class SimpleRemoteEntityField {
447
+ /**
448
+ * ID of the entity field on the remote server
449
+ */
450
+ ID: string;
451
+ Name: string;
452
+ Description?: string;
453
+ Type: string;
454
+ AllowsNull: boolean;
455
+ MaxLength: number;
456
+ }
457
+
458
+ export { ActionItemInput, ActionItemOutput, FieldMapper, GetDataOutput, GraphQLDataProvider, GraphQLProviderConfigData, GraphQLSystemUserClient, RoleInput, RolesAndUsersInput, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, UserInput, setupGraphQLClient };
package/dist/index.d.mts CHANGED
@@ -1,71 +1,9 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
2
  export { gql } from 'graphql-request';
3
- import { CompositeKey, ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunViewParams, RunViewResult, EntityInfo, ProviderType, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider } from '@memberjunction/core';
3
+ import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunViewParams, RunViewResult, EntityInfo, ProviderType, CompositeKey, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider } from '@memberjunction/core';
4
4
  import { UserViewEntityExtended } from '@memberjunction/core-entities';
5
5
  import { Observable } from 'rxjs';
6
6
 
7
- declare class RoleInput {
8
- ID: string;
9
- Name: string;
10
- Description: string;
11
- }
12
- declare class UserInput {
13
- ID: string;
14
- Name: string;
15
- Email: string;
16
- Type: 'Owner' | 'User';
17
- FirstName: string;
18
- LastName: string;
19
- Title: string;
20
- Roles?: RoleInput[];
21
- }
22
- declare class RolesAndUsersInput {
23
- Users: UserInput[];
24
- Roles: RoleInput[];
25
- }
26
- declare enum SyncDataActionType {
27
- Create = "Create",
28
- Update = "Update",
29
- CreateOrUpdate = "CreateOrUpdate",
30
- Delete = "Delete",
31
- DeleteWithFilter = "DeleteWithFilter"
32
- }
33
- declare class ActionItemInput {
34
- /**
35
- * The name of the entity where action is to be taken
36
- */
37
- EntityName: string;
38
- /**
39
- * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
40
- */
41
- PrimaryKey?: CompositeKey;
42
- /**
43
- * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
44
- */
45
- AlternateKey?: CompositeKey;
46
- /**
47
- * The type of action requested. The possible values are Create, Update, CreateOrUpdate, Delete, DeleteWithFilter
48
- */
49
- Type: SyncDataActionType;
50
- /**
51
- * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
52
- */
53
- RecordJSON?: string;
54
- /**
55
- * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
56
- */
57
- DeleteFilter?: string;
58
- }
59
- declare class SyncDataResult {
60
- Success: boolean;
61
- Results: ActionItemOutput[];
62
- }
63
- declare class ActionItemOutput {
64
- input: ActionItemInput;
65
- success: boolean;
66
- errorMessage: string;
67
- }
68
-
69
7
  /**************************************************************************************************************
70
8
  * The graphQLDataProvider provides a data provider for the entities framework that uses GraphQL to communicate
71
9
  * with the server.
@@ -259,16 +197,6 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
259
197
  private _wsClient;
260
198
  private _pushStatusRequests;
261
199
  PushStatusUpdates(sessionId?: string): Observable<string>;
262
- /**
263
- * Utility method to call the Sync Roles and Users mutation on the MJ API server, this can only be invoked by the system user
264
- * @param data
265
- */
266
- SyncRolesAndUsers(data: RolesAndUsersInput): Promise<boolean>;
267
- /**
268
- * Utility method to call the Sync Roles and Users mutation on the MJ API server, this can only be invoked by the system user
269
- * @param data
270
- */
271
- SyncData(items: ActionItemInput[]): Promise<SyncDataResult>;
272
200
  }
273
201
 
274
202
  /**
@@ -312,4 +240,219 @@ declare class FieldMapper {
312
240
  ReverseMapFields(obj: Record<string, unknown>): Record<string, unknown>;
313
241
  }
314
242
 
315
- export { ActionItemInput, ActionItemOutput, FieldMapper, GraphQLDataProvider, GraphQLProviderConfigData, RoleInput, RolesAndUsersInput, SyncDataActionType, SyncDataResult, UserInput, setupGraphQLClient };
243
+ declare class SyncRolesAndUsersResult {
244
+ Success: boolean;
245
+ }
246
+ declare class RoleInput {
247
+ ID: string;
248
+ Name: string;
249
+ Description: string;
250
+ }
251
+ declare class UserInput {
252
+ ID: string;
253
+ Name: string;
254
+ Email: string;
255
+ Type: 'Owner' | 'User';
256
+ FirstName: string;
257
+ LastName: string;
258
+ Title: string;
259
+ Roles?: RoleInput[];
260
+ }
261
+ declare class RolesAndUsersInput {
262
+ Users: UserInput[];
263
+ Roles: RoleInput[];
264
+ }
265
+ /**
266
+ * This type defines the possible list of actions that can be taken in syncing data: Create, Update, CreateOrUpdate, Delete, or DeleteWithFilter
267
+ * DeleteWithFilter is where you specify a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
268
+ * this can be used to ensure cleaning out data from a subset of a given table.
269
+ */
270
+ declare enum SyncDataAction {
271
+ Create = "Create",
272
+ Update = "Update",
273
+ CreateOrUpdate = "CreateOrUpdate",
274
+ Delete = "Delete",
275
+ DeleteWithFilter = "DeleteWithFilter"
276
+ }
277
+ declare class ActionItemInput {
278
+ /**
279
+ * The name of the entity where action is to be taken
280
+ */
281
+ EntityName: string;
282
+ /**
283
+ * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
284
+ */
285
+ PrimaryKey?: CompositeKey;
286
+ /**
287
+ * For Update, CreateOrUpdate and Delete operations either a PrimaryKey or an AlternateKey must be provided. For Create and DeleteWithFilter operations, neither is used.
288
+ */
289
+ AlternateKey?: CompositeKey;
290
+ /**
291
+ * The type of action requested. The possible values are Create, Update, CreateOrUpdate, Delete, DeleteWithFilter
292
+ */
293
+ Type: SyncDataAction;
294
+ /**
295
+ * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
296
+ */
297
+ RecordJSON?: string;
298
+ /**
299
+ * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
300
+ */
301
+ DeleteFilter?: string;
302
+ }
303
+ declare class SyncDataResult {
304
+ Success: boolean;
305
+ Results: ActionItemOutput[];
306
+ }
307
+ declare class ActionItemOutput {
308
+ Success: boolean;
309
+ ErrorMessage: string;
310
+ EntityName: string;
311
+ PrimaryKey?: CompositeKey;
312
+ AlternateKey?: CompositeKey;
313
+ Type: SyncDataAction;
314
+ /**
315
+ * This field is a JSON representation of the field values of the entity to be created or updated. It is used for all ActionTypes except for
316
+ */
317
+ RecordJSON?: string;
318
+ /**
319
+ * This field is only provided when the Action Type is DeleteWithFilter. It is a valid SQL expression that can be used in a where clause to get a list of records in a given entity to delete
320
+ */
321
+ DeleteFilter?: string;
322
+ }
323
+
324
+ /**
325
+ * Specialized client that is designed to be used exclusively on the server side
326
+ * by the System User using the MJ API KEY. This is designed to allow server side
327
+ * code such as within the context of an MJAPI server to talk to another MAJPI server
328
+ * but as the client.
329
+ *
330
+ * It is possible for a server to use the regular @GraphQLDataProvider client to talk
331
+ * to another MJAPI server, but that would require the server to have a user account
332
+ * and the server would have to be able to log in as that user via a JWT token. This
333
+ * is not always possible or convenient in the flow.
334
+ *
335
+ * Also the standard client configuration process has a certain amount over overhead
336
+ * in always loading up certain metadata that is not necessary for many system user
337
+ * operations.
338
+ *
339
+ * Finaly, this client can be used in parallel with the regular client to allow a server
340
+ * to mix and match the two as needed.
341
+ */
342
+ declare class GraphQLSystemUserClient {
343
+ private _client;
344
+ /**
345
+ * Returns the underlying GraphQL client which is an instance of the GraphQLClient object
346
+ * from the graphql-request package. This is useful if you want to perform any operation
347
+ * that is not directly supported by this class via specialized methods.
348
+ */
349
+ get Client(): GraphQLClient;
350
+ /**
351
+ * @param url MJAPI server URL
352
+ * @param token Optional, JWT token that is used for a normal user authentication flow. This is required if mjAPIKey is not provided.
353
+ * @param sessionId Optional, UUID that is used to track a session. This can be any string.
354
+ * @param mjAPIKey Shared Secret key that is provided for system user authentication. This is required if token is not provided.
355
+ * @returns
356
+ */
357
+ constructor(url: string, token: string, sessionId: string, mjAPIKey: string);
358
+ /**
359
+ * Calls the GetData() query on the server to execute any number of provided SQL queries in parallel and returns the results.
360
+ * The queries MUST BE read only and not perform any DML operations. The remote server will execute the queries using a special
361
+ * lower-privilege user that is not allowed to perform any form of write operations.
362
+ * @param queries an array of SQL queries to execute on the remote server
363
+ * @param accessToken the short-lived access token that is required to perform this operation. This is different from the MJAPI key and is used for a second factor and is a short-lived token. You will receive this token
364
+ * when an MJAPI calls your server to request something along with the URL to call back.
365
+ * @returns
366
+ */
367
+ GetData(queries: string[], accessToken: string): Promise<GetDataOutput>;
368
+ /**
369
+ * This method will return a list of all entities that are available on the remote server. This is a lightweight call that only returns the basic metadata for each entity and does not include all of the attributes at
370
+ * either the entity or the field level. This is useful for getting a list of entities that are available on the remote server and knowing their IDs and Entity Field IDs on the remote server. For core MemberJunction
371
+ * entities and entity fields, the ID values are globally unique and set by the MemberJunction distribution, however, for other entities that are generated on each target system they can vary so it is best to use
372
+ * lookups name or a combination of SchemaName and BaseTable to uniquely identify an entity.
373
+ * @param client
374
+ * @returns
375
+ */
376
+ GetAllRemoteEntities(): Promise<SimpleRemoteEntityOutput>;
377
+ /**
378
+ * This method is used to invoke the data synchronization mutation on the remote server. This method is used to create, update, or delete records in the remote server. The method takes an array of ActionItemInput objects
379
+ * Each of the ActionItemInput objects represents a single action to take on a single entity. The action can be Create, Update, CreateOrUpdate, Delete, or DeleteWithFilter. The RecordJSON field is used for Create, CreateOrUpdate and Update whereas
380
+ * the DeleteFilter field is used for DeleteWithFilter. The PrimaryKey and AlternateKey fields are used to identify the record to be acted upon.
381
+ *
382
+ * Use of the AlternateKey is important for situations where you might have divergent primary keys across systems. For example for user entities that are individually generated on each system by CodeGen, the primary key will
383
+ * be different per system, so you would use the combination of the SchemaName and BaseTable to identify the entity and then use the AlternateKey to provide the combination of these fields to uniquely identify the record for updates.
384
+ * @param items
385
+ * @returns
386
+ */
387
+ SyncData(items: ActionItemInput[]): Promise<SyncDataResult>;
388
+ /**
389
+ * This method will sync the roles and users on the remote server. This method is used to create, update, or delete roles and users on the remote server.
390
+ * The method takes a RolesAndUsersInput object that contains an array of RoleInput objects. Note that this will not result in the removal of roles on the
391
+ * remote server that are deemed to be built-in MemberJunction roles such as Developer, Integration and UI.
392
+ * @param data
393
+ * @returns
394
+ */
395
+ SyncRolesAndUsers(data: RolesAndUsersInput): Promise<SyncRolesAndUsersResult>;
396
+ }
397
+ /**
398
+ * Output type for GetData calls
399
+ */
400
+ declare class GetDataOutput {
401
+ /**
402
+ * Indicates if the operation was successful overall. If any individual query failed, this will be false. However, any successful queries will still be returned in the Results array.
403
+ */
404
+ Success: boolean;
405
+ /**
406
+ * The original input of Queries that were run
407
+ */
408
+ Queries: string[];
409
+ /**
410
+ * An ordered array of error messages for each query that was run. This array will always have the same # of entries as Queries. If a query was successful, the corresponding entry will be null.
411
+ */
412
+ ErrorMessages: (string | null)[];
413
+ /**
414
+ * An ordered array of results for each query that was run. This array will always have the same # of entries as Queries. If a query failed, the corresponding entry will be null.
415
+ */
416
+ Results: (string | null)[];
417
+ }
418
+ /**
419
+ * Return type for calls to the GetAllRemoteEntities query
420
+ */
421
+ declare class SimpleRemoteEntityOutput {
422
+ Success: boolean;
423
+ ErrorMessage?: string;
424
+ /**
425
+ * An array of simple entity types that are returned from the remote server
426
+ */
427
+ Results: SimpleRemoteEntity[];
428
+ }
429
+ /**
430
+ * Represents a simple entity type that is used for lightweight retrieval of partial remote entity metadata
431
+ */
432
+ declare class SimpleRemoteEntity {
433
+ /**
434
+ * ID of the entity on the remote server
435
+ */
436
+ ID: string;
437
+ Name: string;
438
+ Description?: string;
439
+ SchemaName: string;
440
+ BaseView: string;
441
+ BaseTable: string;
442
+ CodeName?: string;
443
+ ClassName?: string;
444
+ Fields: SimpleRemoteEntityField[];
445
+ }
446
+ declare class SimpleRemoteEntityField {
447
+ /**
448
+ * ID of the entity field on the remote server
449
+ */
450
+ ID: string;
451
+ Name: string;
452
+ Description?: string;
453
+ Type: string;
454
+ AllowsNull: boolean;
455
+ MaxLength: number;
456
+ }
457
+
458
+ export { ActionItemInput, ActionItemOutput, FieldMapper, GetDataOutput, GraphQLDataProvider, GraphQLProviderConfigData, GraphQLSystemUserClient, RoleInput, RolesAndUsersInput, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, UserInput, setupGraphQLClient };