@memberjunction/server 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +47 -1
  2. package/dist/auth/APIKeyScopeAuth.d.ts +51 -0
  3. package/dist/auth/APIKeyScopeAuth.d.ts.map +1 -0
  4. package/dist/auth/APIKeyScopeAuth.js +163 -0
  5. package/dist/auth/APIKeyScopeAuth.js.map +1 -0
  6. package/dist/auth/index.d.ts +1 -0
  7. package/dist/auth/index.d.ts.map +1 -1
  8. package/dist/auth/index.js +1 -0
  9. package/dist/auth/index.js.map +1 -1
  10. package/dist/context.d.ts +8 -1
  11. package/dist/context.d.ts.map +1 -1
  12. package/dist/context.js +44 -7
  13. package/dist/context.js.map +1 -1
  14. package/dist/generated/generated.d.ts +252 -2
  15. package/dist/generated/generated.d.ts.map +1 -1
  16. package/dist/generated/generated.js +1754 -209
  17. package/dist/generated/generated.js.map +1 -1
  18. package/dist/generic/ResolverBase.d.ts +2 -2
  19. package/dist/generic/ResolverBase.d.ts.map +1 -1
  20. package/dist/generic/ResolverBase.js +22 -4
  21. package/dist/generic/ResolverBase.js.map +1 -1
  22. package/dist/generic/RunViewResolver.d.ts +29 -1
  23. package/dist/generic/RunViewResolver.d.ts.map +1 -1
  24. package/dist/generic/RunViewResolver.js +143 -0
  25. package/dist/generic/RunViewResolver.js.map +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/resolvers/APIKeyResolver.d.ts +23 -0
  31. package/dist/resolvers/APIKeyResolver.d.ts.map +1 -0
  32. package/dist/resolvers/APIKeyResolver.js +191 -0
  33. package/dist/resolvers/APIKeyResolver.js.map +1 -0
  34. package/dist/resolvers/RunAIAgentResolver.js +1 -1
  35. package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
  36. package/dist/resolvers/UserResolver.d.ts.map +1 -1
  37. package/dist/resolvers/UserResolver.js +31 -1
  38. package/dist/resolvers/UserResolver.js.map +1 -1
  39. package/dist/types.d.ts +4 -1
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/types.js.map +1 -1
  42. package/package.json +46 -45
  43. package/src/auth/APIKeyScopeAuth.ts +366 -0
  44. package/src/auth/index.ts +1 -0
  45. package/src/context.ts +91 -9
  46. package/src/generated/generated.ts +987 -14
  47. package/src/generic/ResolverBase.ts +38 -5
  48. package/src/generic/RunViewResolver.ts +132 -5
  49. package/src/index.ts +2 -0
  50. package/src/resolvers/APIKeyResolver.ts +234 -0
  51. package/src/resolvers/RunAIAgentResolver.ts +1 -1
  52. package/src/resolvers/UserResolver.ts +37 -1
  53. package/src/types.ts +7 -2
