@storecraft/sdk 1.0.16 → 1.0.17

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/README.md CHANGED
@@ -187,6 +187,15 @@ const collections: CollectionType[] = await sdk.collections.list(
187
187
 
188
188
  ```
189
189
 
190
+ ## Testing
191
+
192
+ most of the tests for this package are done in the `storecraft` `core` package,
193
+ as part of the **REST API** tests.
194
+
195
+ This package will hold more `unit` tests for the `sdk` itself, which include
196
+ side effects and particular behaviours.
197
+
198
+
190
199
  ```text
191
200
  Author: Tomer Shalev (tomer.shalev@gmail.com)
192
201
  ```
package/index.js CHANGED
@@ -16,7 +16,7 @@ import Images from './src/images.js'
16
16
  import Posts from './src/posts.js'
17
17
  import Checkout from './src/checkout.js'
18
18
  import Payments from './src/payments.js'
19
- import Settings from './src/settings.js'
19
+ import Reference from './src/reference.js'
20
20
  import Notifications from './src/notifications.js'
21
21
  import Storage from './src/storage.js'
22
22
  import AI from './src/ai.js'
@@ -27,7 +27,8 @@ import {
27
27
  import Email from './src/email.js'
28
28
 
29
29
  /**
30
- * @description The official `storecraft` universal **SDK** for `javascript`
30
+ * @description The official `storecraft` universal
31
+ * **SDK** for `javascript`
31
32
  */
32
33
  export class StorecraftSDK {
33
34
 
@@ -64,13 +65,13 @@ export class StorecraftSDK {
64
65
  this.posts = new Posts(this);
65
66
  this.payments = new Payments(this);
66
67
  this.checkout = new Checkout(this);
67
- this.settings = new Settings(this);
68
+ this.reference = new Reference(this);
68
69
  this.notifications = new Notifications(this);
69
70
  this.emails = new Email(this);
70
71
  }
71
72
 
72
73
  get fetcher() {
73
- return this.#fetcher
74
+ return this.#fetcher;
74
75
  }
75
76
 
76
77
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/sdk",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Official storecraft Universal Javascript SDK",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",
package/src/auth.js CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  import {
12
12
  api_query_to_searchparams
13
- } from '@storecraft/core/api/utils.query.js';
13
+ } from '@storecraft/core/api/query.js';
14
14
  import { StorecraftSDK } from '../index.js';
15
15
  import {
16
16
  count_query_of_resource, fetchApiWithAuth, url
package/src/orders.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @import { OrderDataUpsert, OrderData, ApiQuery } from '@storecraft/core/api'
3
3
  */
4
- import { api_query_to_searchparams } from '@storecraft/core/api/utils.query.js';
4
+ import { api_query_to_searchparams } from '@storecraft/core/api/query.js';
5
5
  import { StorecraftSDK } from '../index.js'
6
6
  import { collection_base, fetchApiWithAuth } from './utils.api.fetch.js';
7
7
 
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @import { StorecraftConfig } from '@storecraft/core'
3
+ * @import { StorecraftAppPublicInfo } from '@storecraft/core/api'
4
+ */
5
+ import { StorecraftSDK } from '../index.js'
6
+ import { fetchApiWithAuth } from './utils.api.fetch.js';
7
+
8
+ /**
9
+ * @description Reference
10
+ */
11
+ export default class Reference {
12
+
13
+ /**
14
+ * @param {StorecraftSDK} sdk
15
+ */
16
+ constructor(sdk) {
17
+ this.sdk = sdk;
18
+ }
19
+
20
+ /**
21
+ * @returns {Promise<StorecraftConfig>}
22
+ */
23
+ settings = async () => {
24
+ /** @type {StorecraftConfig} */
25
+ const json = await fetchApiWithAuth(
26
+ this.sdk,
27
+ 'reference/settings',
28
+ { method: 'get' },
29
+ );
30
+ return json;
31
+ }
32
+
33
+ /**
34
+ * @returns {Promise<StorecraftAppPublicInfo>}
35
+ */
36
+ info = async () => {
37
+ /** @type {StorecraftAppPublicInfo} */
38
+ const json = await fetchApiWithAuth(
39
+ this.sdk,
40
+ 'reference/info',
41
+ { method: 'get' },
42
+ );
43
+ return json;
44
+ }
45
+
46
+ }
package/src/search.js CHANGED
@@ -6,10 +6,10 @@
6
6
 
7
7
  import {
8
8
  api_query_to_searchparams, object_to_search_params,
9
- string_array_to_string
10
- } from '@storecraft/core/api/utils.query.js';
9
+ } from '@storecraft/core/api/query.js';
11
10
  import { StorecraftSDK } from '../index.js'
12
11
  import { fetchApiWithAuth, url } from './utils.api.fetch.js';
12
+ import { string_array_to_string } from '@storecraft/core/api/query.utils.js';
13
13
 
14
14
  /**
15
15
  * @description **Search** API (two options):
package/src/statistics.js CHANGED
@@ -6,7 +6,7 @@ import { StorecraftSDK } from '../index.js'
6
6
  import { fetchApiWithAuth } from './utils.api.fetch.js';
7
7
  import {
8
8
  api_query_to_searchparams
9
- } from '@storecraft/core/api/utils.query.js';
9
+ } from '@storecraft/core/api/query.js';
10
10
 
11
11
  /**
12
12
  * @description statistics endpoint
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import {
7
7
  api_query_to_searchparams
8
- } from '@storecraft/core/api/utils.query.js';
8
+ } from '@storecraft/core/api/query.js';
9
9
 
10
10
 
11
11
  /**
package/src/settings.js DELETED
@@ -1,18 +0,0 @@
1
- import { StorecraftSDK } from '../index.js'
2
- import { collection_base } from './utils.api.fetch.js';
3
-
4
- /**
5
- * @description Base `settings` **CRUD**
6
- *
7
- * @extends {collection_base<any, any>}
8
- */
9
- export default class Settings extends collection_base {
10
-
11
- /**
12
- * @param {StorecraftSDK} sdk
13
- */
14
- constructor(sdk) {
15
- super(sdk, 'reference/settings');
16
- }
17
-
18
- }