@field123/client-shopper
Advanced tools
Comparing version 0.1.2 to 0.1.4
@@ -5,10 +5,18 @@ "use strict"; | ||
const middleware_stack_1 = require("@field123/middleware-stack"); | ||
const client_1 = require("@field123/client"); | ||
function createShopperClient(client, config) { | ||
let resolvedEpccClient; | ||
if ('middlewareStack' in client) { | ||
resolvedEpccClient = client; | ||
} | ||
else { | ||
resolvedEpccClient = (0, client_1.createEpccClient)(client); | ||
} | ||
const shopperMiddlewareStack = (0, middleware_stack_1.constructStack)(); | ||
const combinedMiddleware = client.middlewareStack.concat(shopperMiddlewareStack); | ||
const combinedMiddleware = resolvedEpccClient.middlewareStack.concat(shopperMiddlewareStack); | ||
const combinedConfig = { | ||
...client.config | ||
...resolvedEpccClient.config | ||
}; | ||
return { | ||
...client, | ||
...resolvedEpccClient, | ||
config: combinedConfig, | ||
@@ -15,0 +23,0 @@ middlewareStack: combinedMiddleware, |
@@ -8,1 +8,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("@field123/credential-providers"), exports); | ||
tslib_1.__exportStar(require("@field123/client"), exports); |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/hierarchies', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/hierarchies", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetAllHierarchiesCommand = serializeGetAllHierarchiesCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/nodes', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/nodes", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetAllNodesCommand = serializeGetAllNodesCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/products', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/products", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetAllProductsCommand = serializeGetAllProductsCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/hierarchies/{hierarchyId}', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/hierarchies/{hierarchyId}", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetHierarchyByIdCommand = serializeGetHierarchyByIdCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/hierarchies/{hierarchyId}/children', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/hierarchies/{hierarchyId}/children", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetHierarchyChildNodesCommand = serializeGetHierarchyChildNodesCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/hierarchies/{hierarchyId}/nodes', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/hierarchies/{hierarchyId}/nodes", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetHierarchyNodesCommand = serializeGetHierarchyNodesCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/hierarchies/{hierarchyId}/products', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/hierarchies/{hierarchyId}/products", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetHierarchyProductsCommand = serializeGetHierarchyProductsCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/nodes/{nodeId}', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/nodes/{nodeId}", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetNodeByIdCommand = serializeGetNodeByIdCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/nodes/{nodeId}/relationships/children', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/nodes/{nodeId}/relationships/children", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetNodeChildNodesCommand = serializeGetNodeChildNodesCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/nodes/{nodeId}/relationships/products', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/nodes/{nodeId}/relationships/products", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetNodeProductsCommand = serializeGetNodeProductsCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog/products/{productId}', input); | ||
const path = (0, get_url_1.getUrl)("/catalog/products/{productId}", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetProductByIdCommand = serializeGetProductByIdCommand; |
@@ -10,5 +10,5 @@ "use strict"; | ||
}; | ||
const path = (0, get_url_1.getUrl)('/catalog', input); | ||
const path = (0, get_url_1.getUrl)("/catalog", input); | ||
return (0, util_1.buildHttpGetRequest)(context, { headers, path }); | ||
}; | ||
exports.serializeGetShopperCatalogCommand = serializeGetShopperCatalogCommand; |
import { constructStack } from '@field123/middleware-stack'; | ||
import { createEpccClient } from '@field123/client'; | ||
export function createShopperClient(client, config) { | ||
let resolvedEpccClient; | ||
if ('middlewareStack' in client) { | ||
resolvedEpccClient = client; | ||
} | ||
else { | ||
resolvedEpccClient = createEpccClient(client); | ||
} | ||
const shopperMiddlewareStack = constructStack(); | ||
const combinedMiddleware = client.middlewareStack.concat(shopperMiddlewareStack); | ||
const combinedMiddleware = resolvedEpccClient.middlewareStack.concat(shopperMiddlewareStack); | ||
const combinedConfig = { | ||
...client.config | ||
...resolvedEpccClient.config | ||
}; | ||
return { | ||
...client, | ||
...resolvedEpccClient, | ||
config: combinedConfig, | ||
@@ -11,0 +19,0 @@ middlewareStack: combinedMiddleware, |
@@ -5,1 +5,2 @@ export * from './create-shopper-client'; | ||
export * from '@field123/credential-providers'; | ||
export * from '@field123/client'; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/hierarchies', input); | ||
const path = getUrl("/catalog/hierarchies", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/nodes', input); | ||
const path = getUrl("/catalog/nodes", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/products', input); | ||
const path = getUrl("/catalog/products", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/hierarchies/{hierarchyId}', input); | ||
const path = getUrl("/catalog/hierarchies/{hierarchyId}", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/hierarchies/{hierarchyId}/children', input); | ||
const path = getUrl("/catalog/hierarchies/{hierarchyId}/children", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/hierarchies/{hierarchyId}/nodes', input); | ||
const path = getUrl("/catalog/hierarchies/{hierarchyId}/nodes", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/hierarchies/{hierarchyId}/products', input); | ||
const path = getUrl("/catalog/hierarchies/{hierarchyId}/products", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/nodes/{nodeId}', input); | ||
const path = getUrl("/catalog/nodes/{nodeId}", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/nodes/{nodeId}/relationships/children', input); | ||
const path = getUrl("/catalog/nodes/{nodeId}/relationships/children", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/nodes/{nodeId}/relationships/products', input); | ||
const path = getUrl("/catalog/nodes/{nodeId}/relationships/products", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog/products/{productId}', input); | ||
const path = getUrl("/catalog/products/{productId}", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
@@ -7,4 +7,4 @@ import { buildHttpGetRequest } from '../util'; | ||
}; | ||
const path = getUrl('/catalog', input); | ||
const path = getUrl("/catalog", input); | ||
return buildHttpGetRequest(context, { headers, path }); | ||
}; |
import { EpccClient, EpccClientResolvedConfig, ExtractCommandInputs, ExtractCommandOutputs, HttpHandlerOptions, RequestHandlingClient } from '@field123/sdk-types'; | ||
import { GetAllHierarchiesCommand, GetAllNodesCommand, GetAllProductsCommand, GetHierarchyByIdCommand, GetHierarchyChildNodesCommand, GetHierarchyNodesCommand, GetHierarchyProductsCommand, GetNodeByIdCommand, GetNodeChildNodesCommand, GetNodeProductsCommand, GetProductByIdCommand, GetShopperCatalogCommand } from './commands'; | ||
import { createEpccClient } from '@field123/client'; | ||
export declare type ResolvedShopperClientConfig = EpccClientResolvedConfig; | ||
@@ -8,3 +9,5 @@ export declare type ShopperClientConfig = Record<never, never>; | ||
declare type ServiceCommandOutputTypes = ExtractCommandOutputs<ServiceCommandTypes>; | ||
declare type EPCCClientCreatorInput = Parameters<typeof createEpccClient>[0]; | ||
export declare function createShopperClient(client: EPCCClientCreatorInput): RequestHandlingClient<HttpHandlerOptions, ServiceCommandInputTypes, ServiceCommandOutputTypes, ResolvedShopperClientConfig>; | ||
export declare function createShopperClient(client: EpccClient, config?: ShopperClientConfig): RequestHandlingClient<HttpHandlerOptions, ServiceCommandInputTypes, ServiceCommandOutputTypes, ResolvedShopperClientConfig>; | ||
export {}; |
@@ -5,1 +5,2 @@ export * from './create-shopper-client'; | ||
export * from '@field123/credential-providers'; | ||
export * from '@field123/client'; |
{ | ||
"name": "@field123/client-shopper", | ||
"version": "0.1.2", | ||
"version": "0.1.4", | ||
"main": "./dist-cjs/index.js", | ||
@@ -44,2 +44,3 @@ "types": "./dist-types/index.d.ts", | ||
"dependencies": { | ||
"@field123/client": "*", | ||
"@field123/client-common": "*", | ||
@@ -46,0 +47,0 @@ "@field123/middleware-common": "*", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131573
2659
5
6
+ Added@field123/client@*
+ Added@field123/client@0.6.5(transitive)
+ Added@field123/fetch-http-handler@0.1.1(transitive)
+ Added@field123/is-array-buffer@0.1.0(transitive)
+ Added@field123/ls-token-repository@0.1.1(transitive)
+ Added@field123/middleware-auth@0.1.1(transitive)
+ Added@field123/middleware-stack@0.1.1(transitive)
+ Added@field123/node-request-handler@0.1.1(transitive)
+ Added@field123/requester-common@0.3.0(transitive)
+ Added@field123/requester-fetch@0.3.0(transitive)
+ Added@field123/requester-node-http@0.3.0(transitive)
+ Added@field123/util-base64@0.1.0(transitive)
+ Added@field123/util-buffer-from@0.1.0(transitive)
+ Added@field123/util-utf8@0.1.0(transitive)
+ Addedfp-ts@2.16.9(transitive)