@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.js CHANGED
@@ -924,6 +924,7 @@ var endpoints = [
924
924
  pathPatterns: {},
925
925
  queryParams: [],
926
926
  edgeCache: false,
927
+ readOnly: true,
927
928
  responseSchema: AkashaGenerateCreateDataSchema,
928
929
  responseType: "scalar"
929
930
  },
@@ -950,6 +951,7 @@ var endpoints = [
950
951
  pathPatterns: {},
951
952
  queryParams: [],
952
953
  edgeCache: false,
954
+ readOnly: true,
953
955
  responseSchema: JoomlaGenerateCreateDataSchema,
954
956
  responseType: "scalar"
955
957
  },
@@ -2038,6 +2040,7 @@ var endpoints2 = [
2038
2040
  pathPatterns: {},
2039
2041
  queryParams: [],
2040
2042
  edgeCache: false,
2043
+ readOnly: true,
2041
2044
  responseSchema: UsersValidateCreateDataSchema,
2042
2045
  responseType: "object"
2043
2046
  },
@@ -8782,6 +8785,7 @@ var endpoints11 = [
8782
8785
  pathPatterns: {},
8783
8786
  queryParams: [],
8784
8787
  edgeCache: false,
8788
+ readOnly: true,
8785
8789
  responseSchema: AttributesResolveCreateDataSchema,
8786
8790
  responseType: "object"
8787
8791
  },
@@ -9290,6 +9294,7 @@ var endpoints11 = [
9290
9294
  pathPatterns: {},
9291
9295
  queryParams: [],
9292
9296
  edgeCache: false,
9297
+ readOnly: true,
9293
9298
  responseSchema: InternalPdfCreateDataSchema,
9294
9299
  responseType: "scalar"
9295
9300
  },
@@ -9394,6 +9399,7 @@ var endpoints11 = [
9394
9399
  pathPatterns: {},
9395
9400
  queryParams: [],
9396
9401
  edgeCache: false,
9402
+ readOnly: true,
9397
9403
  responseSchema: InvMastAttributesBulkCreateDataSchema,
9398
9404
  responseType: "object"
9399
9405
  },
@@ -17215,6 +17221,7 @@ var endpoints22 = [
17215
17221
  pathPatterns: {},
17216
17222
  queryParams: [],
17217
17223
  edgeCache: false,
17224
+ readOnly: true,
17218
17225
  responseSchema: PriceEngineCreateDataSchema,
17219
17226
  responseType: "object"
17220
17227
  },
@@ -17228,6 +17235,7 @@ var endpoints22 = [
17228
17235
  pathPatterns: {},
17229
17236
  queryParams: [],
17230
17237
  edgeCache: false,
17238
+ readOnly: true,
17231
17239
  responseSchema: TaxEngineCreateDataSchema,
17232
17240
  responseType: "object"
17233
17241
  },
@@ -17389,6 +17397,7 @@ var endpoints23 = [
17389
17397
  pathPatterns: {},
17390
17398
  queryParams: [],
17391
17399
  edgeCache: false,
17400
+ readOnly: true,
17392
17401
  responseSchema: RatesCreateDataSchema2,
17393
17402
  responseType: "array"
17394
17403
  }
@@ -18929,7 +18938,8 @@ function fromRow(service, row) {
18929
18938
  aliases: Object.freeze([...row.aliases]),
18930
18939
  hasBody: row.method === "POST" || row.method === "PUT",
18931
18940
  auth: "bearer",
18932
- edgeCache: row.edgeCache
18941
+ edgeCache: row.edgeCache,
18942
+ ...row.readOnly && { readOnly: true }
18933
18943
  });
18934
18944
  }
