@cloudcommerce/api 0.0.114 → 0.0.116

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,4 @@
1
- @cloudcommerce/api:build: cache hit, replaying output 7d6a688403477437
2
- @cloudcommerce/api:build: 
3
- @cloudcommerce/api:build: > @cloudcommerce/api@0.0.113 build /home/leo/code/ecomplus/cloud-commerce/packages/api
4
- @cloudcommerce/api:build: > sh ../../scripts/build-lib.sh && cp -r src/types lib/
5
- @cloudcommerce/api:build: 
1
+
2
+ > @cloudcommerce/api@0.0.115 build /home/leo/code/ecomplus/cloud-commerce/packages/api
3
+ > sh ../../scripts/build-lib.sh && cp -r src/types lib/
4
+
@@ -1,21 +1,21 @@
1
- @cloudcommerce/api:test: cache hit, replaying output 068ff96a2cd3b810
2
- @cloudcommerce/api:test: 
3
- @cloudcommerce/api:test: > @cloudcommerce/api@0.0.113 test /home/leo/code/ecomplus/cloud-commerce/packages/api
4
- @cloudcommerce/api:test: > tsc -p ../../tsconfig.test.json && vitest run
5
- @cloudcommerce/api:test: 
6
- @cloudcommerce/api:test: 
7
- @cloudcommerce/api:test:  RUN v0.23.4 /home/leo/code/ecomplus/cloud-commerce/packages/api
8
- @cloudcommerce/api:test: 
9
- @cloudcommerce/api:test:  ✓ tests/index.test.ts > Read product and typecheck SKU
10
- @cloudcommerce/api:test: (node:78066) [https://github.com/node-fetch/node-fetch/issues/1000 (response)] DeprecationWarning: data doesn't exist, use json(), text(), arrayBuffer(), or body instead
11
- @cloudcommerce/api:test: (Use `node --trace-deprecation ...` to show where the warning was created)
12
- @cloudcommerce/api:test:  ✓ tests/index.test.ts > 404 with different Store ID from env
13
- @cloudcommerce/api:test:  ✓ tests/index.test.ts > List categories and typecheck result
14
- @cloudcommerce/api:test:  ✓ tests/index.test.ts > 401 trying to list API events
15
- @cloudcommerce/api:test:  ✓ tests/index.test.ts > 401 to create category and body typecheck
16
- @cloudcommerce/api:test: 
17
- @cloudcommerce/api:test: Test Files 1 passed (1)
18
- @cloudcommerce/api:test:  Tests 5 passed (5)
19
- @cloudcommerce/api:test:  Start at 19:52:14
20
- @cloudcommerce/api:test:  Duration 2.53s (transform 988ms, setup 0ms, collect 154ms, tests 765ms)
21
- @cloudcommerce/api:test: 
1
+
2
+ > @cloudcommerce/api@0.0.115 test /home/leo/code/ecomplus/cloud-commerce/packages/api
3
+ > tsc -p ../../tsconfig.test.json && vitest run
4
+
5
+
6
+ RUN v0.24.3 /home/leo/code/ecomplus/cloud-commerce/packages/api
7
+
8
+ ✓ tests/index.test.ts > Read product and typecheck SKU
9
+ ✓ tests/index.test.ts > 404 with different Store ID from env
10
+ (node:83274) [https://github.com/node-fetch/node-fetch/issues/1000 (response)] DeprecationWarning: data doesn't exist, use json(), text(), arrayBuffer(), or body instead
11
+ (Use `node --trace-deprecation ...` to show where the warning was created)
12
+ ✓ tests/index.test.ts > List categories and typecheck result
13
+ ✓ tests/index.test.ts > 401 trying to list API events
14
+ ✓ tests/index.test.ts > 401 to create category and body typecheck
15
+
16
+ Test Files 1 passed (1)
17
+ Tests 5 passed (5)
18
+ Start at 01:18:04
19
+ Duration 8.33s (transform 3.92s, setup 1ms, collect 543ms, tests 1.37s)
20
+
21
+ close timed out after 1000ms
package/lib/types.d.ts CHANGED
@@ -41,12 +41,23 @@ declare type BaseListResultMeta = {
41
41
  limit: number;
42
42
  fields: Array<string>;
43
43
  };
44
- declare type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
45
44
  declare type ListResultDocs<Document extends any> = Array<Partial<Document> & {
46
45
  _id: ResourceId;
47
46
  }>;
47
+ declare type ProductsList = ListResultDocs<Products>;
48
+ declare type CategoriesList = ListResultDocs<Categories>;
49
+ declare type BrandsList = ListResultDocs<Brands>;
50
+ declare type CollectionsList = ListResultDocs<Collections>;
51
+ declare type GridsList = ListResultDocs<Grids>;
52
+ declare type CartsList = ListResultDocs<Carts>;
53
+ declare type OrdersList = ListResultDocs<Orders>;
54
+ declare type CustomersList = ListResultDocs<Customers>;
55
+ declare type StoresList = ListResultDocs<Stores>;
56
+ declare type ApplicationsList = ListResultDocs<Applications>;
57
+ declare type AuthenticationsList = ListResultDocs<Authentications>;
58
+ declare type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
48
59
  declare type ResourceListResult<TEndpoint extends ResourceOpQuery> = {
49
- result: TEndpoint extends ListEndpoint<'products'> ? ListResultDocs<Products> : TEndpoint extends ListEndpoint<'categories'> ? ListResultDocs<Categories> : TEndpoint extends ListEndpoint<'brands'> ? ListResultDocs<Brands> : TEndpoint extends ListEndpoint<'collections'> ? ListResultDocs<Collections> : TEndpoint extends ListEndpoint<'grids'> ? ListResultDocs<Grids> : TEndpoint extends ListEndpoint<'carts'> ? ListResultDocs<Carts> : TEndpoint extends ListEndpoint<'orders'> ? ListResultDocs<Orders> : TEndpoint extends ListEndpoint<'customers'> ? ListResultDocs<Customers> : TEndpoint extends ListEndpoint<'stores'> ? ListResultDocs<Stores> : TEndpoint extends ListEndpoint<'applications'> ? ListResultDocs<Applications> : TEndpoint extends ListEndpoint<'authentications'> ? ListResultDocs<Authentications> : never;
60
+ result: TEndpoint extends ListEndpoint<'products'> ? ProductsList : TEndpoint extends ListEndpoint<'categories'> ? CategoriesList : TEndpoint extends ListEndpoint<'brands'> ? BrandsList : TEndpoint extends ListEndpoint<'collections'> ? CollectionsList : TEndpoint extends ListEndpoint<'grids'> ? GridsList : TEndpoint extends ListEndpoint<'carts'> ? CartsList : TEndpoint extends ListEndpoint<'orders'> ? OrdersList : TEndpoint extends ListEndpoint<'customers'> ? CustomersList : TEndpoint extends ListEndpoint<'stores'> ? StoresList : TEndpoint extends ListEndpoint<'applications'> ? ApplicationsList : TEndpoint extends ListEndpoint<'authentications'> ? AuthenticationsList : never;
50
61
  meta: BaseListResultMeta & {
51
62
  count?: number;
52
63
  sort: Array<{
@@ -118,4 +129,4 @@ declare type ErrorBody = {
118
129
  };
119
130
  more_info?: string;
120
131
  };
121
- export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, ProductSet, CategorySet, BrandSet, CollectionSet, GridSet, CartSet, OrderSet, CustomerSet, StoreSet, ApplicationSet, AuthenticationSet, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, ErrorBody, };
132
+ export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, ProductSet, CategorySet, BrandSet, CollectionSet, GridSet, CartSet, OrderSet, CustomerSet, StoreSet, ApplicationSet, AuthenticationSet, ProductsList, CategoriesList, BrandsList, CollectionsList, GridsList, CartsList, OrdersList, CustomersList, StoresList, ApplicationsList, AuthenticationsList, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, ErrorBody, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "0.0.114",
4
+ "version": "0.0.116",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/api.js",
7
7
  "types": "lib/api.d.ts",
package/src/types.ts CHANGED
@@ -72,21 +72,33 @@ type BaseListResultMeta = {
72
72
  fields: Array<string>,
73
73
  };
74
74
 
75
- type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
76
75
  type ListResultDocs<Document extends any> = Array<Partial<Document> & { _id: ResourceId }>;
76
+ type ProductsList = ListResultDocs<Products>;
77
+ type CategoriesList = ListResultDocs<Categories>;
78
+ type BrandsList = ListResultDocs<Brands>;
79
+ type CollectionsList = ListResultDocs<Collections>;
80
+ type GridsList = ListResultDocs<Grids>;
81
+ type CartsList = ListResultDocs<Carts>;
82
+ type OrdersList = ListResultDocs<Orders>;
83
+ type CustomersList = ListResultDocs<Customers>;
84
+ type StoresList = ListResultDocs<Stores>;
85
+ type ApplicationsList = ListResultDocs<Applications>;
86
+ type AuthenticationsList = ListResultDocs<Authentications>;
87
+
88
+ type ListEndpoint<TResource extends Resource> = TResource | `${TResource}?${string}`;
77
89
  type ResourceListResult<TEndpoint extends ResourceOpQuery> = {
78
90
  result:
79
- TEndpoint extends ListEndpoint<'products'> ? ListResultDocs<Products> :
80
- TEndpoint extends ListEndpoint<'categories'> ? ListResultDocs<Categories> :
81
- TEndpoint extends ListEndpoint<'brands'> ? ListResultDocs<Brands> :
82
- TEndpoint extends ListEndpoint<'collections'> ? ListResultDocs<Collections> :
83
- TEndpoint extends ListEndpoint<'grids'> ? ListResultDocs<Grids> :
84
- TEndpoint extends ListEndpoint<'carts'> ? ListResultDocs<Carts> :
85
- TEndpoint extends ListEndpoint<'orders'> ? ListResultDocs<Orders> :
86
- TEndpoint extends ListEndpoint<'customers'> ? ListResultDocs<Customers> :
87
- TEndpoint extends ListEndpoint<'stores'> ? ListResultDocs<Stores> :
88
- TEndpoint extends ListEndpoint<'applications'> ? ListResultDocs<Applications> :
89
- TEndpoint extends ListEndpoint<'authentications'> ? ListResultDocs<Authentications> :
91
+ TEndpoint extends ListEndpoint<'products'> ? ProductsList :
92
+ TEndpoint extends ListEndpoint<'categories'> ? CategoriesList :
93
+ TEndpoint extends ListEndpoint<'brands'> ? BrandsList :
94
+ TEndpoint extends ListEndpoint<'collections'> ? CollectionsList :
95
+ TEndpoint extends ListEndpoint<'grids'> ? GridsList :
96
+ TEndpoint extends ListEndpoint<'carts'> ? CartsList :
97
+ TEndpoint extends ListEndpoint<'orders'> ? OrdersList :
98
+ TEndpoint extends ListEndpoint<'customers'> ? CustomersList :
99
+ TEndpoint extends ListEndpoint<'stores'> ? StoresList :
100
+ TEndpoint extends ListEndpoint<'applications'> ? ApplicationsList :
101
+ TEndpoint extends ListEndpoint<'authentications'> ? AuthenticationsList :
90
102
  never,
91
103
  meta: BaseListResultMeta & {
92
104
  count?: number,
@@ -219,6 +231,17 @@ export type {
219
231
  StoreSet,
220
232
  ApplicationSet,
221
233
  AuthenticationSet,
234
+ ProductsList,
235
+ CategoriesList,
236
+ BrandsList,
237
+ CollectionsList,
238
+ GridsList,
239
+ CartsList,
240
+ OrdersList,
241
+ CustomersList,
242
+ StoresList,
243
+ ApplicationsList,
244
+ AuthenticationsList,
222
245
  Resource,
223
246
  ResourceId,
224
247
  ResourceAndId,