New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/search-service

Package Overview
Dependencies
Maintainers
12
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/search-service - npm Package Compare versions

Comparing version 0.0.1-alpha.12 to 0.0.1-alpha.13

dist/src/models/metadata-fields/field-types/byte.d.ts

5

dist/src/models/file.d.ts

@@ -1,2 +0,3 @@

import { Duration } from './metadata-fields/field-types/duration';
import type { Byte } from './metadata-fields/field-types/byte';
import type { Duration } from './metadata-fields/field-types/duration';
/**

@@ -18,3 +19,3 @@ * This represents an Internet Archive File

original?: string;
size?: number;
size?: Byte;
title?: string;

@@ -21,0 +22,0 @@ length?: Duration;

/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { DurationParser, } from './metadata-fields/field-types/duration';
import { ByteParser } from './metadata-fields/field-types/byte';
import { DurationParser } from './metadata-fields/field-types/duration';
import { NumberParser } from './metadata-fields/field-types/number';

@@ -27,3 +28,3 @@ /**

this.size = json.size
? NumberParser.shared.parseValue(json.size)
? ByteParser.shared.parseValue(json.size)
: undefined;

@@ -30,0 +31,0 @@ this.height = json.height

@@ -16,4 +16,13 @@ import { FieldParserInterface } from '../field-parser-interface';

}
/**
* The DurationField parses different duration formats
* and returns a `Duration`, which is a number in seconds
* with decimals.
*
* @export
* @class DurationField
* @extends {MetadataField<Duration, DurationParser>}
*/
export declare class DurationField extends MetadataField<Duration, DurationParser> {
constructor(rawValue: any);
}

@@ -27,2 +27,11 @@ import { MetadataField } from '../metadata-field';

DurationParser.shared = new DurationParser();
/**
* The DurationField parses different duration formats
* and returns a `Duration`, which is a number in seconds
* with decimals.
*
* @export
* @class DurationField
* @extends {MetadataField<Duration, DurationParser>}
*/
export class DurationField extends MetadataField {

@@ -29,0 +38,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

66

dist/src/models/metadata.d.ts

@@ -7,2 +7,3 @@ import { BooleanField } from './metadata-fields/field-types/boolean';

import { PageProgressionField } from './metadata-fields/field-types/page-progression';
import { ByteField } from './metadata-fields/field-types/byte';
/**

@@ -22,3 +23,3 @@ * Metadata is an expansive model that describes an Item.

*
* @type {*}
* @type { string: any }
* @memberof Metadata

@@ -29,2 +30,11 @@ */

};
/**
* The item identifier.
*
* _Note_ This is a plain string instead of a `MetadataField` since it's
* the primary key of the item.
*
* @type {string}
* @memberof Metadata
*/
identifier?: string;

@@ -35,2 +45,9 @@ addeddate?: DateField;

collection?: StringField;
/**
* The size of a collection in bytes
*
* @type {ByteField}
* @memberof Metadata
*/
collection_size?: ByteField;
contributor?: StringField;

@@ -41,8 +58,48 @@ coverage?: StringField;

description?: StringField;
/**
* All time download count
*
* @type {NumberField}
* @memberof Metadata
*/
downloads?: NumberField;
/**
* The item duration in seconds
*
* @type {DurationField}
* @memberof Metadata
*/
duration?: DurationField;
/**
* The number of files in an item
*
* @type {NumberField}
* @memberof Metadata
*/
files_count?: NumberField;
indexdate?: DateField;
/**
* For collections, the number of items in the collection
*
* @type {NumberField}
* @memberof Metadata
*/
item_count?: NumberField;
/**
* The size of the item in bytes
*
* @type {NumberField}
* @memberof Metadata
*/
item_size?: ByteField;
language?: StringField;
length?: DurationField;
lineage?: StringField;
/**
* The number of downloads in the last month
*
* @type {NumberField}
* @memberof Metadata
*/
month?: NumberField;
mediatype?: StringField;

@@ -69,4 +126,11 @@ noindex?: BooleanField;

venue?: StringField;
/**
* The number of downloads in the last week
*
* @type {NumberField}
* @memberof Metadata
*/
week?: NumberField;
year?: DateField;
constructor(json: any);
}

@@ -9,2 +9,3 @@ /* eslint-disable @typescript-eslint/camelcase */