18935
18945
  function baseEntries(service) {
@@ -19058,20 +19068,6 @@ var CommonWhoamiResponseSchema = BaseResponseSchema(WhoamiDataSchema);
19058
19068
 
19059
19069
  // src/core/base-client.ts
19060
19070
  var v27 = __toESM(require("valibot"));
19061
- function toDiscoveryEndpoint(entry) {
19062
- return {
19063
- fullPath: `api.${entry.id}`,
19064
- service: entry.service,
19065
- domain: entry.service,
19066
- method: entry.method,
19067
- path: entry.path,
19068
- description: `${entry.method} ${entry.path}`,
19069
- searchTerms: [],
19070
- relatedEndpoints: [],
19071
- commonPatterns: [],
19072
- discoverable: true
19073
- };
19074
- }
19075
19071
  var BaseServiceClient = class {
19076
19072
  /**
19077
19073
  * Create a new service client instance
@@ -19255,29 +19251,6 @@ var BaseServiceClient = class {
19255
19251
  }
19256
19252
  return path;
19257
19253
  }
19258
- /**
19259
- * Get discovery metadata for this service client
19260
- *
19261
- * Built from the endpoint registry, so it lists every endpoint this service
19262
- * exposes, including healthCheck, ping and whoami.
19263
- *
19264
- * @returns ServiceDiscoveryMetadata containing service info and endpoint metadata
19265
- */
19266
- getDiscoveryMetadata() {
19267
- const endpoints27 = registryEntries().filter((entry) => entry.service === this.serviceName).map(toDiscoveryEndpoint);
19268
- return {
19269
- serviceName: this.serviceName,
19270
- description: this.getServiceDescription(),
19271
- baseUrl: this.baseUrl,
19272
- endpoints: endpoints27
19273
- };
19274
- }
19275
- /**
19276
- * Get service description - can be overridden by subclasses
19277
- */
19278
- getServiceDescription() {
19279
- return `${this.serviceName} service client for Augur API`;
19280
- }
19281
19254
  };
19282
19255
 
19283
19256
  // src/core/service-proxy.ts
@@ -19443,9 +19416,6 @@ var JoomlaClient = class extends BaseServiceClient {
19443
19416
  this.usergroupsData = dataProxy.usergroups;
19444
19417
  this.usersData = dataProxy.users;
19445
19418
  }
19446
- getServiceDescription() {
19447
- return "Joomla CMS integration syncing content, users, categories, menus, and extensions";
19448
- }
19449
19419
  };
19450
19420
 
19451
19421
  // src/services/commerce/client.ts
@@ -19468,9 +19438,6 @@ var CommerceClient = class extends BaseServiceClient {
19468
19438
  this.cartLineData = dataProxy.cartLine;
19469
19439
  this.checkoutData = dataProxy.checkout;
19470
19440
  }
19471
- getServiceDescription() {
19472
- return "Shopping cart and checkout engine managing cart state, checkout flow, and Prophet 21 order submission";
19473
- }
19474
19441
  };
19475
19442
 
19476
19443
  // src/services/pricing/client.ts
@@ -19491,9 +19458,6 @@ var PricingClient = class extends BaseServiceClient {
19491
19458
  this.taxEngineData = dataProxy.taxEngine;
19492
19459
  this.webPricingData = dataProxy.webPricing;
19493
19460
  }
19494
- getServiceDescription() {
19495
- return "Pricing engine with 4-stage waterfall calculation, price books, tax groups, and customer-specific rules";
19496
- }
19497
19461
  };
19498
19462
 
19499
19463
  // src/services/vmi/client.ts
@@ -19518,9 +19482,6 @@ var VMIClient = class extends BaseServiceClient {
19518
19482
  this.sectionsData = dataProxy.sections;
19519
19483
  this.warehouseData = dataProxy.warehouse;
19520
19484
  }
19521
- getServiceDescription() {
19522
- return "Vendor-managed inventory for distributor profiles, warehouse stock levels, restocking, and usage tracking";
19523
- }
19524
19485
  };
19525
19486
 
19526
19487
  // src/services/open-search/client.ts
@@ -19547,9 +19508,6 @@ var OpenSearchClient = class extends BaseServiceClient {
19547
19508
  this.queryStringRedirectData = dataProxy.queryStringRedirect;
19548
19509
  this.suggestionsData = dataProxy.suggestions;
19549
19510
  }
19550
- getServiceDescription() {
19551
- return "Product search engine powered by OpenSearch with autocomplete, faceted filtering, and query analytics";
19552
- }
19553
19511
  };
19554
19512
 
19555
19513
  // src/services/items/client.ts
@@ -19598,9 +19556,6 @@ var ItemsClient = class extends BaseServiceClient {
19598
19556
  this.p21Data = dataProxy.p21;
19599
19557
  this.variantsData = dataProxy.variants;
19600
19558
  }
19601
- getServiceDescription() {
19602
- return "Product catalog and inventory management \u2014 items, categories, attributes, variants, brands, wishlists, and P21 inventory master data";
19603
- }
19604
19559
  };
19605
19560
 
19606
19561
  // src/services/legacy/client.ts
@@ -19619,9 +19574,6 @@ var LegacyClient = class extends BaseServiceClient {
19619
19574
  this.itemCategoryData = dataProxy.itemCategory;
19620
19575
  this.legacyData = dataProxy.legacy;
19621
19576
  }
19622
- getServiceDescription() {
19623
- return "Legacy Prophet 21 data mirror for inventory, customers, orders, pricing, and product attributes";
19624
- }
19625
19577
  };
19626
19578
 
