@maixio/pstore 0.1.0
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +515 -0
- package/README.zh-CN.md +610 -0
- package/dist/api/batarang.d.ts +25 -0
- package/dist/api/browse.d.ts +64 -0
- package/dist/api/catalog-discovery.d.ts +40 -0
- package/dist/api/catalog-registry.d.ts +21 -0
- package/dist/api/catalog-validation.d.ts +21 -0
- package/dist/api/category-names.d.ts +2 -0
- package/dist/api/graphql.d.ts +216 -0
- package/dist/api/search.d.ts +23 -0
- package/dist/api/status.d.ts +81 -0
- package/dist/build-record.d.ts +20 -0
- package/dist/cache.d.ts +25 -0
- package/dist/cli.js +5500 -0
- package/dist/client.d.ts +47 -0
- package/dist/config.d.ts +30 -0
- package/dist/fetch.d.ts +19 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +2107 -0
- package/dist/locale.d.ts +12 -0
- package/dist/log.d.ts +31 -0
- package/dist/perf.d.ts +16 -0
- package/dist/provider.d.ts +16 -0
- package/dist/types.d.ts +253 -0
- package/dist/utils.d.ts +54 -0
- package/package.json +76 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { fetchBrowseGrid, type BrowseGridResult, type BrowseQuery } from "./api/browse.js";
|
|
2
|
+
import { fetchCategoryGrid, fetchCategoryGridResult, type CategoryGridItem, type CategoryGridParams, type CategoryGridResult } from "./api/graphql.js";
|
|
3
|
+
import { searchGames, type SearchOptions, type SearchResponse } from "./api/search.js";
|
|
4
|
+
import { fetchPsnStatus, type PsnStatusOptions, type PsnStatusResult } from "./api/status.js";
|
|
5
|
+
import { lookupGame, type LookupResponse } from "./provider.js";
|
|
6
|
+
import type { LookupOptions, PsnLocale } from "./types.js";
|
|
7
|
+
export interface PstoreClientOptions {
|
|
8
|
+
locale?: PsnLocale;
|
|
9
|
+
}
|
|
10
|
+
export interface PstoreClient {
|
|
11
|
+
readonly locale: PsnLocale;
|
|
12
|
+
lookup(id: string, options?: Omit<LookupOptions, "locale"> & {
|
|
13
|
+
locale?: PsnLocale;
|
|
14
|
+
}): Promise<LookupResponse>;
|
|
15
|
+
search(options: Omit<SearchOptions, "locale"> & {
|
|
16
|
+
locale?: PsnLocale;
|
|
17
|
+
}): Promise<SearchResponse>;
|
|
18
|
+
browse(query?: Omit<BrowseQuery, "locale"> & {
|
|
19
|
+
locale?: PsnLocale;
|
|
20
|
+
}): Promise<BrowseGridResult | null>;
|
|
21
|
+
category(params: Omit<CategoryGridParams, "locale"> & {
|
|
22
|
+
locale?: PsnLocale;
|
|
23
|
+
}): Promise<CategoryGridItem[] | null>;
|
|
24
|
+
categoryGrid(params: Omit<CategoryGridParams, "locale"> & {
|
|
25
|
+
locale?: PsnLocale;
|
|
26
|
+
}): Promise<CategoryGridResult | null>;
|
|
27
|
+
status(options?: Omit<PsnStatusOptions, "locale"> & {
|
|
28
|
+
locale?: PsnLocale;
|
|
29
|
+
}): Promise<PsnStatusResult>;
|
|
30
|
+
}
|
|
31
|
+
interface PstoreClientDeps {
|
|
32
|
+
lookupGame: typeof lookupGame;
|
|
33
|
+
searchGames: typeof searchGames;
|
|
34
|
+
fetchBrowseGrid: typeof fetchBrowseGrid;
|
|
35
|
+
fetchCategoryGrid: typeof fetchCategoryGrid;
|
|
36
|
+
fetchCategoryGridResult: typeof fetchCategoryGridResult;
|
|
37
|
+
fetchPsnStatus: typeof fetchPsnStatus;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create a small SDK facade with a default locale. Current provider caches are
|
|
41
|
+
* still process-global; this facade keeps call sites stable while leaving room
|
|
42
|
+
* for per-client cache/logger injection in a future minor release.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createPstoreClient(options?: PstoreClientOptions): PstoreClient;
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare function createPstoreClientWithDeps(options: PstoreClientOptions | undefined, deps: PstoreClientDeps): PstoreClient;
|
|
47
|
+
export {};
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface CliConfig {
|
|
2
|
+
/** Default locale */
|
|
3
|
+
locale?: string;
|
|
4
|
+
/** Default output format: "text" | "json" */
|
|
5
|
+
format?: "text" | "json";
|
|
6
|
+
/** Default page size for search/category */
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
/** Enable verbose timing by default */
|
|
9
|
+
verbose?: boolean;
|
|
10
|
+
/** Whether to show colors */
|
|
11
|
+
color?: boolean;
|
|
12
|
+
/** Cache TTL overrides */
|
|
13
|
+
cacheTtl?: {
|
|
14
|
+
lookup?: number;
|
|
15
|
+
search?: number;
|
|
16
|
+
category?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the merged configuration (file config + defaults).
|
|
21
|
+
*/
|
|
22
|
+
export declare function getConfig(): CliConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Reload configuration from disk.
|
|
25
|
+
*/
|
|
26
|
+
export declare function reloadConfig(): CliConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Create a default config file in the project root.
|
|
29
|
+
*/
|
|
30
|
+
export declare function initConfig(): string;
|
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PsnLocale } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Fetch from PSN GraphQL API with retry, timeout, and gzip.
|
|
4
|
+
*
|
|
5
|
+
* @param operationName - GraphQL operation name
|
|
6
|
+
* @param sha256Hash - Persisted query SHA256 hash
|
|
7
|
+
* @param variables - Query variables
|
|
8
|
+
* @param locale - Optional locale override
|
|
9
|
+
* @returns Parsed JSON response
|
|
10
|
+
*/
|
|
11
|
+
export declare function fetchPsnApi<T>(operationName: string, sha256Hash: string, variables: Record<string, unknown>, locale?: PsnLocale): Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a PSN store HTML page.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fetchHtml(url: string): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a string is a valid URL.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isValidUrl(str: string): boolean;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { createPstoreClient } from "./client.js";
|
|
2
|
+
export type { PstoreClient, PstoreClientOptions } from "./client.js";
|
|
3
|
+
export { lookupGame, clearCaches as clearPstoreCaches } from "./provider.js";
|
|
4
|
+
export type { LookupResponse } from "./provider.js";
|
|
5
|
+
export { searchGames } from "./api/search.js";
|
|
6
|
+
export type { SearchOptions, SearchResponse } from "./api/search.js";
|
|
7
|
+
export { fetchPsnStatus, parsePsnStatus, regionForCountry } from "./api/status.js";
|
|
8
|
+
export type { PsnServiceStatus, PsnStatusIncident, PsnStatusOptions, PsnStatusRegion, PsnStatusResult, PsnStatusService, PsnStatusServiceResource, } from "./api/status.js";
|
|
9
|
+
export { fetchBrowseGrid, normalizeBrowseWindow, resolveBrowseQuery, resolveBrowseSortDefaults, sampleItems, } from "./api/browse.js";
|
|
10
|
+
export type { BrowseGridResult, BrowseOrder, BrowseQuery, BrowseResolvedQuery, BrowseWindow, } from "./api/browse.js";
|
|
11
|
+
export { fetchCategoryGrid, fetchCategoryGridResult } from "./api/graphql.js";
|
|
12
|
+
export type { CategoryFacet, CategoryFacetValue, CategoryGridItem, CategoryGridPageInfo, CategoryGridParams, CategoryGridResult, CategorySortingOption, } from "./api/graphql.js";
|
|
13
|
+
export { resolveCategoryDisplayName } from "./api/category-names.js";
|
|
14
|
+
export { validateCatalog, validateCatalogs } from "./api/catalog-validation.js";
|
|
15
|
+
export type { CatalogValidationOptions, CatalogValidationResult, } from "./api/catalog-validation.js";
|
|
16
|
+
export { BUILTIN_CATALOGS, CATALOG_ALIASES, resolveCatalogAlias, resolveCatalogDisplayName, resolveCatalogVisibility, } from "./api/catalog-registry.js";
|
|
17
|
+
export type { CatalogRegistryEntry, CatalogRegistrySource, CatalogVisibility, } from "./api/catalog-registry.js";
|
|
18
|
+
export { discoverCatalogs } from "./api/catalog-discovery.js";
|
|
19
|
+
export type { CatalogDiscoveryCatalog, CatalogDiscoveryPage, CatalogDiscoveryResult, DiscoverCatalogsOptions, } from "./api/catalog-discovery.js";
|
|
20
|
+
export { DEFAULT_LOCALE, TITLE_LOCALE_PRESETS, getLocaleInfo, isPsnLocale, localeToSearchParams, localeToStorePath, normalizeLocale, parseLocaleList, } from "./locale.js";
|
|
21
|
+
export { LOCALE_MAP } from "./types.js";
|
|
22
|
+
export type { BatarangData, CategoryResults, ConceptId, ContentRating, Description, DescriptionType, Edition, GameCTA, LocaleInfo, LookupOptions, LookupResult, LookupSource, LookupSources, LookupWarning, Media, MediaRole, MediaType, Price, Product, ProductId, PsnLocale, RatingDistribution, SearchResultItem, SearchResults, Sku, StarRating, } from "./types.js";
|