@simpleapps-com/augur-api 2026.10.12 → 2026.10.13

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.mjs CHANGED
@@ -848,6 +848,7 @@ var endpoints = [
848
848
  pathPatterns: {},
849
849
  queryParams: [],
850
850
  edgeCache: false,
851
+ readOnly: true,
851
852
  responseSchema: AkashaGenerateCreateDataSchema,
852
853
  responseType: "scalar"
853
854
  },
@@ -874,6 +875,7 @@ var endpoints = [
874
875
  pathPatterns: {},
875
876
  queryParams: [],
876
877
  edgeCache: false,
878
+ readOnly: true,
877
879
  responseSchema: JoomlaGenerateCreateDataSchema,
878
880
  responseType: "scalar"
879
881
  },
@@ -1962,6 +1964,7 @@ var endpoints2 = [
1962
1964
  pathPatterns: {},
1963
1965
  queryParams: [],
1964
1966
  edgeCache: false,
1967
+ readOnly: true,
1965
1968
  responseSchema: UsersValidateCreateDataSchema,
1966
1969
  responseType: "object"
1967
1970
  },
@@ -8706,6 +8709,7 @@ var endpoints11 = [
8706
8709
  pathPatterns: {},
8707
8710
  queryParams: [],
8708
8711
  edgeCache: false,
8712
+ readOnly: true,
8709
8713
  responseSchema: AttributesResolveCreateDataSchema,
8710
8714
  responseType: "object"
8711
8715
  },
@@ -9214,6 +9218,7 @@ var endpoints11 = [
9214
9218
  pathPatterns: {},
9215
9219
  queryParams: [],
9216
9220
  edgeCache: false,
9221
+ readOnly: true,
9217
9222
  responseSchema: InternalPdfCreateDataSchema,
9218
9223
  responseType: "scalar"
9219
9224
  },
@@ -9318,6 +9323,7 @@ var endpoints11 = [
9318
9323
  pathPatterns: {},
9319
9324
  queryParams: [],
9320
9325
  edgeCache: false,
9326
+ readOnly: true,
9321
9327
  responseSchema: InvMastAttributesBulkCreateDataSchema,
9322
9328
  responseType: "object"
9323
9329
  },
@@ -17139,6 +17145,7 @@ var endpoints22 = [
17139
17145
  pathPatterns: {},
17140
17146
  queryParams: [],
17141
17147
  edgeCache: false,
17148
+ readOnly: true,
17142
17149
  responseSchema: PriceEngineCreateDataSchema,
17143
17150
  responseType: "object"
17144
17151
  },
@@ -17152,6 +17159,7 @@ var endpoints22 = [
17152
17159
  pathPatterns: {},
17153
17160
  queryParams: [],
17154
17161
  edgeCache: false,
17162
+ readOnly: true,
17155
17163
  responseSchema: TaxEngineCreateDataSchema,
17156
17164
  responseType: "object"
17157
17165
  },
@@ -17313,6 +17321,7 @@ var endpoints23 = [
17313
17321
  pathPatterns: {},
17314
17322
  queryParams: [],
17315
17323
  edgeCache: false,
17324
+ readOnly: true,
17316
17325
  responseSchema: RatesCreateDataSchema2,
17317
17326
  responseType: "array"
17318
17327
  }
@@ -18853,7 +18862,8 @@ function fromRow(service, row) {
18853
18862
  aliases: Object.freeze([...row.aliases]),
18854
18863
  hasBody: row.method === "POST" || row.method === "PUT",
18855
18864
  auth: "bearer",
18856
- edgeCache: row.edgeCache
18865
+ edgeCache: row.edgeCache,
18866
+ ...row.readOnly && { readOnly: true }
18857
18867
  });
18858
18868
  }