@@ -4978,6 +4978,12 @@ let MJAIAgentNote_ = class MJAIAgentNote_ {
4978
4978
  CompanyID;
4979
4979
  EmbeddingVector;
4980
4980
  EmbeddingModelID;
4981
+ PrimaryScopeEntityID;
4982
+ PrimaryScopeRecordID;
4983
+ SecondaryScopes;
4984
+ LastAccessedAt;
4985
+ AccessCount;
4986
+ ExpiresAt;
4981
4987
  Agent;
4982
4988
  AgentNoteType;
4983
4989
  User;
@@ -4986,6 +4992,7 @@ let MJAIAgentNote_ = class MJAIAgentNote_ {
4986
4992
  SourceAIAgentRun;
4987
4993
  Company;
4988
4994
  EmbeddingModel;
4995
+ PrimaryScopeEntity;
4989
4996
  };
4990
4997
  __decorate([
4991
4998
  Field(),
@@ -5068,6 +5075,34 @@ __decorate([
5068
5075
  MaxLength(16),
5069
5076
  __metadata("design:type", String)
5070
5077
  ], MJAIAgentNote_.prototype, "EmbeddingModelID", void 0);
5078
+ __decorate([
5079
+ Field({ nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping. NULL means this is a global note.` }),
5080
+ MaxLength(16),
5081
+ __metadata("design:type", String)
5082
+ ], MJAIAgentNote_.prototype, "PrimaryScopeEntityID", void 0);
5083
+ __decorate([
5084
+ Field({ nullable: true, description: `The record ID within the primary scope entity. NULL means global note. When set with empty SecondaryScopes, indicates primary-scope-only note.` }),
5085
+ MaxLength(200),
5086
+ __metadata("design:type", String)
5087
+ ], MJAIAgentNote_.prototype, "PrimaryScopeRecordID", void 0);
5088
+ __decorate([
5089
+ Field({ nullable: true, description: `JSON object containing additional scope dimensions. Empty/NULL with PrimaryScopeRecordID set = org-level note. Populated = fully-scoped note.` }),
5090
+ __metadata("design:type", String)
5091
+ ], MJAIAgentNote_.prototype, "SecondaryScopes", void 0);
5092
+ __decorate([
5093
+ Field({ nullable: true, description: `Timestamp of when this note was last accessed/injected into agent context. Used for lifecycle management and cleanup.` }),
5094
+ MaxLength(10),
5095
+ __metadata("design:type", Date)
5096
+ ], MJAIAgentNote_.prototype, "LastAccessedAt", void 0);
5097
+ __decorate([
5098
+ Field(() => Int, { description: `Number of times this note has been accessed/injected into agent context. Used for analytics and determining note value.` }),
5099
+ __metadata("design:type", Number)
5100
+ ], MJAIAgentNote_.prototype, "AccessCount", void 0);
5101
+ __decorate([
5102
+ Field({ nullable: true, description: `Optional expiration timestamp. Notes past this date are candidates for archival. NULL means no expiration.` }),
5103
+ MaxLength(10),
5104
+ __metadata("design:type", Date)
5105
+ ], MJAIAgentNote_.prototype, "ExpiresAt", void 0);
5071
5106
  __decorate([
5072
5107
  Field({ nullable: true }),
5073
5108
  MaxLength(510),
@@ -5107,6 +5142,11 @@ __decorate([
5107
5142
  MaxLength(100),
5108
5143
  __metadata("design:type", String)
5109
5144
  ], MJAIAgentNote_.prototype, "EmbeddingModel", void 0);
5145
+ __decorate([
5146
+ Field({ nullable: true }),
5147
+ MaxLength(510),
5148
+ __metadata("design:type", String)
5149
+ ], MJAIAgentNote_.prototype, "PrimaryScopeEntity", void 0);
5110
5150
  MJAIAgentNote_ = __decorate([
5111
5151
  ObjectType({ description: `Stores notes, observations, and learnings for AI agents with multi-dimensional scoping (Agent, User, company). Scoping is determined by which FK fields are populated: all NULL = global, AgentID only = agent-specific, UserID only = user-specific across all agents, etc.` })
5112
5152
  ], MJAIAgentNote_);
@@ -5127,6 +5167,12 @@ let CreateMJAIAgentNoteInput = class CreateMJAIAgentNoteInput {
5127
5167
  CompanyID;
5128
5168
  EmbeddingVector;
5129
5169
  EmbeddingModelID;
5170
+ PrimaryScopeEntityID;
5171
+ PrimaryScopeRecordID;
5172
+ SecondaryScopes;
5173
+ LastAccessedAt;
5174
+ AccessCount;
5175
+ ExpiresAt;
5130
5176
  };
5131
5177
  __decorate([
5132
5178
  Field({ nullable: true }),
@@ -5188,6 +5234,30 @@ __decorate([
5188
5234
  Field({ nullable: true }),
5189
5235
  __metadata("design:type", String)
5190
5236
  ], CreateMJAIAgentNoteInput.prototype, "EmbeddingModelID", void 0);
5237
+ __decorate([
5238
+ Field({ nullable: true }),
5239
+ __metadata("design:type", String)
5240
+ ], CreateMJAIAgentNoteInput.prototype, "PrimaryScopeEntityID", void 0);
5241
+ __decorate([
5242
+ Field({ nullable: true }),
5243
+ __metadata("design:type", String)
5244
+ ], CreateMJAIAgentNoteInput.prototype, "PrimaryScopeRecordID", void 0);
5245
+ __decorate([
5246
+ Field({ nullable: true }),
5247
+ __metadata("design:type", String)
5248
+ ], CreateMJAIAgentNoteInput.prototype, "SecondaryScopes", void 0);
5249
+ __decorate([
5250
+ Field({ nullable: true }),
5251
+ __metadata("design:type", Date)
5252
+ ], CreateMJAIAgentNoteInput.prototype, "LastAccessedAt", void 0);
5253
+ __decorate([
5254
+ Field(() => Int, { nullable: true }),
5255
+ __metadata("design:type", Number)
5256
+ ], CreateMJAIAgentNoteInput.prototype, "AccessCount", void 0);
5257
+ __decorate([
5258
+ Field({ nullable: true }),
5259
+ __metadata("design:type", Date)
5260
+ ], CreateMJAIAgentNoteInput.prototype, "ExpiresAt", void 0);
5191
5261
  CreateMJAIAgentNoteInput = __decorate([
5192
5262
  InputType()
5193
5263
  ], CreateMJAIAgentNoteInput);
@@ -5208,6 +5278,12 @@ let UpdateMJAIAgentNoteInput = class UpdateMJAIAgentNoteInput {
5208
5278
  CompanyID;
5209
5279
  EmbeddingVector;
5210
5280
  EmbeddingModelID;
5281
+ PrimaryScopeEntityID;
5282
+ PrimaryScopeRecordID;
5283
+ SecondaryScopes;
5284
+ LastAccessedAt;
5285
+ AccessCount;
5286
+ ExpiresAt;
5211
5287
  OldValues___;
5212
5288
  };
5213
5289
  __decorate([
@@ -5270,6 +5346,30 @@ __decorate([
5270
5346
  Field({ nullable: true }),
5271
5347
  __metadata("design:type", String)
5272
5348
  ], UpdateMJAIAgentNoteInput.prototype, "EmbeddingModelID", void 0);
5349
+ __decorate([
5350
+ Field({ nullable: true }),
5351
+ __metadata("design:type", String)
5352
+ ], UpdateMJAIAgentNoteInput.prototype, "PrimaryScopeEntityID", void 0);
5353
+ __decorate([
5354
+ Field({ nullable: true }),
5355
+ __metadata("design:type", String)
5356
+ ], UpdateMJAIAgentNoteInput.prototype, "PrimaryScopeRecordID", void 0);
5357
+ __decorate([
5358
+ Field({ nullable: true }),
5359
+ __metadata("design:type", String)
5360
+ ], UpdateMJAIAgentNoteInput.prototype, "SecondaryScopes", void 0);
5361
+ __decorate([
5362
+ Field({ nullable: true }),
5363
+ __metadata("design:type", Date)
5364
+ ], UpdateMJAIAgentNoteInput.prototype, "LastAccessedAt", void 0);
5365
+ __decorate([
5366
+ Field(() => Int, { nullable: true }),
5367
+ __metadata("design:type", Number)
5368
+ ], UpdateMJAIAgentNoteInput.prototype, "AccessCount", void 0);
5369
+ __decorate([
5370
+ Field({ nullable: true }),
5371
+ __metadata("design:type", Date)
5372
+ ], UpdateMJAIAgentNoteInput.prototype, "ExpiresAt", void 0);
5273
5373
  __decorate([
5274
5374
  Field(() => [KeyValuePairInput], { nullable: true }),
5275
5375
  __metadata("design:type", Array)
@@ -5837,6 +5937,11 @@ let MJAIAgent_ = class MJAIAgent_ {
5837
5937
  AttachmentRootPath;
5838
5938
  InlineStorageThresholdBytes;
5839
5939
  AgentTypePromptParams;
5940
+ ScopeConfig;
5941
+ NoteRetentionDays;
5942
+ ExampleRetentionDays;
5943
+ AutoArchiveEnabled;
5944
+ RerankerConfiguration;
5840
5945
  Parent;
5841
5946
  ContextCompressionPrompt;
5842
5947
  Type;
@@ -6123,6 +6228,26 @@ __decorate([
6123
6228
  Field({ nullable: true, description: `JSON object containing parameter values that customize how this agent's type-level system prompt is rendered. The schema is defined by the agent type's PromptParamsSchema field. Allows per-agent control over which prompt sections are included, enabling token savings by excluding unused documentation.` }),
6124
6229
  __metadata("design:type", String)
6125
6230
  ], MJAIAgent_.prototype, "AgentTypePromptParams", void 0);
6231
+ __decorate([
6232
+ Field({ nullable: true, description: `JSON configuration defining scope dimensions for multi-tenant deployments. Example: {"dimensions":[{"name":"OrganizationID","entityId":"...","isPrimary":true,"required":true},{"name":"ContactID","entityId":"...","isPrimary":false,"required":false}],"inheritanceMode":"cascading"}` }),
6233
+ __metadata("design:type", String)
6234
+ ], MJAIAgent_.prototype, "ScopeConfig", void 0);
6235
+ __decorate([
6236
+ Field(() => Int, { nullable: true, description: `Number of days to retain notes before archiving due to inactivity. Default 90. NULL means use system default.` }),
6237
+ __metadata("design:type", Number)
6238
+ ], MJAIAgent_.prototype, "NoteRetentionDays", void 0);
6239
+ __decorate([
6240
+ Field(() => Int, { nullable: true, description: `Number of days to retain examples before archiving due to inactivity. Default 180. NULL means use system default.` }),
6241
+ __metadata("design:type", Number)
6242
+ ], MJAIAgent_.prototype, "ExampleRetentionDays", void 0);
6243
+ __decorate([
6244
+ Field(() => Boolean, { description: `Whether automatic archival of stale notes/examples is enabled for this agent. Default true.` }),
6245
+ __metadata("design:type", Boolean)
6246
+ ], MJAIAgent_.prototype, "AutoArchiveEnabled", void 0);
6247
+ __decorate([
6248
+ Field({ nullable: true, description: `JSON configuration for optional reranking of retrieved memory items. Schema: { enabled: boolean, rerankerModelId: string, retrievalMultiplier: number (default 3), minRelevanceThreshold: number (default 0.5), rerankPromptId?: string, contextFields?: string[], fallbackOnError: boolean (default true) }. When null or disabled, vector search results are used directly without reranking.` }),
6249
+ __metadata("design:type", String)
6250
+ ], MJAIAgent_.prototype, "RerankerConfiguration", void 0);
6126
6251
  __decorate([
6127
6252
  Field({ nullable: true }),
6128
6253
  MaxLength(510),
@@ -6305,6 +6430,11 @@ let CreateMJAIAgentInput = class CreateMJAIAgentInput {
6305
6430
  AttachmentRootPath;
6306
6431
  InlineStorageThresholdBytes;
6307
6432
  AgentTypePromptParams;
6433
+ ScopeConfig;
6434
+ NoteRetentionDays;
6435
+ ExampleRetentionDays;
6436
+ AutoArchiveEnabled;
6437
+ RerankerConfiguration;
6308
6438
  };
6309
6439
  __decorate([
6310
6440
  Field({ nullable: true }),
@@ -6522,6 +6652,26 @@ __decorate([
6522
6652
  Field({ nullable: true }),
6523
6653
  __metadata("design:type", String)
6524
6654
  ], CreateMJAIAgentInput.prototype, "AgentTypePromptParams", void 0);
6655
+ __decorate([
6656
+ Field({ nullable: true }),
6657
+ __metadata("design:type", String)
6658
+ ], CreateMJAIAgentInput.prototype, "ScopeConfig", void 0);
6659
+ __decorate([
6660
+ Field(() => Int, { nullable: true }),
6661
+ __metadata("design:type", Number)
6662
+ ], CreateMJAIAgentInput.prototype, "NoteRetentionDays", void 0);
6663
+ __decorate([
6664
+ Field(() => Int, { nullable: true }),
6665
+ __metadata("design:type", Number)
6666
+ ], CreateMJAIAgentInput.prototype, "ExampleRetentionDays", void 0);
6667
+ __decorate([
6668
+ Field(() => Boolean, { nullable: true }),
6669
+ __metadata("design:type", Boolean)
6670
+ ], CreateMJAIAgentInput.prototype, "AutoArchiveEnabled", void 0);
6671
+ __decorate([
6672
+ Field({ nullable: true }),
6673
+ __metadata("design:type", String)
6674
+ ], CreateMJAIAgentInput.prototype, "RerankerConfiguration", void 0);
6525
6675
  CreateMJAIAgentInput = __decorate([
6526
6676
  InputType()
6527
6677
  ], CreateMJAIAgentInput);
@@ -6581,6 +6731,11 @@ let UpdateMJAIAgentInput = class UpdateMJAIAgentInput {
6581
6731
  AttachmentRootPath;
6582
6732
  InlineStorageThresholdBytes;
6583
6733
  AgentTypePromptParams;
6734
+ ScopeConfig;
6735
+ NoteRetentionDays;
6736
+ ExampleRetentionDays;
6737
+ AutoArchiveEnabled;
6738
+ RerankerConfiguration;
6584
6739
  OldValues___;
6585
6740
  };
6586
6741
  __decorate([
@@ -6799,6 +6954,26 @@ __decorate([
6799
6954
  Field({ nullable: true }),
6800
6955
  __metadata("design:type", String)
6801
6956
  ], UpdateMJAIAgentInput.prototype, "AgentTypePromptParams", void 0);
6957
+ __decorate([
6958
+ Field({ nullable: true }),
6959
+ __metadata("design:type", String)
6960
+ ], UpdateMJAIAgentInput.prototype, "ScopeConfig", void 0);
6961
+ __decorate([
6962
+ Field(() => Int, { nullable: true }),
6963
+ __metadata("design:type", Number)
6964
+ ], UpdateMJAIAgentInput.prototype, "NoteRetentionDays", void 0);
6965
+ __decorate([
6966
+ Field(() => Int, { nullable: true }),
6967
+ __metadata("design:type", Number)
6968
+ ], UpdateMJAIAgentInput.prototype, "ExampleRetentionDays", void 0);
6969
+ __decorate([
6970
+ Field(() => Boolean, { nullable: true }),
6971
+ __metadata("design:type", Boolean)
6972
+ ], UpdateMJAIAgentInput.prototype, "AutoArchiveEnabled", void 0);
6973
+ __decorate([
6974
+ Field({ nullable: true }),
6975
+ __metadata("design:type", String)
6976
+ ], UpdateMJAIAgentInput.prototype, "RerankerConfiguration", void 0);
6802
6977
  __decorate([
6803
6978
  Field(() => [KeyValuePairInput], { nullable: true }),
6804
6979
  __metadata("design:type", Array)
@@ -26764,9 +26939,12 @@ let MJEntity_ = class MJEntity_ {
26764
26939
  QueryEntities_EntityIDArray;
26765
26940
  MJ_AccessControlRules_EntityIDArray;
26766
26941
  MJ_RecordLinks_SourceEntityIDArray;
26942
+ MJ_AIAgentExamples_PrimaryScopeEntityIDArray;
26943
+ AIAgentNotes_PrimaryScopeEntityIDArray;
26767
26944
  GeneratedCodes_LinkedEntityIDArray;
26768
26945
  MJ_RecordLinks_TargetEntityIDArray;
26769
26946
  MJ_TestRuns_TargetLogEntityIDArray;
26947
+ MJ_AIAgentRuns_PrimaryScopeEntityIDArray;
26770
26948
  };
26771
26949
  __decorate([
26772
26950
  Field(),
@@ -27203,6 +27381,14 @@ __decorate([
27203
27381
  Field(() => [MJRecordLink_]),
27204
27382
  __metadata("design:type", Array)
27205
27383
  ], MJEntity_.prototype, "MJ_RecordLinks_SourceEntityIDArray", void 0);
27384
+ __decorate([
27385
+ Field(() => [MJAIAgentExample_]),
27386
+ __metadata("design:type", Array)
27387
+ ], MJEntity_.prototype, "MJ_AIAgentExamples_PrimaryScopeEntityIDArray", void 0);
27388
+ __decorate([
27389
+ Field(() => [MJAIAgentNote_]),
27390
+ __metadata("design:type", Array)
27391
+ ], MJEntity_.prototype, "AIAgentNotes_PrimaryScopeEntityIDArray", void 0);
27206
27392
  __decorate([
27207
27393
  Field(() => [MJGeneratedCode_]),
27208
27394
  __metadata("design:type", Array)
@@ -27215,6 +27401,10 @@ __decorate([
27215
27401
  Field(() => [MJTestRun_]),
27216
27402
  __metadata("design:type", Array)
27217
27403
  ], MJEntity_.prototype, "MJ_TestRuns_TargetLogEntityIDArray", void 0);
27404
+ __decorate([
27405
+ Field(() => [MJAIAgentRun_]),
27406
+ __metadata("design:type", Array)
27407
+ ], MJEntity_.prototype, "MJ_AIAgentRuns_PrimaryScopeEntityIDArray", void 0);
27218
27408
  MJEntity_ = __decorate([
27219
27409
  ObjectType({ description: `Catalog of all entities across all schemas` })
27220
27410
  ], MJEntity_);
@@ -28181,6 +28371,24 @@ let MJEntityResolverBase = class MJEntityResolverBase extends ResolverBase {
28181
28371
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Record Links', rows, this.GetUserFromPayload(userPayload));
28182
28372
  return result;
28183
28373
  }
28374
+ async MJ_AIAgentExamples_PrimaryScopeEntityIDArray(mjentity_, { dataSources, userPayload, providers }, pubSub) {
28375
+ this.CheckUserReadPermissions('MJ: AI Agent Examples', userPayload);
28376
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
28377
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
28378
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentExamples] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Examples', userPayload, EntityPermissionType.Read, 'AND');
28379
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
28380
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Examples', rows, this.GetUserFromPayload(userPayload));
28381
+ return result;
28382
+ }
28383
+ async AIAgentNotes_PrimaryScopeEntityIDArray(mjentity_, { dataSources, userPayload, providers }, pubSub) {
28384
+ this.CheckUserReadPermissions('AI Agent Notes', userPayload);
28385
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
28386
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
28387
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentNotes] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'AI Agent Notes', userPayload, EntityPermissionType.Read, 'AND');
28388
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
28389
+ const result = await this.ArrayMapFieldNamesToCodeNames('AI Agent Notes', rows, this.GetUserFromPayload(userPayload));
28390
+ return result;
28391
+ }
28184
28392
  async GeneratedCodes_LinkedEntityIDArray(mjentity_, { dataSources, userPayload, providers }, pubSub) {
28185
28393
  this.CheckUserReadPermissions('Generated Codes', userPayload);
28186
28394
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
@@ -28208,6 +28416,15 @@ let MJEntityResolverBase = class MJEntityResolverBase extends ResolverBase {
28208
28416
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Test Runs', rows, this.GetUserFromPayload(userPayload));
28209
28417
  return result;
28210
28418
  }
28419
+ async MJ_AIAgentRuns_PrimaryScopeEntityIDArray(mjentity_, { dataSources, userPayload, providers }, pubSub) {
28420
+ this.CheckUserReadPermissions('MJ: AI Agent Runs', userPayload);
28421
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
28422
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
28423
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAIAgentRuns] WHERE [PrimaryScopeEntityID]='${mjentity_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: AI Agent Runs', userPayload, EntityPermissionType.Read, 'AND');
28424
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
28425
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: AI Agent Runs', rows, this.GetUserFromPayload(userPayload));
28426
+ return result;
28427
+ }
28211
28428
  async CreateMJEntity(input, { providers, userPayload }, pubSub) {
28212
28429
  const provider = GetReadWriteProvider(providers);
28213
28430
  return this.CreateRecord('Entities', input, provider, userPayload, pubSub);
@@ -28608,6 +28825,24 @@ __decorate([
28608
28825
  __metadata("design:paramtypes", [MJEntity_, Object, PubSubEngine]),
28609
28826
  __metadata("design:returntype", Promise)
28610
28827
  ], MJEntityResolverBase.prototype, "MJ_RecordLinks_SourceEntityIDArray", null);
28828
+ __decorate([
28829
+ FieldResolver(() => [MJAIAgentExample_]),
28830
+ __param(0, Root()),
28831
+ __param(1, Ctx()),
28832
+ __param(2, PubSub()),
28833
+ __metadata("design:type", Function),
28834
+ __metadata("design:paramtypes", [MJEntity_, Object, PubSubEngine]),
28835
+ __metadata("design:returntype", Promise)
28836
+ ], MJEntityResolverBase.prototype, "MJ_AIAgentExamples_PrimaryScopeEntityIDArray", null);
28837
+ __decorate([
28838
+ FieldResolver(() => [MJAIAgentNote_]),
28839
+ __param(0, Root()),
28840
+ __param(1, Ctx()),
28841
+ __param(2, PubSub()),
28842
+ __metadata("design:type", Function),
28843
+ __metadata("design:paramtypes", [MJEntity_, Object, PubSubEngine]),
28844
+ __metadata("design:returntype", Promise)
28845
+ ], MJEntityResolverBase.prototype, "AIAgentNotes_PrimaryScopeEntityIDArray", null);
28611
28846
  __decorate([
28612
28847
  FieldResolver(() => [MJGeneratedCode_]),
28613
28848
  __param(0, Root()),
@@ -28635,6 +28870,15 @@ __decorate([
28635
28870
  __metadata("design:paramtypes", [MJEntity_, Object, PubSubEngine]),
28636
28871
  __metadata("design:returntype", Promise)
28637
28872
  ], MJEntityResolverBase.prototype, "MJ_TestRuns_TargetLogEntityIDArray", null);
28873
+ __decorate([
28874
+ FieldResolver(() => [MJAIAgentRun_]),
28875
+ __param(0, Root()),
28876
+ __param(1, Ctx()),
28877
+ __param(2, PubSub()),
28878
+ __metadata("design:type", Function),
28879
+ __metadata("design:paramtypes", [MJEntity_, Object, PubSubEngine]),
28880
+ __metadata("design:returntype", Promise)
28881
+ ], MJEntityResolverBase.prototype, "MJ_AIAgentRuns_PrimaryScopeEntityIDArray", null);
28638
28882
  __decorate([
28639
28883
  Mutation(() => MJEntity_),
28640
28884
  __param(0, Arg('input', () => CreateMJEntityInput)),
@@ -41954,6 +42198,12 @@ let MJAIAgentExample_ = class MJAIAgentExample_ {
41954
42198
  _mj__UpdatedAt;
41955
42199
  EmbeddingVector;
41956
42200
  EmbeddingModelID;
42201
+ PrimaryScopeEntityID;
42202
+ PrimaryScopeRecordID;
42203
+ SecondaryScopes;
42204
+ LastAccessedAt;
42205
+ AccessCount;
42206
+ ExpiresAt;
41957
42207
  Agent;
41958
42208
  User;
41959
42209
  Company;
@@ -41961,6 +42211,7 @@ let MJAIAgentExample_ = class MJAIAgentExample_ {
41961
42211
  SourceConversationDetail;
41962
42212
  SourceAIAgentRun;
41963
42213
  EmbeddingModel;
42214
+ PrimaryScopeEntity;
41964
42215
  };
41965
42216
  __decorate([
41966
42217
  Field(),
@@ -42046,6 +42297,34 @@ __decorate([
42046
42297
  MaxLength(16),
42047
42298
  __metadata("design:type", String)
42048
42299
  ], MJAIAgentExample_.prototype, "EmbeddingModelID", void 0);
42300
+ __decorate([
42301
+ Field({ nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping. NULL means this is a global example.` }),
42302
+ MaxLength(16),
42303
+ __metadata("design:type", String)
42304
+ ], MJAIAgentExample_.prototype, "PrimaryScopeEntityID", void 0);
42305
+ __decorate([
42306
+ Field({ nullable: true, description: `The record ID within the primary scope entity. NULL means global example. When set with empty SecondaryScopes, indicates primary-scope-only example.` }),
42307
+ MaxLength(200),
42308
+ __metadata("design:type", String)
42309
+ ], MJAIAgentExample_.prototype, "PrimaryScopeRecordID", void 0);
42310
+ __decorate([
42311
+ Field({ nullable: true, description: `JSON object containing additional scope dimensions. Empty/NULL with PrimaryScopeRecordID set = org-level example. Populated = fully-scoped example.` }),
42312
+ __metadata("design:type", String)
42313
+ ], MJAIAgentExample_.prototype, "SecondaryScopes", void 0);
42314
+ __decorate([
42315
+ Field({ nullable: true, description: `Timestamp of when this example was last accessed/used for agent context. Used for lifecycle management and cleanup.` }),
42316
+ MaxLength(10),
42317
+ __metadata("design:type", Date)
42318
+ ], MJAIAgentExample_.prototype, "LastAccessedAt", void 0);
42319
+ __decorate([
42320
+ Field(() => Int, { description: `Number of times this example has been accessed/used. Used for analytics and determining example value.` }),
42321
+ __metadata("design:type", Number)
42322
+ ], MJAIAgentExample_.prototype, "AccessCount", void 0);
42323
+ __decorate([
42324
+ Field({ nullable: true, description: `Optional expiration timestamp. Examples past this date are candidates for archival. NULL means no expiration.` }),
42325
+ MaxLength(10),
42326
+ __metadata("design:type", Date)
42327
+ ], MJAIAgentExample_.prototype, "ExpiresAt", void 0);
42049
42328
  __decorate([
42050
42329
  Field({ nullable: true }),
42051
42330
  MaxLength(510),
@@ -42080,6 +42359,11 @@ __decorate([
42080
42359
  MaxLength(100),
42081
42360
  __metadata("design:type", String)
42082
42361
  ], MJAIAgentExample_.prototype, "EmbeddingModel", void 0);
42362
+ __decorate([
42363
+ Field({ nullable: true }),
42364
+ MaxLength(510),
42365
+ __metadata("design:type", String)
42366
+ ], MJAIAgentExample_.prototype, "PrimaryScopeEntity", void 0);
42083
42367
  MJAIAgentExample_ = __decorate([
42084
42368
  ObjectType({ description: `Stores example input/output pairs for AI agents to learn from successful interactions. Examples are always agent-specific and support optional user/company scoping for personalized examples.` })
42085
42369
  ], MJAIAgentExample_);
@@ -42101,6 +42385,12 @@ let CreateMJAIAgentExampleInput = class CreateMJAIAgentExampleInput {
42101
42385
  Status;
42102
42386
  EmbeddingVector;
42103
42387
  EmbeddingModelID;
42388
+ PrimaryScopeEntityID;
42389
+ PrimaryScopeRecordID;
42390
+ SecondaryScopes;
42391
+ LastAccessedAt;
42392
+ AccessCount;
42393
+ ExpiresAt;
42104
42394
  };
42105
42395
  __decorate([
42106
42396
  Field({ nullable: true }),
@@ -42166,6 +42456,30 @@ __decorate([
42166
42456
  Field({ nullable: true }),
42167
42457
  __metadata("design:type", String)
42168
42458
  ], CreateMJAIAgentExampleInput.prototype, "EmbeddingModelID", void 0);
42459
+ __decorate([
42460
+ Field({ nullable: true }),
42461
+ __metadata("design:type", String)
42462
+ ], CreateMJAIAgentExampleInput.prototype, "PrimaryScopeEntityID", void 0);
42463
+ __decorate([
42464
+ Field({ nullable: true }),
42465
+ __metadata("design:type", String)
42466
+ ], CreateMJAIAgentExampleInput.prototype, "PrimaryScopeRecordID", void 0);
42467
+ __decorate([
42468
+ Field({ nullable: true }),
42469
+ __metadata("design:type", String)
42470
+ ], CreateMJAIAgentExampleInput.prototype, "SecondaryScopes", void 0);
42471
+ __decorate([
42472
+ Field({ nullable: true }),
42473
+ __metadata("design:type", Date)
42474
+ ], CreateMJAIAgentExampleInput.prototype, "LastAccessedAt", void 0);
42475
+ __decorate([
42476
+ Field(() => Int, { nullable: true }),
42477
+ __metadata("design:type", Number)
42478
+ ], CreateMJAIAgentExampleInput.prototype, "AccessCount", void 0);
42479
+ __decorate([
42480
+ Field({ nullable: true }),
42481
+ __metadata("design:type", Date)
42482
+ ], CreateMJAIAgentExampleInput.prototype, "ExpiresAt", void 0);
42169
42483
  CreateMJAIAgentExampleInput = __decorate([
42170
42484
  InputType()
42171
42485
  ], CreateMJAIAgentExampleInput);
@@ -42187,6 +42501,12 @@ let UpdateMJAIAgentExampleInput = class UpdateMJAIAgentExampleInput {
42187
42501
  Status;
42188
42502
  EmbeddingVector;
42189
42503
  EmbeddingModelID;
42504
+ PrimaryScopeEntityID;
42505
+ PrimaryScopeRecordID;
42506
+ SecondaryScopes;
42507
+ LastAccessedAt;
42508
+ AccessCount;
42509
+ ExpiresAt;
42190
42510
  OldValues___;
42191
42511
  };
42192
42512
  __decorate([
@@ -42253,6 +42573,30 @@ __decorate([
42253
42573
  Field({ nullable: true }),
42254
42574
  __metadata("design:type", String)
42255
42575
  ], UpdateMJAIAgentExampleInput.prototype, "EmbeddingModelID", void 0);
42576
+ __decorate([
42577
+ Field({ nullable: true }),
42578
+ __metadata("design:type", String)
42579
+ ], UpdateMJAIAgentExampleInput.prototype, "PrimaryScopeEntityID", void 0);
42580
+ __decorate([
42581
+ Field({ nullable: true }),
42582
+ __metadata("design:type", String)
42583
+ ], UpdateMJAIAgentExampleInput.prototype, "PrimaryScopeRecordID", void 0);
42584
+ __decorate([
42585
+ Field({ nullable: true }),
42586
+ __metadata("design:type", String)
42587
+ ], UpdateMJAIAgentExampleInput.prototype, "SecondaryScopes", void 0);
42588
+ __decorate([
42589
+ Field({ nullable: true }),
42590
+ __metadata("design:type", Date)
42591
+ ], UpdateMJAIAgentExampleInput.prototype, "LastAccessedAt", void 0);
42592
+ __decorate([
42593
+ Field(() => Int, { nullable: true }),
42594
+ __metadata("design:type", Number)
42595
+ ], UpdateMJAIAgentExampleInput.prototype, "AccessCount", void 0);
42596
+ __decorate([
42597
+ Field({ nullable: true }),
42598
+ __metadata("design:type", Date)
42599
+ ], UpdateMJAIAgentExampleInput.prototype, "ExpiresAt", void 0);
42256
42600
  __decorate([
42257
42601
  Field(() => [KeyValuePairInput], { nullable: true }),
42258
42602
  __metadata("design:type", Array)
@@ -44766,6 +45110,9 @@ let MJAIAgentRun_ = class MJAIAgentRun_ {
44766
45110
  Comments;
44767
45111
  ScheduledJobRunID;
44768
45112
  TestRunID;
45113
+ PrimaryScopeEntityID;
45114
+ PrimaryScopeRecordID;
45115
+ SecondaryScopes;
44769
45116
  Agent;
44770
45117
  ParentRun;
44771
45118
  Conversation;
@@ -44777,6 +45124,7 @@ let MJAIAgentRun_ = class MJAIAgentRun_ {
44777
45124
  OverrideVendor;
44778
45125
  ScheduledJobRun;
44779
45126
  TestRun;
45127
+ PrimaryScopeEntity;
44780
45128
  RootParentRunID;
44781
45129
  RootLastRunID;
44782
45130
  MJ_AIAgentRunSteps_AgentRunIDArray;
@@ -44971,6 +45319,20 @@ __decorate([
44971
45319
  MaxLength(16),
44972
45320
  __metadata("design:type", String)
44973
45321
  ], MJAIAgentRun_.prototype, "TestRunID", void 0);
45322
+ __decorate([
45323
+ Field({ nullable: true, description: `Foreign key to Entity table identifying which entity type is used for primary scoping (e.g., Organizations, Tenants)` }),
45324
+ MaxLength(16),
45325
+ __metadata("design:type", String)
45326
+ ], MJAIAgentRun_.prototype, "PrimaryScopeEntityID", void 0);
45327
+ __decorate([
45328
+ Field({ nullable: true, description: `The record ID within the primary scope entity (e.g., the specific OrganizationID). Indexed for fast multi-tenant filtering.` }),
45329
+ MaxLength(200),
45330
+ __metadata("design:type", String)
45331
+ ], MJAIAgentRun_.prototype, "PrimaryScopeRecordID", void 0);
45332
+ __decorate([
45333
+ Field({ nullable: true, description: `JSON object containing additional scope dimensions beyond the primary scope. Example: {"ContactID":"abc-123","TeamID":"team-456"}` }),
45334
+ __metadata("design:type", String)
45335
+ ], MJAIAgentRun_.prototype, "SecondaryScopes", void 0);
44974
45336
  __decorate([
44975
45337
  Field({ nullable: true }),
44976
45338
  MaxLength(510),
@@ -45025,6 +45387,11 @@ __decorate([
45025
45387
  MaxLength(510),
45026
45388
  __metadata("design:type", String)
45027
45389
  ], MJAIAgentRun_.prototype, "TestRun", void 0);
45390
+ __decorate([
45391
+ Field({ nullable: true }),
45392
+ MaxLength(510),
45393
+ __metadata("design:type", String)
45394
+ ], MJAIAgentRun_.prototype, "PrimaryScopeEntity", void 0);
45028
45395
  __decorate([
45029
45396
  Field({ nullable: true }),
45030
45397
  MaxLength(16),
@@ -45103,6 +45470,9 @@ let CreateMJAIAgentRunInput = class CreateMJAIAgentRunInput {
45103
45470
  Comments;
45104
45471
  ScheduledJobRunID;
45105
45472
  TestRunID;
45473
+ PrimaryScopeEntityID;
45474
+ PrimaryScopeRecordID;
45475
+ SecondaryScopes;
45106
45476
  };
45107
45477
  __decorate([
45108
45478
  Field({ nullable: true }),
@@ -45260,6 +45630,18 @@ __decorate([
45260
45630
  Field({ nullable: true }),
45261
45631
  __metadata("design:type", String)
45262
45632
  ], CreateMJAIAgentRunInput.prototype, "TestRunID", void 0);
45633
+ __decorate([
45634
+ Field({ nullable: true }),
45635
+ __metadata("design:type", String)
45636
+ ], CreateMJAIAgentRunInput.prototype, "PrimaryScopeEntityID", void 0);
45637
+ __decorate([
45638
+ Field({ nullable: true }),
45639
+ __metadata("design:type", String)
45640
+ ], CreateMJAIAgentRunInput.prototype, "PrimaryScopeRecordID", void 0);
45641
+ __decorate([
45642
+ Field({ nullable: true }),
45643
+ __metadata("design:type", String)
45644
+ ], CreateMJAIAgentRunInput.prototype, "SecondaryScopes", void 0);
45263
45645
  CreateMJAIAgentRunInput = __decorate([
45264
45646
  InputType()
45265
45647
  ], CreateMJAIAgentRunInput);
@@ -45304,6 +45686,9 @@ let UpdateMJAIAgentRunInput = class UpdateMJAIAgentRunInput {
45304
45686
  Comments;
45305
45687
  ScheduledJobRunID;
45306
45688
  TestRunID;
45689
+ PrimaryScopeEntityID;
45690
+ PrimaryScopeRecordID;
45691
+ SecondaryScopes;
45307
45692
  OldValues___;
45308
45693
  };
45309
45694
  __decorate([
@@ -45462,6 +45847,18 @@ __decorate([
45462
45847
  Field({ nullable: true }),
45463
45848
  __metadata("design:type", String)
45464
45849
  ], UpdateMJAIAgentRunInput.prototype, "TestRunID", void 0);
45850
+ __decorate([
45851
+ Field({ nullable: true }),
45852
+ __metadata("design:type", String)
45853
+ ], UpdateMJAIAgentRunInput.prototype, "PrimaryScopeEntityID", void 0);
45854
+ __decorate([
45855
+ Field({ nullable: true }),
45856
+ __metadata("design:type", String)
45857
+ ], UpdateMJAIAgentRunInput.prototype, "PrimaryScopeRecordID", void 0);
45858
+ __decorate([
45859
+ Field({ nullable: true }),
45860
+ __metadata("design:type", String)
45861
+ ], UpdateMJAIAgentRunInput.prototype, "SecondaryScopes", void 0);
45465
45862
  __decorate([
45466
45863
  Field(() => [KeyValuePairInput], { nullable: true }),
45467
45864
  __metadata("design:type", Array)
@@ -54473,102 +54870,164 @@ MJAIVendorResolver = __decorate([
54473
54870
  Resolver(MJAIVendor_)
54474
54871
  ], MJAIVendorResolver);
54475
54872
  export { MJAIVendorResolver };
54476
- let MJAPIKeyScope_ = class MJAPIKeyScope_ {
54873
+ let MJAPIApplicationScope_ = class MJAPIApplicationScope_ {
54477
54874
  ID;
54478
- APIKeyID;
54875
+ ApplicationID;
54479
54876
  ScopeID;
54877
+ ResourcePattern;
54878
+ PatternType;
54879
+ IsDeny;
54880
+ Priority;
54480
54881
  _mj__CreatedAt;
54481
54882
  _mj__UpdatedAt;
54482
- APIKey;
54883
+ Application;
54483
54884
  Scope;
54484
54885
  };
54485
54886
  __decorate([
54486
54887
  Field(),
54487
54888
  MaxLength(16),
54488
54889
  __metadata("design:type", String)
54489
- ], MJAPIKeyScope_.prototype, "ID", void 0);
54890
+ ], MJAPIApplicationScope_.prototype, "ID", void 0);
54490
54891
  __decorate([
54491
- Field(),
54892
+ Field({ description: `Reference to the application this ceiling rule applies to.` }),
54492
54893
  MaxLength(16),
54493
54894
  __metadata("design:type", String)
54494
- ], MJAPIKeyScope_.prototype, "APIKeyID", void 0);
54895
+ ], MJAPIApplicationScope_.prototype, "ApplicationID", void 0);
54495
54896
  __decorate([
54496
- Field(),
54897
+ Field({ description: `Reference to the scope this rule applies to.` }),
54497
54898
  MaxLength(16),
54498
54899
  __metadata("design:type", String)
54499
- ], MJAPIKeyScope_.prototype, "ScopeID", void 0);
54900
+ ], MJAPIApplicationScope_.prototype, "ScopeID", void 0);
54901
+ __decorate([
54902
+ Field({ nullable: true, description: `Glob pattern for matching resources (e.g., Users,Accounts or Skip* or *). NULL means match all resources.` }),
54903
+ MaxLength(1500),
54904
+ __metadata("design:type", String)
54905
+ ], MJAPIApplicationScope_.prototype, "ResourcePattern", void 0);
54906
+ __decorate([
54907
+ Field({ description: `How to interpret the pattern: Include (grant if matches) or Exclude (grant if does NOT match).` }),
54908
+ MaxLength(40),
54909
+ __metadata("design:type", String)
54910
+ ], MJAPIApplicationScope_.prototype, "PatternType", void 0);
54911
+ __decorate([
54912
+ Field(() => Boolean, { description: `If true, this rule explicitly DENIES access. Deny rules trump allow rules at the same priority level.` }),
54913
+ __metadata("design:type", Boolean)
54914
+ ], MJAPIApplicationScope_.prototype, "IsDeny", void 0);
54915
+ __decorate([
54916
+ Field(() => Int, { description: `Rule evaluation order. Higher priority rules are evaluated first. Within same priority, deny rules are evaluated before allow rules.` }),
54917
+ __metadata("design:type", Number)
54918
+ ], MJAPIApplicationScope_.prototype, "Priority", void 0);
54500
54919
  __decorate([
54501
54920
  Field(),
54502
54921
  MaxLength(10),
54503
54922
  __metadata("design:type", Date)
54504
- ], MJAPIKeyScope_.prototype, "_mj__CreatedAt", void 0);
54923
+ ], MJAPIApplicationScope_.prototype, "_mj__CreatedAt", void 0);
54505
54924
  __decorate([
54506
54925
  Field(),
54507
54926
  MaxLength(10),
54508
54927
  __metadata("design:type", Date)
54509
- ], MJAPIKeyScope_.prototype, "_mj__UpdatedAt", void 0);
54928
+ ], MJAPIApplicationScope_.prototype, "_mj__UpdatedAt", void 0);
54510
54929
  __decorate([
54511
54930
  Field(),
54512
- MaxLength(510),
54931
+ MaxLength(200),
54513
54932
  __metadata("design:type", String)
54514
- ], MJAPIKeyScope_.prototype, "APIKey", void 0);
54933
+ ], MJAPIApplicationScope_.prototype, "Application", void 0);
54515
54934
  __decorate([
54516
54935
  Field(),
54517
54936
  MaxLength(200),
54518
54937
  __metadata("design:type", String)
54519
- ], MJAPIKeyScope_.prototype, "Scope", void 0);
54520
- MJAPIKeyScope_ = __decorate([
54521
- ObjectType({ description: `Junction table linking API keys to their assigned permission scopes. Each key can have multiple scopes, and scopes can be shared across multiple keys.` })
54522
- ], MJAPIKeyScope_);
54523
- export { MJAPIKeyScope_ };
54524
- let CreateMJAPIKeyScopeInput = class CreateMJAPIKeyScopeInput {
54938
+ ], MJAPIApplicationScope_.prototype, "Scope", void 0);
54939
+ MJAPIApplicationScope_ = __decorate([
54940
+ ObjectType({ description: `Defines the scope ceiling for each application with pattern-based rules. Controls which scopes and resource patterns an application can use, regardless of what API keys grant.` })
54941
+ ], MJAPIApplicationScope_);
54942
+ export { MJAPIApplicationScope_ };
54943
+ let CreateMJAPIApplicationScopeInput = class CreateMJAPIApplicationScopeInput {
54525
54944
  ID;
54526
- APIKeyID;
54945
+ ApplicationID;
54527
54946
  ScopeID;
54947
+ ResourcePattern;
54948
+ PatternType;
54949
+ IsDeny;
54950
+ Priority;
54528
54951
  };
54529
54952
  __decorate([
54530
54953
  Field({ nullable: true }),
54531
54954
  __metadata("design:type", String)
54532
- ], CreateMJAPIKeyScopeInput.prototype, "ID", void 0);
54955
+ ], CreateMJAPIApplicationScopeInput.prototype, "ID", void 0);
54533
54956
  __decorate([
54534
54957
  Field({ nullable: true }),
54535
54958
  __metadata("design:type", String)
54536
- ], CreateMJAPIKeyScopeInput.prototype, "APIKeyID", void 0);
54959
+ ], CreateMJAPIApplicationScopeInput.prototype, "ApplicationID", void 0);
54537
54960
  __decorate([
54538
54961
  Field({ nullable: true }),
54539
54962
  __metadata("design:type", String)
54540
- ], CreateMJAPIKeyScopeInput.prototype, "ScopeID", void 0);
54541
- CreateMJAPIKeyScopeInput = __decorate([
54963
+ ], CreateMJAPIApplicationScopeInput.prototype, "ScopeID", void 0);
54964
+ __decorate([
54965
+ Field({ nullable: true }),
54966
+ __metadata("design:type", String)
54967
+ ], CreateMJAPIApplicationScopeInput.prototype, "ResourcePattern", void 0);
54968
+ __decorate([
54969
+ Field({ nullable: true }),
54970
+ __metadata("design:type", String)
54971
+ ], CreateMJAPIApplicationScopeInput.prototype, "PatternType", void 0);
54972
+ __decorate([
54973
+ Field(() => Boolean, { nullable: true }),
54974
+ __metadata("design:type", Boolean)
54975
+ ], CreateMJAPIApplicationScopeInput.prototype, "IsDeny", void 0);
54976
+ __decorate([
54977
+ Field(() => Int, { nullable: true }),
54978
+ __metadata("design:type", Number)
54979
+ ], CreateMJAPIApplicationScopeInput.prototype, "Priority", void 0);
54980
+ CreateMJAPIApplicationScopeInput = __decorate([
54542
54981
  InputType()
54543
- ], CreateMJAPIKeyScopeInput);
54544
- export { CreateMJAPIKeyScopeInput };
54545
- let UpdateMJAPIKeyScopeInput = class UpdateMJAPIKeyScopeInput {
54982
+ ], CreateMJAPIApplicationScopeInput);
54983
+ export { CreateMJAPIApplicationScopeInput };
54984
+ let UpdateMJAPIApplicationScopeInput = class UpdateMJAPIApplicationScopeInput {
54546
54985
  ID;
54547
- APIKeyID;
54986
+ ApplicationID;
54548
54987
  ScopeID;
54988
+ ResourcePattern;
54989
+ PatternType;
54990
+ IsDeny;
54991
+ Priority;
54549
54992
  OldValues___;
54550
54993
  };
54551
54994
  __decorate([
54552
54995
  Field(),
54553
54996
  __metadata("design:type", String)
54554
- ], UpdateMJAPIKeyScopeInput.prototype, "ID", void 0);
54997
+ ], UpdateMJAPIApplicationScopeInput.prototype, "ID", void 0);
54555
54998
  __decorate([
54556
54999
  Field({ nullable: true }),
54557
55000
  __metadata("design:type", String)
54558
- ], UpdateMJAPIKeyScopeInput.prototype, "APIKeyID", void 0);
55001
+ ], UpdateMJAPIApplicationScopeInput.prototype, "ApplicationID", void 0);
54559
55002
  __decorate([
54560
55003
  Field({ nullable: true }),
54561
55004
  __metadata("design:type", String)
54562
- ], UpdateMJAPIKeyScopeInput.prototype, "ScopeID", void 0);
55005
+ ], UpdateMJAPIApplicationScopeInput.prototype, "ScopeID", void 0);
55006
+ __decorate([
55007
+ Field({ nullable: true }),
55008
+ __metadata("design:type", String)
55009
+ ], UpdateMJAPIApplicationScopeInput.prototype, "ResourcePattern", void 0);
55010
+ __decorate([
55011
+ Field({ nullable: true }),
55012
+ __metadata("design:type", String)
55013
+ ], UpdateMJAPIApplicationScopeInput.prototype, "PatternType", void 0);
55014
+ __decorate([
55015
+ Field(() => Boolean, { nullable: true }),
55016
+ __metadata("design:type", Boolean)
55017
+ ], UpdateMJAPIApplicationScopeInput.prototype, "IsDeny", void 0);
55018
+ __decorate([
55019
+ Field(() => Int, { nullable: true }),
55020
+ __metadata("design:type", Number)
55021
+ ], UpdateMJAPIApplicationScopeInput.prototype, "Priority", void 0);
54563
55022
  __decorate([
54564
55023
  Field(() => [KeyValuePairInput], { nullable: true }),
54565
55024
  __metadata("design:type", Array)
54566
- ], UpdateMJAPIKeyScopeInput.prototype, "OldValues___", void 0);
54567
- UpdateMJAPIKeyScopeInput = __decorate([
55025
+ ], UpdateMJAPIApplicationScopeInput.prototype, "OldValues___", void 0);
55026
+ UpdateMJAPIApplicationScopeInput = __decorate([
54568
55027
  InputType()
54569
- ], UpdateMJAPIKeyScopeInput);
54570
- export { UpdateMJAPIKeyScopeInput };
54571
- let RunMJAPIKeyScopeViewResult = class RunMJAPIKeyScopeViewResult {
55028
+ ], UpdateMJAPIApplicationScopeInput);
55029
+ export { UpdateMJAPIApplicationScopeInput };
55030
+ let RunMJAPIApplicationScopeViewResult = class RunMJAPIApplicationScopeViewResult {
54572
55031
  Results;
54573
55032
  UserViewRunID;
54574
55033
  RowCount;
@@ -54578,130 +55037,130 @@ let RunMJAPIKeyScopeViewResult = class RunMJAPIKeyScopeViewResult {
54578
55037
  Success;
54579
55038
  };
54580
55039
  __decorate([
54581
- Field(() => [MJAPIKeyScope_]),
55040
+ Field(() => [MJAPIApplicationScope_]),
54582
55041
  __metadata("design:type", Array)
54583
- ], RunMJAPIKeyScopeViewResult.prototype, "Results", void 0);
55042
+ ], RunMJAPIApplicationScopeViewResult.prototype, "Results", void 0);
54584
55043
  __decorate([
54585
55044
  Field(() => String, { nullable: true }),
54586
55045
  __metadata("design:type", String)
54587
- ], RunMJAPIKeyScopeViewResult.prototype, "UserViewRunID", void 0);
55046
+ ], RunMJAPIApplicationScopeViewResult.prototype, "UserViewRunID", void 0);
54588
55047
  __decorate([
54589
55048
  Field(() => Int, { nullable: true }),
54590
55049
  __metadata("design:type", Number)
54591
- ], RunMJAPIKeyScopeViewResult.prototype, "RowCount", void 0);
55050
+ ], RunMJAPIApplicationScopeViewResult.prototype, "RowCount", void 0);
54592
55051
  __decorate([
54593
55052
  Field(() => Int, { nullable: true }),
54594
55053
  __metadata("design:type", Number)
54595
- ], RunMJAPIKeyScopeViewResult.prototype, "TotalRowCount", void 0);
55054
+ ], RunMJAPIApplicationScopeViewResult.prototype, "TotalRowCount", void 0);
54596
55055
  __decorate([
54597
55056
  Field(() => Int, { nullable: true }),
54598
55057
  __metadata("design:type", Number)
54599
- ], RunMJAPIKeyScopeViewResult.prototype, "ExecutionTime", void 0);
55058
+ ], RunMJAPIApplicationScopeViewResult.prototype, "ExecutionTime", void 0);
54600
55059
  __decorate([
54601
55060
  Field({ nullable: true }),
54602
55061
  __metadata("design:type", String)
54603
- ], RunMJAPIKeyScopeViewResult.prototype, "ErrorMessage", void 0);
55062
+ ], RunMJAPIApplicationScopeViewResult.prototype, "ErrorMessage", void 0);
54604
55063
  __decorate([
54605
55064
  Field(() => Boolean, { nullable: false }),
54606
55065
  __metadata("design:type", Boolean)
54607
- ], RunMJAPIKeyScopeViewResult.prototype, "Success", void 0);
54608
- RunMJAPIKeyScopeViewResult = __decorate([
55066
+ ], RunMJAPIApplicationScopeViewResult.prototype, "Success", void 0);
55067
+ RunMJAPIApplicationScopeViewResult = __decorate([
54609
55068
  ObjectType()
54610
- ], RunMJAPIKeyScopeViewResult);
54611
- export { RunMJAPIKeyScopeViewResult };
54612
- let MJAPIKeyScopeResolver = class MJAPIKeyScopeResolver extends ResolverBase {
54613
- async RunMJAPIKeyScopeViewByID(input, { providers, userPayload }, pubSub) {
55069
+ ], RunMJAPIApplicationScopeViewResult);
55070
+ export { RunMJAPIApplicationScopeViewResult };
55071
+ let MJAPIApplicationScopeResolver = class MJAPIApplicationScopeResolver extends ResolverBase {
55072
+ async RunMJAPIApplicationScopeViewByID(input, { providers, userPayload }, pubSub) {
54614
55073
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54615
55074
  return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
54616
55075
  }
54617
- async RunMJAPIKeyScopeViewByName(input, { providers, userPayload }, pubSub) {
55076
+ async RunMJAPIApplicationScopeViewByName(input, { providers, userPayload }, pubSub) {
54618
55077
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54619
55078
  return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
54620
55079
  }
54621
- async RunMJAPIKeyScopeDynamicView(input, { providers, userPayload }, pubSub) {
55080
+ async RunMJAPIApplicationScopeDynamicView(input, { providers, userPayload }, pubSub) {
54622
55081
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54623
- input.EntityName = 'MJ: API Key Scopes';
55082
+ input.EntityName = 'MJ: API Application Scopes';
54624
55083
  return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
54625
55084
  }
54626
- async MJAPIKeyScope(ID, { dataSources, userPayload, providers }, pubSub) {
54627
- this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
55085
+ async MJAPIApplicationScope(ID, { dataSources, userPayload, providers }, pubSub) {
55086
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
54628
55087
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
54629
55088
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
54630
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
55089
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
54631
55090
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
54632
- const result = await this.MapFieldNamesToCodeNames('MJ: API Key Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
55091
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Application Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
54633
55092
  return result;
54634
55093
  }
54635
- async CreateMJAPIKeyScope(input, { providers, userPayload }, pubSub) {
55094
+ async CreateMJAPIApplicationScope(input, { providers, userPayload }, pubSub) {
54636
55095
  const provider = GetReadWriteProvider(providers);
54637
- return this.CreateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
55096
+ return this.CreateRecord('MJ: API Application Scopes', input, provider, userPayload, pubSub);
54638
55097
  }
54639
- async UpdateMJAPIKeyScope(input, { providers, userPayload }, pubSub) {
55098
+ async UpdateMJAPIApplicationScope(input, { providers, userPayload }, pubSub) {
54640
55099
  const provider = GetReadWriteProvider(providers);
54641
- return this.UpdateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
55100
+ return this.UpdateRecord('MJ: API Application Scopes', input, provider, userPayload, pubSub);
54642
55101
  }
54643
- async DeleteMJAPIKeyScope(ID, options, { providers, userPayload }, pubSub) {
55102
+ async DeleteMJAPIApplicationScope(ID, options, { providers, userPayload }, pubSub) {
54644
55103
  const provider = GetReadWriteProvider(providers);
54645
55104
  const key = new CompositeKey([{ FieldName: 'ID', Value: ID }]);
54646
- return this.DeleteRecord('MJ: API Key Scopes', key, options, provider, userPayload, pubSub);
55105
+ return this.DeleteRecord('MJ: API Application Scopes', key, options, provider, userPayload, pubSub);
54647
55106
  }
54648
55107
  };
54649
55108
  __decorate([
54650
- Query(() => RunMJAPIKeyScopeViewResult),
55109
+ Query(() => RunMJAPIApplicationScopeViewResult),
54651
55110
  __param(0, Arg('input', () => RunViewByIDInput)),
54652
55111
  __param(1, Ctx()),
54653
55112
  __param(2, PubSub()),
54654
55113
  __metadata("design:type", Function),
54655
55114
  __metadata("design:paramtypes", [RunViewByIDInput, Object, PubSubEngine]),
54656
55115
  __metadata("design:returntype", Promise)
54657
- ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeViewByID", null);
55116
+ ], MJAPIApplicationScopeResolver.prototype, "RunMJAPIApplicationScopeViewByID", null);
54658
55117
  __decorate([
54659
- Query(() => RunMJAPIKeyScopeViewResult),
55118
+ Query(() => RunMJAPIApplicationScopeViewResult),
54660
55119
  __param(0, Arg('input', () => RunViewByNameInput)),
54661
55120
  __param(1, Ctx()),
54662
55121
  __param(2, PubSub()),
54663
55122
  __metadata("design:type", Function),
54664
55123
  __metadata("design:paramtypes", [RunViewByNameInput, Object, PubSubEngine]),
54665
55124
  __metadata("design:returntype", Promise)
54666
- ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeViewByName", null);
55125
+ ], MJAPIApplicationScopeResolver.prototype, "RunMJAPIApplicationScopeViewByName", null);
54667
55126
  __decorate([
54668
- Query(() => RunMJAPIKeyScopeViewResult),
55127
+ Query(() => RunMJAPIApplicationScopeViewResult),
54669
55128
  __param(0, Arg('input', () => RunDynamicViewInput)),
54670
55129
  __param(1, Ctx()),
54671
55130
  __param(2, PubSub()),
54672
55131
  __metadata("design:type", Function),
54673
55132
  __metadata("design:paramtypes", [RunDynamicViewInput, Object, PubSubEngine]),
54674
55133
  __metadata("design:returntype", Promise)
54675
- ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeDynamicView", null);
55134
+ ], MJAPIApplicationScopeResolver.prototype, "RunMJAPIApplicationScopeDynamicView", null);
54676
55135
  __decorate([
54677
- Query(() => MJAPIKeyScope_, { nullable: true }),
55136
+ Query(() => MJAPIApplicationScope_, { nullable: true }),
54678
55137
  __param(0, Arg('ID', () => String)),
54679
55138
  __param(1, Ctx()),
54680
55139
  __param(2, PubSub()),
54681
55140
  __metadata("design:type", Function),
54682
55141
  __metadata("design:paramtypes", [String, Object, PubSubEngine]),
54683
55142
  __metadata("design:returntype", Promise)
54684
- ], MJAPIKeyScopeResolver.prototype, "MJAPIKeyScope", null);
55143
+ ], MJAPIApplicationScopeResolver.prototype, "MJAPIApplicationScope", null);
54685
55144
  __decorate([
54686
- Mutation(() => MJAPIKeyScope_),
54687
- __param(0, Arg('input', () => CreateMJAPIKeyScopeInput)),
55145
+ Mutation(() => MJAPIApplicationScope_),
55146
+ __param(0, Arg('input', () => CreateMJAPIApplicationScopeInput)),
54688
55147
  __param(1, Ctx()),
54689
55148
  __param(2, PubSub()),
54690
55149
  __metadata("design:type", Function),
54691
- __metadata("design:paramtypes", [CreateMJAPIKeyScopeInput, Object, PubSubEngine]),
55150
+ __metadata("design:paramtypes", [CreateMJAPIApplicationScopeInput, Object, PubSubEngine]),
54692
55151
  __metadata("design:returntype", Promise)
54693
- ], MJAPIKeyScopeResolver.prototype, "CreateMJAPIKeyScope", null);
55152
+ ], MJAPIApplicationScopeResolver.prototype, "CreateMJAPIApplicationScope", null);
54694
55153
  __decorate([
54695
- Mutation(() => MJAPIKeyScope_),
54696
- __param(0, Arg('input', () => UpdateMJAPIKeyScopeInput)),
55154
+ Mutation(() => MJAPIApplicationScope_),
55155
+ __param(0, Arg('input', () => UpdateMJAPIApplicationScopeInput)),
54697
55156
  __param(1, Ctx()),
54698
55157
  __param(2, PubSub()),
54699
55158
  __metadata("design:type", Function),
54700
- __metadata("design:paramtypes", [UpdateMJAPIKeyScopeInput, Object, PubSubEngine]),
55159
+ __metadata("design:paramtypes", [UpdateMJAPIApplicationScopeInput, Object, PubSubEngine]),
54701
55160
  __metadata("design:returntype", Promise)
54702
- ], MJAPIKeyScopeResolver.prototype, "UpdateMJAPIKeyScope", null);
55161
+ ], MJAPIApplicationScopeResolver.prototype, "UpdateMJAPIApplicationScope", null);
54703
55162
  __decorate([
54704
- Mutation(() => MJAPIKeyScope_),
55163
+ Mutation(() => MJAPIApplicationScope_),
54705
55164
  __param(0, Arg('ID', () => String)),
54706
55165
  __param(1, Arg('options___', () => DeleteOptionsInput)),
54707
55166
  __param(2, Ctx()),
@@ -54709,174 +55168,1096 @@ __decorate([
54709
55168
  __metadata("design:type", Function),
54710
55169
  __metadata("design:paramtypes", [String, DeleteOptionsInput, Object, PubSubEngine]),
54711
55170
  __metadata("design:returntype", Promise)
54712
- ], MJAPIKeyScopeResolver.prototype, "DeleteMJAPIKeyScope", null);
54713
- MJAPIKeyScopeResolver = __decorate([
54714
- Resolver(MJAPIKeyScope_)
54715
- ], MJAPIKeyScopeResolver);
54716
- export { MJAPIKeyScopeResolver };
54717
- let MJAPIKeyUsageLog_ = class MJAPIKeyUsageLog_ {
55171
+ ], MJAPIApplicationScopeResolver.prototype, "DeleteMJAPIApplicationScope", null);
55172
+ MJAPIApplicationScopeResolver = __decorate([
55173
+ Resolver(MJAPIApplicationScope_)
55174
+ ], MJAPIApplicationScopeResolver);
55175
+ export { MJAPIApplicationScopeResolver };
55176
+ let MJAPIApplication_ = class MJAPIApplication_ {
54718
55177
  ID;
54719
- APIKeyID;
54720
- Endpoint;
54721
- Operation;
54722
- Method;
54723
- StatusCode;
54724
- ResponseTimeMs;
54725
- IPAddress;
54726
- UserAgent;
55178
+ Name;
55179
+ Description;
55180
+ IsActive;
54727
55181
  _mj__CreatedAt;
54728
55182
  _mj__UpdatedAt;
54729
- APIKey;
55183
+ MJ_APIApplicationScopes_ApplicationIDArray;
55184
+ MJ_APIKeyUsageLogs_ApplicationIDArray;
55185
+ MJ_APIKeyApplications_ApplicationIDArray;
54730
55186
  };
54731
55187
  __decorate([
54732
55188
  Field(),
54733
55189
  MaxLength(16),
54734
55190
  __metadata("design:type", String)
54735
- ], MJAPIKeyUsageLog_.prototype, "ID", void 0);
55191
+ ], MJAPIApplication_.prototype, "ID", void 0);
54736
55192
  __decorate([
54737
- Field(),
54738
- MaxLength(16),
55193
+ Field({ description: `Unique name identifying the application (e.g., MJAPI, MCPServer, Portal, CLI).` }),
55194
+ MaxLength(200),
54739
55195
  __metadata("design:type", String)
54740
- ], MJAPIKeyUsageLog_.prototype, "APIKeyID", void 0);
55196
+ ], MJAPIApplication_.prototype, "Name", void 0);
54741
55197
  __decorate([
54742
- Field({ description: `The API endpoint path that was accessed (e.g., /mcp, /graphql, /api/v1/entities).` }),
55198
+ Field({ nullable: true, description: `Human-readable description of the application and its purpose.` }),
54743
55199
  MaxLength(1000),
54744
55200
  __metadata("design:type", String)
54745
- ], MJAPIKeyUsageLog_.prototype, "Endpoint", void 0);
54746
- __decorate([
54747
- Field({ nullable: true, description: `The specific operation performed, such as the GraphQL operation name or MCP tool invoked (e.g., Get_Users_Record, Run_Agent).` }),
54748
- MaxLength(510),
54749
- __metadata("design:type", String)
54750
- ], MJAPIKeyUsageLog_.prototype, "Operation", void 0);
54751
- __decorate([
54752
- Field({ description: `HTTP method used for the request (GET, POST, PUT, DELETE, etc.).` }),
54753
- MaxLength(20),
54754
- __metadata("design:type", String)
54755
- ], MJAPIKeyUsageLog_.prototype, "Method", void 0);
54756
- __decorate([
54757
- Field(() => Int, { description: `HTTP response status code returned to the client (e.g., 200 for success, 401 for unauthorized, 500 for server error).` }),
54758
- __metadata("design:type", Number)
54759
- ], MJAPIKeyUsageLog_.prototype, "StatusCode", void 0);
54760
- __decorate([
54761
- Field(() => Int, { nullable: true, description: `Total time in milliseconds to process the request and return a response. Useful for performance monitoring.` }),
54762
- __metadata("design:type", Number)
54763
- ], MJAPIKeyUsageLog_.prototype, "ResponseTimeMs", void 0);
54764
- __decorate([
54765
- Field({ nullable: true, description: `Client IP address that made the request. Supports both IPv4 and IPv6 addresses (up to 45 characters).` }),
54766
- MaxLength(90),
54767
- __metadata("design:type", String)
54768
- ], MJAPIKeyUsageLog_.prototype, "IPAddress", void 0);
55201
+ ], MJAPIApplication_.prototype, "Description", void 0);
54769
55202
  __decorate([
54770
- Field({ nullable: true, description: `User-Agent header from the HTTP request, identifying the client application or library making the API call.` }),
54771
- MaxLength(1000),
54772
- __metadata("design:type", String)
54773
- ], MJAPIKeyUsageLog_.prototype, "UserAgent", void 0);
55203
+ Field(() => Boolean, { description: `Whether this application is currently active. Inactive applications reject all API key authentication.` }),
55204
+ __metadata("design:type", Boolean)
55205
+ ], MJAPIApplication_.prototype, "IsActive", void 0);
54774
55206
  __decorate([
54775
55207
  Field(),
54776
55208
  MaxLength(10),
54777
55209
  __metadata("design:type", Date)
54778
- ], MJAPIKeyUsageLog_.prototype, "_mj__CreatedAt", void 0);
55210
+ ], MJAPIApplication_.prototype, "_mj__CreatedAt", void 0);
54779
55211
  __decorate([
54780
55212
  Field(),
54781
55213
  MaxLength(10),
54782
55214
  __metadata("design:type", Date)
54783
- ], MJAPIKeyUsageLog_.prototype, "_mj__UpdatedAt", void 0);
54784
- __decorate([
54785
- Field(),
54786
- MaxLength(510),
54787
- __metadata("design:type", String)
54788
- ], MJAPIKeyUsageLog_.prototype, "APIKey", void 0);
54789
- MJAPIKeyUsageLog_ = __decorate([
54790
- ObjectType({ description: `Audit log tracking all API key usage for analytics, debugging, and security monitoring. Records each request including endpoint, response status, timing, and client information.` })
54791
- ], MJAPIKeyUsageLog_);
54792
- export { MJAPIKeyUsageLog_ };
54793
- let CreateMJAPIKeyUsageLogInput = class CreateMJAPIKeyUsageLogInput {
54794
- ID;
54795
- APIKeyID;
54796
- Endpoint;
54797
- Operation;
54798
- Method;
54799
- StatusCode;
54800
- ResponseTimeMs;
54801
- IPAddress;
54802
- UserAgent;
54803
- };
55215
+ ], MJAPIApplication_.prototype, "_mj__UpdatedAt", void 0);
54804
55216
  __decorate([
54805
- Field({ nullable: true }),
54806
- __metadata("design:type", String)
54807
- ], CreateMJAPIKeyUsageLogInput.prototype, "ID", void 0);
55217
+ Field(() => [MJAPIApplicationScope_]),
55218
+ __metadata("design:type", Array)
55219
+ ], MJAPIApplication_.prototype, "MJ_APIApplicationScopes_ApplicationIDArray", void 0);
54808
55220
  __decorate([
54809
- Field({ nullable: true }),
54810
- __metadata("design:type", String)
54811
- ], CreateMJAPIKeyUsageLogInput.prototype, "APIKeyID", void 0);
55221
+ Field(() => [MJAPIKeyUsageLog_]),
55222
+ __metadata("design:type", Array)
55223
+ ], MJAPIApplication_.prototype, "MJ_APIKeyUsageLogs_ApplicationIDArray", void 0);
54812
55224
  __decorate([
54813
- Field({ nullable: true }),
54814
- __metadata("design:type", String)
54815
- ], CreateMJAPIKeyUsageLogInput.prototype, "Endpoint", void 0);
55225
+ Field(() => [MJAPIKeyApplication_]),
55226
+ __metadata("design:type", Array)
55227
+ ], MJAPIApplication_.prototype, "MJ_APIKeyApplications_ApplicationIDArray", void 0);
55228
+ MJAPIApplication_ = __decorate([
55229
+ ObjectType({ description: `Registry of applications that can consume MemberJunction APIs. Each application defines a scope ceiling that limits what API keys can access when used with that application.` })
55230
+ ], MJAPIApplication_);
55231
+ export { MJAPIApplication_ };
55232
+ let CreateMJAPIApplicationInput = class CreateMJAPIApplicationInput {
55233
+ ID;
55234
+ Name;
55235
+ Description;
55236
+ IsActive;
55237
+ };
54816
55238
  __decorate([
54817
55239
  Field({ nullable: true }),
54818
55240
  __metadata("design:type", String)
54819
- ], CreateMJAPIKeyUsageLogInput.prototype, "Operation", void 0);
55241
+ ], CreateMJAPIApplicationInput.prototype, "ID", void 0);
54820
55242
  __decorate([
54821
55243
  Field({ nullable: true }),
54822
55244
  __metadata("design:type", String)
54823
- ], CreateMJAPIKeyUsageLogInput.prototype, "Method", void 0);
54824
- __decorate([
54825
- Field(() => Int, { nullable: true }),
54826
- __metadata("design:type", Number)
54827
- ], CreateMJAPIKeyUsageLogInput.prototype, "StatusCode", void 0);
54828
- __decorate([
54829
- Field(() => Int, { nullable: true }),
54830
- __metadata("design:type", Number)
54831
- ], CreateMJAPIKeyUsageLogInput.prototype, "ResponseTimeMs", void 0);
55245
+ ], CreateMJAPIApplicationInput.prototype, "Name", void 0);
54832
55246
  __decorate([
54833
55247
  Field({ nullable: true }),
54834
55248
  __metadata("design:type", String)
54835
- ], CreateMJAPIKeyUsageLogInput.prototype, "IPAddress", void 0);
55249
+ ], CreateMJAPIApplicationInput.prototype, "Description", void 0);
54836
55250
  __decorate([
54837
- Field({ nullable: true }),
54838
- __metadata("design:type", String)
54839
- ], CreateMJAPIKeyUsageLogInput.prototype, "UserAgent", void 0);
54840
- CreateMJAPIKeyUsageLogInput = __decorate([
55251
+ Field(() => Boolean, { nullable: true }),
55252
+ __metadata("design:type", Boolean)
55253
+ ], CreateMJAPIApplicationInput.prototype, "IsActive", void 0);
55254
+ CreateMJAPIApplicationInput = __decorate([
54841
55255
  InputType()
54842
- ], CreateMJAPIKeyUsageLogInput);
54843
- export { CreateMJAPIKeyUsageLogInput };
54844
- let UpdateMJAPIKeyUsageLogInput = class UpdateMJAPIKeyUsageLogInput {
55256
+ ], CreateMJAPIApplicationInput);
55257
+ export { CreateMJAPIApplicationInput };
55258
+ let UpdateMJAPIApplicationInput = class UpdateMJAPIApplicationInput {
54845
55259
  ID;
54846
- APIKeyID;
54847
- Endpoint;
54848
- Operation;
54849
- Method;
54850
- StatusCode;
54851
- ResponseTimeMs;
54852
- IPAddress;
54853
- UserAgent;
55260
+ Name;
55261
+ Description;
55262
+ IsActive;
54854
55263
  OldValues___;
54855
55264
  };
