@cloudcommerce/api 0.0.32 → 0.0.36

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.
@@ -1,5 +1,5 @@
1
- @cloudcommerce/api:build: cache hit, replaying output 22ed66669a2f4f39
1
+ @cloudcommerce/api:build: cache hit, replaying output 6359f4c86cdf680b
2
2
  @cloudcommerce/api:build: 
3
- @cloudcommerce/api:build: > @cloudcommerce/api@0.0.31 build /home/leo/code/ecomplus/cloud-commerce/packages/api
3
+ @cloudcommerce/api:build: > @cloudcommerce/api@0.0.35 build /home/leo/code/ecomplus/cloud-commerce/packages/api
4
4
  @cloudcommerce/api:build: > sh ../../scripts/build-lib.sh && cp -r src/types lib/
5
5
  @cloudcommerce/api:build: 
@@ -1,10 +1,10 @@
1
- @cloudcommerce/api:test: cache hit, replaying output f4aa14db6bc112f2
1
+ @cloudcommerce/api:test: cache hit, replaying output 0faabc9806456df5
2
2
  @cloudcommerce/api:test: 
3
- @cloudcommerce/api:test: > @cloudcommerce/api@0.0.31 test /home/leo/code/ecomplus/cloud-commerce/packages/api
3
+ @cloudcommerce/api:test: > @cloudcommerce/api@0.0.35 test /home/leo/code/ecomplus/cloud-commerce/packages/api
4
4
  @cloudcommerce/api:test: > tsc -p ../../tsconfig.test.json && vitest run
5
5
  @cloudcommerce/api:test: 
6
6
  @cloudcommerce/api:test: 
7
- @cloudcommerce/api:test:  RUN v0.18.1 /home/leo/code/ecomplus/cloud-commerce/packages/api
7
+ @cloudcommerce/api:test:  RUN v0.19.1 /home/leo/code/ecomplus/cloud-commerce/packages/api
8
8
  @cloudcommerce/api:test: 
9
9
  @cloudcommerce/api:test:  ✓ tests/index.test.ts > Read product and typecheck SKU
10
10
  @cloudcommerce/api:test:  ✓ tests/index.test.ts > 404 with different Store ID from env
@@ -14,5 +14,5 @@
14
14
  @cloudcommerce/api:test: 
15
15
  @cloudcommerce/api:test: Test Files 1 passed (1)
16
16
  @cloudcommerce/api:test:  Tests 5 passed (5)
17
- @cloudcommerce/api:test:  Time 2.91s (in thread 1.02s, 285.51%)
17
+ @cloudcommerce/api:test:  Time 3.32s (in thread 1.29s, 257.40%)
18
18
  @cloudcommerce/api:test: 
File without changes
package/lib/index.d.ts CHANGED
@@ -26,62 +26,7 @@ declare const api: {
26
26
  }>;
27
27
  get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
28
28
  config: Config;