19627
19579
  // src/services/agr-site/client.ts
@@ -19656,9 +19608,6 @@ var AgrSiteClient = class extends BaseServiceClient {
19656
19608
  this.settingsData = dataProxy.settings;
19657
19609
  this.usersData = dataProxy.users;
19658
19610
  }
19659
- getServiceDescription() {
19660
- return "Central site configuration hub managing settings, notifications, and cross-service integrations per client";
19661
- }
19662
19611
  };
19663
19612
 
19664
19613
  // src/services/customers/client.ts
@@ -19681,9 +19630,6 @@ var CustomersClient = class extends BaseServiceClient {
19681
19630
  this.contactsUdData = dataProxy.contactsUd;
19682
19631
  this.customerData = dataProxy.customer;
19683
19632
  }
19684
- getServiceDescription() {
19685
- return "Customer master data including contacts, shipping addresses, invoices, rewards, and P21 customer sync";
19686
- }
19687
19633
  };
19688
19634
 
19689
19635
  // src/services/orders/client.ts
@@ -19706,9 +19652,6 @@ var OrdersClient = class extends BaseServiceClient {
19706
19652
  this.poHdrData = dataProxy.poHdr;
19707
19653
  this.poLineData = dataProxy.poLine;
19708
19654
  }
19709
- getServiceDescription() {
19710
- return "Order lifecycle management for sales orders, invoices, payments, RMAs, and accounts receivable from P21";
19711
- }
19712
19655
  };
19713
19656
 
19714
19657
  // src/services/p21-pim/client.ts
@@ -19731,9 +19674,6 @@ var P21PimClient = class extends BaseServiceClient {
19731
19674
  this.itemsData = dataProxy.items;
19732
19675
  this.podcastsData = dataProxy.podcasts;
19733
19676
  }
19734
- getServiceDescription() {
19735
- return "Product information management for rich content, media assets, and extended item descriptions";
19736
- }
19737
19677
  };
19738
19678
 
19739
19679
  // src/services/payments/client.ts
@@ -19760,9 +19700,6 @@ var PaymentsClient = class extends BaseServiceClient {
19760
19700
  this.paytraceData = dataProxy.paytrace;
19761
19701
  this.unifiedData = dataProxy.unified;
19762
19702
  }
19763
- getServiceDescription() {
19764
- return "Unified payment processing gateway supporting Moneris, PayTrace, and Element card transactions and PayPal orders";
19765
- }
19766
19703
  };
19767
19704
 
19768
19705
  // src/services/agr-info/client.ts
@@ -19789,9 +19726,6 @@ var AgrInfoClient = class extends BaseServiceClient {
19789
19726
  this.sitesData = dataProxy.sites;
19790
19727
  this.workflowsData = dataProxy.workflows;
19791
19728
  }
19792
- getServiceDescription() {
19793
- return "Knowledge management and contextual information aggregation from Basecamp, Joomla, and AI sources";
19794
- }
19795
19729
  };
19796
19730
 
19797
19731
  // src/services/agr-int/client.ts
@@ -19814,9 +19748,6 @@ var AgrIntClient = class extends BaseServiceClient {
19814
19748
  this.rolesData = dataProxy.roles;
19815
19749
  this.usersData = dataProxy.users;
19816
19750
  }
19817
- getServiceDescription() {
19818
- return "Access control for Augur API users and clients: users, roles, bundles, resources, per-user table access grants, and client credentials";
19819
- }
19820
19751
  };
19821
19752
 
19822
19753
  // src/services/agr-work/client.ts
@@ -19824,9 +19755,6 @@ var AgrWorkClient = class extends BaseServiceClient {
19824
19755
  constructor(http, baseUrl = "https://agr-work.augur-api.com") {
19825
19756
  super("agr-work", http, baseUrl);
19826
19757
  }
19827
- getServiceDescription() {
19828
- return "Work tracking and task management for internal operations and job scheduling";
19829
- }
19830
19758
  };
19831
19759
 
19832
19760
  // src/services/avalara/client.ts
@@ -19841,9 +19769,6 @@ var AvalaraClient = class extends BaseServiceClient {
19841
19769
  this.rates = proxy.rates;
19842
19770
  this.ratesData = dataProxy.rates;
19843
19771
  }
19844
- getServiceDescription() {
19845
- return "Avalara tax rate calculation API integration for real-time sales tax on e-commerce transactions";
19846
- }
19847
19772
  };
19848
19773
 
19849
19774
  // src/services/brand-folder/client.ts
@@ -19862,9 +19787,6 @@ var BrandFolderClient = class extends BaseServiceClient {
19862
19787
  this.categories = proxy.categories;
19863
19788
  this.categoriesData = dataProxy.categories;
19864
19789
  }
