@malevich-studio/strapi-sdk-typescript 1.2.1 → 1.2.3
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/dist/cli.cjs +32 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +32 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/generator/attributes/time.d.ts +11 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Base from "@/generator/attributes/base";
|
|
2
|
+
import type { BaseAttribute } from "@/generator/attributes/base";
|
|
3
|
+
export type TimeAttribute = BaseAttribute & {
|
|
4
|
+
type: 'time';
|
|
5
|
+
};
|
|
6
|
+
export default class Time extends Base {
|
|
7
|
+
protected readonly name: string;
|
|
8
|
+
protected readonly attribute: TimeAttribute;
|
|
9
|
+
constructor(name: string, attribute: TimeAttribute);
|
|
10
|
+
getType(): string;
|
|
11
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -20079,6 +20079,9 @@ class Strapi {
|
|
|
20079
20079
|
this.token = token;
|
|
20080
20080
|
}
|
|
20081
20081
|
async fetch(endpoint, data = {}, params = {}) {
|
|
20082
|
+
return await this.fetchData(endpoint, data, params);
|
|
20083
|
+
}
|
|
20084
|
+
async fetchData(endpoint, data = {}, params = {}) {
|
|
20082
20085
|
const queryString = params.method === 'GET' ? qs.stringify(data) : '';
|
|
20083
20086
|
return await this.baseFetch(queryString ? `${endpoint}?${queryString}` : endpoint, _.merge({
|
|
20084
20087
|
headers: {
|
|
@@ -20091,6 +20094,19 @@ class Strapi {
|
|
|
20091
20094
|
} : {}),
|
|
20092
20095
|
}, params));
|
|
20093
20096
|
}
|
|
20097
|
+
setToken(token) {
|
|
20098
|
+
this.token = token;
|
|
20099
|
+
}
|
|
20100
|
+
async baseLogin(identifier, password) {
|
|
20101
|
+
const response = await this.fetchData('/auth/local', {
|
|
20102
|
+
identifier,
|
|
20103
|
+
password
|
|
20104
|
+
}, {
|
|
20105
|
+
method: 'POST',
|
|
20106
|
+
});
|
|
20107
|
+
this.setToken(response.jwt);
|
|
20108
|
+
return response.user;
|
|
20109
|
+
}
|
|
20094
20110
|
async getLocales(params) {
|
|
20095
20111
|
return await this.baseFetch('i18n/locales', _.merge({
|
|
20096
20112
|
headers: {
|