29
- data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types/authentications").Authentications : E extends ResourceOpQuery ? {
30
- result: E extends infer T_1 ? T_1 extends E ? T_1 extends "products" | `products?${string}` ? import("./types").Products[] : T_1 extends "categories" | `categories?${string}` ? import("./types").Categories[] : T_1 extends "brands" | `brands?${string}` ? import("./types").Brands[] : T_1 extends "collections" | `collections?${string}` ? import("./types").Collections[] : T_1 extends "grids" | `grids?${string}` ? import("./types").Grids[] : T_1 extends "carts" | `carts?${string}` ? import("./types").Carts[] : T_1 extends "orders" | `orders?${string}` ? import("./types").Orders[] : T_1 extends "customers" | `customers?${string}` ? import("./types").Customers[] : T_1 extends "stores" | `stores?${string}` ? import("./types").Stores[] : T_1 extends "applications" | `applications?${string}` ? import("./types").Applications[] : T_1 extends "authentications" | `authentications?${string}` ? import("./types/authentications").Authentications[] : never : never : never;
31
- meta: {
32
- offset: number;
33
- limit: number;
34
- fields: string[];
35
- } & {
36
- count?: number | undefined;
37
- sort: {
38
- field: string;
39
- order: 1 | -1;
40
- }[];
41
- query: {
42
- [key: string]: any;
43
- };
44
- };
45
- } : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? {
46
- result: ({
47
- timestamp: string;
48
- store_id?: number | undefined;
49
- resource?: string | undefined;
50
- authentication_id?: (string & {
51
- length: 24;
52
- }) | null | undefined;
53
- resource_id?: (string & {
54
- length: 24;
55
- }) | undefined;
56
- action: string;
57
- modified_fields: string[];
58
- method?: number | undefined;
59
- endpoint?: string | undefined;
60
- body?: any;
61
- ip?: string | undefined;
62
- } & (E extends infer T_2 ? T_2 extends E ? T_2 extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" ? {
63
- resource_id: string & {
64
- length: 24;
65
- };
66
- authentication_id: (string & {
67
- length: 24;
68
- }) | null;
69
- } : T_2 extends `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` ? {
70
- authentication_id: (string & {
71
- length: 24;
72
- }) | null;
73
- } : T_2 extends "events/me" ? {
74
- resource: import("./types").Resource;
75
- resource_id: string & {
76
- length: 24;
77
- };
78
- } : never : never : never))[];
79
- meta: {
80
- offset: number;
81
- limit: number;
82
- fields: string[];
83
- };
84
- } : any;
29
+ data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types").Authentications : E extends ResourceOpQuery ? import("./types").ResourceListResult<E> : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? import("./types").EventsResult<E> : any;
85
30
  }>;
86
31
  post: <E_1 extends Endpoint, C_1 extends AbstractedAuthConfig>(endpoint: E_1, body: E_1 extends "products" | `products/${string}` ? {
87
32
  categories?: {
@@ -5089,62 +5034,7 @@ declare type AbstractedAuthConfig = AbstractedConfig & {
5089
5034
  };
5090
5035
  declare const get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
5091
5036
  config: Config;
5092
- data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types/authentications").Authentications : E extends ResourceOpQuery ? {
5093
- result: E extends infer T_1 ? T_1 extends E ? T_1 extends "products" | `products?${string}` ? import("./types").Products[] : T_1 extends "categories" | `categories?${string}` ? import("./types").Categories[] : T_1 extends "brands" | `brands?${string}` ? import("./types").Brands[] : T_1 extends "collections" | `collections?${string}` ? import("./types").Collections[] : T_1 extends "grids" | `grids?${string}` ? import("./types").Grids[] : T_1 extends "carts" | `carts?${string}` ? import("./types").Carts[] : T_1 extends "orders" | `orders?${string}` ? import("./types").Orders[] : T_1 extends "customers" | `customers?${string}` ? import("./types").Customers[] : T_1 extends "stores" | `stores?${string}` ? import("./types").Stores[] : T_1 extends "applications" | `applications?${string}` ? import("./types").Applications[] : T_1 extends "authentications" | `authentications?${string}` ? import("./types/authentications").Authentications[] : never : never : never;
5094
- meta: {
5095
- offset: number;
5096
- limit: number;
5097
- fields: string[];
5098
- } & {
5099
- count?: number | undefined;
5100
- sort: {
5101
- field: string;
5102
- order: 1 | -1;
5103
- }[];
5104
- query: {
5105
- [key: string]: any;
5106
- };
5107
- };
5108
- } : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? {
5109
- result: ({
5110
- timestamp: string;
5111
- store_id?: number | undefined;
5112
- resource?: string | undefined;
5113
- authentication_id?: (string & {
5114
- length: 24;
5115
- }) | null | undefined;
5116
- resource_id?: (string & {
5117
- length: 24;
5118
- }) | undefined;
5119
- action: string;
5120
- modified_fields: string[];
5121
- method?: number | undefined;
5122
- endpoint?: string | undefined;
5123
- body?: any;
5124
- ip?: string | undefined;
5125
- } & (E extends infer T_2 ? T_2 extends E ? T_2 extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" ? {
5126
- resource_id: string & {
5127
- length: 24;
5128
- };
5129
- authentication_id: (string & {
5130
- length: 24;
5131
- }) | null;
5132
- } : T_2 extends `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` ? {
5133
- authentication_id: (string & {
5134
- length: 24;
5135
- }) | null;
5136
- } : T_2 extends "events/me" ? {
5137
- resource: import("./types").Resource;
5138
- resource_id: string & {
5139
- length: 24;
5140
- };
5141
- } : never : never : never))[];
5142
- meta: {
5143
- offset: number;
5144
- limit: number;
5145
- fields: string[];
5146
- };
5147
- } : any;
5037
+ data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types").Authentications : E extends ResourceOpQuery ? import("./types").ResourceListResult<E> : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? import("./types").EventsResult<E> : any;
5148
5038
  }>;