19865
- getServiceDescription() {
19866
- return "Digital asset management for brand images, documents, and media with tagging and categorization";
19867
- }
19868
19790
  };
19869
19791
 
19870
19792
  // src/services/gregorovich/client.ts
@@ -19883,9 +19805,6 @@ var GregorovichClient = class extends BaseServiceClient {
19883
19805
  this.documents = proxy.documents;
19884
19806
  this.documentsData = dataProxy.documents;
19885
19807
  }
19886
- getServiceDescription() {
19887
- return "AI and LLM gateway providing RAG, embeddings, and chat via OpenAI, Groq, Ollama, and vLLM backends";
19888
- }
19889
19808
  };
19890
19809
 
19891
19810
  // src/services/logistics/client.ts
@@ -19914,9 +19833,6 @@ var LogisticsClient = class extends BaseServiceClient {
19914
19833
  this.speedshipData = dataProxy.speedship;
19915
19834
  this.upsData = dataProxy.ups;
19916
19835
  }
19917
- getServiceDescription() {
19918
- return "Multi-carrier shipping logistics for label generation, tracking, and delivery coordination";
19919
- }
19920
19836
  };
19921
19837
 
19922
19838
  // src/services/p21-apis/client.ts
@@ -19941,9 +19857,6 @@ var P21ApisClient = class extends BaseServiceClient {
19941
19857
  this.transUserData = dataProxy.transUser;
19942
19858
  this.transWebDisplayTypeData = dataProxy.transWebDisplayType;
19943
19859
  }
19944
- getServiceDescription() {
19945
- return "Prophet 21 REST API abstraction for normalized CRUD operations on ERP entities";
19946
- }
19947
19860
  };
19948
19861
 
19949
19862
  // src/services/p21-core/client.ts
@@ -19970,9 +19883,6 @@ var P21CoreClient = class extends BaseServiceClient {
19970
19883
  this.locationData = dataProxy.location;
19971
19884
  this.paymentTypesData = dataProxy.paymentTypes;
19972
19885
  }
19973
- getServiceDescription() {
19974
- return "Prophet 21 core reference data including companies, locations, users, payment types, and system settings";
19975
- }
19976
19886
  };
19977
19887
 
19978
19888
  // src/services/p21-sism/client.ts
@@ -19991,9 +19901,6 @@ var P21SismClient = class extends BaseServiceClient {
19991
19901
  this.scheduledImportMasterData = dataProxy.scheduledImportMaster;
19992
19902
  this.scheduledImportMetadataData = dataProxy.scheduledImportMetadata;
19993
19903
  }
19994
- getServiceDescription() {
19995
- return "Prophet 21 staged import engine for batch processing orders, inventory, customers, and transactions";
19996
- }
19997
19904
  };
19998
19905
 
19999
19906
  // src/services/shipping/client.ts
@@ -20012,9 +19919,6 @@ var ShippingClient = class extends BaseServiceClient {
20012
19919
  this.rates = proxy.rates;
20013
19920
  this.ratesData = dataProxy.rates;
20014
19921
  }
20015
- getServiceDescription() {
20016
- return "Shipping rate aggregation and calculation across multiple carrier integrations";
20017
- }
20018
19922
  };
20019
19923
 
20020
19924
  // src/services/smarty-streets/client.ts
@@ -20033,9 +19937,6 @@ var SmartyStreetsClient = class extends BaseServiceClient {
20033
19937
  this.us = proxy.us;
20034
19938
  this.usData = dataProxy.us;
20035
19939
  }
20036
- getServiceDescription() {
20037
- return "SmartyStreets address validation and geocoding for shipping address standardization";
20038
- }
20039
19940
  };
20040
19941
 
20041
19942
  // src/services/ups/client.ts
@@ -20050,9 +19951,6 @@ var UPSClient = class extends BaseServiceClient {
20050
19951
  this.ratesShop = proxy.ratesShop;
20051
19952
  this.ratesShopData = dataProxy.ratesShop;
20052
19953
  }
20053
- getServiceDescription() {
20054
- return "UPS shipping integration for address validation, rate quoting, and OAuth-based API access";
20055
- }
20056
19954
  };
20057
19955
 
20058
19956
  // src/services/basecamp2/client.ts
@@ -20085,9 +19983,6 @@ var Basecamp2Client = class extends BaseServiceClient {
20085
19983
  this.todosData = dataProxy.todos;
20086
19984
  this.todosSummaryData = dataProxy.todosSummary;
20087
19985
  }