54856
55265
  __decorate([
54857
55266
  Field(),
54858
55267
  __metadata("design:type", String)
54859
- ], UpdateMJAPIKeyUsageLogInput.prototype, "ID", void 0);
55268
+ ], UpdateMJAPIApplicationInput.prototype, "ID", void 0);
54860
55269
  __decorate([
54861
55270
  Field({ nullable: true }),
54862
55271
  __metadata("design:type", String)
54863
- ], UpdateMJAPIKeyUsageLogInput.prototype, "APIKeyID", void 0);
55272
+ ], UpdateMJAPIApplicationInput.prototype, "Name", void 0);
54864
55273
  __decorate([
54865
55274
  Field({ nullable: true }),
54866
55275
  __metadata("design:type", String)
54867
- ], UpdateMJAPIKeyUsageLogInput.prototype, "Endpoint", void 0);
55276
+ ], UpdateMJAPIApplicationInput.prototype, "Description", void 0);
54868
55277
  __decorate([
54869
- Field({ nullable: true }),
54870
- __metadata("design:type", String)
54871
- ], UpdateMJAPIKeyUsageLogInput.prototype, "Operation", void 0);
55278
+ Field(() => Boolean, { nullable: true }),
55279
+ __metadata("design:type", Boolean)
55280
+ ], UpdateMJAPIApplicationInput.prototype, "IsActive", void 0);
54872
55281
  __decorate([
54873
- Field({ nullable: true }),
55282
+ Field(() => [KeyValuePairInput], { nullable: true }),
55283
+ __metadata("design:type", Array)
55284
+ ], UpdateMJAPIApplicationInput.prototype, "OldValues___", void 0);
55285
+ UpdateMJAPIApplicationInput = __decorate([
55286
+ InputType()
55287
+ ], UpdateMJAPIApplicationInput);
55288
+ export { UpdateMJAPIApplicationInput };
55289
+ let RunMJAPIApplicationViewResult = class RunMJAPIApplicationViewResult {
55290
+ Results;
55291
+ UserViewRunID;
55292
+ RowCount;
55293
+ TotalRowCount;
55294
+ ExecutionTime;
55295
+ ErrorMessage;
55296
+ Success;
55297
+ };
55298
+ __decorate([
55299
+ Field(() => [MJAPIApplication_]),
55300
+ __metadata("design:type", Array)
55301
+ ], RunMJAPIApplicationViewResult.prototype, "Results", void 0);
55302
+ __decorate([
55303
+ Field(() => String, { nullable: true }),
54874
55304
  __metadata("design:type", String)
54875
- ], UpdateMJAPIKeyUsageLogInput.prototype, "Method", void 0);
55305
+ ], RunMJAPIApplicationViewResult.prototype, "UserViewRunID", void 0);
54876
55306
  __decorate([
54877
55307
  Field(() => Int, { nullable: true }),
54878
55308
  __metadata("design:type", Number)
54879
- ], UpdateMJAPIKeyUsageLogInput.prototype, "StatusCode", void 0);
55309
+ ], RunMJAPIApplicationViewResult.prototype, "RowCount", void 0);
55310
+ __decorate([
55311
+ Field(() => Int, { nullable: true }),
55312
+ __metadata("design:type", Number)
55313
+ ], RunMJAPIApplicationViewResult.prototype, "TotalRowCount", void 0);
55314
+ __decorate([
55315
+ Field(() => Int, { nullable: true }),
55316
+ __metadata("design:type", Number)
55317
+ ], RunMJAPIApplicationViewResult.prototype, "ExecutionTime", void 0);
55318
+ __decorate([
55319
+ Field({ nullable: true }),
55320
+ __metadata("design:type", String)
55321
+ ], RunMJAPIApplicationViewResult.prototype, "ErrorMessage", void 0);
55322
+ __decorate([
55323
+ Field(() => Boolean, { nullable: false }),
55324
+ __metadata("design:type", Boolean)
55325
+ ], RunMJAPIApplicationViewResult.prototype, "Success", void 0);
55326
+ RunMJAPIApplicationViewResult = __decorate([
55327
+ ObjectType()
55328
+ ], RunMJAPIApplicationViewResult);
55329
+ export { RunMJAPIApplicationViewResult };
55330
+ let MJAPIApplicationResolver = class MJAPIApplicationResolver extends ResolverBase {
55331
+ async RunMJAPIApplicationViewByID(input, { providers, userPayload }, pubSub) {
55332
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55333
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
55334
+ }
55335
+ async RunMJAPIApplicationViewByName(input, { providers, userPayload }, pubSub) {
55336
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55337
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
55338
+ }
55339
+ async RunMJAPIApplicationDynamicView(input, { providers, userPayload }, pubSub) {
55340
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55341
+ input.EntityName = 'MJ: API Applications';
55342
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
55343
+ }
55344
+ async MJAPIApplication(ID, { dataSources, userPayload, providers }, pubSub) {
55345
+ this.CheckUserReadPermissions('MJ: API Applications', userPayload);
55346
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55347
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55348
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplications] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Applications', userPayload, EntityPermissionType.Read, 'AND');
55349
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55350
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Applications', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
55351
+ return result;
55352
+ }
55353
+ async MJ_APIApplicationScopes_ApplicationIDArray(mjapiapplication_, { dataSources, userPayload, providers }, pubSub) {
55354
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
55355
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55356
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55357
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
55358
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55359
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Application Scopes', rows, this.GetUserFromPayload(userPayload));
55360
+ return result;
55361
+ }
55362
+ async MJ_APIKeyUsageLogs_ApplicationIDArray(mjapiapplication_, { dataSources, userPayload, providers }, pubSub) {
55363
+ this.CheckUserReadPermissions('MJ: API Key Usage Logs', userPayload);
55364
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55365
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55366
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyUsageLogs] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Usage Logs', userPayload, EntityPermissionType.Read, 'AND');
55367
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55368
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Usage Logs', rows, this.GetUserFromPayload(userPayload));
55369
+ return result;
55370
+ }
55371
+ async MJ_APIKeyApplications_ApplicationIDArray(mjapiapplication_, { dataSources, userPayload, providers }, pubSub) {
55372
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
55373
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55374
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55375
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [ApplicationID]='${mjapiapplication_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
55376
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55377
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Applications', rows, this.GetUserFromPayload(userPayload));
55378
+ return result;
55379
+ }
55380
+ async CreateMJAPIApplication(input, { providers, userPayload }, pubSub) {
55381
+ const provider = GetReadWriteProvider(providers);
55382
+ return this.CreateRecord('MJ: API Applications', input, provider, userPayload, pubSub);
55383
+ }
55384
+ async UpdateMJAPIApplication(input, { providers, userPayload }, pubSub) {
55385
+ const provider = GetReadWriteProvider(providers);
55386
+ return this.UpdateRecord('MJ: API Applications', input, provider, userPayload, pubSub);
55387
+ }
55388
+ async DeleteMJAPIApplication(ID, options, { providers, userPayload }, pubSub) {
55389
+ const provider = GetReadWriteProvider(providers);
55390
+ const key = new CompositeKey([{ FieldName: 'ID', Value: ID }]);
55391
+ return this.DeleteRecord('MJ: API Applications', key, options, provider, userPayload, pubSub);
55392
+ }
55393
+ };
55394
+ __decorate([
55395
+ Query(() => RunMJAPIApplicationViewResult),
55396
+ __param(0, Arg('input', () => RunViewByIDInput)),
55397
+ __param(1, Ctx()),
55398
+ __param(2, PubSub()),
55399
+ __metadata("design:type", Function),
55400
+ __metadata("design:paramtypes", [RunViewByIDInput, Object, PubSubEngine]),
55401
+ __metadata("design:returntype", Promise)
55402
+ ], MJAPIApplicationResolver.prototype, "RunMJAPIApplicationViewByID", null);
55403
+ __decorate([
55404
+ Query(() => RunMJAPIApplicationViewResult),
55405
+ __param(0, Arg('input', () => RunViewByNameInput)),
55406
+ __param(1, Ctx()),
55407
+ __param(2, PubSub()),
55408
+ __metadata("design:type", Function),
55409
+ __metadata("design:paramtypes", [RunViewByNameInput, Object, PubSubEngine]),
55410
+ __metadata("design:returntype", Promise)
55411
+ ], MJAPIApplicationResolver.prototype, "RunMJAPIApplicationViewByName", null);
55412
+ __decorate([
55413
+ Query(() => RunMJAPIApplicationViewResult),
55414
+ __param(0, Arg('input', () => RunDynamicViewInput)),
55415
+ __param(1, Ctx()),
55416
+ __param(2, PubSub()),
55417
+ __metadata("design:type", Function),
55418
+ __metadata("design:paramtypes", [RunDynamicViewInput, Object, PubSubEngine]),
55419
+ __metadata("design:returntype", Promise)
55420
+ ], MJAPIApplicationResolver.prototype, "RunMJAPIApplicationDynamicView", null);
55421
+ __decorate([
55422
+ Query(() => MJAPIApplication_, { nullable: true }),
55423
+ __param(0, Arg('ID', () => String)),
55424
+ __param(1, Ctx()),
55425
+ __param(2, PubSub()),
55426
+ __metadata("design:type", Function),
55427
+ __metadata("design:paramtypes", [String, Object, PubSubEngine]),
55428
+ __metadata("design:returntype", Promise)
55429
+ ], MJAPIApplicationResolver.prototype, "MJAPIApplication", null);
55430
+ __decorate([
55431
+ FieldResolver(() => [MJAPIApplicationScope_]),
55432
+ __param(0, Root()),
55433
+ __param(1, Ctx()),
55434
+ __param(2, PubSub()),
55435
+ __metadata("design:type", Function),
55436
+ __metadata("design:paramtypes", [MJAPIApplication_, Object, PubSubEngine]),
55437
+ __metadata("design:returntype", Promise)
55438
+ ], MJAPIApplicationResolver.prototype, "MJ_APIApplicationScopes_ApplicationIDArray", null);
55439
+ __decorate([
55440
+ FieldResolver(() => [MJAPIKeyUsageLog_]),
55441
+ __param(0, Root()),
55442
+ __param(1, Ctx()),
55443
+ __param(2, PubSub()),
55444
+ __metadata("design:type", Function),
55445
+ __metadata("design:paramtypes", [MJAPIApplication_, Object, PubSubEngine]),
55446
+ __metadata("design:returntype", Promise)
55447
+ ], MJAPIApplicationResolver.prototype, "MJ_APIKeyUsageLogs_ApplicationIDArray", null);
55448
+ __decorate([
55449
+ FieldResolver(() => [MJAPIKeyApplication_]),
55450
+ __param(0, Root()),
55451
+ __param(1, Ctx()),
55452
+ __param(2, PubSub()),
55453
+ __metadata("design:type", Function),
55454
+ __metadata("design:paramtypes", [MJAPIApplication_, Object, PubSubEngine]),
55455
+ __metadata("design:returntype", Promise)
55456
+ ], MJAPIApplicationResolver.prototype, "MJ_APIKeyApplications_ApplicationIDArray", null);
55457
+ __decorate([
55458
+ Mutation(() => MJAPIApplication_),
55459
+ __param(0, Arg('input', () => CreateMJAPIApplicationInput)),
55460
+ __param(1, Ctx()),
55461
+ __param(2, PubSub()),
55462
+ __metadata("design:type", Function),
55463
+ __metadata("design:paramtypes", [CreateMJAPIApplicationInput, Object, PubSubEngine]),
55464
+ __metadata("design:returntype", Promise)
55465
+ ], MJAPIApplicationResolver.prototype, "CreateMJAPIApplication", null);
55466
+ __decorate([
55467
+ Mutation(() => MJAPIApplication_),
55468
+ __param(0, Arg('input', () => UpdateMJAPIApplicationInput)),
55469
+ __param(1, Ctx()),
55470
+ __param(2, PubSub()),
55471
+ __metadata("design:type", Function),
55472
+ __metadata("design:paramtypes", [UpdateMJAPIApplicationInput, Object, PubSubEngine]),
55473
+ __metadata("design:returntype", Promise)
55474
+ ], MJAPIApplicationResolver.prototype, "UpdateMJAPIApplication", null);
55475
+ __decorate([
55476
+ Mutation(() => MJAPIApplication_),
55477
+ __param(0, Arg('ID', () => String)),
55478
+ __param(1, Arg('options___', () => DeleteOptionsInput)),
55479
+ __param(2, Ctx()),
55480
+ __param(3, PubSub()),
55481
+ __metadata("design:type", Function),
55482
+ __metadata("design:paramtypes", [String, DeleteOptionsInput, Object, PubSubEngine]),
55483
+ __metadata("design:returntype", Promise)
55484
+ ], MJAPIApplicationResolver.prototype, "DeleteMJAPIApplication", null);
55485
+ MJAPIApplicationResolver = __decorate([
55486
+ Resolver(MJAPIApplication_)
55487
+ ], MJAPIApplicationResolver);
55488
+ export { MJAPIApplicationResolver };
55489
+ let MJAPIKeyApplication_ = class MJAPIKeyApplication_ {
55490
+ ID;
55491
+ APIKeyID;
55492
+ ApplicationID;
55493
+ _mj__CreatedAt;
55494
+ _mj__UpdatedAt;
55495
+ APIKey;
55496
+ Application;
55497
+ };
55498
+ __decorate([
55499
+ Field(),
55500
+ MaxLength(16),
55501
+ __metadata("design:type", String)
55502
+ ], MJAPIKeyApplication_.prototype, "ID", void 0);
55503
+ __decorate([
55504
+ Field({ description: `Reference to the API key being bound to an application.` }),
55505
+ MaxLength(16),
55506
+ __metadata("design:type", String)
55507
+ ], MJAPIKeyApplication_.prototype, "APIKeyID", void 0);
55508
+ __decorate([
55509
+ Field({ description: `Reference to the application this key is authorized to use.` }),
55510
+ MaxLength(16),
55511
+ __metadata("design:type", String)
55512
+ ], MJAPIKeyApplication_.prototype, "ApplicationID", void 0);
55513
+ __decorate([
55514
+ Field(),
55515
+ MaxLength(10),
55516
+ __metadata("design:type", Date)
55517
+ ], MJAPIKeyApplication_.prototype, "_mj__CreatedAt", void 0);
55518
+ __decorate([
55519
+ Field(),
55520
+ MaxLength(10),
55521
+ __metadata("design:type", Date)
55522
+ ], MJAPIKeyApplication_.prototype, "_mj__UpdatedAt", void 0);
55523
+ __decorate([
55524
+ Field(),
55525
+ MaxLength(510),
55526
+ __metadata("design:type", String)
55527
+ ], MJAPIKeyApplication_.prototype, "APIKey", void 0);
55528
+ __decorate([
55529
+ Field(),
55530
+ MaxLength(200),
55531
+ __metadata("design:type", String)
55532
+ ], MJAPIKeyApplication_.prototype, "Application", void 0);
55533
+ MJAPIKeyApplication_ = __decorate([
55534
+ ObjectType({ description: `Optional binding of API keys to specific applications. If no records exist for a key, it works with all applications. If records exist, the key only works with those specific applications.` })
55535
+ ], MJAPIKeyApplication_);
55536
+ export { MJAPIKeyApplication_ };
55537
+ let CreateMJAPIKeyApplicationInput = class CreateMJAPIKeyApplicationInput {
55538
+ ID;
55539
+ APIKeyID;
55540
+ ApplicationID;
55541
+ };
55542
+ __decorate([
55543
+ Field({ nullable: true }),
55544
+ __metadata("design:type", String)
55545
+ ], CreateMJAPIKeyApplicationInput.prototype, "ID", void 0);
55546
+ __decorate([
55547
+ Field({ nullable: true }),
55548
+ __metadata("design:type", String)
55549
+ ], CreateMJAPIKeyApplicationInput.prototype, "APIKeyID", void 0);
55550
+ __decorate([
55551
+ Field({ nullable: true }),
55552
+ __metadata("design:type", String)
55553
+ ], CreateMJAPIKeyApplicationInput.prototype, "ApplicationID", void 0);
55554
+ CreateMJAPIKeyApplicationInput = __decorate([
55555
+ InputType()
55556
+ ], CreateMJAPIKeyApplicationInput);
55557
+ export { CreateMJAPIKeyApplicationInput };
55558
+ let UpdateMJAPIKeyApplicationInput = class UpdateMJAPIKeyApplicationInput {
55559
+ ID;
55560
+ APIKeyID;
55561
+ ApplicationID;
55562
+ OldValues___;
55563
+ };
55564
+ __decorate([
55565
+ Field(),
55566
+ __metadata("design:type", String)
55567
+ ], UpdateMJAPIKeyApplicationInput.prototype, "ID", void 0);
55568
+ __decorate([
55569
+ Field({ nullable: true }),
55570
+ __metadata("design:type", String)
55571
+ ], UpdateMJAPIKeyApplicationInput.prototype, "APIKeyID", void 0);
55572
+ __decorate([
55573
+ Field({ nullable: true }),
55574
+ __metadata("design:type", String)
55575
+ ], UpdateMJAPIKeyApplicationInput.prototype, "ApplicationID", void 0);
55576
+ __decorate([
55577
+ Field(() => [KeyValuePairInput], { nullable: true }),
55578
+ __metadata("design:type", Array)
55579
+ ], UpdateMJAPIKeyApplicationInput.prototype, "OldValues___", void 0);
55580
+ UpdateMJAPIKeyApplicationInput = __decorate([
55581
+ InputType()
55582
+ ], UpdateMJAPIKeyApplicationInput);
55583
+ export { UpdateMJAPIKeyApplicationInput };
55584
+ let RunMJAPIKeyApplicationViewResult = class RunMJAPIKeyApplicationViewResult {
55585
+ Results;
55586
+ UserViewRunID;
55587
+ RowCount;
55588
+ TotalRowCount;
55589
+ ExecutionTime;
55590
+ ErrorMessage;
55591
+ Success;
55592
+ };
55593
+ __decorate([
55594
+ Field(() => [MJAPIKeyApplication_]),
55595
+ __metadata("design:type", Array)
55596
+ ], RunMJAPIKeyApplicationViewResult.prototype, "Results", void 0);
55597
+ __decorate([
55598
+ Field(() => String, { nullable: true }),
55599
+ __metadata("design:type", String)
55600
+ ], RunMJAPIKeyApplicationViewResult.prototype, "UserViewRunID", void 0);
55601
+ __decorate([
55602
+ Field(() => Int, { nullable: true }),
55603
+ __metadata("design:type", Number)
55604
+ ], RunMJAPIKeyApplicationViewResult.prototype, "RowCount", void 0);
55605
+ __decorate([
55606
+ Field(() => Int, { nullable: true }),
55607
+ __metadata("design:type", Number)
55608
+ ], RunMJAPIKeyApplicationViewResult.prototype, "TotalRowCount", void 0);
55609
+ __decorate([
55610
+ Field(() => Int, { nullable: true }),
55611
+ __metadata("design:type", Number)
55612
+ ], RunMJAPIKeyApplicationViewResult.prototype, "ExecutionTime", void 0);
55613
+ __decorate([
55614
+ Field({ nullable: true }),
55615
+ __metadata("design:type", String)
55616
+ ], RunMJAPIKeyApplicationViewResult.prototype, "ErrorMessage", void 0);
55617
+ __decorate([
55618
+ Field(() => Boolean, { nullable: false }),
55619
+ __metadata("design:type", Boolean)
55620
+ ], RunMJAPIKeyApplicationViewResult.prototype, "Success", void 0);
55621
+ RunMJAPIKeyApplicationViewResult = __decorate([
55622
+ ObjectType()
55623
+ ], RunMJAPIKeyApplicationViewResult);
55624
+ export { RunMJAPIKeyApplicationViewResult };
55625
+ let MJAPIKeyApplicationResolver = class MJAPIKeyApplicationResolver extends ResolverBase {
55626
+ async RunMJAPIKeyApplicationViewByID(input, { providers, userPayload }, pubSub) {
55627
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55628
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
55629
+ }
55630
+ async RunMJAPIKeyApplicationViewByName(input, { providers, userPayload }, pubSub) {
55631
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55632
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
55633
+ }
55634
+ async RunMJAPIKeyApplicationDynamicView(input, { providers, userPayload }, pubSub) {
55635
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55636
+ input.EntityName = 'MJ: API Key Applications';
55637
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
55638
+ }
55639
+ async MJAPIKeyApplication(ID, { dataSources, userPayload, providers }, pubSub) {
55640
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
55641
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55642
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55643
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
55644
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55645
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Applications', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
55646
+ return result;
55647
+ }
55648
+ async CreateMJAPIKeyApplication(input, { providers, userPayload }, pubSub) {
55649
+ const provider = GetReadWriteProvider(providers);
55650
+ return this.CreateRecord('MJ: API Key Applications', input, provider, userPayload, pubSub);
55651
+ }
55652
+ async UpdateMJAPIKeyApplication(input, { providers, userPayload }, pubSub) {
55653
+ const provider = GetReadWriteProvider(providers);
55654
+ return this.UpdateRecord('MJ: API Key Applications', input, provider, userPayload, pubSub);
55655
+ }
55656
+ async DeleteMJAPIKeyApplication(ID, options, { providers, userPayload }, pubSub) {
55657
+ const provider = GetReadWriteProvider(providers);
55658
+ const key = new CompositeKey([{ FieldName: 'ID', Value: ID }]);
55659
+ return this.DeleteRecord('MJ: API Key Applications', key, options, provider, userPayload, pubSub);
55660
+ }
55661
+ };
55662
+ __decorate([
55663
+ Query(() => RunMJAPIKeyApplicationViewResult),
55664
+ __param(0, Arg('input', () => RunViewByIDInput)),
55665
+ __param(1, Ctx()),
55666
+ __param(2, PubSub()),
55667
+ __metadata("design:type", Function),
55668
+ __metadata("design:paramtypes", [RunViewByIDInput, Object, PubSubEngine]),
55669
+ __metadata("design:returntype", Promise)
55670
+ ], MJAPIKeyApplicationResolver.prototype, "RunMJAPIKeyApplicationViewByID", null);
55671
+ __decorate([
55672
+ Query(() => RunMJAPIKeyApplicationViewResult),
55673
+ __param(0, Arg('input', () => RunViewByNameInput)),
55674
+ __param(1, Ctx()),
55675
+ __param(2, PubSub()),
55676
+ __metadata("design:type", Function),
55677
+ __metadata("design:paramtypes", [RunViewByNameInput, Object, PubSubEngine]),
55678
+ __metadata("design:returntype", Promise)
55679
+ ], MJAPIKeyApplicationResolver.prototype, "RunMJAPIKeyApplicationViewByName", null);
55680
+ __decorate([
55681
+ Query(() => RunMJAPIKeyApplicationViewResult),
55682
+ __param(0, Arg('input', () => RunDynamicViewInput)),
55683
+ __param(1, Ctx()),
55684
+ __param(2, PubSub()),
55685
+ __metadata("design:type", Function),
55686
+ __metadata("design:paramtypes", [RunDynamicViewInput, Object, PubSubEngine]),
55687
+ __metadata("design:returntype", Promise)
55688
+ ], MJAPIKeyApplicationResolver.prototype, "RunMJAPIKeyApplicationDynamicView", null);
55689
+ __decorate([
55690
+ Query(() => MJAPIKeyApplication_, { nullable: true }),
55691
+ __param(0, Arg('ID', () => String)),
55692
+ __param(1, Ctx()),
55693
+ __param(2, PubSub()),
55694
+ __metadata("design:type", Function),
55695
+ __metadata("design:paramtypes", [String, Object, PubSubEngine]),
55696
+ __metadata("design:returntype", Promise)
55697
+ ], MJAPIKeyApplicationResolver.prototype, "MJAPIKeyApplication", null);
55698
+ __decorate([
55699
+ Mutation(() => MJAPIKeyApplication_),
55700
+ __param(0, Arg('input', () => CreateMJAPIKeyApplicationInput)),
55701
+ __param(1, Ctx()),
55702
+ __param(2, PubSub()),
55703
+ __metadata("design:type", Function),
55704
+ __metadata("design:paramtypes", [CreateMJAPIKeyApplicationInput, Object, PubSubEngine]),
55705
+ __metadata("design:returntype", Promise)
55706
+ ], MJAPIKeyApplicationResolver.prototype, "CreateMJAPIKeyApplication", null);
55707
+ __decorate([
55708
+ Mutation(() => MJAPIKeyApplication_),
55709
+ __param(0, Arg('input', () => UpdateMJAPIKeyApplicationInput)),
55710
+ __param(1, Ctx()),
55711
+ __param(2, PubSub()),
55712
+ __metadata("design:type", Function),
55713
+ __metadata("design:paramtypes", [UpdateMJAPIKeyApplicationInput, Object, PubSubEngine]),
55714
+ __metadata("design:returntype", Promise)
55715
+ ], MJAPIKeyApplicationResolver.prototype, "UpdateMJAPIKeyApplication", null);
55716
+ __decorate([
55717
+ Mutation(() => MJAPIKeyApplication_),
55718
+ __param(0, Arg('ID', () => String)),
55719
+ __param(1, Arg('options___', () => DeleteOptionsInput)),
55720
+ __param(2, Ctx()),
55721
+ __param(3, PubSub()),
55722
+ __metadata("design:type", Function),
55723
+ __metadata("design:paramtypes", [String, DeleteOptionsInput, Object, PubSubEngine]),
55724
+ __metadata("design:returntype", Promise)
55725
+ ], MJAPIKeyApplicationResolver.prototype, "DeleteMJAPIKeyApplication", null);
55726
+ MJAPIKeyApplicationResolver = __decorate([
55727
+ Resolver(MJAPIKeyApplication_)
55728
+ ], MJAPIKeyApplicationResolver);
55729
+ export { MJAPIKeyApplicationResolver };
55730
+ let MJAPIKeyScope_ = class MJAPIKeyScope_ {
55731
+ ID;
55732
+ APIKeyID;
55733
+ ScopeID;
55734
+ _mj__CreatedAt;
55735
+ _mj__UpdatedAt;
55736
+ ResourcePattern;
55737
+ PatternType;
55738
+ IsDeny;
55739
+ Priority;
55740
+ APIKey;
55741
+ Scope;
55742
+ };
55743
+ __decorate([
55744
+ Field(),
55745
+ MaxLength(16),
55746
+ __metadata("design:type", String)
55747
+ ], MJAPIKeyScope_.prototype, "ID", void 0);
55748
+ __decorate([
55749
+ Field(),
55750
+ MaxLength(16),
55751
+ __metadata("design:type", String)
55752
+ ], MJAPIKeyScope_.prototype, "APIKeyID", void 0);
55753
+ __decorate([
55754
+ Field(),
55755
+ MaxLength(16),
55756
+ __metadata("design:type", String)
55757
+ ], MJAPIKeyScope_.prototype, "ScopeID", void 0);
55758
+ __decorate([
55759
+ Field(),
55760
+ MaxLength(10),
55761
+ __metadata("design:type", Date)
55762
+ ], MJAPIKeyScope_.prototype, "_mj__CreatedAt", void 0);
55763
+ __decorate([
55764
+ Field(),
55765
+ MaxLength(10),
55766
+ __metadata("design:type", Date)
55767
+ ], MJAPIKeyScope_.prototype, "_mj__UpdatedAt", void 0);
55768
+ __decorate([
55769
+ Field({ nullable: true, description: `Glob pattern for matching resources (e.g., Users,Accounts or Skip* or *). NULL means match all resources under this scope.` }),
55770
+ MaxLength(1500),
55771
+ __metadata("design:type", String)
55772
+ ], MJAPIKeyScope_.prototype, "ResourcePattern", void 0);
55773
+ __decorate([
55774
+ Field({ description: `How to interpret the pattern: Include (grant if matches) or Exclude (grant if does NOT match).` }),
55775
+ MaxLength(40),
55776
+ __metadata("design:type", String)
55777
+ ], MJAPIKeyScope_.prototype, "PatternType", void 0);
55778
+ __decorate([
55779
+ Field(() => Boolean, { description: `If true, this rule explicitly DENIES access. Deny rules trump allow rules at the same priority level.` }),
55780
+ __metadata("design:type", Boolean)
55781
+ ], MJAPIKeyScope_.prototype, "IsDeny", void 0);
55782
+ __decorate([
55783
+ Field(() => Int, { description: `Rule evaluation order. Higher priority rules are evaluated first. Within same priority, deny rules are evaluated before allow rules.` }),
55784
+ __metadata("design:type", Number)
55785
+ ], MJAPIKeyScope_.prototype, "Priority", void 0);
55786
+ __decorate([
55787
+ Field(),
55788
+ MaxLength(510),
55789
+ __metadata("design:type", String)
55790
+ ], MJAPIKeyScope_.prototype, "APIKey", void 0);
55791
+ __decorate([
55792
+ Field(),
55793
+ MaxLength(200),
55794
+ __metadata("design:type", String)
55795
+ ], MJAPIKeyScope_.prototype, "Scope", void 0);
55796
+ MJAPIKeyScope_ = __decorate([
55797
+ ObjectType({ description: `Junction table linking API keys to their assigned permission scopes. Each key can have multiple scopes, and scopes can be shared across multiple keys.` })
55798
+ ], MJAPIKeyScope_);
55799
+ export { MJAPIKeyScope_ };
55800
+ let CreateMJAPIKeyScopeInput = class CreateMJAPIKeyScopeInput {
55801
+ ID;
55802
+ APIKeyID;
55803
+ ScopeID;
55804
+ ResourcePattern;
55805
+ PatternType;
55806
+ IsDeny;
55807
+ Priority;
55808
+ };
55809
+ __decorate([
55810
+ Field({ nullable: true }),
55811
+ __metadata("design:type", String)
55812
+ ], CreateMJAPIKeyScopeInput.prototype, "ID", void 0);
55813
+ __decorate([
55814
+ Field({ nullable: true }),
55815
+ __metadata("design:type", String)
55816
+ ], CreateMJAPIKeyScopeInput.prototype, "APIKeyID", void 0);
55817
+ __decorate([
55818
+ Field({ nullable: true }),
55819
+ __metadata("design:type", String)
55820
+ ], CreateMJAPIKeyScopeInput.prototype, "ScopeID", void 0);
55821
+ __decorate([
55822
+ Field({ nullable: true }),
55823
+ __metadata("design:type", String)
55824
+ ], CreateMJAPIKeyScopeInput.prototype, "ResourcePattern", void 0);
55825
+ __decorate([
55826
+ Field({ nullable: true }),
55827
+ __metadata("design:type", String)
55828
+ ], CreateMJAPIKeyScopeInput.prototype, "PatternType", void 0);
55829
+ __decorate([
55830
+ Field(() => Boolean, { nullable: true }),
55831
+ __metadata("design:type", Boolean)
55832
+ ], CreateMJAPIKeyScopeInput.prototype, "IsDeny", void 0);
55833
+ __decorate([
55834
+ Field(() => Int, { nullable: true }),
55835
+ __metadata("design:type", Number)
55836
+ ], CreateMJAPIKeyScopeInput.prototype, "Priority", void 0);
55837
+ CreateMJAPIKeyScopeInput = __decorate([
55838
+ InputType()
55839
+ ], CreateMJAPIKeyScopeInput);
55840
+ export { CreateMJAPIKeyScopeInput };
55841
+ let UpdateMJAPIKeyScopeInput = class UpdateMJAPIKeyScopeInput {
55842
+ ID;
55843
+ APIKeyID;
55844
+ ScopeID;
55845
+ ResourcePattern;
55846
+ PatternType;
55847
+ IsDeny;
55848
+ Priority;
55849
+ OldValues___;
55850
+ };
55851
+ __decorate([
55852
+ Field(),
55853
+ __metadata("design:type", String)
55854
+ ], UpdateMJAPIKeyScopeInput.prototype, "ID", void 0);
55855
+ __decorate([
55856
+ Field({ nullable: true }),
55857
+ __metadata("design:type", String)
55858
+ ], UpdateMJAPIKeyScopeInput.prototype, "APIKeyID", void 0);
55859
+ __decorate([
55860
+ Field({ nullable: true }),
55861
+ __metadata("design:type", String)
55862
+ ], UpdateMJAPIKeyScopeInput.prototype, "ScopeID", void 0);
55863
+ __decorate([
55864
+ Field({ nullable: true }),
55865
+ __metadata("design:type", String)
55866
+ ], UpdateMJAPIKeyScopeInput.prototype, "ResourcePattern", void 0);
55867
+ __decorate([
55868
+ Field({ nullable: true }),
55869
+ __metadata("design:type", String)
55870
+ ], UpdateMJAPIKeyScopeInput.prototype, "PatternType", void 0);
55871
+ __decorate([
55872
+ Field(() => Boolean, { nullable: true }),
55873
+ __metadata("design:type", Boolean)
55874
+ ], UpdateMJAPIKeyScopeInput.prototype, "IsDeny", void 0);
55875
+ __decorate([
55876
+ Field(() => Int, { nullable: true }),
55877
+ __metadata("design:type", Number)
55878
+ ], UpdateMJAPIKeyScopeInput.prototype, "Priority", void 0);
55879
+ __decorate([
55880
+ Field(() => [KeyValuePairInput], { nullable: true }),
55881
+ __metadata("design:type", Array)
55882
+ ], UpdateMJAPIKeyScopeInput.prototype, "OldValues___", void 0);
55883
+ UpdateMJAPIKeyScopeInput = __decorate([
55884
+ InputType()
55885
+ ], UpdateMJAPIKeyScopeInput);
55886
+ export { UpdateMJAPIKeyScopeInput };
55887
+ let RunMJAPIKeyScopeViewResult = class RunMJAPIKeyScopeViewResult {
55888
+ Results;
55889
+ UserViewRunID;
55890
+ RowCount;
55891
+ TotalRowCount;
55892
+ ExecutionTime;
55893
+ ErrorMessage;
55894
+ Success;
55895
+ };
55896
+ __decorate([
55897
+ Field(() => [MJAPIKeyScope_]),
55898
+ __metadata("design:type", Array)
55899
+ ], RunMJAPIKeyScopeViewResult.prototype, "Results", void 0);
55900
+ __decorate([
55901
+ Field(() => String, { nullable: true }),
55902
+ __metadata("design:type", String)
55903
+ ], RunMJAPIKeyScopeViewResult.prototype, "UserViewRunID", void 0);
55904
+ __decorate([
55905
+ Field(() => Int, { nullable: true }),
55906
+ __metadata("design:type", Number)
55907
+ ], RunMJAPIKeyScopeViewResult.prototype, "RowCount", void 0);
55908
+ __decorate([
55909
+ Field(() => Int, { nullable: true }),
55910
+ __metadata("design:type", Number)
55911
+ ], RunMJAPIKeyScopeViewResult.prototype, "TotalRowCount", void 0);
55912
+ __decorate([
55913
+ Field(() => Int, { nullable: true }),
55914
+ __metadata("design:type", Number)
55915
+ ], RunMJAPIKeyScopeViewResult.prototype, "ExecutionTime", void 0);
55916
+ __decorate([
55917
+ Field({ nullable: true }),
55918
+ __metadata("design:type", String)
55919
+ ], RunMJAPIKeyScopeViewResult.prototype, "ErrorMessage", void 0);
55920
+ __decorate([
55921
+ Field(() => Boolean, { nullable: false }),
55922
+ __metadata("design:type", Boolean)
55923
+ ], RunMJAPIKeyScopeViewResult.prototype, "Success", void 0);
55924
+ RunMJAPIKeyScopeViewResult = __decorate([
55925
+ ObjectType()
55926
+ ], RunMJAPIKeyScopeViewResult);
55927
+ export { RunMJAPIKeyScopeViewResult };
55928
+ let MJAPIKeyScopeResolver = class MJAPIKeyScopeResolver extends ResolverBase {
55929
+ async RunMJAPIKeyScopeViewByID(input, { providers, userPayload }, pubSub) {
55930
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55931
+ return super.RunViewByIDGeneric(input, provider, userPayload, pubSub);
55932
+ }
55933
+ async RunMJAPIKeyScopeViewByName(input, { providers, userPayload }, pubSub) {
55934
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55935
+ return super.RunViewByNameGeneric(input, provider, userPayload, pubSub);
55936
+ }
55937
+ async RunMJAPIKeyScopeDynamicView(input, { providers, userPayload }, pubSub) {
55938
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55939
+ input.EntityName = 'MJ: API Key Scopes';
55940
+ return super.RunDynamicViewGeneric(input, provider, userPayload, pubSub);
55941
+ }
55942
+ async MJAPIKeyScope(ID, { dataSources, userPayload, providers }, pubSub) {
55943
+ this.CheckUserReadPermissions('MJ: API Key Scopes', userPayload);
55944
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
55945
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
55946
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyScopes] WHERE [ID]='${ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Scopes', userPayload, EntityPermissionType.Read, 'AND');
55947
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
55948
+ const result = await this.MapFieldNamesToCodeNames('MJ: API Key Scopes', rows && rows.length > 0 ? rows[0] : {}, this.GetUserFromPayload(userPayload));
55949
+ return result;
55950
+ }
55951
+ async CreateMJAPIKeyScope(input, { providers, userPayload }, pubSub) {
55952
+ const provider = GetReadWriteProvider(providers);
55953
+ return this.CreateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
55954
+ }
55955
+ async UpdateMJAPIKeyScope(input, { providers, userPayload }, pubSub) {
55956
+ const provider = GetReadWriteProvider(providers);
55957
+ return this.UpdateRecord('MJ: API Key Scopes', input, provider, userPayload, pubSub);
55958
+ }
55959
+ async DeleteMJAPIKeyScope(ID, options, { providers, userPayload }, pubSub) {
55960
+ const provider = GetReadWriteProvider(providers);
55961
+ const key = new CompositeKey([{ FieldName: 'ID', Value: ID }]);
55962
+ return this.DeleteRecord('MJ: API Key Scopes', key, options, provider, userPayload, pubSub);
55963
+ }
55964
+ };
55965
+ __decorate([
55966
+ Query(() => RunMJAPIKeyScopeViewResult),
55967
+ __param(0, Arg('input', () => RunViewByIDInput)),
55968
+ __param(1, Ctx()),
55969
+ __param(2, PubSub()),
55970
+ __metadata("design:type", Function),
55971
+ __metadata("design:paramtypes", [RunViewByIDInput, Object, PubSubEngine]),
55972
+ __metadata("design:returntype", Promise)
55973
+ ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeViewByID", null);
55974
+ __decorate([
55975
+ Query(() => RunMJAPIKeyScopeViewResult),
55976
+ __param(0, Arg('input', () => RunViewByNameInput)),
55977
+ __param(1, Ctx()),
55978
+ __param(2, PubSub()),
55979
+ __metadata("design:type", Function),
55980
+ __metadata("design:paramtypes", [RunViewByNameInput, Object, PubSubEngine]),
55981
+ __metadata("design:returntype", Promise)
55982
+ ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeViewByName", null);
55983
+ __decorate([
55984
+ Query(() => RunMJAPIKeyScopeViewResult),
55985
+ __param(0, Arg('input', () => RunDynamicViewInput)),
55986
+ __param(1, Ctx()),
55987
+ __param(2, PubSub()),
55988
+ __metadata("design:type", Function),
55989
+ __metadata("design:paramtypes", [RunDynamicViewInput, Object, PubSubEngine]),
55990
+ __metadata("design:returntype", Promise)
55991
+ ], MJAPIKeyScopeResolver.prototype, "RunMJAPIKeyScopeDynamicView", null);
55992
+ __decorate([
55993
+ Query(() => MJAPIKeyScope_, { nullable: true }),
55994
+ __param(0, Arg('ID', () => String)),
55995
+ __param(1, Ctx()),
55996
+ __param(2, PubSub()),
55997
+ __metadata("design:type", Function),
55998
+ __metadata("design:paramtypes", [String, Object, PubSubEngine]),
55999
+ __metadata("design:returntype", Promise)
56000
+ ], MJAPIKeyScopeResolver.prototype, "MJAPIKeyScope", null);
56001
+ __decorate([
56002
+ Mutation(() => MJAPIKeyScope_),
56003
+ __param(0, Arg('input', () => CreateMJAPIKeyScopeInput)),
56004
+ __param(1, Ctx()),
56005
+ __param(2, PubSub()),
56006
+ __metadata("design:type", Function),
56007
+ __metadata("design:paramtypes", [CreateMJAPIKeyScopeInput, Object, PubSubEngine]),
56008
+ __metadata("design:returntype", Promise)
56009
+ ], MJAPIKeyScopeResolver.prototype, "CreateMJAPIKeyScope", null);
56010
+ __decorate([
56011
+ Mutation(() => MJAPIKeyScope_),
56012
+ __param(0, Arg('input', () => UpdateMJAPIKeyScopeInput)),
56013
+ __param(1, Ctx()),
56014
+ __param(2, PubSub()),
56015
+ __metadata("design:type", Function),
56016
+ __metadata("design:paramtypes", [UpdateMJAPIKeyScopeInput, Object, PubSubEngine]),
56017
+ __metadata("design:returntype", Promise)
56018
+ ], MJAPIKeyScopeResolver.prototype, "UpdateMJAPIKeyScope", null);
56019
+ __decorate([
56020
+ Mutation(() => MJAPIKeyScope_),
56021
+ __param(0, Arg('ID', () => String)),
56022
+ __param(1, Arg('options___', () => DeleteOptionsInput)),
56023
+ __param(2, Ctx()),
56024
+ __param(3, PubSub()),
56025
+ __metadata("design:type", Function),
56026
+ __metadata("design:paramtypes", [String, DeleteOptionsInput, Object, PubSubEngine]),
56027
+ __metadata("design:returntype", Promise)
56028
+ ], MJAPIKeyScopeResolver.prototype, "DeleteMJAPIKeyScope", null);
56029
+ MJAPIKeyScopeResolver = __decorate([
56030
+ Resolver(MJAPIKeyScope_)
56031
+ ], MJAPIKeyScopeResolver);
56032
+ export { MJAPIKeyScopeResolver };
56033
+ let MJAPIKeyUsageLog_ = class MJAPIKeyUsageLog_ {
56034
+ ID;
56035
+ APIKeyID;
56036
+ Endpoint;
56037
+ Operation;
56038
+ Method;
56039
+ StatusCode;
56040
+ ResponseTimeMs;
56041
+ IPAddress;
56042
+ UserAgent;
56043
+ _mj__CreatedAt;
56044
+ _mj__UpdatedAt;
56045
+ ApplicationID;
56046
+ RequestedResource;
56047
+ ScopesEvaluated;
56048
+ AuthorizationResult;
56049
+ DeniedReason;
56050
+ APIKey;
56051
+ Application;
56052
+ };
56053
+ __decorate([
56054
+ Field(),
56055
+ MaxLength(16),
56056
+ __metadata("design:type", String)
56057
+ ], MJAPIKeyUsageLog_.prototype, "ID", void 0);
56058
+ __decorate([
56059
+ Field(),
56060
+ MaxLength(16),
56061
+ __metadata("design:type", String)
56062
+ ], MJAPIKeyUsageLog_.prototype, "APIKeyID", void 0);
56063
+ __decorate([
56064
+ Field({ description: `The API endpoint path that was accessed (e.g., /mcp, /graphql, /api/v1/entities).` }),
56065
+ MaxLength(1000),
56066
+ __metadata("design:type", String)
56067
+ ], MJAPIKeyUsageLog_.prototype, "Endpoint", void 0);
56068
+ __decorate([
56069
+ Field({ nullable: true, description: `The specific operation performed, such as the GraphQL operation name or MCP tool invoked (e.g., Get_Users_Record, Run_Agent).` }),
56070
+ MaxLength(510),
56071
+ __metadata("design:type", String)
56072
+ ], MJAPIKeyUsageLog_.prototype, "Operation", void 0);
56073
+ __decorate([
56074
+ Field({ description: `HTTP method used for the request (GET, POST, PUT, DELETE, etc.).` }),
56075
+ MaxLength(20),
56076
+ __metadata("design:type", String)
56077
+ ], MJAPIKeyUsageLog_.prototype, "Method", void 0);
56078
+ __decorate([
56079
+ Field(() => Int, { description: `HTTP response status code returned to the client (e.g., 200 for success, 401 for unauthorized, 500 for server error).` }),
56080
+ __metadata("design:type", Number)
56081
+ ], MJAPIKeyUsageLog_.prototype, "StatusCode", void 0);
56082
+ __decorate([
56083
+ Field(() => Int, { nullable: true, description: `Total time in milliseconds to process the request and return a response. Useful for performance monitoring.` }),
56084
+ __metadata("design:type", Number)
56085
+ ], MJAPIKeyUsageLog_.prototype, "ResponseTimeMs", void 0);
56086
+ __decorate([
56087
+ Field({ nullable: true, description: `Client IP address that made the request. Supports both IPv4 and IPv6 addresses (up to 45 characters).` }),
56088
+ MaxLength(90),
56089
+ __metadata("design:type", String)
56090
+ ], MJAPIKeyUsageLog_.prototype, "IPAddress", void 0);
56091
+ __decorate([
56092
+ Field({ nullable: true, description: `User-Agent header from the HTTP request, identifying the client application or library making the API call.` }),
56093
+ MaxLength(1000),
56094
+ __metadata("design:type", String)
56095
+ ], MJAPIKeyUsageLog_.prototype, "UserAgent", void 0);
56096
+ __decorate([
56097
+ Field(),
56098
+ MaxLength(10),
56099
+ __metadata("design:type", Date)
56100
+ ], MJAPIKeyUsageLog_.prototype, "_mj__CreatedAt", void 0);
56101
+ __decorate([
56102
+ Field(),
56103
+ MaxLength(10),
56104
+ __metadata("design:type", Date)
56105
+ ], MJAPIKeyUsageLog_.prototype, "_mj__UpdatedAt", void 0);
56106
+ __decorate([
56107
+ Field({ nullable: true, description: `The application through which this request was made (MJAPI, MCPServer, etc.).` }),
56108
+ MaxLength(16),
56109
+ __metadata("design:type", String)
56110
+ ], MJAPIKeyUsageLog_.prototype, "ApplicationID", void 0);
56111
+ __decorate([
56112
+ Field({ nullable: true, description: `The specific resource that was requested (e.g., entity name, agent name, query name).` }),
56113
+ MaxLength(1000),
56114
+ __metadata("design:type", String)
56115
+ ], MJAPIKeyUsageLog_.prototype, "RequestedResource", void 0);
56116
+ __decorate([
56117
+ Field({ nullable: true, description: `JSON array containing detailed evaluation of each scope rule checked during authorization.` }),
56118
+ __metadata("design:type", String)
56119
+ ], MJAPIKeyUsageLog_.prototype, "ScopesEvaluated", void 0);
56120
+ __decorate([
56121
+ Field({ description: `Final authorization result: Allowed, Denied, or NoScopesRequired (for operations that do not require scope checks).` }),
56122
+ MaxLength(40),
56123
+ __metadata("design:type", String)
56124
+ ], MJAPIKeyUsageLog_.prototype, "AuthorizationResult", void 0);
56125
+ __decorate([
56126
+ Field({ nullable: true, description: `When authorization is denied, explains why (e.g., app ceiling blocked, no matching key scope, explicit deny rule).` }),
56127
+ MaxLength(1000),
56128
+ __metadata("design:type", String)
56129
+ ], MJAPIKeyUsageLog_.prototype, "DeniedReason", void 0);
56130
+ __decorate([
56131
+ Field(),
56132
+ MaxLength(510),
56133
+ __metadata("design:type", String)
56134
+ ], MJAPIKeyUsageLog_.prototype, "APIKey", void 0);
56135
+ __decorate([
56136
+ Field({ nullable: true }),
56137
+ MaxLength(200),
56138
+ __metadata("design:type", String)
56139
+ ], MJAPIKeyUsageLog_.prototype, "Application", void 0);
56140
+ MJAPIKeyUsageLog_ = __decorate([
56141
+ ObjectType({ description: `Audit log tracking all API key usage for analytics, debugging, and security monitoring. Records each request including endpoint, response status, timing, and client information.` })
56142
+ ], MJAPIKeyUsageLog_);
56143
+ export { MJAPIKeyUsageLog_ };
56144
+ let CreateMJAPIKeyUsageLogInput = class CreateMJAPIKeyUsageLogInput {
56145
+ ID;
56146
+ APIKeyID;
56147
+ Endpoint;
56148
+ Operation;
56149
+ Method;
56150
+ StatusCode;
56151
+ ResponseTimeMs;
56152
+ IPAddress;
56153
+ UserAgent;
56154
+ ApplicationID;
56155
+ RequestedResource;
56156
+ ScopesEvaluated;
56157
+ AuthorizationResult;
56158
+ DeniedReason;
56159
+ };
56160
+ __decorate([
56161
+ Field({ nullable: true }),
56162
+ __metadata("design:type", String)
56163
+ ], CreateMJAPIKeyUsageLogInput.prototype, "ID", void 0);
56164
+ __decorate([
56165
+ Field({ nullable: true }),
56166
+ __metadata("design:type", String)
56167
+ ], CreateMJAPIKeyUsageLogInput.prototype, "APIKeyID", void 0);
56168
+ __decorate([
56169
+ Field({ nullable: true }),
56170
+ __metadata("design:type", String)
56171
+ ], CreateMJAPIKeyUsageLogInput.prototype, "Endpoint", void 0);
56172
+ __decorate([
56173
+ Field({ nullable: true }),
56174
+ __metadata("design:type", String)
56175
+ ], CreateMJAPIKeyUsageLogInput.prototype, "Operation", void 0);
56176
+ __decorate([
56177
+ Field({ nullable: true }),
56178
+ __metadata("design:type", String)
56179
+ ], CreateMJAPIKeyUsageLogInput.prototype, "Method", void 0);
56180
+ __decorate([
56181
+ Field(() => Int, { nullable: true }),
56182
+ __metadata("design:type", Number)
56183
+ ], CreateMJAPIKeyUsageLogInput.prototype, "StatusCode", void 0);
56184
+ __decorate([
56185
+ Field(() => Int, { nullable: true }),
56186
+ __metadata("design:type", Number)
56187
+ ], CreateMJAPIKeyUsageLogInput.prototype, "ResponseTimeMs", void 0);
56188
+ __decorate([
56189
+ Field({ nullable: true }),
56190
+ __metadata("design:type", String)
56191
+ ], CreateMJAPIKeyUsageLogInput.prototype, "IPAddress", void 0);
56192
+ __decorate([
56193
+ Field({ nullable: true }),
56194
+ __metadata("design:type", String)
56195
+ ], CreateMJAPIKeyUsageLogInput.prototype, "UserAgent", void 0);
56196
+ __decorate([
56197
+ Field({ nullable: true }),
56198
+ __metadata("design:type", String)
56199
+ ], CreateMJAPIKeyUsageLogInput.prototype, "ApplicationID", void 0);
56200
+ __decorate([
56201
+ Field({ nullable: true }),
56202
+ __metadata("design:type", String)
56203
+ ], CreateMJAPIKeyUsageLogInput.prototype, "RequestedResource", void 0);
56204
+ __decorate([
56205
+ Field({ nullable: true }),
56206
+ __metadata("design:type", String)
56207
+ ], CreateMJAPIKeyUsageLogInput.prototype, "ScopesEvaluated", void 0);
56208
+ __decorate([
56209
+ Field({ nullable: true }),
56210
+ __metadata("design:type", String)
56211
+ ], CreateMJAPIKeyUsageLogInput.prototype, "AuthorizationResult", void 0);
56212
+ __decorate([
56213
+ Field({ nullable: true }),
56214
+ __metadata("design:type", String)
56215
+ ], CreateMJAPIKeyUsageLogInput.prototype, "DeniedReason", void 0);
56216
+ CreateMJAPIKeyUsageLogInput = __decorate([
56217
+ InputType()
56218
+ ], CreateMJAPIKeyUsageLogInput);
56219
+ export { CreateMJAPIKeyUsageLogInput };
56220
+ let UpdateMJAPIKeyUsageLogInput = class UpdateMJAPIKeyUsageLogInput {
56221
+ ID;
56222
+ APIKeyID;
56223
+ Endpoint;
56224
+ Operation;
56225
+ Method;
56226
+ StatusCode;
56227
+ ResponseTimeMs;
56228
+ IPAddress;
56229
+ UserAgent;
56230
+ ApplicationID;
56231
+ RequestedResource;
56232
+ ScopesEvaluated;
56233
+ AuthorizationResult;
56234
+ DeniedReason;
56235
+ OldValues___;
56236
+ };
56237
+ __decorate([
56238
+ Field(),
56239
+ __metadata("design:type", String)
56240
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "ID", void 0);
56241
+ __decorate([
56242
+ Field({ nullable: true }),
56243
+ __metadata("design:type", String)
56244
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "APIKeyID", void 0);
56245
+ __decorate([
56246
+ Field({ nullable: true }),
56247
+ __metadata("design:type", String)
56248
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "Endpoint", void 0);
56249
+ __decorate([
56250
+ Field({ nullable: true }),
56251
+ __metadata("design:type", String)
56252
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "Operation", void 0);
56253
+ __decorate([
56254
+ Field({ nullable: true }),
56255
+ __metadata("design:type", String)
56256
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "Method", void 0);
56257
+ __decorate([
56258
+ Field(() => Int, { nullable: true }),
56259
+ __metadata("design:type", Number)
56260
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "StatusCode", void 0);
54880
56261
  __decorate([
54881
56262
  Field(() => Int, { nullable: true }),
54882
56263
  __metadata("design:type", Number)
@@ -54889,6 +56270,26 @@ __decorate([
54889
56270
  Field({ nullable: true }),
54890
56271
  __metadata("design:type", String)
54891
56272
  ], UpdateMJAPIKeyUsageLogInput.prototype, "UserAgent", void 0);
56273
+ __decorate([
56274
+ Field({ nullable: true }),
56275
+ __metadata("design:type", String)
56276
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "ApplicationID", void 0);
56277
+ __decorate([
56278
+ Field({ nullable: true }),
56279
+ __metadata("design:type", String)
56280
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "RequestedResource", void 0);
56281
+ __decorate([
56282
+ Field({ nullable: true }),
56283
+ __metadata("design:type", String)
56284
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "ScopesEvaluated", void 0);
56285
+ __decorate([
56286
+ Field({ nullable: true }),
56287
+ __metadata("design:type", String)
56288
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "AuthorizationResult", void 0);
56289
+ __decorate([
56290
+ Field({ nullable: true }),
56291
+ __metadata("design:type", String)
56292
+ ], UpdateMJAPIKeyUsageLogInput.prototype, "DeniedReason", void 0);
54892
56293
  __decorate([
54893
56294
  Field(() => [KeyValuePairInput], { nullable: true }),
54894
56295
  __metadata("design:type", Array)
@@ -55059,6 +56460,7 @@ let MJAPIKey_ = class MJAPIKey_ {
55059
56460
  CreatedByUser;
55060
56461
  MJ_APIKeyUsageLogs_APIKeyIDArray;
55061
56462
  MJ_APIKeyScopes_APIKeyIDArray;
56463
+ MJ_APIKeyApplications_APIKeyIDArray;
55062
56464
  };
55063
56465
  __decorate([
55064
56466
  Field(),
@@ -55133,6 +56535,10 @@ __decorate([
55133
56535
  Field(() => [MJAPIKeyScope_]),
55134
56536
  __metadata("design:type", Array)
55135
56537
  ], MJAPIKey_.prototype, "MJ_APIKeyScopes_APIKeyIDArray", void 0);
56538
+ __decorate([
56539
+ Field(() => [MJAPIKeyApplication_]),
56540
+ __metadata("design:type", Array)
56541
+ ], MJAPIKey_.prototype, "MJ_APIKeyApplications_APIKeyIDArray", void 0);
55136
56542
  MJAPIKey_ = __decorate([
55137
56543
  ObjectType({ description: `Stores API keys for programmatic access to MemberJunction services. Keys are stored as SHA-256 hashes for security. Each key is associated with a user context and can have multiple permission scopes assigned.` })
55138
56544
  ], MJAPIKey_);
@@ -55326,6 +56732,15 @@ let MJAPIKeyResolver = class MJAPIKeyResolver extends ResolverBase {
55326
56732
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
55327
56733
  return result;
55328
56734
  }
56735
+ async MJ_APIKeyApplications_APIKeyIDArray(mjapikey_, { dataSources, userPayload, providers }, pubSub) {
56736
+ this.CheckUserReadPermissions('MJ: API Key Applications', userPayload);
56737
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
56738
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
56739
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeyApplications] WHERE [APIKeyID]='${mjapikey_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Key Applications', userPayload, EntityPermissionType.Read, 'AND');
56740
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
56741
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Applications', rows, this.GetUserFromPayload(userPayload));
56742
+ return result;
56743
+ }
55329
56744
  async CreateMJAPIKey(input, { providers, userPayload }, pubSub) {
55330
56745
  const provider = GetReadWriteProvider(providers);
55331
56746
  return this.CreateRecord('MJ: API Keys', input, provider, userPayload, pubSub);
@@ -55394,6 +56809,15 @@ __decorate([
55394
56809
  __metadata("design:paramtypes", [MJAPIKey_, Object, PubSubEngine]),
55395
56810
  __metadata("design:returntype", Promise)
55396
56811
  ], MJAPIKeyResolver.prototype, "MJ_APIKeyScopes_APIKeyIDArray", null);
56812
+ __decorate([
56813
+ FieldResolver(() => [MJAPIKeyApplication_]),
56814
+ __param(0, Root()),
56815
+ __param(1, Ctx()),
56816
+ __param(2, PubSub()),
56817
+ __metadata("design:type", Function),
56818
+ __metadata("design:paramtypes", [MJAPIKey_, Object, PubSubEngine]),
56819
+ __metadata("design:returntype", Promise)
56820
+ ], MJAPIKeyResolver.prototype, "MJ_APIKeyApplications_APIKeyIDArray", null);
55397
56821
  __decorate([
55398
56822
  Mutation(() => MJAPIKey_),
55399
56823
  __param(0, Arg('input', () => CreateMJAPIKeyInput)),
@@ -55433,7 +56857,15 @@ let MJAPIScope_ = class MJAPIScope_ {
55433
56857
  Description;
55434
56858
  _mj__CreatedAt;
55435
56859
  _mj__UpdatedAt;
56860
+ ParentID;
56861
+ FullPath;
56862
+ ResourceType;
56863
+ IsActive;
56864
+ Parent;
56865
+ RootParentID;
55436
56866
  MJ_APIKeyScopes_ScopeIDArray;
56867
+ MJ_APIApplicationScopes_ScopeIDArray;
56868
+ MJ_APIScopes_ParentIDArray;
55437
56869
  };
55438
56870
  __decorate([
55439
56871
  Field(),
@@ -55465,10 +56897,47 @@ __decorate([
55465
56897
  MaxLength(10),
55466
56898
  __metadata("design:type", Date)
55467
56899
  ], MJAPIScope_.prototype, "_mj__UpdatedAt", void 0);
56900
+ __decorate([
56901
+ Field({ nullable: true, description: `Reference to parent scope for hierarchical organization. NULL indicates a root-level scope.` }),
56902
+ MaxLength(16),
56903
+ __metadata("design:type", String)
56904
+ ], MJAPIScope_.prototype, "ParentID", void 0);
56905
+ __decorate([
56906
+ Field({ description: `Full hierarchical path of the scope (e.g., entity:runview, agent:execute). Used for matching during authorization.` }),
56907
+ MaxLength(1000),
56908
+ __metadata("design:type", String)
56909
+ ], MJAPIScope_.prototype, "FullPath", void 0);
56910
+ __decorate([
56911
+ Field({ nullable: true, description: `Type of resource this scope applies to (Entity, Agent, Query, Mutation, or NULL for abstract grouping scopes).` }),
56912
+ MaxLength(100),
56913
+ __metadata("design:type", String)
56914
+ ], MJAPIScope_.prototype, "ResourceType", void 0);
56915
+ __decorate([
56916
+ Field(() => Boolean, { description: `Whether this scope is currently active. Inactive scopes are ignored during authorization.` }),
56917
+ __metadata("design:type", Boolean)
56918
+ ], MJAPIScope_.prototype, "IsActive", void 0);
56919
+ __decorate([
56920
+ Field({ nullable: true }),
56921
+ MaxLength(200),
56922
+ __metadata("design:type", String)
56923
+ ], MJAPIScope_.prototype, "Parent", void 0);
56924
+ __decorate([
56925
+ Field({ nullable: true }),
56926
+ MaxLength(16),
56927
+ __metadata("design:type", String)
56928
+ ], MJAPIScope_.prototype, "RootParentID", void 0);
55468
56929
  __decorate([
55469
56930
  Field(() => [MJAPIKeyScope_]),
55470
56931
  __metadata("design:type", Array)
55471
56932
  ], MJAPIScope_.prototype, "MJ_APIKeyScopes_ScopeIDArray", void 0);
56933
+ __decorate([
56934
+ Field(() => [MJAPIApplicationScope_]),
56935
+ __metadata("design:type", Array)
56936
+ ], MJAPIScope_.prototype, "MJ_APIApplicationScopes_ScopeIDArray", void 0);
56937
+ __decorate([
56938
+ Field(() => [MJAPIScope_]),
56939
+ __metadata("design:type", Array)
56940
+ ], MJAPIScope_.prototype, "MJ_APIScopes_ParentIDArray", void 0);
55472
56941
  MJAPIScope_ = __decorate([
55473
56942
  ObjectType({ description: `Defines reusable permission scopes that can be assigned to API keys. Scopes follow a hierarchical naming convention (e.g., entities:read, agents:execute, admin:*) and are grouped by category for organizational purposes.` })
55474
56943
  ], MJAPIScope_);
@@ -55478,6 +56947,10 @@ let CreateMJAPIScopeInput = class CreateMJAPIScopeInput {
55478
56947
  Name;
55479
56948
  Category;
55480
56949
  Description;
56950
+ ParentID;
56951
+ FullPath;
56952
+ ResourceType;
56953
+ IsActive;
55481
56954
  };
55482
56955
  __decorate([
55483
56956
  Field({ nullable: true }),
@@ -55495,6 +56968,22 @@ __decorate([
55495
56968
  Field({ nullable: true }),
55496
56969
  __metadata("design:type", String)
55497
56970
  ], CreateMJAPIScopeInput.prototype, "Description", void 0);
56971
+ __decorate([
56972
+ Field({ nullable: true }),
56973
+ __metadata("design:type", String)
56974
+ ], CreateMJAPIScopeInput.prototype, "ParentID", void 0);
56975
+ __decorate([
56976
+ Field({ nullable: true }),
56977
+ __metadata("design:type", String)
56978
+ ], CreateMJAPIScopeInput.prototype, "FullPath", void 0);
56979
+ __decorate([
56980
+ Field({ nullable: true }),
56981
+ __metadata("design:type", String)
56982
+ ], CreateMJAPIScopeInput.prototype, "ResourceType", void 0);
56983
+ __decorate([
56984
+ Field(() => Boolean, { nullable: true }),
56985
+ __metadata("design:type", Boolean)
56986
+ ], CreateMJAPIScopeInput.prototype, "IsActive", void 0);
55498
56987
  CreateMJAPIScopeInput = __decorate([
55499
56988
  InputType()
55500
56989
  ], CreateMJAPIScopeInput);
@@ -55504,6 +56993,10 @@ let UpdateMJAPIScopeInput = class UpdateMJAPIScopeInput {
55504
56993
  Name;
55505
56994
  Category;
55506
56995
  Description;
56996
+ ParentID;
56997
+ FullPath;
56998
+ ResourceType;
56999
+ IsActive;
55507
57000
  OldValues___;
55508
57001
  };
55509
57002
  __decorate([
@@ -55522,6 +57015,22 @@ __decorate([
55522
57015
  Field({ nullable: true }),
55523
57016
  __metadata("design:type", String)
55524
57017
  ], UpdateMJAPIScopeInput.prototype, "Description", void 0);
57018
+ __decorate([
57019
+ Field({ nullable: true }),
57020
+ __metadata("design:type", String)
57021
+ ], UpdateMJAPIScopeInput.prototype, "ParentID", void 0);
57022
+ __decorate([
57023
+ Field({ nullable: true }),
57024
+ __metadata("design:type", String)
57025
+ ], UpdateMJAPIScopeInput.prototype, "FullPath", void 0);
57026
+ __decorate([
57027
+ Field({ nullable: true }),
57028
+ __metadata("design:type", String)
57029
+ ], UpdateMJAPIScopeInput.prototype, "ResourceType", void 0);
57030
+ __decorate([
57031
+ Field(() => Boolean, { nullable: true }),
57032
+ __metadata("design:type", Boolean)
57033
+ ], UpdateMJAPIScopeInput.prototype, "IsActive", void 0);
55525
57034
  __decorate([
55526
57035
  Field(() => [KeyValuePairInput], { nullable: true }),
55527
57036
  __metadata("design:type", Array)
@@ -55603,6 +57112,24 @@ let MJAPIScopeResolver = class MJAPIScopeResolver extends ResolverBase {
55603
57112
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Key Scopes', rows, this.GetUserFromPayload(userPayload));
55604
57113
  return result;
55605
57114
  }
57115
+ async MJ_APIApplicationScopes_ScopeIDArray(mjapiscope_, { dataSources, userPayload, providers }, pubSub) {
57116
+ this.CheckUserReadPermissions('MJ: API Application Scopes', userPayload);
57117
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
57118
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
57119
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIApplicationScopes] WHERE [ScopeID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Application Scopes', userPayload, EntityPermissionType.Read, 'AND');
57120
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
57121
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Application Scopes', rows, this.GetUserFromPayload(userPayload));
57122
+ return result;
57123
+ }
57124
+ async MJ_APIScopes_ParentIDArray(mjapiscope_, { dataSources, userPayload, providers }, pubSub) {
57125
+ this.CheckUserReadPermissions('MJ: API Scopes', userPayload);
57126
+ const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
57127
+ const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
57128
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIScopes] WHERE [ParentID]='${mjapiscope_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Scopes', userPayload, EntityPermissionType.Read, 'AND');
57129
+ const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
57130
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Scopes', rows, this.GetUserFromPayload(userPayload));
57131
+ return result;
57132
+ }
55606
57133
  async CreateMJAPIScope(input, { providers, userPayload }, pubSub) {
55607
57134
  const provider = GetReadWriteProvider(providers);
55608
57135
  return this.CreateRecord('MJ: API Scopes', input, provider, userPayload, pubSub);
@@ -55662,6 +57189,24 @@ __decorate([
55662
57189
  __metadata("design:paramtypes", [MJAPIScope_, Object, PubSubEngine]),
55663
57190
  __metadata("design:returntype", Promise)
55664
57191
  ], MJAPIScopeResolver.prototype, "MJ_APIKeyScopes_ScopeIDArray", null);
57192
+ __decorate([
57193
+ FieldResolver(() => [MJAPIApplicationScope_]),
57194
+ __param(0, Root()),
57195
+ __param(1, Ctx()),
57196
+ __param(2, PubSub()),
57197
+ __metadata("design:type", Function),
57198
+ __metadata("design:paramtypes", [MJAPIScope_, Object, PubSubEngine]),
57199
+ __metadata("design:returntype", Promise)
57200
+ ], MJAPIScopeResolver.prototype, "MJ_APIApplicationScopes_ScopeIDArray", null);
57201
+ __decorate([
57202
+ FieldResolver(() => [MJAPIScope_]),
57203
+ __param(0, Root()),
57204
+ __param(1, Ctx()),
57205
+ __param(2, PubSub()),
57206
+ __metadata("design:type", Function),
57207
+ __metadata("design:paramtypes", [MJAPIScope_, Object, PubSubEngine]),
57208
+ __metadata("design:returntype", Promise)
57209
+ ], MJAPIScopeResolver.prototype, "MJ_APIScopes_ParentIDArray", null);
55665
57210
  __decorate([
55666
57211
  Mutation(() => MJAPIScope_),
55667
57212
  __param(0, Arg('input', () => CreateMJAPIScopeInput)),
@@ -92982,8 +94527,8 @@ let MJUser_ = class MJUser_ {
92982
94527
  MJ_DashboardCategoryLinks_UserIDArray;
92983
94528
  MJ_DashboardCategoryPermissions_UserIDArray;
92984
94529
  MJ_DashboardPermissions_SharedByUserIDArray;
92985
- MJ_UserNotificationPreferences_UserIDArray;
92986
94530
  MJ_APIKeys_UserIDArray;
94531
+ MJ_UserNotificationPreferences_UserIDArray;
92987
94532
  ResourcePermissions_UserIDArray;
92988
94533
  AIAgentRequests_RequestForUserIDArray;
92989
94534
  ConversationDetails_UserIDArray;
@@ -93324,14 +94869,14 @@ __decorate([
93324
94869
  Field(() => [MJDashboardPermission_]),
93325
94870
  __metadata("design:type", Array)
93326
94871
  ], MJUser_.prototype, "MJ_DashboardPermissions_SharedByUserIDArray", void 0);
93327
- __decorate([
93328
- Field(() => [MJUserNotificationPreference_]),
93329
- __metadata("design:type", Array)
93330
- ], MJUser_.prototype, "MJ_UserNotificationPreferences_UserIDArray", void 0);
93331
94872
  __decorate([
93332
94873
  Field(() => [MJAPIKey_]),
93333
94874
  __metadata("design:type", Array)
93334
94875
  ], MJUser_.prototype, "MJ_APIKeys_UserIDArray", void 0);
94876
+ __decorate([
94877
+ Field(() => [MJUserNotificationPreference_]),
94878
+ __metadata("design:type", Array)
94879
+ ], MJUser_.prototype, "MJ_UserNotificationPreferences_UserIDArray", void 0);
93335
94880
  __decorate([
93336
94881
  Field(() => [MJResourcePermission_]),
93337
94882
  __metadata("design:type", Array)
@@ -94119,22 +95664,22 @@ let MJUserResolverBase = class MJUserResolverBase extends ResolverBase {
94119
95664
  const result = await this.ArrayMapFieldNamesToCodeNames('MJ: Dashboard Permissions', rows, this.GetUserFromPayload(userPayload));
94120
95665
  return result;
94121
95666
  }
94122
- async MJ_UserNotificationPreferences_UserIDArray(mjuser_, { dataSources, userPayload, providers }, pubSub) {
94123
- this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
95667
+ async MJ_APIKeys_UserIDArray(mjuser_, { dataSources, userPayload, providers }, pubSub) {
95668
+ this.CheckUserReadPermissions('MJ: API Keys', userPayload);
94124
95669
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
94125
95670
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
94126
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
95671
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
94127
95672
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
94128
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
95673
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
94129
95674
  return result;
94130
95675
  }
94131
- async MJ_APIKeys_UserIDArray(mjuser_, { dataSources, userPayload, providers }, pubSub) {
94132
- this.CheckUserReadPermissions('MJ: API Keys', userPayload);
95676
+ async MJ_UserNotificationPreferences_UserIDArray(mjuser_, { dataSources, userPayload, providers }, pubSub) {
95677
+ this.CheckUserReadPermissions('MJ: User Notification Preferences', userPayload);
94133
95678
  const provider = GetReadOnlyProvider(providers, { allowFallbackToReadWrite: true });
94134
95679
  const connPool = GetReadOnlyDataSource(dataSources, { allowFallbackToReadWrite: true });
94135
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwAPIKeys] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: API Keys', userPayload, EntityPermissionType.Read, 'AND');
95680
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwUserNotificationPreferences] WHERE [UserID]='${mjuser_.ID}' ` + this.getRowLevelSecurityWhereClause(provider, 'MJ: User Notification Preferences', userPayload, EntityPermissionType.Read, 'AND');
94136
95681
  const rows = await SQLServerDataProvider.ExecuteSQLWithPool(connPool, sSQL, undefined, this.GetUserFromPayload(userPayload));
94137
- const result = await this.ArrayMapFieldNamesToCodeNames('MJ: API Keys', rows, this.GetUserFromPayload(userPayload));
95682
+ const result = await this.ArrayMapFieldNamesToCodeNames('MJ: User Notification Preferences', rows, this.GetUserFromPayload(userPayload));
94138
95683
  return result;
94139
95684
  }
94140
95685
  async ResourcePermissions_UserIDArray(mjuser_, { dataSources, userPayload, providers }, pubSub) {
@@ -94844,23 +96389,23 @@ __decorate([
94844
96389
  __metadata("design:returntype", Promise)
94845
96390
  ], MJUserResolverBase.prototype, "MJ_DashboardPermissions_SharedByUserIDArray", null);
94846
96391
  __decorate([
94847
- FieldResolver(() => [MJUserNotificationPreference_]),
96392
+ FieldResolver(() => [MJAPIKey_]),
94848
96393
  __param(0, Root()),
94849
96394
  __param(1, Ctx()),
94850
96395
  __param(2, PubSub()),
94851
96396
  __metadata("design:type", Function),
94852
96397
  __metadata("design:paramtypes", [MJUser_, Object, PubSubEngine]),
94853
96398
  __metadata("design:returntype", Promise)
94854
- ], MJUserResolverBase.prototype, "MJ_UserNotificationPreferences_UserIDArray", null);
96399
+ ], MJUserResolverBase.prototype, "MJ_APIKeys_UserIDArray", null);
94855
96400
  __decorate([
94856
- FieldResolver(() => [MJAPIKey_]),
96401
+ FieldResolver(() => [MJUserNotificationPreference_]),
94857
96402
  __param(0, Root()),
94858
96403
  __param(1, Ctx()),
94859
96404
  __param(2, PubSub()),
94860
96405
  __metadata("design:type", Function),
94861
96406
  __metadata("design:paramtypes", [MJUser_, Object, PubSubEngine]),
94862
96407
  __metadata("design:returntype", Promise)
94863
- ], MJUserResolverBase.prototype, "MJ_APIKeys_UserIDArray", null);
96408
+ ], MJUserResolverBase.prototype, "MJ_UserNotificationPreferences_UserIDArray", null);
94864
96409
  __decorate([
94865
96410
  FieldResolver(() => [MJResourcePermission_]),
94866
96411
  __param(0, Root()),