5149
5039
  declare const post: <E extends Endpoint, C extends AbstractedAuthConfig>(endpoint: E, body: E extends "products" | `products/${string}` ? {
5150
5040
  categories?: {
package/lib/types.d.ts CHANGED
@@ -91,4 +91,4 @@ declare type ResponseBody<TConfig extends Config> = TConfig['method'] extends 'p
91
91
  declare type DocSchema<Document extends any> = Omit<Document, '_id' | 'store_id' | 'store_ids' | 'created_at' | 'updated_at'>;
92
92
  declare type SetDocEndpoint<TResource extends Resource> = TResource | `${TResource}/${ResourceId}`;
93
93
  declare type RequestBody<TConfig extends Config> = TConfig['method'] extends undefined | 'get' | 'delete' ? undefined : TConfig['method'] extends 'patch' ? any : TConfig['endpoint'] extends SetDocEndpoint<'products'> ? DocSchema<Products> : TConfig['endpoint'] extends SetDocEndpoint<'categories'> ? DocSchema<Categories> : TConfig['endpoint'] extends SetDocEndpoint<'brands'> ? DocSchema<Brands> : TConfig['endpoint'] extends SetDocEndpoint<'collections'> ? DocSchema<Collections> : TConfig['endpoint'] extends SetDocEndpoint<'grids'> ? DocSchema<Grids> : TConfig['endpoint'] extends SetDocEndpoint<'carts'> ? DocSchema<Carts> : TConfig['endpoint'] extends SetDocEndpoint<'orders'> ? DocSchema<Orders> : TConfig['endpoint'] extends SetDocEndpoint<'customers'> ? DocSchema<Customers> : TConfig['endpoint'] extends SetDocEndpoint<'stores'> ? DocSchema<Stores> : TConfig['endpoint'] extends SetDocEndpoint<'applications'> ? DocSchema<Applications> : TConfig['endpoint'] extends SetDocEndpoint<'authentications'> ? DocSchema<Authentications> : any;
94
- export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Resource, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResponseBody, RequestBody, };
94
+ export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.0.32",
4
+ "version": "0.0.36",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
package/src/types.ts CHANGED
@@ -182,12 +182,16 @@ export type {
182
182
  Customers,
183
183
  Stores,
184
184
  Applications,
185
+ Authentications,
185
186
  Resource,
187
+ ResourceId,
186
188
  ResourceAndId,
187
189
  ResourceOpQuery,
188
190
  Endpoint,
189
191
  Method,
190
192
  Config,
193
+ ResourceListResult,
194
+ EventsResult,
191
195
  ResponseBody,
192
196
  RequestBody,
193
197
  };
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-console, import/no-extraneous-dependencies */
2
2
 
3
3
  import { test, expect } from 'vitest';
4
- import './fetch-polyfill';
4
+ import '../fetch-polyfill';
5
5
  import api, { ApiError } from '../src/index';
6
6
 
7
7
  const productId = '618041aa239b7206d3fc06de';