18859
18869
  function baseEntries(service) {
@@ -18982,20 +18992,6 @@ var CommonWhoamiResponseSchema = BaseResponseSchema(WhoamiDataSchema);
18982
18992
 
18983
18993
  // src/core/base-client.ts
18984
18994
  import * as v27 from "valibot";
18985
- function toDiscoveryEndpoint(entry) {
18986
- return {
18987
- fullPath: `api.${entry.id}`,
18988
- service: entry.service,
18989
- domain: entry.service,
18990
- method: entry.method,
18991
- path: entry.path,
18992
- description: `${entry.method} ${entry.path}`,
18993
- searchTerms: [],
18994
- relatedEndpoints: [],
18995
- commonPatterns: [],
18996
- discoverable: true
18997
- };
18998
- }
18999
18995
  var BaseServiceClient = class {
19000
18996
  /**
19001
18997
  * Create a new service client instance
@@ -19179,29 +19175,6 @@ var BaseServiceClient = class {
19179
19175
  }
19180
19176
  return path;
19181
19177
  }
19182
- /**
19183
- * Get discovery metadata for this service client
19184
- *
19185
- * Built from the endpoint registry, so it lists every endpoint this service
19186
- * exposes, including healthCheck, ping and whoami.
19187
- *
19188
- * @returns ServiceDiscoveryMetadata containing service info and endpoint metadata
19189
- */
19190
- getDiscoveryMetadata() {
19191
- const endpoints27 = registryEntries().filter((entry) => entry.service === this.serviceName).map(toDiscoveryEndpoint);
19192
- return {
19193
- serviceName: this.serviceName,
19194
- description: this.getServiceDescription(),
19195
- baseUrl: this.baseUrl,
19196
- endpoints: endpoints27
19197
- };
19198
- }
19199
- /**
19200
- * Get service description - can be overridden by subclasses
19201
- */
19202
- getServiceDescription() {
19203
- return `${this.serviceName} service client for Augur API`;
19204
- }
19205
19178
  };
19206
19179
 
19207
19180
  // src/core/service-proxy.ts
@@ -19367,9 +19340,6 @@ var JoomlaClient = class extends BaseServiceClient {
19367
19340
  this.usergroupsData = dataProxy.usergroups;
19368
19341
  this.usersData = dataProxy.users;
19369
19342
  }
19370
- getServiceDescription() {
19371
- return "Joomla CMS integration syncing content, users, categories, menus, and extensions";
19372
- }
19373
19343
  };
19374
19344
 
19375
19345
  // src/services/commerce/client.ts
@@ -19392,9 +19362,6 @@ var CommerceClient = class extends BaseServiceClient {
19392
19362
  this.cartLineData = dataProxy.cartLine;
19393
19363
  this.checkoutData = dataProxy.checkout;
19394
19364
  }
19395
- getServiceDescription() {
19396
- return "Shopping cart and checkout engine managing cart state, checkout flow, and Prophet 21 order submission";
19397
- }
19398
19365
  };
19399
19366
 
19400
19367
  // src/services/pricing/client.ts
@@ -19415,9 +19382,6 @@ var PricingClient = class extends BaseServiceClient {
19415
19382
  this.taxEngineData = dataProxy.taxEngine;
19416
19383
  this.webPricingData = dataProxy.webPricing;
19417
19384
  }
19418
- getServiceDescription() {
19419
- return "Pricing engine with 4-stage waterfall calculation, price books, tax groups, and customer-specific rules";
19420
- }
19421
19385
  };
19422
19386
 
19423
19387
  // src/services/vmi/client.ts
@@ -19442,9 +19406,6 @@ var VMIClient = class extends BaseServiceClient {
19442
19406
  this.sectionsData = dataProxy.sections;
19443
19407
  this.warehouseData = dataProxy.warehouse;
19444
19408
  }
19445
- getServiceDescription() {
19446
- return "Vendor-managed inventory for distributor profiles, warehouse stock levels, restocking, and usage tracking";
19447
- }
19448
19409
  };
19449
19410
 
19450
19411
  // src/services/open-search/client.ts
@@ -19471,9 +19432,6 @@ var OpenSearchClient = class extends BaseServiceClient {
19471
19432
  this.queryStringRedirectData = dataProxy.queryStringRedirect;
19472
19433
  this.suggestionsData = dataProxy.suggestions;
19473
19434
  }
19474
- getServiceDescription() {
19475
- return "Product search engine powered by OpenSearch with autocomplete, faceted filtering, and query analytics";
19476
- }
19477
19435
  };
19478
19436
 
19479
19437
  // src/services/items/client.ts
@@ -19522,9 +19480,6 @@ var ItemsClient = class extends BaseServiceClient {
19522
19480
  this.p21Data = dataProxy.p21;
19523
19481
  this.variantsData = dataProxy.variants;
19524
19482
  }
19525
- getServiceDescription() {
19526
- return "Product catalog and inventory management \u2014 items, categories, attributes, variants, brands, wishlists, and P21 inventory master data";
19527
- }
19528
19483
  };
19529
19484
 
19530
19485
  // src/services/legacy/client.ts
@@ -19543,9 +19498,6 @@ var LegacyClient = class extends BaseServiceClient {
19543
19498
  this.itemCategoryData = dataProxy.itemCategory;
19544
19499
  this.legacyData = dataProxy.legacy;
19545
19500
  }
19546
- getServiceDescription() {
19547
- return "Legacy Prophet 21 data mirror for inventory, customers, orders, pricing, and product attributes";
19548
- }
19549
19501
  };