import { StringField } from './metadata-fields/field-types/string';
import { ByteField } from './metadata-fields/field-types/byte';
/**

@@ -38,2 +39,5 @@ * Metadata is an expansive model that describes an Item.

: undefined;
this.collection_size = json.collection_size
? new ByteField(json.collection_size)
: undefined;
this.contributor = json.contributor

@@ -54,2 +58,9 @@ ? new StringField(json.contributor)

: undefined;
this.files_count = json.files_count
? new NumberField(json.files_count)
: undefined;
this.item_count = json.item_count
? new NumberField(json.item_count)
: undefined;
this.item_size = json.item_size ? new ByteField(json.item_size) : undefined;
this.language = json.language ? new StringField(json.language) : undefined;

@@ -61,2 +72,3 @@ this.length = json.length ? new DurationField(json.length) : undefined;

: undefined;
this.month = json.month ? new NumberField(json.month) : undefined;
this.noindex = json.noindex ? new BooleanField(json.noindex) : undefined;

@@ -90,2 +102,3 @@ this.notes = json.notes ? new StringField(json.notes) : undefined;

this.venue = json.venue ? new StringField(json.venue) : undefined;
this.week = json.week ? new NumberField(json.week) : undefined;
this.year = json.year ? new DateField(json.year) : undefined;

@@ -92,0 +105,0 @@ }

{
"name": "@internetarchive/search-service",
"version": "0.0.1-alpha.12",
"version": "0.0.1-alpha.13",
"description": "A search service for the Internet Archive",

@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only",

@@ -15,8 +15,13 @@ @@ -1,117 +0,0 @@

```ts
import { SearchService } from '@internetarchive/search-service';
import {
SearchService,
SortParam,
SortDirection
} from '@internetarchive/search-service';
const searchService = SearchService.default;
const sortParam = new SortParam('date', SortDirection.Desc)
const params = new SearchParams({
query: 'collection:books AND title:(little bunny foo foo)',
sort: 'downloads desc',
query: 'collection:books AND title:(goody)',
sort: sortParam,
rows: 25,

@@ -50,3 +55,3 @@ start: 0,

The Search Service handles all of the possible variations in data formats and converts them to native types. For instance on date fields, like `date`, it takes the string returned and converts it into a native javascript `Date` value. Similarly for duration-type fields, like `length`, it takes the duration, which can be seconds `324.34` or `hh:mm:ss.ms` and converts them to a `number` in seconds.
The Search Service handles all of the possible variations in data formats and converts them to their appropriate types. For instance on date fields, like `date`, it takes the string returned and converts it into a native javascript `Date` value. Similarly for duration-type fields, like `length`, it takes the duration, which can be seconds `324.34` or `hh:mm:ss.ms` and converts them to a `number` in seconds.

@@ -83,3 +88,3 @@ There are parsers for several different field types, like `Number`, `String`, `Date`, and `Duration` and others can be added for other field types.

```bash
npm run formatting
npm run format
```
/* eslint-disable @typescript-eslint/camelcase */
/* eslint-disable @typescript-eslint/no-explicit-any */
import {
Duration,
DurationParser,
} from './metadata-fields/field-types/duration';
import type { Byte } from './metadata-fields/field-types/byte';
import type { Duration } from './metadata-fields/field-types/duration';
import { ByteParser } from './metadata-fields/field-types/byte';
import { DurationParser } from './metadata-fields/field-types/duration';
import { NumberParser } from './metadata-fields/field-types/number';

@@ -35,3 +35,3 @@

size?: number;
size?: Byte;

@@ -69,3 +69,3 @@ title?: string;

this.size = json.size
? NumberParser.shared.parseValue(json.size)
? ByteParser.shared.parseValue(json.size)
: undefined;

@@ -72,0 +72,0 @@ this.height = json.height

@@ -36,2 +36,11 @@ import { FieldParserInterface } from '../field-parser-interface';

/**
* The DurationField parses different duration formats
* and returns a `Duration`, which is a number in seconds
* with decimals.
*
* @export
* @class DurationField
* @extends {MetadataField<Duration, DurationParser>}
*/
export class DurationField extends MetadataField<Duration, DurationParser> {

@@ -38,0 +47,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -11,2 +11,3 @@ /* eslint-disable @typescript-eslint/camelcase */

import { PageProgressionField } from './metadata-fields/field-types/page-progression';
import { ByteField } from './metadata-fields/field-types/byte';

@@ -27,3 +28,3 @@ /**

*
* @type {*}
* @type { string: any }
* @memberof Metadata

@@ -33,2 +34,11 @@ */

/**
* The item identifier.
*
* _Note_ This is a plain string instead of a `MetadataField` since it's
* the primary key of the item.
*
* @type {string}
* @memberof Metadata
*/
identifier?: string;

@@ -44,2 +54,10 @@

/**
* The size of a collection in bytes
*
* @type {ByteField}
* @memberof Metadata
*/
collection_size?: ByteField;
contributor?: StringField;

@@ -55,8 +73,44 @@

/**
* All time download count
*
* @type {NumberField}
* @memberof Metadata
*/
downloads?: NumberField;
/**
* The item duration in seconds
*
* @type {DurationField}
* @memberof Metadata
*/
duration?: DurationField;
/**
* The number of files in an item
*
* @type {NumberField}
* @memberof Metadata
*/
files_count?: NumberField;
indexdate?: DateField;
/**
* For collections, the number of items in the collection
*
* @type {NumberField}
* @memberof Metadata
*/
item_count?: NumberField;
/**
* The size of the item in bytes
*
* @type {NumberField}
* @memberof Metadata
*/
item_size?: ByteField;
language?: StringField;

@@ -68,2 +122,10 @@

/**
* The number of downloads in the last month
*
* @type {NumberField}
* @memberof Metadata
*/
month?: NumberField;
mediatype?: StringField;

@@ -111,2 +173,10 @@

/**
* The number of downloads in the last week
*
* @type {NumberField}
* @memberof Metadata
*/
week?: NumberField;
year?: DateField;

@@ -133,2 +203,5 @@

: undefined;
this.collection_size = json.collection_size
? new ByteField(json.collection_size)
: undefined;
this.contributor = json.contributor

@@ -149,2 +222,9 @@ ? new StringField(json.contributor)

: undefined;
this.files_count = json.files_count
? new NumberField(json.files_count)
: undefined;
this.item_count = json.item_count
? new NumberField(json.item_count)
: undefined;
this.item_size = json.item_size ? new ByteField(json.item_size) : undefined;
this.language = json.language ? new StringField(json.language) : undefined;

@@ -156,2 +236,3 @@ this.length = json.length ? new DurationField(json.length) : undefined;

: undefined;
this.month = json.month ? new NumberField(json.month) : undefined;
this.noindex = json.noindex ? new BooleanField(json.noindex) : undefined;

@@ -185,4 +266,5 @@ this.notes = json.notes ? new StringField(json.notes) : undefined;

this.venue = json.venue ? new StringField(json.venue) : undefined;
this.week = json.week ? new NumberField(json.week) : undefined;
this.year = json.year ? new DateField(json.year) : undefined;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc