@levo-so/core 0.1.11 → 0.1.12
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/index.js +1 -1
- package/dist/plugins/LevoCollection.d.ts.map +1 -1
- package/dist/plugins/LevoCollection.js +2 -6
- package/dist/plugins/LevoLogger.js +1 -1
- package/dist/plugins/LevoMembership.d.ts +3 -1
- package/dist/plugins/LevoMembership.d.ts.map +1 -1
- package/dist/plugins/LevoMembership.js +10 -40
- package/dist/types/membership/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoCollection.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,cAAe,SAAQ,UAAU;IAC5C,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LevoCollection.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,cAAe,SAAQ,UAAU;IAC5C,iBAAiB,CACf,IAAI,GAAE,SAAS,CAAC,SAAc,EAC9B,OAAO,GAAE,aAAkB;IAS7B,yBAAyB,CAAC,CAAC,GAAG,eAAe,EAC3C,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,aAAkB;IAS7B,gBAAgB,CAAC,IAAI,EAAE,eAAe;IAOtC,kBAAkB,CAAC,EACjB,aAAa,EACb,IAAI,EACJ,OAAY,GACb,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;IAQD,wBAAwB,CAAC,EACvB,cAAc,EACd,IAAI,EACJ,MAAM,EACN,KAAU,GACX,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAYD,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAOhD,aAAa,CAAC,cAAc,EAAE,MAAM;IAOpC,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAMnD"}
|
|
@@ -2,12 +2,8 @@ import { LevoPlugin } from '../chunk-QJSKNLTV.js';
|
|
|
2
2
|
|
|
3
3
|
// src/plugins/LevoCollection.ts
|
|
4
4
|
var LevoCollection = class extends LevoPlugin {
|
|
5
|
-
getAllCollections(data = {}, options) {
|
|
6
|
-
|
|
7
|
-
if (options) {
|
|
8
|
-
request = request.options(options);
|
|
9
|
-
}
|
|
10
|
-
return request.post(data).json();
|
|
5
|
+
getAllCollections(data = {}, options = {}) {
|
|
6
|
+
return this.client.fetch.url("/v1/bevy/collection/query").options(options).post(data).json();
|
|
11
7
|
}
|
|
12
8
|
getCollectionByIDExpanded(id, options = {}) {
|
|
13
9
|
return this.client.fetch.url(`/v1/bevy/collection/${id}`).options(options).get().json();
|
|
@@ -9,7 +9,7 @@ var LevoLogger = class extends LevoPlugin {
|
|
|
9
9
|
logger.setLevel(
|
|
10
10
|
this.client.NODE_ENV === "production" ? logger.levels.INFO : logger.levels.DEBUG
|
|
11
11
|
);
|
|
12
|
-
logger.methodFactory = (methodName
|
|
12
|
+
logger.methodFactory = (methodName) => (message, attributes = {}) => {
|
|
13
13
|
wretch().url(`${this.client.apiUrl}/v1/apm/logs/json`).post({
|
|
14
14
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15
15
|
level: methodName,
|
|
@@ -18,7 +18,9 @@ export declare class LevoMembership extends LevoPlugin {
|
|
|
18
18
|
* Sign out the current user's account
|
|
19
19
|
* @returns T | null
|
|
20
20
|
*/
|
|
21
|
-
signOut<T =
|
|
21
|
+
signOut<T = {
|
|
22
|
+
status: boolean;
|
|
23
|
+
}>(options?: WretchOptions): Promise<T>;
|
|
22
24
|
/**
|
|
23
25
|
* Get the current user's account
|
|
24
26
|
* @returns T | null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoMembership.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoMembership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,cAAe,SAAQ,UAAU;IAC5C;;;;;;;;;;OAUG;IACG,WAAW,CACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"LevoMembership.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoMembership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,cAAe,SAAQ,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E,eAAe,CAAC,OAAO,CAAC,aAAa,EAC3C,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAUd,kBAAkB,CAAC,CAAC,GAAG,eAAe,CAAC,OAAO,EAClD,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,kBAAkB,EAChD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAUd,kBAAkB,CAAC,CAAC,GAAG,eAAe,CAAC,OAAO,EAClD,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,kBAAkB,EAChD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CASrB"}
|
|
@@ -17,9 +17,7 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
17
17
|
async getOAuthURL(options = {}) {
|
|
18
18
|
try {
|
|
19
19
|
const response = await this.client.fetch.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json();
|
|
20
|
-
const
|
|
21
|
-
content: { data: result }
|
|
22
|
-
} = response;
|
|
20
|
+
const result = response?.content?.data;
|
|
23
21
|
const providers = Object.keys(result);
|
|
24
22
|
if (typeof window !== "undefined") {
|
|
25
23
|
for (const provider of providers) {
|
|
@@ -48,11 +46,7 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
48
46
|
* @returns T | null
|
|
49
47
|
*/
|
|
50
48
|
async signOut(options = {}) {
|
|
51
|
-
|
|
52
|
-
const {
|
|
53
|
-
content: { data: result }
|
|
54
|
-
} = response;
|
|
55
|
-
return result;
|
|
49
|
+
return this.client.fetch.url("/v1/membership/auth/sign-out").options(options).post("").json();
|
|
56
50
|
}
|
|
57
51
|
/**
|
|
58
52
|
* Get the current user's account
|
|
@@ -60,24 +54,15 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
60
54
|
*/
|
|
61
55
|
async getMe(options = {}) {
|
|
62
56
|
const response = await this.client.fetch.url("/v1/membership/auth/get-me").options(options).get().json();
|
|
63
|
-
|
|
64
|
-
content: { data: result }
|
|
65
|
-
} = response;
|
|
66
|
-
return result;
|
|
57
|
+
return response?.content?.data;
|
|
67
58
|
}
|
|
68
59
|
async updateMe(data, options = {}) {
|
|
69
60
|
const response = await this.client.fetch.url("/v1/membership/auth/update-me").options(options).put(data).json();
|
|
70
|
-
|
|
71
|
-
content: { data: result }
|
|
72
|
-
} = response;
|
|
73
|
-
return result;
|
|
61
|
+
return response?.content?.data;
|
|
74
62
|
}
|
|
75
63
|
async createPassword(data, options = {}) {
|
|
76
64
|
const response = await this.client.fetch.url("/v1/membership/auth/change-password").options(options).put(data).json();
|
|
77
|
-
|
|
78
|
-
content: { data: result }
|
|
79
|
-
} = response;
|
|
80
|
-
return result;
|
|
65
|
+
return response?.content?.data;
|
|
81
66
|
}
|
|
82
67
|
async isLoggedIn(options = {}) {
|
|
83
68
|
try {
|
|
@@ -92,38 +77,23 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
92
77
|
data.redirect_uri = window.location.href;
|
|
93
78
|
}
|
|
94
79
|
const response = await this.client.fetch.url("/v1/membership/auth/request-magic-link").options(options).post(data).json();
|
|
95
|
-
|
|
96
|
-
content: { data: result }
|
|
97
|
-
} = response;
|
|
98
|
-
return result;
|
|
80
|
+
return response?.content?.data;
|
|
99
81
|
}
|
|
100
82
|
async requestOtp(data, options = {}) {
|
|
101
83
|
const response = await this.client.fetch.url("/v1/membership/auth/request-otp").options(options).post(data).json();
|
|
102
|
-
|
|
103
|
-
content: { data: result }
|
|
104
|
-
} = response;
|
|
105
|
-
return result;
|
|
84
|
+
return response?.content?.data;
|
|
106
85
|
}
|
|
107
86
|
async signInWithOtp(data, options = {}) {
|
|
108
87
|
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json();
|
|
109
|
-
|
|
110
|
-
content: { data: result }
|
|
111
|
-
} = response;
|
|
112
|
-
return result;
|
|
88
|
+
return response?.content?.data;
|
|
113
89
|
}
|
|
114
90
|
async signInWithPassword(data, options = {}) {
|
|
115
91
|
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-password").options(options).post(data).json();
|
|
116
|
-
|
|
117
|
-
content: { data: result }
|
|
118
|
-
} = response;
|
|
119
|
-
return result;
|
|
92
|
+
return response?.content?.data;
|
|
120
93
|
}
|
|
121
94
|
async signUpWithPassword(data, options = {}) {
|
|
122
95
|
const response = await this.client.fetch.url("/v1/membership/auth/signup-with-password").options(options).post(data).json();
|
|
123
|
-
|
|
124
|
-
content: { data: result }
|
|
125
|
-
} = response;
|
|
126
|
-
return result;
|
|
96
|
+
return response?.content?.data;
|
|
127
97
|
}
|
|
128
98
|
};
|
|
129
99
|
|
|
@@ -58,9 +58,9 @@ export declare namespace ILevoMembership {
|
|
|
58
58
|
* @example
|
|
59
59
|
* ```javascript
|
|
60
60
|
* {
|
|
61
|
-
* "google": 'https://
|
|
62
|
-
* "microsoft": 'https://
|
|
63
|
-
* "linkedin": 'https://
|
|
61
|
+
* "google": 'https://public-api.levo.so/v1/membership/auth/oauth/google?redirect_uri=https://example.com&workspace=my-workspace',
|
|
62
|
+
* "microsoft": 'https://public-api.levo.so/v1/membership/auth/oauth/microsoft?redirect_uri=https://example.com&workspace=my-workspace',
|
|
63
|
+
* "linkedin": 'https://public-api.levo.so/v1/membership/auth/oauth/linkedin?redirect_uri=https://example.com&workspace=my-workspace'
|
|
64
64
|
* }
|
|
65
65
|
* ```
|
|
66
66
|
*/
|