19550
19502
 
19551
19503
  // src/services/agr-site/client.ts
@@ -19580,9 +19532,6 @@ var AgrSiteClient = class extends BaseServiceClient {
19580
19532
  this.settingsData = dataProxy.settings;
19581
19533
  this.usersData = dataProxy.users;
19582
19534
  }
19583
- getServiceDescription() {
19584
- return "Central site configuration hub managing settings, notifications, and cross-service integrations per client";
19585
- }
19586
19535
  };
19587
19536
 
19588
19537
  // src/services/customers/client.ts
@@ -19605,9 +19554,6 @@ var CustomersClient = class extends BaseServiceClient {
19605
19554
  this.contactsUdData = dataProxy.contactsUd;
19606
19555
  this.customerData = dataProxy.customer;
19607
19556
  }
19608
- getServiceDescription() {
19609
- return "Customer master data including contacts, shipping addresses, invoices, rewards, and P21 customer sync";
19610
- }
19611
19557
  };
19612
19558
 
19613
19559
  // src/services/orders/client.ts
@@ -19630,9 +19576,6 @@ var OrdersClient = class extends BaseServiceClient {
19630
19576
  this.poHdrData = dataProxy.poHdr;
19631
19577
  this.poLineData = dataProxy.poLine;
19632
19578
  }
19633
- getServiceDescription() {
19634
- return "Order lifecycle management for sales orders, invoices, payments, RMAs, and accounts receivable from P21";
19635
- }
19636
19579
  };
19637
19580
 
19638
19581
  // src/services/p21-pim/client.ts
@@ -19655,9 +19598,6 @@ var P21PimClient = class extends BaseServiceClient {
19655
19598
  this.itemsData = dataProxy.items;
19656
19599
  this.podcastsData = dataProxy.podcasts;
19657
19600
  }
19658
- getServiceDescription() {
19659
- return "Product information management for rich content, media assets, and extended item descriptions";
19660
- }
19661
19601
  };
19662
19602
 
19663
19603
  // src/services/payments/client.ts
@@ -19684,9 +19624,6 @@ var PaymentsClient = class extends BaseServiceClient {
19684
19624
  this.paytraceData = dataProxy.paytrace;
19685
19625
  this.unifiedData = dataProxy.unified;
19686
19626
  }
19687
- getServiceDescription() {
19688
- return "Unified payment processing gateway supporting Moneris, PayTrace, and Element card transactions and PayPal orders";
19689
- }
19690
19627
  };
19691
19628
 
19692
19629
  // src/services/agr-info/client.ts
@@ -19713,9 +19650,6 @@ var AgrInfoClient = class extends BaseServiceClient {
19713
19650
  this.sitesData = dataProxy.sites;
19714
19651
  this.workflowsData = dataProxy.workflows;
19715
19652
  }
19716
- getServiceDescription() {
19717
- return "Knowledge management and contextual information aggregation from Basecamp, Joomla, and AI sources";
19718
- }
19719
19653
  };
19720
19654
 
19721
19655
  // src/services/agr-int/client.ts
@@ -19738,9 +19672,6 @@ var AgrIntClient = class extends BaseServiceClient {
19738
19672
  this.rolesData = dataProxy.roles;
19739
19673
  this.usersData = dataProxy.users;
19740
19674
  }
19741
- getServiceDescription() {
19742
- return "Access control for Augur API users and clients: users, roles, bundles, resources, per-user table access grants, and client credentials";
19743
- }
19744
19675
  };
19745
19676
 
19746
19677
  // src/services/agr-work/client.ts
@@ -19748,9 +19679,6 @@ var AgrWorkClient = class extends BaseServiceClient {
19748
19679
  constructor(http, baseUrl = "https://agr-work.augur-api.com") {
19749
19680
  super("agr-work", http, baseUrl);
19750
19681
  }
19751
- getServiceDescription() {
19752
- return "Work tracking and task management for internal operations and job scheduling";
19753
- }
19754
19682
  };
19755
19683
 
19756
19684
  // src/services/avalara/client.ts
@@ -19765,9 +19693,6 @@ var AvalaraClient = class extends BaseServiceClient {
19765
19693
  this.rates = proxy.rates;
19766
19694
  this.ratesData = dataProxy.rates;
19767
19695
  }
19768
- getServiceDescription() {
19769
- return "Avalara tax rate calculation API integration for real-time sales tax on e-commerce transactions";
19770
- }
19771
19696
  };
19772
19697
 
19773
19698
  // src/services/brand-folder/client.ts
