@accelbyte/sdk 0.1.1-alpha.62 → 0.2.0-beta.2
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/CHANGELOG.md +13 -1
- package/README.md +4 -4
- package/dist/index.browser.es.js +39 -44
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.d.ts +51797 -54741
- package/dist/index.node.es.js +39 -44
- package/dist/index.node.es.js.map +1 -1
- package/dist/index.node.js +46 -52
- package/dist/index.node.js.map +1 -1
- package/examples/next/README.md +1 -22
- package/examples/next/package.json +1 -1
- package/examples/next/pages/index.tsx +15 -14
- package/examples/next/yarn.lock +9 -9
- package/examples/node/index.mjs +13 -12
- package/examples/node/package.json +1 -1
- package/examples/node/yarn.lock +9 -9
- package/examples/vite/README.md +13 -0
- package/examples/vite/package.json +1 -1
- package/examples/vite/src/Sdk.ts +12 -12
- package/examples/vite/yarn.lock +9 -9
- package/package.json +1 -1
- package/examples/next/.env.example +0 -7
- package/examples/node/.env.example +0 -7
- package/examples/vite/.env.example +0 -5
package/examples/next/README.md
CHANGED
|
@@ -10,25 +10,4 @@ npm run dev
|
|
|
10
10
|
yarn dev
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
|
16
|
-
|
|
17
|
-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
|
|
18
|
-
|
|
19
|
-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
20
|
-
|
|
21
|
-
## Learn More
|
|
22
|
-
|
|
23
|
-
To learn more about Next.js, take a look at the following resources:
|
|
24
|
-
|
|
25
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
26
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
27
|
-
|
|
28
|
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
29
|
-
|
|
30
|
-
## Deploy on Vercel
|
|
31
|
-
|
|
32
|
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
33
|
-
|
|
34
|
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
13
|
+
And open the url in your browser http://localhost:3000/
|
|
@@ -9,22 +9,17 @@ import Head from 'next/head'
|
|
|
9
9
|
import Image from 'next/image'
|
|
10
10
|
import styles from '../styles/Home.module.css'
|
|
11
11
|
|
|
12
|
-
import { Accelbyte, CurrencyInfo, DiscoveryConfigData,
|
|
12
|
+
import { Accelbyte, CurrencyInfo, DiscoveryConfigData, ItemPagingSlicedResult, NamespaceInfo } from '@accelbyte/sdk'
|
|
13
13
|
|
|
14
14
|
const SDK_CONFIG = {
|
|
15
|
-
baseURL:
|
|
16
|
-
clientId:
|
|
17
|
-
namespace:
|
|
18
|
-
redirectURI:
|
|
15
|
+
baseURL: 'https://demo.accelbyte.io',
|
|
16
|
+
clientId: '77f88506b6174c3ea4d925f5b4096ce8',
|
|
17
|
+
namespace: 'accelbyte',
|
|
18
|
+
redirectURI: 'http://localhost:3030'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const sdk = Accelbyte.SDK({
|
|
22
|
-
options: SDK_CONFIG
|
|
23
|
-
config: {
|
|
24
|
-
headers: {
|
|
25
|
-
Authorization: `Bearer ${process.env.NEXT_SDK_ACCESS_TOKEN}`
|
|
26
|
-
}
|
|
27
|
-
}
|
|
22
|
+
options: SDK_CONFIG
|
|
28
23
|
})
|
|
29
24
|
|
|
30
25
|
interface TestSdkReturnType {
|
|
@@ -43,8 +38,14 @@ export const getServerSideProps: GetServerSideProps<{ data: TestSdkReturnType }>
|
|
|
43
38
|
sdk.Platform.Item().fetchItemsByCriteria({}),
|
|
44
39
|
|
|
45
40
|
// These require authentication and we can't use it right away.
|
|
46
|
-
// Ensure that you have
|
|
47
|
-
sdk.Basic.Namespace(
|
|
41
|
+
// Ensure that you have logged in (have cookies) or pass the access token to the `Authorization` header.
|
|
42
|
+
sdk.Basic.Namespace({
|
|
43
|
+
config: {
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer <replace-this-with-access-token>`
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}).getNamespaces()
|
|
48
49
|
])
|
|
49
50
|
|
|
50
51
|
return {
|
|
@@ -54,7 +55,7 @@ export const getServerSideProps: GetServerSideProps<{ data: TestSdkReturnType }>
|
|
|
54
55
|
listDiscoveryConfigs: listDiscoveryConfigs.response?.data,
|
|
55
56
|
listOfCurrencies: listOfCurrencies.response?.data,
|
|
56
57
|
listOfItems: listOfItems.response?.data,
|
|
57
|
-
listOfNamespaces: listOfNamespaces.response?.data
|
|
58
|
+
listOfNamespaces: listOfNamespaces.response?.data || null
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
package/examples/next/yarn.lock
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# yarn lockfile v1
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"@accelbyte/sdk@0.
|
|
6
|
-
version "0.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.
|
|
8
|
-
integrity sha512-
|
|
5
|
+
"@accelbyte/sdk@0.2.0-beta.1":
|
|
6
|
+
version "0.2.0-beta.1"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.2.0-beta.1.tgz#51850f829094b386858b24c7573404e96bd28371"
|
|
8
|
+
integrity sha512-NDNCIdWppgY/1/XgF7Tvqj1pc3oL7X2oYPOjqGYpMq3yEdx+UW6yJ1lA3ZsC/vKbZUST8JRWpE0bE4/ncW1HaA==
|
|
9
9
|
dependencies:
|
|
10
10
|
axios "0.27.2"
|
|
11
11
|
buffer "6.0.3"
|
|
12
12
|
crypto-js "4.1.1"
|
|
13
13
|
lodash-core "4.17.19"
|
|
14
|
-
nanoid "3.1.
|
|
14
|
+
nanoid "3.1.31"
|
|
15
15
|
platform "1.3.6"
|
|
16
16
|
query-string "7.1.1"
|
|
17
17
|
uuid "8.3.2"
|
|
@@ -247,10 +247,10 @@ mime-types@^2.1.12:
|
|
|
247
247
|
dependencies:
|
|
248
248
|
mime-db "1.52.0"
|
|
249
249
|
|
|
250
|
-
nanoid@3.1.
|
|
251
|
-
version "3.1.
|
|
252
|
-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.
|
|
253
|
-
integrity sha512-
|
|
250
|
+
nanoid@3.1.31:
|
|
251
|
+
version "3.1.31"
|
|
252
|
+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.31.tgz#f5b58a1ce1b7604da5f0605757840598d8974dc6"
|
|
253
|
+
integrity sha512-ZivnJm0o9bb13p2Ot5CpgC2rQdzB9Uxm/mFZweqm5eMViqOJe3PV6LU2E30SiLgheesmcPrjquqraoolONSA0A==
|
|
254
254
|
|
|
255
255
|
nanoid@^3.3.4:
|
|
256
256
|
version "3.3.4"
|
package/examples/node/index.mjs
CHANGED
|
@@ -5,19 +5,14 @@ import { config } from 'dotenv'
|
|
|
5
5
|
config()
|
|
6
6
|
|
|
7
7
|
const SDK_CONFIG = {
|
|
8
|
-
baseURL:
|
|
9
|
-
clientId:
|
|
10
|
-
namespace:
|
|
11
|
-
redirectURI:
|
|
8
|
+
baseURL: 'https://demo.accelbyte.io',
|
|
9
|
+
clientId: '77f88506b6174c3ea4d925f5b4096ce8',
|
|
10
|
+
namespace: 'accelbyte',
|
|
11
|
+
redirectURI: 'http://localhost:3030'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const sdk = Accelbyte.SDK({
|
|
15
|
-
options: SDK_CONFIG
|
|
16
|
-
config: {
|
|
17
|
-
headers: {
|
|
18
|
-
Authorization: `Bearer ${process.env.SDK_ACCESS_TOKEN}`
|
|
19
|
-
}
|
|
20
|
-
}
|
|
15
|
+
options: SDK_CONFIG
|
|
21
16
|
})
|
|
22
17
|
|
|
23
18
|
// Sample SDK calls:
|
|
@@ -43,8 +38,14 @@ async function main() {
|
|
|
43
38
|
console.info(JSON.stringify(listOfItems))
|
|
44
39
|
|
|
45
40
|
// These require authentication and we can't use it right away.
|
|
46
|
-
// Ensure that you have
|
|
47
|
-
const listOfNamespaces =
|
|
41
|
+
// Ensure that you have logged in (have cookies) or pass the access token to the `Authorization` header.
|
|
42
|
+
const listOfNamespaces = sdk.Basic.Namespace({
|
|
43
|
+
config: {
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer <replace-this-with-access-token>`
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}).getNamespaces()
|
|
48
49
|
|
|
49
50
|
console.info('List of namespaces:')
|
|
50
51
|
console.info(JSON.stringify(listOfNamespaces))
|
package/examples/node/yarn.lock
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# yarn lockfile v1
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"@accelbyte/sdk@0.
|
|
6
|
-
version "0.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.
|
|
8
|
-
integrity sha512-
|
|
5
|
+
"@accelbyte/sdk@0.2.0-beta.1":
|
|
6
|
+
version "0.2.0-beta.1"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.2.0-beta.1.tgz#51850f829094b386858b24c7573404e96bd28371"
|
|
8
|
+
integrity sha512-NDNCIdWppgY/1/XgF7Tvqj1pc3oL7X2oYPOjqGYpMq3yEdx+UW6yJ1lA3ZsC/vKbZUST8JRWpE0bE4/ncW1HaA==
|
|
9
9
|
dependencies:
|
|
10
10
|
axios "0.27.2"
|
|
11
11
|
buffer "6.0.3"
|
|
12
12
|
crypto-js "4.1.1"
|
|
13
13
|
lodash-core "4.17.19"
|
|
14
|
-
nanoid "3.1.
|
|
14
|
+
nanoid "3.1.31"
|
|
15
15
|
platform "1.3.6"
|
|
16
16
|
query-string "7.1.1"
|
|
17
17
|
uuid "8.3.2"
|
|
@@ -112,10 +112,10 @@ mime-types@^2.1.12:
|
|
|
112
112
|
dependencies:
|
|
113
113
|
mime-db "1.52.0"
|
|
114
114
|
|
|
115
|
-
nanoid@3.1.
|
|
116
|
-
version "3.1.
|
|
117
|
-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.
|
|
118
|
-
integrity sha512-
|
|
115
|
+
nanoid@3.1.31:
|
|
116
|
+
version "3.1.31"
|
|
117
|
+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.31.tgz#f5b58a1ce1b7604da5f0605757840598d8974dc6"
|
|
118
|
+
integrity sha512-ZivnJm0o9bb13p2Ot5CpgC2rQdzB9Uxm/mFZweqm5eMViqOJe3PV6LU2E30SiLgheesmcPrjquqraoolONSA0A==
|
|
119
119
|
|
|
120
120
|
platform@1.3.6:
|
|
121
121
|
version "1.3.6"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
Run the command below:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And open the link http://localhost:3030/
|
package/examples/vite/src/Sdk.ts
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { Accelbyte } from '@accelbyte/sdk'
|
|
3
2
|
|
|
4
3
|
const SDK_CONFIG = {
|
|
5
4
|
baseURL: '/api',
|
|
6
|
-
clientId:
|
|
7
|
-
namespace:
|
|
8
|
-
redirectURI:
|
|
5
|
+
clientId: '77f88506b6174c3ea4d925f5b4096ce8',
|
|
6
|
+
namespace: 'accelbyte',
|
|
7
|
+
redirectURI: 'http://localhost:3030'
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
const sdk = Accelbyte.SDK({
|
|
12
|
-
options: SDK_CONFIG
|
|
13
|
-
config: {
|
|
14
|
-
headers: {
|
|
15
|
-
Authorization: `Bearer ${import.meta.env.VITE_SDK_ACCESS_TOKEN}`
|
|
16
|
-
}
|
|
17
|
-
}
|
|
11
|
+
options: SDK_CONFIG
|
|
18
12
|
})
|
|
19
13
|
|
|
20
14
|
export async function getSdkTestValues() {
|
|
@@ -25,8 +19,14 @@ export async function getSdkTestValues() {
|
|
|
25
19
|
sdk.Platform.Item().fetchItemsByCriteria({}),
|
|
26
20
|
|
|
27
21
|
// These require authentication and we can't use it right away.
|
|
28
|
-
// Ensure that you have
|
|
29
|
-
sdk.Basic.Namespace(
|
|
22
|
+
// Ensure that you have logged in (have cookies) or pass the access token to the `Authorization` header.
|
|
23
|
+
sdk.Basic.Namespace({
|
|
24
|
+
config: {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer <replace-this-with-access-token>`
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}).getNamespaces()
|
|
30
30
|
])
|
|
31
31
|
|
|
32
32
|
return {
|
package/examples/vite/yarn.lock
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# yarn lockfile v1
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"@accelbyte/sdk@0.
|
|
6
|
-
version "0.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.
|
|
8
|
-
integrity sha512-
|
|
5
|
+
"@accelbyte/sdk@0.2.0-beta.1":
|
|
6
|
+
version "0.2.0-beta.1"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-0.2.0-beta.1.tgz#51850f829094b386858b24c7573404e96bd28371"
|
|
8
|
+
integrity sha512-NDNCIdWppgY/1/XgF7Tvqj1pc3oL7X2oYPOjqGYpMq3yEdx+UW6yJ1lA3ZsC/vKbZUST8JRWpE0bE4/ncW1HaA==
|
|
9
9
|
dependencies:
|
|
10
10
|
axios "0.27.2"
|
|
11
11
|
buffer "6.0.3"
|
|
12
12
|
crypto-js "4.1.1"
|
|
13
13
|
lodash-core "4.17.19"
|
|
14
|
-
nanoid "3.1.
|
|
14
|
+
nanoid "3.1.31"
|
|
15
15
|
platform "1.3.6"
|
|
16
16
|
query-string "7.1.1"
|
|
17
17
|
uuid "8.3.2"
|
|
@@ -681,10 +681,10 @@ ms@2.1.2:
|
|
|
681
681
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
|
682
682
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
|
683
683
|
|
|
684
|
-
nanoid@3.1.
|
|
685
|
-
version "3.1.
|
|
686
|
-
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.
|
|
687
|
-
integrity sha512-
|
|
684
|
+
nanoid@3.1.31:
|
|
685
|
+
version "3.1.31"
|
|
686
|
+
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.31.tgz#f5b58a1ce1b7604da5f0605757840598d8974dc6"
|
|
687
|
+
integrity sha512-ZivnJm0o9bb13p2Ot5CpgC2rQdzB9Uxm/mFZweqm5eMViqOJe3PV6LU2E30SiLgheesmcPrjquqraoolONSA0A==
|
|
688
688
|
|
|
689
689
|
nanoid@^3.3.4:
|
|
690
690
|
version "3.3.4"
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# To use this file, copy this as `.env` file, then replace the values.
|
|
2
|
-
|
|
3
|
-
NEXT_SDK_BASE_URL=${NEXT_SDK_BASE_URL}
|
|
4
|
-
NEXT_SDK_REDIRECT_URI=${NEXT_SDK_REDIRECT_URI}
|
|
5
|
-
NEXT_SDK_CLIENT_ID=${NEXT_SDK_CLIENT_ID}
|
|
6
|
-
NEXT_SDK_NAMESPACE=${NEXT_SDK_NAMESPACE}
|
|
7
|
-
NEXT_SDK_ACCESS_TOKEN=${NEXT_SDK_ACCESS_TOKEN}
|