Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Socket
Sign inDemoInstall

@shopware/api-client

Package Overview
Dependencies
Maintainers
1
Versions
458
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopware/api-client - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

./dist/index.cjs

28

package.json
{
"name": "@shopware/api-client",
"version": "0.3.0",
"version": "0.4.0",
"description": "Shopware client for API connection.",

@@ -21,9 +21,20 @@ "author": "Shopware",

"module": "./dist/index.mjs",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"api-types"
"api-types",
"admin-api-types"
],
"exports": {
"import": "./dist/index.mjs"
".": {
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
}
}
},

@@ -33,10 +44,11 @@ "devDependencies": {

"@vitest/coverage-c8": "^0.33.0",
"prettier": "^3.0.0",
"vitest": "^0.33.0",
"@shopware/api-gen": "0.0.6",
"eslint-config-shopware": "0.0.5",
"prettier": "^3.0.3",
"unbuild": "^2.0.0",
"vitest": "^0.34.3",
"@shopware/api-gen": "0.0.7",
"eslint-config-shopware": "0.0.6",
"tsconfig": "0.0.0"
},
"dependencies": {
"ofetch": "^1.1.1"
"ofetch": "^1.3.3"
},

@@ -43,0 +55,0 @@ "scripts": {

@@ -53,3 +53,2 @@ # shopware/frontends - api-client

contextToken: Cookies.get("sw-context-token"),
apiType: "store-api",
onContextChanged(newContextToken) {

@@ -74,2 +73,43 @@ Cookies.set("sw-context-token", newContextToken, {

## Admin API client setup
The setup works the same way as `creteAPIClient` function, with few differences:
```typescript
// example adminApiClient.ts file
import { createAdminAPIClient } from "@shopware/api-client"; // we use different function to create admin api client
import {
RequestParameters,
RequestReturnType,
createAdminAPIClient,
} from "@shopware/api-client";
import {
operationPaths,
operations,
components,
} from "@shopware/api-client/admin-api-types"; // we take default admin api types from different directory than store-api
import Cookies from "js-cookie";
export const adminApiClient = createAdminAPIClient<operations, operationPaths>({
baseURL: "https://demo-frontends.shopware.store/api",
sessionData: JSON.parse(Cookies.get("sw-admin-session-data") || "{}"),
onAuthChange(sessionData) {
Cookies.set("sw-admin-session-data", JSON.stringify(sessionData), {
expires: 1, // days
path: "/",
sameSite: "lax",
});
},
});
export type AdminApiSchemas = components["schemas"];
export type AdminApiRequestParams<OPERATION_NAME extends keyof operations> =
RequestParameters<OPERATION_NAME, operations>;
export type AdminApiReturnType<OPERATION_NAME extends keyof operations> =
RequestReturnType<OPERATION_NAME, operations>;
```
the rest works the same as store-api client.
## Basic usage

@@ -151,6 +191,22 @@

### Latest changes: 0.3.0
### Latest changes: 0.4.0
### Minor Changes
- [#330](https://github.com/shopware/frontends/pull/330) [`3683116`](https://github.com/shopware/frontends/commit/3683116588a7ef75e750fc33deee119f038c88e8) Thanks [@mdanilowicz](https://github.com/mdanilowicz)! - Add `setCurrentCountry` for changing context countryId
- [#371](https://github.com/shopware/frontends/pull/371) [`83c94e9b`](https://github.com/shopware/frontends/commit/83c94e9bb609533c4a1275cbf3822b0fc2ea1dd5) Thanks [@patzick](https://github.com/patzick)! - New method `createAdminAPIClient` supporting Admin API πŸ…°πŸ…ΏπŸ…Έ
- [#373](https://github.com/shopware/frontends/pull/373) [`5510bb02`](https://github.com/shopware/frontends/commit/5510bb028b1fea4c63d677850f50bb7b5a1cf01a) Thanks [@patzick](https://github.com/patzick)! - Added `getSessionData` and `setSessionData` methods in admin API client for test purposes.
### Patch Changes
- [#385](https://github.com/shopware/frontends/pull/385) [`5d7e7973`](https://github.com/shopware/frontends/commit/5d7e7973437a4d74d19ec2fa0765c6d927bf8b2a) Thanks [@patzick](https://github.com/patzick)! - Dependency changes:
- Changed dependency _ofetch_ from **^1.2.1** to **^1.3.3**
- [#375](https://github.com/shopware/frontends/pull/375) [`bd88d6fa`](https://github.com/shopware/frontends/commit/bd88d6fa95de2b90f8a1e08e34159b46c5932b3b) Thanks [@patzick](https://github.com/patzick)! - Dependency changes:
- Changed dependency _ofetch_ from **^1.1.1** to **^1.2.1**
- [`15d6e696`](https://github.com/shopware/frontends/commit/15d6e69616bd9bc5ad32f2a5f697e00c45a94784) Thanks [@patzick](https://github.com/patzick)! - Emit cjs bundle
- [#371](https://github.com/shopware/frontends/pull/371) [`83c94e9b`](https://github.com/shopware/frontends/commit/83c94e9bb609533c4a1275cbf3822b0fc2ea1dd5) Thanks [@patzick](https://github.com/patzick)! - Deprecated `apiType` param in `createAPIClient`, for Admin API client use `createAdminAPIClient` instead.

Sorry, the diff of this file is too big to display

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