@@ -19786,9 +19711,6 @@ var BrandFolderClient = class extends BaseServiceClient {
19786
19711
  this.categories = proxy.categories;
19787
19712
  this.categoriesData = dataProxy.categories;
19788
19713
  }
19789
- getServiceDescription() {
19790
- return "Digital asset management for brand images, documents, and media with tagging and categorization";
19791
- }
19792
19714
  };
19793
19715
 
19794
19716
  // src/services/gregorovich/client.ts
@@ -19807,9 +19729,6 @@ var GregorovichClient = class extends BaseServiceClient {
19807
19729
  this.documents = proxy.documents;
19808
19730
  this.documentsData = dataProxy.documents;
19809
19731
  }
19810
- getServiceDescription() {
19811
- return "AI and LLM gateway providing RAG, embeddings, and chat via OpenAI, Groq, Ollama, and vLLM backends";
19812
- }
19813
19732
  };
19814
19733
 
19815
19734
  // src/services/logistics/client.ts
@@ -19838,9 +19757,6 @@ var LogisticsClient = class extends BaseServiceClient {
19838
19757
  this.speedshipData = dataProxy.speedship;
19839
19758
  this.upsData = dataProxy.ups;
19840
19759
  }
19841
- getServiceDescription() {
19842
- return "Multi-carrier shipping logistics for label generation, tracking, and delivery coordination";
19843
- }
19844
19760
  };
19845
19761
 
19846
19762
  // src/services/p21-apis/client.ts
@@ -19865,9 +19781,6 @@ var P21ApisClient = class extends BaseServiceClient {
19865
19781
  this.transUserData = dataProxy.transUser;
19866
19782
  this.transWebDisplayTypeData = dataProxy.transWebDisplayType;
19867
19783
  }
19868
- getServiceDescription() {
19869
- return "Prophet 21 REST API abstraction for normalized CRUD operations on ERP entities";
19870
- }
19871
19784
  };
19872
19785
 
19873
19786
  // src/services/p21-core/client.ts
@@ -19894,9 +19807,6 @@ var P21CoreClient = class extends BaseServiceClient {
19894
19807
  this.locationData = dataProxy.location;
19895
19808
  this.paymentTypesData = dataProxy.paymentTypes;
19896
19809
  }
19897
- getServiceDescription() {
19898
- return "Prophet 21 core reference data including companies, locations, users, payment types, and system settings";
19899
- }
19900
19810
  };
19901
19811
 
19902
19812
  // src/services/p21-sism/client.ts
@@ -19915,9 +19825,6 @@ var P21SismClient = class extends BaseServiceClient {
19915
19825
  this.scheduledImportMasterData = dataProxy.scheduledImportMaster;
19916
19826
  this.scheduledImportMetadataData = dataProxy.scheduledImportMetadata;
19917
19827
  }
19918
- getServiceDescription() {
19919
- return "Prophet 21 staged import engine for batch processing orders, inventory, customers, and transactions";
19920
- }
19921
19828
  };
19922
19829
 
19923
19830
  // src/services/shipping/client.ts
@@ -19936,9 +19843,6 @@ var ShippingClient = class extends BaseServiceClient {
19936
19843
  this.rates = proxy.rates;
19937
19844
  this.ratesData = dataProxy.rates;
19938
19845
  }
19939
- getServiceDescription() {
19940
- return "Shipping rate aggregation and calculation across multiple carrier integrations";
19941
- }
19942
19846
  };
19943
19847
 
19944
19848
  // src/services/smarty-streets/client.ts
@@ -19957,9 +19861,6 @@ var SmartyStreetsClient = class extends BaseServiceClient {
19957
19861
  this.us = proxy.us;
19958
19862
  this.usData = dataProxy.us;
19959
19863
  }
19960
- getServiceDescription() {
19961
- return "SmartyStreets address validation and geocoding for shipping address standardization";
19962
- }
19963
19864
  };
19964
19865
 
19965
19866
  // src/services/ups/client.ts
@@ -19974,9 +19875,6 @@ var UPSClient = class extends BaseServiceClient {
19974
19875
  this.ratesShop = proxy.ratesShop;
19975
19876
  this.ratesShopData = dataProxy.ratesShop;
19976
19877
  }
19977
- getServiceDescription() {
19978
- return "UPS shipping integration for address validation, rate quoting, and OAuth-based API access";
19979
- }
19980
19878
  };
19981
19879
 
19982
19880
  // src/services/basecamp2/client.ts
@@ -20009,9 +19907,6 @@ var Basecamp2Client = class extends BaseServiceClient {
20009
19907
  this.todosData = dataProxy.todos;
20010
19908
  this.todosSummaryData = dataProxy.todosSummary;
20011
19909
  }
