@sebspark/opensearch 0.1.0 → 0.1.1

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.mts CHANGED
@@ -238,7 +238,8 @@ type OpenSearchQuery<T extends {
238
238
  size?: number;
239
239
  } : never;
240
240
  type BasicOpenSearchFieldTypes = 'text' | 'keyword' | 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' | 'date' | 'boolean' | 'binary';
241
- type OpenSearchFieldType<T> = T extends string ? 'text' | 'keyword' : T extends number ? 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' : T extends boolean ? 'boolean' : T extends Date ? 'date' : BasicOpenSearchFieldTypes;
241
+ type ElementType<T> = T extends Array<infer U> ? U : T;
242
+ type OpenSearchFieldType<T> = ElementType<T> extends string ? 'text' | 'keyword' : ElementType<T> extends number ? 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' : ElementType<T> extends boolean ? 'boolean' : ElementType<T> extends Date ? 'date' : BasicOpenSearchFieldTypes;
242
243
  type FieldOptions<T> = {
243
244
  type: OpenSearchFieldType<T>;
244
245
  };
@@ -255,7 +256,7 @@ type IndexOptions<T extends WithId> = {
255
256
  aliases?: Record<string, Record<string, never>>;
256
257
  };
257
258
  type IndexProperties<T> = {
258
- [K in keyof Partial<T>]: T[K] extends object ? T[K] extends Array<infer U> ? Array<IndexProperties<U>> : IndexProperties<T[K]> : FieldOptions<T[K]>;
259
+ [K in keyof Partial<T>]: T[K] extends object ? T[K] extends Array<infer U> ? FieldOptions<T[K]> : IndexProperties<T[K]> : FieldOptions<T[K]>;
259
260
  };
260
261
 
261
262
  interface OpenSearchHelper extends Client {
package/dist/index.d.ts CHANGED
@@ -238,7 +238,8 @@ type OpenSearchQuery<T extends {
238
238
  size?: number;
239
239
  } : never;
240
240
  type BasicOpenSearchFieldTypes = 'text' | 'keyword' | 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' | 'date' | 'boolean' | 'binary';
241
- type OpenSearchFieldType<T> = T extends string ? 'text' | 'keyword' : T extends number ? 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' : T extends boolean ? 'boolean' : T extends Date ? 'date' : BasicOpenSearchFieldTypes;
241
+ type ElementType<T> = T extends Array<infer U> ? U : T;
242
+ type OpenSearchFieldType<T> = ElementType<T> extends string ? 'text' | 'keyword' : ElementType<T> extends number ? 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float' : ElementType<T> extends boolean ? 'boolean' : ElementType<T> extends Date ? 'date' : BasicOpenSearchFieldTypes;
242
243
  type FieldOptions<T> = {
243
244
  type: OpenSearchFieldType<T>;
244
245
  };
@@ -255,7 +256,7 @@ type IndexOptions<T extends WithId> = {
255
256
  aliases?: Record<string, Record<string, never>>;
256
257
  };
257
258
  type IndexProperties<T> = {
258
- [K in keyof Partial<T>]: T[K] extends object ? T[K] extends Array<infer U> ? Array<IndexProperties<U>> : IndexProperties<T[K]> : FieldOptions<T[K]>;
259
+ [K in keyof Partial<T>]: T[K] extends object ? T[K] extends Array<infer U> ? FieldOptions<T[K]> : IndexProperties<T[K]> : FieldOptions<T[K]>;
259
260
  };
260
261
 
261
262
  interface OpenSearchHelper extends Client {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/opensearch",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",