@memberjunction/graphql-dataprovider 2.122.1 → 2.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -5,6 +5,7 @@ import { UserViewEntityExtended } from '@memberjunction/core-entities';
5
5
  import { Observable } from 'rxjs';
6
6
  import { ExecuteAgentParams, ExecuteAgentResult } from '@memberjunction/ai-core-plus';
7
7
  import { ActionParam, ActionResult, EntityActionInvocationParams, EntityActionResult } from '@memberjunction/actions-base';
8
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
8
9
 
9
10
  /**
10
11
  * Client for executing AI operations through GraphQL.
@@ -2280,480 +2281,6 @@ declare class GraphQLTestingClient {
2280
2281
  private handleError;
2281
2282
  }
2282
2283
 
2283
- interface ComponentDataRequirements {
2284
- /**
2285
- * How the component gets its data
2286
- * - 'views': Fetches data at runtime using MJ RunView()
2287
- * - 'queries': Fetches data at runtime using MJ RunQuery()
2288
- * - 'hybrid': Uses both views and queries, depending on the context
2289
- */
2290
- mode: 'views' | 'queries' | 'hybrid';
2291
- /**
2292
- * Describes the entities and fields the component will access to fulfill user requirements.
2293
- */
2294
- entities: ComponentEntityDataRequirement[];
2295
- /**
2296
- * Stored Queries that the component will use to fetch data.
2297
- */
2298
- queries: ComponentQueryDataRequirement[];
2299
- /**
2300
- * Description of data access patterns
2301
- */
2302
- description?: string;
2303
- }
2304
- /**
2305
- * Describes how a component will use a specific query in MemberJunction to fetch data
2306
- */
2307
- type ComponentQueryDataRequirement = {
2308
- /**
2309
- * Query name, used along with categoryPath to identify the query
2310
- */
2311
- name: string;
2312
- /**
2313
- * Full path of the category for the query. Categories can be hierarchical so a full path might be
2314
- * 'Membership/Users/ActiveUsers'. This helps in organizing queries and avoiding name collisions.
2315
- */
2316
- categoryPath: string;
2317
- /**
2318
- * Description of the query and how/why the component will use it
2319
- */
2320
- description?: string;
2321
- /**
2322
- * A list of the fields that the component will use out of the possible fields returned by the query.
2323
- * Uses the @see SimpleEntityFieldInfo type to describe each field. **NOTE** not all of the fields are actually
2324
- * directly related to entity fields as some might be computed/etc, but SimpleEntityFieldInfo helps define some key aspects
2325
- * like the data type of the column and a description of the field.
2326
- */
2327
- fields: SimpleEntityFieldInfo[];
2328
- /**
2329
- * A list of the entities that are part of this query. This is vital information for matching query requests
2330
- * against existing queries
2331
- */
2332
- entityNames: string[];
2333
- /**
2334
- * Queries can have parameters (not all do). See @see ComponentQueryParameterValue for details.
2335
- */
2336
- parameters?: ComponentQueryParameterValue[];
2337
- /**
2338
- * This is only provided when requesting a NEW query be created. For existing queries, this will be undefined.
2339
- * This SQL can use Nunjucks syntax/templating for parameters including the custom filters defined in
2340
- */
2341
- newQuerySQL?: string;
2342
- };
2343
- /**
2344
- * Describes a single query parameter that a component will use when running a query.
2345
- */
2346
- type ComponentQueryParameterValue = {
2347
- /**
2348
- * Name of the parameter
2349
- */
2350
- name: string;
2351
- /**
2352
- * Whether this parameter must be provided when executing the query.
2353
- */
2354
- isRequired: boolean;
2355
- /**
2356
- * Value of the parameter. If the value is '@runtime', it indicates that the component will determine the value at runtime.
2357
- * If anything other than '@runtime' is specified, it is a hardcoded value that the component will use.
2358
- */
2359
- value?: string;
2360
- /**
2361
- * When specifying '@runtime' for the value, populate this field with a value that can be used to test the query to validate it runs. It doesn't need
2362
- * to be a value that is valid in the sense of being in the database, but is of the right type. For example if the
2363
- * parameter is a number, date or string, include a test value of that type. **Note** if the parameter is for a UNIQUEIDENTIFIER column
2364
- * type make sure to use a valid UUID format otherwise the query will FAIL.
2365
- */
2366
- testValue?: string;
2367
- /**
2368
- * Data type of the parameter (e.g., 'string', 'int', 'uniqueidentifier', 'datetime', 'decimal').
2369
- * This helps the component generator understand how to properly format and pass the parameter value.
2370
- */
2371
- type?: string;
2372
- /**
2373
- * Example value demonstrating the proper format for this parameter.
2374
- * Preferred over testValue for component generation as it aligns with SkipQueryParamInfo.SampleValue naming.
2375
- */
2376
- sampleValue?: string;
2377
- /**
2378
- * Description of the parameter and how it is used in the query. This is important for helping
2379
- * the component developer understand what the parameter is for and how to determine its value.
2380
- */
2381
- description?: string;
2382
- };
2383
- /**
2384
- * Describes use of a single entity
2385
- */
2386
- type ComponentEntityDataRequirement = {
2387
- /**
2388
- * Name of the entity (unique system-wide)
2389
- */
2390
- name: string;
2391
- /**
2392
- * Description of data in the entity
2393
- */
2394
- description?: string;
2395
- /**
2396
- * Fields to show the user
2397
- */
2398
- displayFields: string[];
2399
- /**
2400
- * Fields to filter on initially or via user interaction.
2401
- */
2402
- filterFields?: string[];
2403
- /**
2404
- * Fields to use when sorting
2405
- */
2406
- sortFields?: string[];
2407
- /**
2408
- * For the set of fields used in the combination of display, filter, and sort,
2409
- * this array is populated with additional metadata about each field. This will
2410
- * NOT include fields that are not used in the component.
2411
- */
2412
- fieldMetadata: SimpleEntityFieldInfo[];
2413
- /**
2414
- * When/Where/How components should use this data
2415
- */
2416
- usageContext?: string;
2417
- /**
2418
- * Array of permissions required by the component
2419
- */
2420
- permissionLevelNeeded: ComponentEntitySimplePermission[];
2421
- };
2422
- type ComponentEntitySimplePermission = 'read' | 'create' | 'update' | 'delete';
2423
- /**
2424
- * Simple type to share more information about the relevant fields
2425
- * in an entity that are to be used in a component
2426
- **/
2427
- type SimpleEntityFieldInfo = {
2428
- /**
2429
- * Name of the field
2430
- */
2431
- name: string;
2432
- /**
2433
- * Display sequence usually used for this field
2434
- */
2435
- sequence: number;
2436
- /**
2437
- * Whether this field is usually displayed in a user-facing view
2438
- */
2439
- defaultInView: boolean;
2440
- /**
2441
- * SQL Server type of the field, e.g., 'varchar', 'int', etc.
2442
- */
2443
- type: string;
2444
- /**
2445
- * Whether the field allows null values
2446
- */
2447
- allowsNull: boolean;
2448
- /**
2449
- * Whether the field is part of the primary key
2450
- */
2451
- isPrimaryKey: boolean;
2452
- /**
2453
- * Possible values for the field, if applicable
2454
- */
2455
- possibleValues?: string[];
2456
- /**
2457
- * Description of the field
2458
- */
2459
- description?: string;
2460
- };
2461
-
2462
- /**
2463
- * Definition of a single property of a component.
2464
- */
2465
- interface ComponentProperty {
2466
- /**
2467
- * The name of the property
2468
- */
2469
- name: string;
2470
- /**
2471
- * A description of what this property is used for
2472
- */
2473
- description: string;
2474
- /**
2475
- * The type of the property.
2476
- * It can be one of 'string', 'number', 'boolean', 'object', 'array', 'function', or 'any'.
2477
- * These types are for aligning users of the component. Components are in JavaScript and do not
2478
- * actually enforce types at runtime, but this is used to provide guidance for users (AI and Human)
2479
- */
2480
- type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function' | 'any';
2481
- /**
2482
- * Indicates if this property is required for the component to function correctly.
2483
- * If true, the component will not work without this property being set.
2484
- */
2485
- required: boolean;
2486
- /**
2487
- * The default value, if any, for this property if it is not provided.
2488
- */
2489
- defaultValue?: any;
2490
- /**
2491
- * Optional list of possible values for this property.
2492
- */
2493
- possibleValues?: string[];
2494
- }
2495
- /**
2496
- * Definition of a single event of a component.
2497
- */
2498
- interface ComponentEvent {
2499
- /**
2500
- * The name of the event
2501
- */
2502
- name: string;
2503
- /**
2504
- * A description of what this event does
2505
- */
2506
- description: string;
2507
- /**
2508
- * An array of parameters that this event can emit.
2509
- */
2510
- parameters?: ComponentEventParameter[];
2511
- }
2512
- interface ComponentEventParameter {
2513
- /**
2514
- * The name of the parameter
2515
- */
2516
- name: string;
2517
- /**
2518
- * A description of what this parameter is used for
2519
- */
2520
- description: string;
2521
- /**
2522
- * The type of the parameter.
2523
- * It can be one of 'string', 'number', 'boolean', 'object', 'array', 'function', or 'any'.
2524
- */
2525
- type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function' | 'any';
2526
- }
2527
-
2528
- /**
2529
- * Library dependency information for a component
2530
- */
2531
- interface ComponentLibraryDependency {
2532
- /**
2533
- * Unique name of the library from our registry. Typically
2534
- * reuses npm style package names such as
2535
- * "recharts", "lodash", "dayjs", "antd" or "@memberjunction/lib-name"
2536
- */
2537
- name: string;
2538
- /**
2539
- * The global variable name used by the component to access the library in code.
2540
- * When the component is bootstrapped, the library is loaded into a variable in a
2541
- * Factory/wrapper function around it by the host.
2542
- */
2543
- globalVariable: string;
2544
- /**
2545
- * SemVer string describing minimum version requirement
2546
- * Example: "2.5.0" for fixed version, "^1.0.0" for minimum version
2547
- */
2548
- version?: string;
2549
- }
2550
-
2551
- /**
2552
- * Specification for an interactive component
2553
- */
2554
- declare class ComponentSpec {
2555
- name: string;
2556
- /**
2557
- * Components can be embedded or registry. Registry means we don't have the
2558
- * code directly here nor do we generate the code, we simply use the component from its registry
2559
- */
2560
- location: "embedded" | "registry";
2561
- /**
2562
- * Used when location === 'registry' - the unique name of a given registry without the @ sign
2563
- * for example MJ or Skip would be valid globally unique registry names (as registered with MemberJunction.org)
2564
- * You would not include @ here. Fully qualified component identifiers would be
2565
- * @Registry/Namespace/Name/Version but in the context of this field it is just the registry name.
2566
- */
2567
- registry?: string;
2568
- /**
2569
- * Used when location === "registry", a hierarchical namespace such as "crm/analytics/accounts". The combination of the
2570
- * namespace and name are how a registry component is loaded. Registry components might have
2571
- * a root level segment that starts with @ such as "@memberjunction/examples/entities" or if the root
2572
- * segment doesn't have @ that means the component is local to that registry
2573
- */
2574
- namespace?: string;
2575
- /**
2576
- * Used when location === "registry", a semantic versioning string such as
2577
- * "1.0.0"
2578
- * "^1.0.0"
2579
- * "~1.0.0"
2580
- * Follows conventions documented here: https://semver.org/ and https://docs.npmjs.com/about-semantic-versioning
2581
- */
2582
- version?: string;
2583
- /**
2584
- * Only used when location === 'registry', logic explaining why this component is being selected
2585
- * to serve a specific use case or requirement
2586
- */
2587
- selectionReasoning?: string;
2588
- /**
2589
- * When an architect decides to use an existing component as a base for a new version,
2590
- * they can set this flag to true. This indicates that the new version will be created
2591
- * based on the existing component based on the namespace/name/version specified above
2592
- */
2593
- createNewVersion?: boolean;
2594
- /**
2595
- * End-user friendly description of what the component does
2596
- */
2597
- description: string;
2598
- /**
2599
- * User-friendly name
2600
- */
2601
- title: string;
2602
- /**
2603
- * Self-declared type - some common options below, can be any string if the standard ones aren't sufficient
2604
- */
2605
- type: "report" | "dashboard" | "form" | "table" | "chart" | "navigation" | "search" | string;
2606
- /**
2607
- * JavaScript code
2608
- */
2609
- code: string;
2610
- /**
2611
- * A functional description of what the component should do in markdown.
2612
- *
2613
- * Describes:
2614
- * - Core functionality
2615
- * - Any business rules
2616
- * - Expected outcomes
2617
- * - UX considerations
2618
- */
2619
- functionalRequirements: string;
2620
- /**
2621
- * Describes the entities and queries a component requires to function.
2622
- */
2623
- dataRequirements?: ComponentDataRequirements;
2624
- /**
2625
- * Technical explanation of the component in markdown.
2626
- */
2627
- technicalDesign: string;
2628
- /**
2629
- * Optional array of diagrams that use Mermaid syntax to illustrate component design.
2630
- * When provided each entry in the array specifies a title, optional description and the mermaid content itself.
2631
- * Examples of diagrams include:
2632
- * - Flowcharts of the process the component implements
2633
- * - Entity-relationship diagrams of the data model the component uses
2634
- * - Sequence diagrams illustrating interactions between the components various parts
2635
- */
2636
- diagrams?: Array<{
2637
- title: string;
2638
- description?: string;
2639
- content: string;
2640
- }>;
2641
- /**
2642
- * Properties the component accepts, if any
2643
- */
2644
- properties?: ComponentProperty[];
2645
- /**
2646
- * Events that the component emits, if any
2647
- */
2648
- events?: ComponentEvent[];
2649
- /**
2650
- * Metadata about methods the component supports, if any
2651
- */
2652
- methods?: ComponentMethodInfo;
2653
- /**
2654
- * Example of the component being used in JSX format. This is used to provide a clear example on the properties and
2655
- * event handling that the component supports.
2656
- */
2657
- exampleUsage: string;
2658
- /**
2659
- * Describes any other components this one depends on, if any
2660
- */
2661
- dependencies?: ComponentSpec[];
2662
- /**
2663
- * 3rd party lib dependencies, if any
2664
- */
2665
- libraries?: ComponentLibraryDependency[];
2666
- /**
2667
- * Relevant examples of components intended to inspire this component's creation
2668
- */
2669
- relevantExamples?: ComponentExample[];
2670
- /**
2671
- * Self-declared maturity level of the component. When a component is "in progress" and is not
2672
- * yet complete but is partially done, it can be marked as "incomplete". When it is functionally complete
2673
- * but not yet widely tested, it can be marked as "beta". When it is fully complete and tested, it can be marked
2674
- * as "production". This is intended to help architects and developers understand the readiness of a component
2675
- * for use in production systems.
2676
- */
2677
- readinessLevel?: "incomplete" | "beta" | "production";
2678
- /**
2679
- * If a component isn't complete or encounters problems in testing, this field can be used to
2680
- * track a work plan for completing or fixing the component. Generally this work plan string will contain
2681
- * a markdown formatted list of tasks to be done with rich explanations to allow developers (human+AI) to
2682
- * collaborate on completing the component.
2683
- */
2684
- workPlan?: string;
2685
- }
2686
- /**
2687
- * Defines standard and custom methods a component implements
2688
- */
2689
- interface ComponentMethodInfo {
2690
- standardMethodsSupported: {
2691
- print?: boolean;
2692
- refresh?: boolean;
2693
- getCurrentDataState?: boolean;
2694
- getDataStateHistory?: boolean;
2695
- validate?: boolean;
2696
- isDirty?: boolean;
2697
- reset?: boolean;
2698
- scrollTo?: boolean;
2699
- focus?: boolean;
2700
- invokeMethod?: boolean;
2701
- hasMethod?: boolean;
2702
- };
2703
- customMethods: CustomComponentMethod[];
2704
- }
2705
- /**
2706
- * Defines a single custom component method
2707
- */
2708
- interface CustomComponentMethod {
2709
- name: string;
2710
- description: string;
2711
- parameters: Array<{
2712
- name: string;
2713
- type: string;
2714
- description?: string;
2715
- }>;
2716
- returnType: string;
2717
- }
2718
- /**
2719
- * Type that defines an example component used to inspire the creation
2720
- * of a new component. By definition these examples are located in a registry
2721
- * and can be found via the combination of their name and namespace. The optional
2722
- * properties can be used at runtime to store additional information as required
2723
- * for generation/inference needs
2724
- */
2725
- type ComponentExample = {
2726
- name: string;
2727
- namespace: string;
2728
- version?: string;
2729
- registry?: string;
2730
- description?: string;
2731
- functionalRequirements?: string;
2732
- technicalDesign?: string;
2733
- /**
2734
- * Tracks a 0-1 number that indicates the relevance of this example to the containing ComponentSpec, can be used
2735
- * for ranking examples by importance/relevance
2736
- */
2737
- relevance?: number;
2738
- code?: string;
2739
- /**
2740
- * Optional runtime embedding vector calculated for description
2741
- */
2742
- descriptionVector?: number[];
2743
- /**
2744
- * Optional runtime embedding vector calculated for functional requirements
2745
- */
2746
- functionalRequirementsVector?: number[];
2747
- /**
2748
- * Optional runtime embedding vector calculated for technical design
2749
- */
2750
- technicalDesignVector?: number[];
2751
- /**
2752
- * Bag to hold any number of other runtime attributes
2753
- */
2754
- other?: any;
2755
- };
2756
-
2757
2284
  /**
2758
2285
  * Parameters for getting a component from registry
2759
2286
  */