20088
- getServiceDescription() {
20089
- return "Basecamp project management integration syncing todos, projects, people, and conversation data with AI analytics";
20090
- }
20091
19986
  };
20092
19987
 
20093
19988
  // src/client.ts
@@ -20498,436 +20393,6 @@ var _AugurAPI = class _AugurAPI {
20498
20393
  this._ups = void 0;
20499
20394
  this._basecamp2 = void 0;
20500
20395
  }
20501
- /**
20502
- * Discover all available services and their capabilities
20503
- *
20504
- * Returns a complete service map showing all discoverable endpoints across
20505
- * all microservices, enabling AI agents to understand the full API topology.
20506
- *
20507
- * @returns Promise<ServiceMap[]> Array of service maps with endpoint metadata
20508
- *
20509
- * @example
20510
- * ```typescript
20511
- * const api = new AugurAPI({ siteId: 'my-site', bearerToken: 'token' });
20512
- * const services = await api.discover();
20513
- *
20514
- * // Find all user-related endpoints
20515
- * const userEndpoints = services.flatMap(s => s.endpoints)
20516
- * .filter(e => e.searchTerms.some(term => term.includes('user')));
20517
- *
20518
- * // Show service capabilities
20519
- * services.forEach(service => {
20520
- * console.log(`${service.serviceName}: ${service.endpointCount} endpoints`);
20521
- * service.endpoints.forEach(endpoint => {
20522
- * console.log(` ${endpoint.fullPath} - ${endpoint.description}`);
20523
- * });
20524
- * });
20525
- * ```
20526
- */
20527
- async discover() {
20528
- const clients = [
20529
- this.joomla,
20530
- this.commerce,
20531
- this.pricing,
20532
- this.vmi,
20533
- this.openSearch,
20534
- this.items,
20535
- this.legacy,
20536
- this.agrSite,
20537
- this.customers,
20538
- this.orders,
20539
- this.p21Pim,
20540
- this.payments,
20541
- this.agrInfo,
20542
- this.agrInt,
20543
- this.agrWork,
20544
- this.avalara,
20545
- this.brandFolder,
20546
- this.gregorovich,
20547
- this.logistics,
20548
- this.p21Apis,
20549
- this.p21Core,
20550
- this.p21Sism,
20551
- this.shipping,
20552
- this.smartyStreets,
20553
- this.ups,
20554
- this.basecamp2
20555
- ];
20556
- return clients.map((client) => {
20557
- const metadata = client.getDiscoveryMetadata();
20558
- return {
20559
- serviceName: metadata.serviceName,
20560
- description: metadata.description,
20561
- baseUrl: metadata.baseUrl,
20562
- endpointCount: metadata.endpoints.length,
20563
- endpoints: metadata.endpoints
20564
- };
20565
- });
20566
- }
20567
- /**
20568
- * Find endpoints by search term or functionality description
20569
- *
20570
- * Searches across all services to find endpoints that match the given search term.
20571
- * Uses intelligent matching against endpoint descriptions, search terms, domains,
20572
- * and common usage patterns.
20573
- *
20574
- * @param searchTerm The functionality or term to search for
20575
- * @param options Search options for filtering and ranking
20576
- * @returns Promise<EndpointSearchResult[]> Array of matching endpoints with relevance scores
20577
- *
20578
- * @example
20579
- * ```typescript
20580
- * const api = new AugurAPI({ siteId: 'my-site', bearerToken: 'token' });
20581
- *
20582
- * // Find user-related endpoints
20583
- * const userEndpoints = await api.findEndpoint('users');
20584
- * console.log(`Found ${userEndpoints.length} user-related endpoints`);
20585
- *
20586
- * // Find authentication endpoints
20587
- * const authEndpoints = await api.findEndpoint('authentication');
20588
- *
20589
- * // Find inventory management
20590
- * const inventoryEndpoints = await api.findEndpoint('inventory management');
20591
- *
20592
- * // Show results with scores
20593
- * userEndpoints.forEach(result => {
20594
- * console.log(`${result.endpoint.fullPath} (${result.score.toFixed(2)}) - ${result.matchReason}`);
20595
- * });
20596
- * ```
20597
- */
20598
- async findEndpoint(searchTerm, options = {}) {
20599
- const { minScore = 0.1, maxResults = 10, service, domain, readOnly = false } = options;
20600
- if (!searchTerm.trim()) {
20601
- return [];
20602
- }
20603
- const filteredEndpoints = await this.getFilteredEndpoints({ service, domain, readOnly });
20604
- const results = this.searchAndScoreEndpoints(filteredEndpoints, searchTerm, {
20605
- domain,
20606
- minScore
20607
- });
20608
- return results.sort((a, b) => b.score - a.score).slice(0, maxResults);
20609
- }
20610
- /**
20611
- * Get endpoints filtered by service, domain, and method options
20612
- */
20613
- async getFilteredEndpoints(filters) {
20614
- const { service, domain, readOnly } = filters;
20615
- const services = await this.discover();
20616
- let filteredEndpoints = services.flatMap((s) => s.endpoints);
20617
- if (service) {
20618
- filteredEndpoints = filteredEndpoints.filter((e) => e.service === service);
20619
- }
20620
- if (domain) {
20621
- filteredEndpoints = filteredEndpoints.filter((e) => e.domain === domain);
20622
- }
20623
- if (readOnly) {
20624
- filteredEndpoints = filteredEndpoints.filter((e) => e.method === "GET");
20625
- }
20626
- return filteredEndpoints;
20627
- }
20628
- /**
20629
- * Search and score endpoints against search term
20630
- */
20631
- searchAndScoreEndpoints(endpoints27, searchTerm, options) {
20632
- const { domain, minScore } = options;
20633
- const results = [];
20634
- const searchTermLower = searchTerm.toLowerCase();
20635
- for (const endpoint of endpoints27) {
20636
- if (!this.isValidEndpoint(endpoint)) {
20637
- continue;
20638
- }
20639
- const { finalScore, finalMatchReason } = this.calculateFinalScore(
20640
- endpoint,
20641
- searchTermLower,
20642
- domain
20643
- );
20644
- if (finalScore >= minScore) {
20645
- results.push({
20646
- endpoint,
20647
- score: finalScore,
20648
- matchReason: finalMatchReason
20649
- });
20650
- }
20651
- }
20652
- return results;
20653
- }
20654
- /**
20655
- * Check if endpoint has required fields
20656
- */
20657
- isValidEndpoint(endpoint) {
20658
- return !!(endpoint.domain && endpoint.description && endpoint.method);
20659
- }
20660
- /**
20661
- * Calculate final score with domain filter adjustments
20662
- */
20663
- calculateFinalScore(endpoint, searchTermLower, domain) {
20664
- const { score, matchReason } = this.calculateEndpointRelevance(endpoint, searchTermLower);
20665
- if (domain && score === 0) {
20666
- return {
20667
- finalScore: 0.1,
20668
- finalMatchReason: "Domain filter match"
20669
- };
20670
- }
20671
- return {
20672
- finalScore: score,
20673
- finalMatchReason: matchReason
20674
- };
20675
- }
20676
- /**
20677
- * Calculate relevance score for an endpoint against a search term
20678
- */
20679
- calculateEndpointRelevance(endpoint, searchTermLower) {
20680
- const exactMatches = this.calculateExactMatches(endpoint, searchTermLower);
20681
- const partialMatches = this.calculatePartialMatches(endpoint, searchTermLower);
20682
- if (exactMatches.score > 0) {
20683
- return this.processExactMatches(exactMatches, partialMatches);
20684
- }
20685
- return this.processFallbackMatches(endpoint, searchTermLower, partialMatches);
20686
- }
20687
- /**
20688
- * Process exact matches with appropriate combining logic
20689
- */
20690
- processExactMatches(exactMatches, partialMatches) {
20691
- if (this.isExclusiveMatch(exactMatches.reason)) {
20692
- return {
20693
- score: exactMatches.score,
20694
- matchReason: exactMatches.reason
20695
- };
20696
- }
20697
- if (this.isCombinableMatch(exactMatches.reason)) {
20698
- const totalScore = Math.min(exactMatches.score + partialMatches.score, 1);
20699
- return {
20700
- score: totalScore,
20701
- matchReason: exactMatches.reason
20702
- };
20703
- }
20704
- return {
20705
- score: exactMatches.score,
20706
- matchReason: exactMatches.reason
20707
- };
20708
- }
20709
- /**
20710
- * Check if match type should be exclusive (no combining)
20711
- */
20712
- isExclusiveMatch(reason) {
20713
- return reason === "Service match" || reason.startsWith("Search term match");
20714
- }
20715
- /**
20716
- * Check if match type can be combined with partial matches
20717
- */
20718
- isCombinableMatch(reason) {
20719
- const combinableReasons = [
20720
- "Description match",
20721
- "Full path match",
20722
- "Path substring match",
20723
- "Domain match",
20724
- "Usage pattern match"
20725
- ];
20726
- return combinableReasons.includes(reason);
20727
- }
20728
- /**
20729
- * Process fallback matches when no exact match found
20730
- */
20731
- processFallbackMatches(endpoint, searchTermLower, partialMatches) {
20732
- const multiWordMatches = this.calculateMultiWordMatches(endpoint, searchTermLower);
20733
- if (multiWordMatches.score > partialMatches.score) {
20734
- return {
20735
- score: multiWordMatches.score,
20736
- matchReason: multiWordMatches.reason
20737
- };
20738
- }
20739
- return {
20740
- score: partialMatches.score,
20741
- matchReason: partialMatches.reason || "Low relevance match"
20742
- };
20743
- }
20744
- /**
20745
- * Calculate exact field matches with high scores
20746
- */
20747
- calculateExactMatches(endpoint, searchTermLower) {
20748
- const exactMatch = this.checkExactFieldMatches(endpoint, searchTermLower);
20749
- if (exactMatch.score > 0) {
20750
- return exactMatch;
20751
- }
20752
- const pathMatch = this.checkPathSubstringMatch(endpoint, searchTermLower);
20753
- if (pathMatch.score > 0) {
20754
- return pathMatch;
20755
- }
20756
- const descSubstringMatch = this.checkDescriptionSubstringMatch(endpoint, searchTermLower);
20757
- if (descSubstringMatch.score > 0) {
20758
- return descSubstringMatch;
20759
- }
20760
- const termMatch = this.checkSearchTermsAndPatterns(endpoint, searchTermLower);
20761
- if (termMatch.score > 0) {
20762
- return termMatch;
20763
- }
20764
- const otherSubstringMatch = this.checkOtherSubstringMatches(endpoint, searchTermLower);
20765
- if (otherSubstringMatch.score > 0) {
20766
- return otherSubstringMatch;
20767
- }
20768
- return { score: 0, reason: "" };
20769
- }
20770
- /**
20771
- * Check for path substring matches
20772
- */
20773
- checkPathSubstringMatch(endpoint, searchTermLower) {
20774
- if (endpoint.fullPath && (endpoint.fullPath.toLowerCase().includes(searchTermLower) || searchTermLower.includes(endpoint.fullPath.toLowerCase()))) {
20775
- return { score: 0.9, reason: "Path substring match" };
20776
- }
20777
- return { score: 0, reason: "" };
20778
- }
20779
- /**
20780
- * Check for description substring matches
20781
- */
20782
- checkDescriptionSubstringMatch(endpoint, searchTermLower) {
20783
- if (endpoint.description && endpoint.description.toLowerCase().includes(searchTermLower)) {
20784
- return { score: 0.65, reason: "Description substring match" };
20785
- }
20786
- return { score: 0, reason: "" };
20787
- }
20788
- /**
20789
- * Check for other substring matches (domain, service)
20790
- */
20791
- checkOtherSubstringMatches(endpoint, searchTermLower) {
20792
- if (endpoint.domain && endpoint.domain.toLowerCase().includes(searchTermLower)) {
20793
- return { score: 0.5, reason: "Domain match" };
20794
- }
20795
- if (endpoint.service && endpoint.service.toLowerCase().includes(searchTermLower)) {
20796
- return { score: 0.3, reason: "Service match" };
20797
- }
20798
- return { score: 0, reason: "" };
20799
- }
20800
- /**
20801
- * Check for exact field matches
20802
- */
20803
- checkExactFieldMatches(endpoint, searchTermLower) {
20804
- if (endpoint.domain && endpoint.domain.toLowerCase() === searchTermLower) {
20805
- return { score: 0.6, reason: "Domain match" };
20806
- }
20807
- if (endpoint.service && endpoint.service.toLowerCase() === searchTermLower) {
20808
- return { score: 0.3, reason: "Service match" };
20809
- }
20810
- if (endpoint.fullPath && endpoint.fullPath.toLowerCase() === searchTermLower) {
20811
- return { score: 1, reason: "Full path match" };
20812
- }
20813
- if (endpoint.description && endpoint.description.toLowerCase() === searchTermLower) {
20814
- return { score: 0.8, reason: "Description match" };
20815
- }
20816
- return { score: 0, reason: "" };
20817
- }
20818
- /**
20819
- * Check search terms and common patterns
20820
- */
20821
- checkSearchTermsAndPatterns(endpoint, searchTermLower) {
20822
- if (Array.isArray(endpoint.searchTerms)) {
20823
- const searchTermMatches = endpoint.searchTerms.filter(
20824
- (term) => term && typeof term === "string" && term.toLowerCase().includes(searchTermLower)
20825
- );
20826
- if (searchTermMatches.length > 0) {
20827
- return { score: 0.7, reason: `Search term match: ${searchTermMatches[0]}` };
20828
- }
20829
- }
20830
- if (Array.isArray(endpoint.commonPatterns)) {
20831
- const patternMatches = endpoint.commonPatterns.filter((pattern) => {
20832
- if (!pattern || typeof pattern !== "string") return false;
20833
- const patternLower = pattern.toLowerCase();
20834
- return patternLower.includes(searchTermLower);
20835
- });
20836
- if (patternMatches.length > 0) {
20837
- return { score: 0.5, reason: "Usage pattern match" };
20838
- }
20839
- }
20840
- return { score: 0, reason: "" };
20841
- }
20842
- /**
20843
- * Calculate partial word matches with lower scores
20844
- */
20845
- calculatePartialMatches(endpoint, searchTermLower) {
20846
- const allText = this.buildSearchableText(endpoint);
20847
- const wordMatches = this.countWordMatches(searchTermLower, allText);
20848
- return this.buildPartialMatchResult(wordMatches, searchTermLower);
20849
- }
20850
- /**
20851
- * Build searchable text from endpoint fields
20852
- */
20853
- buildSearchableText(endpoint) {
20854
- const searchTerms = Array.isArray(endpoint.searchTerms) ? endpoint.searchTerms : [];
20855
- const commonPatterns = Array.isArray(endpoint.commonPatterns) ? endpoint.commonPatterns : [];
20856
- return [
20857
- endpoint.fullPath || "",
20858
- endpoint.description || "",
20859
- endpoint.domain || "",
20860
- endpoint.service || "",
20861
- ...searchTerms,
20862
- ...commonPatterns
20863
- ].filter((text) => typeof text === "string").join(" ").toLowerCase();
20864
- }
20865
- /**
20866
- * Count matching words in text
20867
- */
20868
- countWordMatches(searchTermLower, allText) {
20869
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20870
- let wordMatches = 0;
20871
- for (const word of searchWords) {
20872
- if (word.length > 2 && allText.includes(word)) {
20873
- wordMatches++;
20874
- }
20875
- }
20876
- return wordMatches;
20877
- }
20878
- /**
20879
- * Build partial match result with score and reason
20880
- */
20881
- buildPartialMatchResult(wordMatches, searchTermLower) {
20882
- if (wordMatches > 0) {
20883
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20884
- const partialScore = wordMatches / searchWords.length * 0.2;
20885
- const reasonText = `Partial word match (${wordMatches}/${searchWords.length})`;
20886
- return {
20887
- score: partialScore,
20888
- reason: reasonText,
20889
- matchReason: reasonText
20890
- };
20891
- }
20892
- return { score: 0, reason: "", matchReason: "" };
20893
- }
20894
- /**
20895
- * Calculate multi-word matches by finding the best match for each word
20896
- */
20897
- calculateMultiWordMatches(endpoint, searchTermLower) {
20898
- const searchWords = searchTermLower.split(/\s+/).filter((word) => word.length > 0);
20899
- if (searchWords.length <= 1) {
20900
- return { score: 0, reason: "" };
20901
- }
20902
- let bestScore = 0;
20903
- let bestReason = "";
20904
- const matchedWords = [];
20905
- for (const word of searchWords) {
20906
- const wordMatch = this.calculateExactMatches(endpoint, word);
20907
- if (wordMatch.score > 0) {
20908
- if (wordMatch.score > bestScore) {
20909
- bestScore = wordMatch.score;
20910
- bestReason = wordMatch.reason;
20911
- }
20912
- matchedWords.push(word);
20913
- }
20914
- }
20915
- if (matchedWords.length > 1) {
20916
- const bonusScore = Math.min((matchedWords.length - 1) * 0.1, 0.3);
20917
- const finalScore = Math.min(bestScore + bonusScore, 1);
20918
- return {
20919
- score: finalScore,
20920
- reason: `Multi-word match (${matchedWords.length}/${searchWords.length} words): ${bestReason}`
20921
- };
20922
- }
20923
- if (bestScore > 0) {
20924
- return {
20925
- score: bestScore,
20926
- reason: bestReason
20927
- };
20928
- }
20929
- return { score: 0, reason: "" };
20930
- }
20931
20396
  };
20932
20397
  /** Endpoint registry contract version (see shared/REGISTRY.md). */
20933
20398
  _AugurAPI.registryVersion = REGISTRY_VERSION;
@@ -20987,7 +20452,7 @@ function createCrossSiteAuthenticator(augurInfoToken) {
20987
20452
  }
20988
20453
 
20989
20454
  // src/index.ts
20990
- var VERSION = "2026.10.12";
20455
+ var VERSION = "2026.10.13";
20991
20456
  // Annotate the CommonJS export names for ESM import in node:
20992
20457
  0 && (module.exports = {
20993
20458
  AgrInfoClient,