@neuroinfoapi-client/core 2.6.1 → 2.7.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Appstun
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Appstun
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # @neuroinfoapi-client/core
2
-
3
- Shared HTTP client, API types, utilities and WebSocket protocol logic for NeuroInfoAPI.
4
- Core has no WebSocket runtime dependency.
5
-
6
- **You can use this for HTTP only, but please consider using the other packages.**
7
-
8
- - [@neuroinfoapi-client/native](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/native/README.md): standard WebSocket in browsers and Node.js; ticket auth and JSON heartbeat.
9
- - [@neuroinfoapi-client/node](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/node/README.md): Node.js with `ws`; header auth and protocol heartbeat.
10
- - [@neuroinfoapi-client/bun](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/bun/README.md): Bun's native WebSocket; header auth and protocol heartbeat.
11
-
12
- ## Documentation
13
-
14
- - [Clients Repositories](https://github.com/NeuroInfoAPI/NPM-Package/tree/master/packages)
15
- - [API documentation](https://neuroinfoapi.dev/api/docs)
16
-
17
- ## License
18
-
19
- MIT
1
+ # @neuroinfoapi-client/core
2
+
3
+ Shared HTTP client, API types, utilities and WebSocket protocol logic for NeuroInfoAPI.
4
+ Core has no WebSocket runtime dependency.
5
+
6
+ **You can use this for HTTP only, but please consider using the other packages.**
7
+
8
+ - [@neuroinfoapi-client/native](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/native/README.md): standard WebSocket in browsers and Node.js; ticket auth and JSON heartbeat.
9
+ - [@neuroinfoapi-client/node](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/node/README.md): Node.js with `ws`; header auth and protocol heartbeat.
10
+ - [@neuroinfoapi-client/bun](https://github.com/NeuroInfoAPI/NPM-Package/blob/master/packages/bun/README.md): Bun's native WebSocket; header auth and protocol heartbeat.
11
+
12
+ ## Documentation
13
+
14
+ - [Clients Repositories](https://github.com/NeuroInfoAPI/NPM-Package/tree/master/packages)
15
+ - [API documentation](https://neuroinfoapi.dev/api/docs)
16
+
17
+ ## License
18
+
19
+ MIT
@@ -137,6 +137,10 @@ export declare class NeuroInfoApiClient {
137
137
  * @docs https://github.com/Appstun/NeuroInfoAPI-Docs/blob/master/x-feed.md#endpoint
138
138
  */
139
139
  getXFeed: (user: XFeedAccount) => Promise<ApiResult<XFeedEntry[]>>;
140
+ /** Fetches the full shop catalog. Requires an API token. Prices optionally use the requested currency. */
141
+ getShopProducts: (currency?: string) => Promise<ApiResult<ShopProduct[]>>;
142
+ /** Fetches a shop product by ID. Requires an API token. Price currencyCode identifies the returned currency. */
143
+ getShopProduct: (id: string, currency?: string) => Promise<ApiResult<ShopProduct>>;
140
144
  }
141
145
  /**
142
146
  * Event-based wrapper for the NeuroInfo API.
@@ -485,8 +489,70 @@ export interface WsSubathonGoalUpdateData {
485
489
  goal: SubathonGoal;
486
490
  subcount: number;
487
491
  }
492
+ export interface ShopImage {
493
+ url: string;
494
+ altText: string | null;
495
+ width: number;
496
+ height: number;
497
+ }
498
+ export interface ShopMoney {
499
+ amount: string;
500
+ currencyCode: string;
501
+ }
502
+ export interface ShopProduct {
503
+ id: string;
504
+ title: string;
505
+ handle: string;
506
+ url: string;
507
+ description: string;
508
+ descriptionHtml: string;
509
+ vendor: string;
510
+ productType: string;
511
+ tags: string[];
512
+ availableForSale: boolean;
513
+ createdAt: number;
514
+ updatedAt: number;
515
+ publishedAt: number;
516
+ seo: {
517
+ title: string | null;
518
+ description: string | null;
519
+ };
520
+ options: {
521
+ name: string;
522
+ values: string[];
523
+ }[];
524
+ images: ShopImage[];
525
+ variants: {
526
+ id: string;
527
+ title: string;
528
+ sku: string | null;
529
+ availableForSale: boolean;
530
+ price: ShopMoney;
531
+ compareAtPrice: ShopMoney | null;
532
+ selectedOptions: {
533
+ name: string;
534
+ value: string;
535
+ }[];
536
+ image: ShopImage | null;
537
+ }[];
538
+ collections: {
539
+ id: string;
540
+ title: string;
541
+ }[];
542
+ metafields: {
543
+ namespace: string;
544
+ key: string;
545
+ type: string;
546
+ value: string;
547
+ reference: Record<string, unknown> | null;
548
+ }[];
549
+ }
550
+ export interface ShopProductsUpdateData {
551
+ products: ShopProduct[];
552
+ }
488
553
  /** Mapping of event types to their data structures. */
489
554
  export interface WsEventDataMap {
555
+ shopProductsUpdate: ShopProductsUpdateData;
490
556
  blogFeedUpdate: BlogFeedData;
491
557
  xFeedNewEntries: XFeedNewEntriesData;
492
558
  /** @deprecated Subscribe to xFeedNewEntries instead. */
@@ -1,5 +1,5 @@
1
1
  const apiVersion = "v2";
2
- const clientVersion = "2.6.1";
2
+ const clientVersion = "2.7.0";
3
3
  const userAgent = `niac_js@${clientVersion}`;
4
4
  const defaultApiBaseUrl = `neuroinfoapi.dev/api/${apiVersion}`;
5
5
  function invokeSafely(callback, ...args) {
@@ -253,6 +253,10 @@ export class NeuroInfoApiClient {
253
253
  * @docs https://github.com/Appstun/NeuroInfoAPI-Docs/blob/master/x-feed.md#endpoint
254
254
  */
255
255
  this.getXFeed = (user) => this.request("/x-feed", { user });
256
+ /** Fetches the full shop catalog. Requires an API token. Prices optionally use the requested currency. */
257
+ this.getShopProducts = (currency) => this.request("/shop/products", currency === undefined ? undefined : { currency });
258
+ /** Fetches a shop product by ID. Requires an API token. Price currencyCode identifies the returned currency. */
259
+ this.getShopProduct = (id, currency) => this.request("/shop/product", { id, ...(currency === undefined ? {} : { currency }) });
256
260
  const apiUrl = options.apiBaseUrl != null ? createClientUrls(options.apiBaseUrl, options.useTls).api : (options.baseUrl ?? createClientUrls().api);
257
261
  this.apiInstance = new HttpClient({
258
262
  baseURL: apiUrl,
@@ -1239,6 +1243,7 @@ export var Utils;
1239
1243
  Utils.hasScheduleImage = hasScheduleImage;
1240
1244
  })(Utils || (Utils = {}));
1241
1245
  const wsEventTypes = new Set([
1246
+ "shopProductsUpdate",
1242
1247
  "blogFeedUpdate",
1243
1248
  "xFeedNewEntries",
1244
1249
  "xFeedUpdate",
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "@neuroinfoapi-client/core",
3
- "version": "2.6.1",
4
- "description": "Shared HTTP client, types and WebSocket protocol logic for NeuroInfoAPI-Client (Bun, Node.js, Native)",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "files": [
15
- "dist/*.js",
16
- "dist/*.d.ts",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "scripts": {
21
- "build": "tsc -b && node ../../scripts/helpers/setClientVersion.mjs",
22
- "typecheck": "tsc -p tsconfig.json --noEmit",
23
- "publishPackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/publishAsk.ps1 -Package core",
24
- "deprecatePackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/deprecateAsk.ps1 -Package core"
25
- },
26
- "publishConfig": {
27
- "access": "public"
28
- },
29
- "author": "Appstun",
30
- "license": "MIT",
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/NeuroInfoAPI/NPM-Package.git",
34
- "directory": "packages/core"
35
- },
36
- "bugs": {
37
- "url": "https://github.com/NeuroInfoAPI/NPM-Package/issues"
38
- },
39
- "homepage": "https://neuroinfoapi.dev/api/docs"
40
- }
1
+ {
2
+ "name": "@neuroinfoapi-client/core",
3
+ "version": "2.7.0",
4
+ "description": "Shared HTTP client, types and WebSocket protocol logic for NeuroInfoAPI-Client (Bun, Node.js, Native)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/*.js",
16
+ "dist/*.d.ts",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -b && node ../../scripts/helpers/setClientVersion.mjs",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit",
23
+ "publishPackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/publishAsk.ps1 -Package core",
24
+ "deprecatePackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/deprecateAsk.ps1 -Package core"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "author": "Appstun",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/NeuroInfoAPI/NPM-Packages.git",
34
+ "directory": "packages/core"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/NeuroInfoAPI/NPM-Packages/issues"
38
+ },
39
+ "homepage": "https://neuroinfoapi.dev/api/docs"
40
+ }