20012
- getServiceDescription() {
20013
- return "Basecamp project management integration syncing todos, projects, people, and conversation data with AI analytics";
20014
- }
20015
19910
  };
20016
19911
 
20017
19912
  // src/client.ts
@@ -20422,436 +20317,6 @@ var _AugurAPI = class _AugurAPI {
20422
20317
  this._ups = void 0;
20423
20318
  this._basecamp2 = void 0;
20424
20319
  }
20425
- /**
20426
- * Discover all available services and their capabilities
20427
- *
20428
- * Returns a complete service map showing all discoverable endpoints across
20429
- * all microservices, enabling AI agents to understand the full API topology.
20430
- *
20431
- * @returns Promise<ServiceMap[]> Array of service maps with endpoint metadata
20432
- *
20433
- * @example
20434
- * ```typescript
20435
- * const api = new AugurAPI({ siteId: 'my-site', bearerToken: 'token' });
20436
- * const services = await api.discover();
20437
- *
20438
- * // Find all user-related endpoints
20439
- * const userEndpoints = services.flatMap(s => s.endpoints)
20440
- * .filter(e => e.searchTerms.some(term => term.includes('user')));
20441
- *
20442
- * // Show service capabilities
20443
- * services.forEach(service => {
20444
- * console.log(`${service.serviceName}: ${service.endpointCount} endpoints`);
20445
- * service.endpoints.forEach(endpoint => {
20446
- * console.log(` ${endpoint.fullPath} - ${endpoint.description}`);
20447
- * });
20448
- * });
20449
- * ```
20450
- */
20451
- async discover() {
20452
- const clients = [
20453
- this.joomla,
20454
- this.commerce,
20455
- this.pricing,
20456
- this.vmi,
20457
- this.openSearch,
20458
- this.items,
20459
- this.legacy,
20460
- this.agrSite,
20461
- this.customers,
20462
- this.orders,
20463
- this.p21Pim,
20464
- this.payments,
20465
- this.agrInfo,
20466
- this.agrInt,
20467
- this.agrWork,
20468
- this.avalara,
20469
- this.brandFolder,
20470
- this.gregorovich,
20471
- this.logistics,
20472
- this.p21Apis,
20473
- this.p21Core,
20474
- this.p21Sism,
20475
- this.shipping,
20476
- this.smartyStreets,
20477
- this.ups,
20478
- this.basecamp2
20479
- ];
20480
- return clients.map((client) => {
20481
- const metadata = client.getDiscoveryMetadata();
20482
- return {
20483
- serviceName: metadata.serviceName,
20484
- description: metadata.description,
20485
- baseUrl: metadata.baseUrl,
20486
- endpointCount: metadata.endpoints.length,
20487
- endpoints: metadata.endpoints
20488
- };
20489
- });
20490
- }
20491
- /**
20492
- * Find endpoints by search term or functionality description
20493
- *
20494
- * Searches across all services to find endpoints that match the given search term.
20495
- * Uses intelligent matching against endpoint descriptions, search terms, domains,
20496
- * and common usage patterns.
20497
- *
20498
- * @param searchTerm The functionality or term to search for
20499
- * @param options Search options for filtering and ranking
20500
- * @returns Promise<EndpointSearchResult[]> Array of matching endpoints with relevance scores
20501
- *
20502
- * @example
20503
- * ```typescript
20504
- * const api = new AugurAPI({ siteId: 'my-site', bearerToken: 'token' });
20505
- *
20506
- * // Find user-related endpoints
20507
- * const userEndpoints = await api.findEndpoint('users');
20508
- * console.log(`Found ${userEndpoints.length} user-related endpoints`);
20509
- *
20510
- * // Find authentication endpoints
20511
- * const authEndpoints = await api.findEndpoint('authentication');
20512
- *
20513
- * // Find inventory management
20514
- * const inventoryEndpoints = await api.findEndpoint('inventory management');
20515
- *
20516
- * // Show results with scores
20517
- * userEndpoints.forEach(result => {
20518
- * console.log(`${result.endpoint.fullPath} (${result.score.toFixed(2)}) - ${result.matchReason}`);
20519
- * });
20520
- * ```
20521
- */
20522
- async findEndpoint(searchTerm, options = {}) {
20523
- const { minScore = 0.1, maxResults = 10, service, domain, readOnly = false } = options;
20524
- if (!searchTerm.trim()) {
20525
- return [];
20526
- }
20527
- const filteredEndpoints = await this.getFilteredEndpoints({ service, domain, readOnly });
20528
- const results = this.searchAndScoreEndpoints(filteredEndpoints, searchTerm, {
20529
- domain,
20530
- minScore
20531
- });
20532
- return results.sort((a, b) => b.score - a.score).slice(0, maxResults);
20533
- }
20534
- /**
20535
- * Get endpoints filtered by service, domain, and method options
20536
- */
20537
- async getFilteredEndpoints(filters) {
20538
- const { service, domain, readOnly } = filters;
20539
- const services = await this.discover();
20540
- let filteredEndpoints = services.flatMap((s) => s.endpoints);
20541
- if (service) {
20542
- filteredEndpoints = filteredEndpoints.filter((e) => e.service === service);
20543
- }
20544
- if (domain) {
20545
- filteredEndpoints = filteredEndpoints.filter((e) => e.domain === domain);
20546
- }
20547
- if (readOnly) {
20548
- filteredEndpoints = filteredEndpoints.filter((e) => e.method === "GET");
20549
- }
20550
- return filteredEndpoints;
20551
- }
20552
- /**
20553
- * Search and score endpoints against search term
20554
- */
20555
- searchAndScoreEndpoints(endpoints27, searchTerm, options) {
20556
- const { domain, minScore } = options;
20557
- const results = [];
20558
- const searchTermLower = searchTerm.toLowerCase();
20559
- for (const endpoint of endpoints27) {
20560
- if (!this.isValidEndpoint(endpoint)) {
20561
- continue;
20562
- }
20563
- const { finalScore, finalMatchReason } = this.calculateFinalScore(
20564
- endpoint,
20565
- searchTermLower,
20566
- domain
20567
- );
20568
- if (finalScore >= minScore) {
20569
- results.push({
20570
- endpoint,
20571
- score: finalScore,
20572
- matchReason: finalMatchReason
20573
- });
20574
- }
20575
- }
20576
- return results;
20577
- }
20578
- /**
20579
- * Check if endpoint has required fields
20580
- */
20581
- isValidEndpoint(endpoint) {
20582
- return !!(endpoint.domain && endpoint.description && endpoint.method);
20583
- }
20584
- /**
20585
- * Calculate final score with domain filter adjustments
20586
- */
20587
- calculateFinalScore(endpoint, searchTermLower, domain) {
20588
- const { score, matchReason } = this.calculateEndpointRelevance(endpoint, searchTermLower);
20589
- if (domain && score === 0) {
20590
- return {
20591
- finalScore: 0.1,
20592
- finalMatchReason: "Domain filter match"
20593
- };
20594
- }
20595
- return {
20596
- finalScore: score,
20597
- finalMatchReason: matchReason
20598
- };
20599
- }
20600
- /**
20601
- * Calculate relevance score for an endpoint against a search term
20602
- */
20603
- calculateEndpointRelevance(endpoint, searchTermLower) {
20604
- const exactMatches = this.calculateExactMatches(endpoint, searchTermLower);
20605
- const partialMatches = this.calculatePartialMatches(endpoint, searchTermLower);
20606
- if (exactMatches.score > 0) {
20607
- return this.processExactMatches(exactMatches, partialMatches);
20608
- }
20609
- return this.processFallbackMatches(endpoint, searchTermLower, partialMatches);
20610
- }
20611
- /**
20612
- * Process exact matches with appropriate combining logic
20613
- */
20614
- processExactMatches(exactMatches, partialMatches) {
20615
- if (this.isExclusiveMatch(exactMatches.reason)) {
20616
- return {
20617
- score: exactMatches.score,
20618
- matchReason: exactMatches.reason
20619
- };
20620
- }
20621
- if (this.isCombinableMatch(exactMatches.reason)) {
20622
- const totalScore = Math.min(exactMatches.score + partialMatches.score, 1);
20623
- return {
20624
- score: totalScore,
20625
- matchReason: exactMatches.reason
20626
- };
20627
- }
20628
- return {
20629
- score: exactMatches.score,
20630
- matchReason: exactMatches.reason
20631
- };
20632
- }
20633
- /**
20634
- * Check if match type should be exclusive (no combining)
20635
- */
20636
- isExclusiveMatch(reason) {
20637
- return reason === "Service match" || reason.startsWith("Search term match");
20638
- }
20639
- /**
20640
- * Check if match type can be combined with partial matches
20641
- */
20642
- isCombinableMatch(reason) {
20643
- const combinableReasons = [
20644
- "Description match",
20645
- "Full path match",
20646
- "Path substring match",
20647
- "Domain match",
20648
- "Usage pattern match"
20649
- ];
20650
- return combinableReasons.includes(reason);
20651
- }
20652
- /**
20653
- * Process fallback matches when no exact match found
20654
- */
20655
- processFallbackMatches(endpoint, searchTermLower, partialMatches) {
20656
- const multiWordMatches = this.calculateMultiWordMatches(endpoint, searchTermLower);
20657
- if (multiWordMatches.score > partialMatches.score) {
20658
- return {
20659
- score: multiWordMatches.score,
20660
- matchReason: multiWordMatches.reason
20661
- };
20662
- }
20663
- return {
20664
- score: partialMatches.score,
20665
- matchReason: partialMatches.reason || "Low relevance match"
20666
- };
20667
- }
20668
- /**
20669
- * Calculate exact field matches with high scores
20670
- */
20671
- calculateExactMatches(endpoint, searchTermLower) {
20672
- const exactMatch = this.checkExactFieldMatches(endpoint, searchTermLower);
20673
- if (exactMatch.score > 0) {
20674
- return exactMatch;
20675
- }
20676
- const pathMatch = this.checkPathSubstringMatch(endpoint, searchTermLower);
20677
- if (pathMatch.score > 0) {
20678
- return pathMatch;
20679
- }
20680
- const descSubstringMatch = this.checkDescriptionSubstringMatch(endpoint, searchTermLower);
20681
- if (descSubstringMatch.score > 0) {
20682
- return descSubstringMatch;
20683
- }
20684
- const termMatch = this.checkSearchTermsAndPatterns(endpoint, searchTermLower);
20685
- if (termMatch.score > 0) {
20686
- return termMatch;
20687
- }
20688
- const otherSubstringMatch = this.checkOtherSubstringMatches(endpoint, searchTermLower);
20689
- if (otherSubstringMatch.score > 0) {
20690
- return otherSubstringMatch;
20691
- }
20692
- return { score: 0, reason: "" };
20693
- }
20694
- /**
20695
- * Check for path substring matches
20696
- */
20697
- checkPathSubstringMatch(endpoint, searchTermLower) {
20698
- if (endpoint.fullPath && (endpoint.fullPath.toLowerCase().includes(searchTermLower) || searchTermLower.includes(endpoint.fullPath.toLowerCase()))) {
20699
- return { score: 0.9, reason: "Path substring match" };
20700
- }
20701
- return { score: 0, reason: "" };
20702
- }
20703
- /**
20704
- * Check for description substring matches
20705
- */
20706
- checkDescriptionSubstringMatch(endpoint, searchTermLower) {
20707
- if (endpoint.description && endpoint.description.toLowerCase().includes(searchTermLower)) {
20708
- return { score: 0.65, reason: "Description substring match" };
20709
- }
20710
- return { score: 0, reason: "" };
20711
- }
20712
- /**
20713
- * Check for other substring matches (domain, service)
20714
- */
20715
- checkOtherSubstringMatches(endpoint, searchTermLower) {
20716
- if (endpoint.domain && endpoint.domain.toLowerCase().includes(searchTermLower)) {
20717
- return { score: 0.5, reason: "Domain match" };
20718
- }
20719
- if (endpoint.service && endpoint.service.toLowerCase().includes(searchTermLower)) {
20720
- return { score: 0.3, reason: "Service match" };
20721
- }
20722
- return { score: 0, reason: "" };
20723
- }
20724
- /**
20725
- * Check for exact field matches
20726
- */
20727
- checkExactFieldMatches(endpoint, searchTermLower) {
20728
- if (endpoint.domain && endpoint.domain.toLowerCase() === searchTermLower) {
20729
- return { score: 0.6, reason: "Domain match" };
20730
- }
20731
- if (endpoint.service && endpoint.service.toLowerCase() === searchTermLower) {
20732
- return { score: 0.3, reason: "Service match" };
20733
- }
20734
- if (endpoint.fullPath && endpoint.fullPath.toLowerCase() === searchTermLower) {
20735
- return { score: 1, reason: "Full path match" };
20736
- }
20737
- if (endpoint.description && endpoint.description.toLowerCase() === searchTermLower) {
20738
- return { score: 0.8, reason: "Description match" };
20739
- }
20740
- return { score: 0, reason: "" };
20741
- }
20742
- /**
20743
- * Check search terms and common patterns
20744
- */
20745
- checkSearchTermsAndPatterns(endpoint, searchTermLower) {
20746
- if (Array.isArray(endpoint.searchTerms)) {
20747
- const searchTermMatches = endpoint.searchTerms.filter(
20748
- (term) => term && typeof term === "string" && term.toLowerCase().includes(searchTermLower)
20749
- );
20750
- if (searchTermMatches.length > 0) {
20751
- return { score: 0.7, reason: `Search term match: ${searchTermMatches[0]}` };
20752
- }
20753
- }
20754
- if (Array.isArray(endpoint.commonPatterns)) {
20755
- const patternMatches = endpoint.commonPatterns.filter((pattern) => {
20756
- if (!pattern || typeof pattern !== "string") return false;
20757
- const patternLower = pattern.toLowerCase();
20758
- return patternLower.includes(searchTermLower);
20759
- });
20760
- if (patternMatches.length > 0) {
20761
- return { score: 0.5, reason: "Usage pattern match" };
20762
- }
20763
- }
20764
- return { score: 0, reason: "" };
20765
- }
20766
- /**
20767
- * Calculate partial word matches with lower scores
20768
- */
20769
- calculatePartialMatches(endpoint, searchTermLower) {
20770
- const allText = this.buildSearchableText(endpoint);
20771
- const wordMatches = this.countWordMatches(searchTermLower, allText);
20772
- return this.buildPartialMatchResult(wordMatches, searchTermLower);
20773
- }
20774
- /**
20775
- * Build searchable text from endpoint fields
20776
- */
20777
- buildSearchableText(endpoint) {
20778
- const searchTerms = Array.isArray(endpoint.searchTerms) ? endpoint.searchTerms : [];
20779
- const commonPatterns = Array.isArray(endpoint.commonPatterns) ? endpoint.commonPatterns : [];
20780
- return [
20781
- endpoint.fullPath || "",
20782
- endpoint.description || "",
20783
- endpoint.domain || "",
20784
- endpoint.service || "",
20785
- ...searchTerms,
20786
- ...commonPatterns
20787
- ].filter((text) => typeof text === "string").join(" ").toLowerCase();
20788
- }
20789
- /**
20790
- * Count matching words in text
20791
- */
20792
- countWordMatches(searchTermLower, allText) {
20793
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20794
- let wordMatches = 0;
20795
- for (const word of searchWords) {
20796
- if (word.length > 2 && allText.includes(word)) {
20797
- wordMatches++;
20798
- }
20799
- }
20800
- return wordMatches;
20801
- }
20802
- /**
20803
- * Build partial match result with score and reason
20804
- */
20805
- buildPartialMatchResult(wordMatches, searchTermLower) {
20806
- if (wordMatches > 0) {
20807
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20808
- const partialScore = wordMatches / searchWords.length * 0.2;
20809
- const reasonText = `Partial word match (${wordMatches}/${searchWords.length})`;
20810
- return {
20811
- score: partialScore,
20812
- reason: reasonText,
20813
- matchReason: reasonText
20814
- };
20815
- }
20816
- return { score: 0, reason: "", matchReason: "" };
20817
- }
20818
- /**
20819
- * Calculate multi-word matches by finding the best match for each word
20820
- */
20821
- calculateMultiWordMatches(endpoint, searchTermLower) {
20822
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20823
- if (searchWords.length <= 1) {
20824
- return { score: 0, reason: "" };
20825
- }
20826
- let bestScore = 0;
20827
- let bestReason = "";
20828
- const matchedWords = [];
20829
- for (const word of searchWords) {
20830
- const wordMatch = this.calculateExactMatches(endpoint, word);
20831
- if (wordMatch.score > 0) {
20832
- if (wordMatch.score > bestScore) {
20833
- bestScore = wordMatch.score;
20834
- bestReason = wordMatch.reason;
20835
- }
20836
- matchedWords.push(word);
20837
- }
20838
- }
20839
- if (matchedWords.length > 1) {
20840
- const bonusScore = Math.min((matchedWords.length - 1) * 0.1, 0.3);
20841
- const finalScore = Math.min(bestScore + bonusScore, 1);
20842
- return {
20843
- score: finalScore,
20844
- reason: `Multi-word match (${matchedWords.length}/${searchWords.length} words): ${bestReason}`
20845
- };
20846
- }
20847
- if (bestScore > 0) {
20848
- return {
20849
- score: bestScore,
20850
- reason: bestReason
20851
- };
20852
- }
20853
- return { score: 0, reason: "" };
20854
- }
20855
20320
  };
20856
20321
  /** Endpoint registry contract version (see shared/REGISTRY.md). */
20857
20322
  _AugurAPI.registryVersion = REGISTRY_VERSION;
@@ -20911,7 +20376,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
20911
20376
  }
20912
20377
 
20913
20378
  // src/index.ts
20914
- var VERSION = "2026.10.12";
20379
+ var VERSION = "2026.10.13";
20915
20380
  export {
20916
20381
  AgrInfoClient,
20917
20382
  AgrIntClient,