@microsoft/webiq 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -92,6 +92,8 @@ const client = new WebIQClient({
92
92
  ### Web Search
93
93
 
94
94
  ```typescript
95
+ import { ContentFormat, SafeSearch } from '@microsoft/webiq';
96
+
95
97
  const results = await client.web.search(query, {
96
98
  maxResults: 10, // 1-50, default 10
97
99
  language: 'en', // ISO 639-1 code
@@ -99,6 +101,7 @@ const results = await client.web.search(query, {
99
101
  location: 'lat:40.7;long:-74.0', // Optional
100
102
  contentFormat: ContentFormat.HTML, // PASSAGE, TEXT, HTML, MARKDOWN
101
103
  maxLength: 10000, // 1-500000
104
+ safeSearch: SafeSearch.STRICT, // OFF, STRICT
102
105
  customSearchConfigId: 'my-config', // Optional custom search config
103
106
  includeDomains: ['example.com'], // Optional allowlist (max 250)
104
107
  excludeDomains: ['spam.example'], // Optional blocklist (max 250)
@@ -117,7 +120,7 @@ const results = await client.news.search(query, {
117
120
  contentFormat: ContentFormat.TEXT,
118
121
  maxLength: 10000,
119
122
  });
120
- // results.newsResults → [{title, url, content, source, lastUpdatedAt, thumbnail, isAdult}]
123
+ // results.newsResults → [{title, url, content, source, lastUpdatedAt, crawledAt, thumbnail, isAdult}]
121
124
  ```
122
125
 
123
126
  ### Video Search
@@ -137,9 +140,11 @@ const results = await client.videos.search(query, {
137
140
  ### Browse
138
141
 
139
142
  ```typescript
143
+ import { BrowseContentFormat, BrowseLiveCrawl } from '@microsoft/webiq';
144
+
140
145
  const page = await client.browse.fetch(url, {
141
146
  maxLength: 10000, // 1-500000
142
- liveCrawl: 'fallback', // "none" (default) | "fallback" | "force"
147
+ liveCrawl: BrowseLiveCrawl.FALLBACK, // NONE (default), FALLBACK, FORCE
143
148
  includeWebLinks: true,
144
149
  includeImageLinks: true,
145
150
  renderDynamicPages: false,
@@ -170,7 +175,7 @@ const results = await client.images.search(query, {
170
175
  Given a query, classic search will search and retrieve content from webpages, images, videos, news, weather, sports, etc.
171
176
 
172
177
  ```typescript
173
- import { ContentFormat, SafeSearchMode } from '@microsoft/webiq';
178
+ import { ContentFormat, SafeSearch } from '@microsoft/webiq';
174
179
 
175
180
  const response = await client.classic.search(query, {
176
181
  maxAnswerTypes: 6, // 1-6, default 6
@@ -182,7 +187,7 @@ const response = await client.classic.search(query, {
182
187
  contentFormat: ContentFormat.HTML,
183
188
  freshness: 'month', // day, week, month, year, or date range
184
189
  responseFilter: ['webResults', 'newsResults'], // Answer types to include
185
- safeSearch: SafeSearchMode.MODERATE, // OFF, MODERATE, STRICT
190
+ safeSearch: SafeSearch.STRICT, // OFF, STRICT
186
191
  });
187
192
  // response.querySignals → {originalQuery, normalizedQuery, isDefensive, isAdult, isNav, isFresh}
188
193
  // response.traceId → string
package/dist/index.d.mts CHANGED
@@ -84,6 +84,11 @@ declare enum ContentFormat {
84
84
  MARKDOWN = "markdown"
85
85
  }
86
86
 
87
+ declare enum SafeSearch {
88
+ OFF = "off",
89
+ STRICT = "strict"
90
+ }
91
+
87
92
  declare enum ContentTier {
88
93
  STANDARD = "standard",
89
94
  ENTITLED = "entitled",
@@ -171,6 +176,8 @@ interface WebSearchParams {
171
176
  contentFormat?: ContentFormat;
172
177
  /** Max characters in content (1-500000, default 10000). */
173
178
  maxLength?: number;
179
+ /** Safe search mode: use SafeSearch.OFF or .STRICT. */
180
+ safeSearch?: SafeSearch;
174
181
  /** Per-request timeout in milliseconds (overrides client default). */
175
182
  timeout?: number;
176
183
  /**
@@ -233,6 +240,10 @@ type NewsItem = {
233
240
  * The last updated date of the news, in UTC ISO8601 format.
234
241
  */
235
242
  lastUpdatedAt?: string | null;
243
+ /**
244
+ * The last crawled date of the news, follows ISO8601 format.
245
+ */
246
+ crawledAt?: string | null;
236
247
  /**
237
248
  * Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
238
249
  */
@@ -315,11 +326,6 @@ declare class NewsResource {
315
326
  search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
316
327
  }
317
328
 
318
- declare enum SafeSearch {
319
- OFF = "off",
320
- STRICT = "strict"
321
- }
322
-
323
329
  declare enum VideoDuration {
324
330
  SHORT = "short",
325
331
  MEDIUM = "medium",
@@ -686,6 +692,12 @@ declare enum BrowseContentFormat {
686
692
  MARKDOWN = "markdown"
687
693
  }
688
694
 
695
+ declare enum BrowseLiveCrawl {
696
+ NONE = "none",
697
+ FALLBACK = "fallback",
698
+ FORCE = "force"
699
+ }
700
+
689
701
  type BrowseResponse = {
690
702
  /**
691
703
  * The URL of the web page.
@@ -733,8 +745,8 @@ interface BrowseParams {
733
745
  url: string;
734
746
  /** Max characters in content (1-500000, default 10000). */
735
747
  maxLength?: number;
736
- /** Crawl behavior ('none', 'fallback', or 'force', default 'none'). */
737
- liveCrawl?: 'none' | 'fallback' | 'force';
748
+ /** Crawl behavior: use BrowseLiveCrawl.NONE, .FALLBACK, or .FORCE. */
749
+ liveCrawl?: BrowseLiveCrawl;
738
750
  /** Include outbound hyperlinks (default false). */
739
751
  includeWebLinks?: boolean;
740
752
  /** Enable JS rendering for dynamic content (default false). */
@@ -770,12 +782,6 @@ declare class BrowseResource {
770
782
  fetch(url: string, options?: BrowseFetchOptions): Promise<BrowseResponse>;
771
783
  }
772
784
 
773
- declare enum SafeSearchMode {
774
- OFF = "off",
775
- MODERATE = "moderate",
776
- STRICT = "strict"
777
- }
778
-
779
785
  type QuerySignals = {
780
786
  /**
781
787
  * The original user query as received by the system.
@@ -848,8 +854,8 @@ interface ClassicSearchParams {
848
854
  freshness?: string;
849
855
  /** List of answer types to include in response. */
850
856
  responseFilter?: string[];
851
- /** Safe search mode: use SafeSearchMode.OFF, .MODERATE, or .STRICT. */
852
- safeSearch?: SafeSearchMode;
857
+ /** Safe search mode: use SafeSearch.OFF or .STRICT. */
858
+ safeSearch?: SafeSearch;
853
859
  /** Per-request timeout in milliseconds (overrides client default). */
854
860
  timeout?: number;
855
861
  /** Caller-provided cancellation signal (see `WebSearchParams.signal`). */
@@ -1129,6 +1135,12 @@ declare class PermissionDeniedError extends APIStatusError {
1129
1135
  });
1130
1136
  }
1131
1137
 
1138
+ declare enum SafeSearchMode {
1139
+ OFF = "off",
1140
+ MODERATE = "moderate",
1141
+ STRICT = "strict"
1142
+ }
1143
+
1132
1144
  /**
1133
1145
  * HTTP transport implementation.
1134
1146
  */
@@ -1171,4 +1183,4 @@ declare class HttpTransport implements Transport {
1171
1183
  close(): Promise<void>;
1172
1184
  }
1173
1185
 
1174
- export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, type BrowseParams, BrowseResource, type BrowseResponse, ClassicResource, type ClassicSearchOptions, type ClassicSearchParams, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, ImagesResource, type ImagesResponse, type ImagesSearchParams, type NewsItem, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, type QuerySignals, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, SafeSearchMode, type SearchClassicResponse, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
1186
+ export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, BrowseLiveCrawl, type BrowseParams, BrowseResource, type BrowseResponse, ClassicResource, type ClassicSearchOptions, type ClassicSearchParams, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, ImagesResource, type ImagesResponse, type ImagesSearchParams, type NewsItem, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, type QuerySignals, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, SafeSearchMode, type SearchClassicResponse, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
package/dist/index.d.ts CHANGED
@@ -84,6 +84,11 @@ declare enum ContentFormat {
84
84
  MARKDOWN = "markdown"
85
85
  }
86
86
 
87
+ declare enum SafeSearch {
88
+ OFF = "off",
89
+ STRICT = "strict"
90
+ }
91
+
87
92
  declare enum ContentTier {
88
93
  STANDARD = "standard",
89
94
  ENTITLED = "entitled",
@@ -171,6 +176,8 @@ interface WebSearchParams {
171
176
  contentFormat?: ContentFormat;
172
177
  /** Max characters in content (1-500000, default 10000). */
173
178
  maxLength?: number;
179
+ /** Safe search mode: use SafeSearch.OFF or .STRICT. */
180
+ safeSearch?: SafeSearch;
174
181
  /** Per-request timeout in milliseconds (overrides client default). */
175
182
  timeout?: number;
176
183
  /**
@@ -233,6 +240,10 @@ type NewsItem = {
233
240
  * The last updated date of the news, in UTC ISO8601 format.
234
241
  */
235
242
  lastUpdatedAt?: string | null;
243
+ /**
244
+ * The last crawled date of the news, follows ISO8601 format.
245
+ */
246
+ crawledAt?: string | null;
236
247
  /**
237
248
  * Publisher name, such as 'USA TODAY | MSN', 'CNN', etc.
238
249
  */
@@ -315,11 +326,6 @@ declare class NewsResource {
315
326
  search(query: string, options?: NewsSearchOptions): Promise<NewsResponse>;
316
327
  }
317
328
 
318
- declare enum SafeSearch {
319
- OFF = "off",
320
- STRICT = "strict"
321
- }
322
-
323
329
  declare enum VideoDuration {
324
330
  SHORT = "short",
325
331
  MEDIUM = "medium",
@@ -686,6 +692,12 @@ declare enum BrowseContentFormat {
686
692
  MARKDOWN = "markdown"
687
693
  }
688
694
 
695
+ declare enum BrowseLiveCrawl {
696
+ NONE = "none",
697
+ FALLBACK = "fallback",
698
+ FORCE = "force"
699
+ }
700
+
689
701
  type BrowseResponse = {
690
702
  /**
691
703
  * The URL of the web page.
@@ -733,8 +745,8 @@ interface BrowseParams {
733
745
  url: string;
734
746
  /** Max characters in content (1-500000, default 10000). */
735
747
  maxLength?: number;
736
- /** Crawl behavior ('none', 'fallback', or 'force', default 'none'). */
737
- liveCrawl?: 'none' | 'fallback' | 'force';
748
+ /** Crawl behavior: use BrowseLiveCrawl.NONE, .FALLBACK, or .FORCE. */
749
+ liveCrawl?: BrowseLiveCrawl;
738
750
  /** Include outbound hyperlinks (default false). */
739
751
  includeWebLinks?: boolean;
740
752
  /** Enable JS rendering for dynamic content (default false). */
@@ -770,12 +782,6 @@ declare class BrowseResource {
770
782
  fetch(url: string, options?: BrowseFetchOptions): Promise<BrowseResponse>;
771
783
  }
772
784
 
773
- declare enum SafeSearchMode {
774
- OFF = "off",
775
- MODERATE = "moderate",
776
- STRICT = "strict"
777
- }
778
-
779
785
  type QuerySignals = {
780
786
  /**
781
787
  * The original user query as received by the system.
@@ -848,8 +854,8 @@ interface ClassicSearchParams {
848
854
  freshness?: string;
849
855
  /** List of answer types to include in response. */
850
856
  responseFilter?: string[];
851
- /** Safe search mode: use SafeSearchMode.OFF, .MODERATE, or .STRICT. */
852
- safeSearch?: SafeSearchMode;
857
+ /** Safe search mode: use SafeSearch.OFF or .STRICT. */
858
+ safeSearch?: SafeSearch;
853
859
  /** Per-request timeout in milliseconds (overrides client default). */
854
860
  timeout?: number;
855
861
  /** Caller-provided cancellation signal (see `WebSearchParams.signal`). */
@@ -1129,6 +1135,12 @@ declare class PermissionDeniedError extends APIStatusError {
1129
1135
  });
1130
1136
  }
1131
1137
 
1138
+ declare enum SafeSearchMode {
1139
+ OFF = "off",
1140
+ MODERATE = "moderate",
1141
+ STRICT = "strict"
1142
+ }
1143
+
1132
1144
  /**
1133
1145
  * HTTP transport implementation.
1134
1146
  */
@@ -1171,4 +1183,4 @@ declare class HttpTransport implements Transport {
1171
1183
  close(): Promise<void>;
1172
1184
  }
1173
1185
 
1174
- export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, type BrowseParams, BrowseResource, type BrowseResponse, ClassicResource, type ClassicSearchOptions, type ClassicSearchParams, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, ImagesResource, type ImagesResponse, type ImagesSearchParams, type NewsItem, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, type QuerySignals, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, SafeSearchMode, type SearchClassicResponse, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
1186
+ export { APIConnectionError, APIStatusError, ApiKeyAuth, type AuthProvider, AuthenticationError, BrowseContentFormat, type BrowseFetchOptions, BrowseLiveCrawl, type BrowseParams, BrowseResource, type BrowseResponse, ClassicResource, type ClassicSearchOptions, type ClassicSearchParams, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, type FetchFunction, HttpTransport, type HttpTransportOptions, ImageAspectRatio, ImageColor, type ImageItem, type ImageSearchOptions, ImageSize, ImagesResource, type ImagesResponse, type ImagesSearchParams, type NewsItem, NewsResource, type NewsResponse, type NewsSearchOptions, type NewsSearchParams, type NewsThumbnail, PermissionDeniedError, type PlaylistItem, type PlaylistVideo, type QuerySignals, RateLimitError, RetryPolicy, type RetryPolicyOptions, SafeSearch, SafeSearchMode, type SearchClassicResponse, type TelemetryEvent, type TelemetryHook, type TokenCredential, type Transport, type TransportRequestOptions, VideoDuration, type VideoItem, type VideoMoment, VideoResolution, type VideoSearchOptions, VideosResource, type VideosResponse, type VideosSearchParams, WebIQClient, type WebIQClientOptions, WebIQError, WebResource, type WebResponse, type WebResult, type WebSearchOptions, type WebSearchParams, createAuth, createClient, createTelemetryEvent, safeCall };
package/dist/index.js CHANGED
@@ -84,6 +84,9 @@ var WebResource = class {
84
84
  if (options?.maxLength !== void 0) {
85
85
  payload.maxLength = options.maxLength;
86
86
  }
87
+ if (options?.safeSearch !== void 0) {
88
+ payload.safeSearch = options.safeSearch;
89
+ }
87
90
  const result = await this.transport.request({
88
91
  method: "POST",
89
92
  path: "/search/web",
@@ -726,6 +729,14 @@ var BrowseContentFormat = /* @__PURE__ */ ((BrowseContentFormat2) => {
726
729
  return BrowseContentFormat2;
727
730
  })(BrowseContentFormat || {});
728
731
 
732
+ // src/generated-otc/models/BrowseLiveCrawl.ts
733
+ var BrowseLiveCrawl = /* @__PURE__ */ ((BrowseLiveCrawl2) => {
734
+ BrowseLiveCrawl2["NONE"] = "none";
735
+ BrowseLiveCrawl2["FALLBACK"] = "fallback";
736
+ BrowseLiveCrawl2["FORCE"] = "force";
737
+ return BrowseLiveCrawl2;
738
+ })(BrowseLiveCrawl || {});
739
+
729
740
  // src/generated-otc/models/ContentFormat.ts
730
741
  var ContentFormat = /* @__PURE__ */ ((ContentFormat2) => {
731
742
  ContentFormat2["PASSAGE"] = "passage";
@@ -804,6 +815,7 @@ exports.APIStatusError = APIStatusError;
804
815
  exports.ApiKeyAuth = ApiKeyAuth;
805
816
  exports.AuthenticationError = AuthenticationError;
806
817
  exports.BrowseContentFormat = BrowseContentFormat;
818
+ exports.BrowseLiveCrawl = BrowseLiveCrawl;
807
819
  exports.BrowseResource = BrowseResource;
808
820
  exports.ClassicResource = ClassicResource;
809
821
  exports.ContentFormat = ContentFormat;
package/dist/index.mjs CHANGED
@@ -82,6 +82,9 @@ var WebResource = class {
82
82
  if (options?.maxLength !== void 0) {
83
83
  payload.maxLength = options.maxLength;
84
84
  }
85
+ if (options?.safeSearch !== void 0) {
86
+ payload.safeSearch = options.safeSearch;
87
+ }
85
88
  const result = await this.transport.request({
86
89
  method: "POST",
87
90
  path: "/search/web",
@@ -724,6 +727,14 @@ var BrowseContentFormat = /* @__PURE__ */ ((BrowseContentFormat2) => {
724
727
  return BrowseContentFormat2;
725
728
  })(BrowseContentFormat || {});
726
729
 
730
+ // src/generated-otc/models/BrowseLiveCrawl.ts
731
+ var BrowseLiveCrawl = /* @__PURE__ */ ((BrowseLiveCrawl2) => {
732
+ BrowseLiveCrawl2["NONE"] = "none";
733
+ BrowseLiveCrawl2["FALLBACK"] = "fallback";
734
+ BrowseLiveCrawl2["FORCE"] = "force";
735
+ return BrowseLiveCrawl2;
736
+ })(BrowseLiveCrawl || {});
737
+
727
738
  // src/generated-otc/models/ContentFormat.ts
728
739
  var ContentFormat = /* @__PURE__ */ ((ContentFormat2) => {
729
740
  ContentFormat2["PASSAGE"] = "passage";
@@ -797,4 +808,4 @@ var ImageSize = /* @__PURE__ */ ((ImageSize2) => {
797
808
  return ImageSize2;
798
809
  })(ImageSize || {});
799
810
 
800
- export { APIConnectionError, APIStatusError, ApiKeyAuth, AuthenticationError, BrowseContentFormat, BrowseResource, ClassicResource, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, HttpTransport, ImageAspectRatio, ImageColor, ImageSize, ImagesResource, NewsResource, PermissionDeniedError, RateLimitError, RetryPolicy, SafeSearch, SafeSearchMode, VideoDuration, VideoResolution, VideosResource, WebIQClient, WebIQError, WebResource, createAuth, createClient, createTelemetryEvent, safeCall };
811
+ export { APIConnectionError, APIStatusError, ApiKeyAuth, AuthenticationError, BrowseContentFormat, BrowseLiveCrawl, BrowseResource, ClassicResource, ContentFormat, ContentTier, DEFAULT_SCOPE, DEFAULT_TIMEOUT, EntraIDAuth, HttpTransport, ImageAspectRatio, ImageColor, ImageSize, ImagesResource, NewsResource, PermissionDeniedError, RateLimitError, RetryPolicy, SafeSearch, SafeSearchMode, VideoDuration, VideoResolution, VideosResource, WebIQClient, WebIQError, WebResource, createAuth, createClient, createTelemetryEvent, safeCall };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/webiq",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Web IQ API TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",