@nocobase/sdk 0.13.0-alpha.3 → 0.13.0-alpha.5
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/lib/APIClient.d.ts +4 -8
- package/lib/APIClient.js +163 -159
- package/lib/getSubAppName.js +26 -10
- package/lib/index.js +36 -24
- package/package.json +4 -5
- package/.buildrc.ts +0 -5
- package/es/APIClient.d.ts +0 -88
- package/es/APIClient.js +0 -287
- package/es/getSubAppName.d.ts +0 -2
- package/es/getSubAppName.js +0 -8
- package/es/index.d.ts +0 -2
- package/es/index.js +0 -2
package/lib/APIClient.d.ts
CHANGED
|
@@ -9,14 +9,10 @@ type ResourceActionOptions<P = any> = {
|
|
|
9
9
|
action?: string;
|
|
10
10
|
params?: P;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
update?: (params?: ActionParams) => Promise<any>;
|
|
17
|
-
destroy?: (params?: ActionParams) => Promise<any>;
|
|
18
|
-
[key: string]: (params?: ActionParams) => Promise<any>;
|
|
19
|
-
}
|
|
12
|
+
type ResourceAction = (params?: ActionParams) => Promise<any>;
|
|
13
|
+
export type IResource = {
|
|
14
|
+
[key: string]: ResourceAction;
|
|
15
|
+
};
|
|
20
16
|
export declare class Auth {
|
|
21
17
|
protected api: APIClient;
|
|
22
18
|
protected KEYS: {
|
package/lib/APIClient.js
CHANGED
|
@@ -1,54 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var APIClient_exports = {};
|
|
30
|
+
__export(APIClient_exports, {
|
|
31
|
+
APIClient: () => APIClient,
|
|
32
|
+
Auth: () => Auth,
|
|
33
|
+
MemoryStorage: () => MemoryStorage,
|
|
34
|
+
Storage: () => Storage
|
|
5
35
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
module.exports = __toCommonJS(APIClient_exports);
|
|
37
|
+
var import_axios = __toESM(require("axios"));
|
|
38
|
+
var import_qs = __toESM(require("qs"));
|
|
39
|
+
var import_getSubAppName = __toESM(require("./getSubAppName"));
|
|
40
|
+
const _Auth = class _Auth {
|
|
41
|
+
api;
|
|
42
|
+
KEYS = {
|
|
43
|
+
locale: "NOCOBASE_LOCALE",
|
|
44
|
+
role: "NOCOBASE_ROLE",
|
|
45
|
+
token: "NOCOBASE_TOKEN",
|
|
46
|
+
authenticator: "NOCOBASE_AUTH",
|
|
47
|
+
theme: "NOCOBASE_THEME"
|
|
48
|
+
};
|
|
49
|
+
options = {
|
|
50
|
+
locale: null,
|
|
51
|
+
role: null,
|
|
52
|
+
authenticator: null,
|
|
53
|
+
token: null
|
|
54
|
+
};
|
|
23
55
|
constructor(api) {
|
|
24
|
-
this.api = void 0;
|
|
25
|
-
this.KEYS = {
|
|
26
|
-
locale: 'NOCOBASE_LOCALE',
|
|
27
|
-
role: 'NOCOBASE_ROLE',
|
|
28
|
-
token: 'NOCOBASE_TOKEN',
|
|
29
|
-
authenticator: 'NOCOBASE_AUTH',
|
|
30
|
-
theme: 'NOCOBASE_THEME'
|
|
31
|
-
};
|
|
32
|
-
this.options = {
|
|
33
|
-
locale: null,
|
|
34
|
-
role: null,
|
|
35
|
-
authenticator: null,
|
|
36
|
-
token: null
|
|
37
|
-
};
|
|
38
56
|
this.api = api;
|
|
39
57
|
this.initKeys();
|
|
40
58
|
this.api.axios.interceptors.request.use(this.middleware.bind(this));
|
|
41
59
|
}
|
|
42
60
|
initKeys() {
|
|
43
|
-
if (typeof window ===
|
|
61
|
+
if (typeof window === "undefined") {
|
|
44
62
|
return;
|
|
45
63
|
}
|
|
46
|
-
const appName = (0,
|
|
64
|
+
const appName = (0, import_getSubAppName.default)();
|
|
47
65
|
if (!appName) {
|
|
48
66
|
return;
|
|
49
67
|
}
|
|
50
|
-
this.KEYS[
|
|
51
|
-
this.KEYS[
|
|
68
|
+
this.KEYS["role"] = `${appName.toUpperCase()}_` + this.KEYS["role"];
|
|
69
|
+
this.KEYS["locale"] = `${appName.toUpperCase()}_` + this.KEYS["locale"];
|
|
52
70
|
}
|
|
53
71
|
get locale() {
|
|
54
72
|
return this.getLocale();
|
|
@@ -85,100 +103,91 @@ class Auth {
|
|
|
85
103
|
return;
|
|
86
104
|
}
|
|
87
105
|
this.options[key] = value;
|
|
88
|
-
return this.api.storage.setItem(this.KEYS[key], value ||
|
|
106
|
+
return this.api.storage.setItem(this.KEYS[key], value || "");
|
|
89
107
|
}
|
|
90
108
|
getLocale() {
|
|
91
|
-
return this.getOption(
|
|
109
|
+
return this.getOption("locale");
|
|
92
110
|
}
|
|
93
111
|
setLocale(locale) {
|
|
94
|
-
this.setOption(
|
|
112
|
+
this.setOption("locale", locale);
|
|
95
113
|
}
|
|
96
114
|
getRole() {
|
|
97
|
-
return this.getOption(
|
|
115
|
+
return this.getOption("role");
|
|
98
116
|
}
|
|
99
117
|
setRole(role) {
|
|
100
|
-
this.setOption(
|
|
118
|
+
this.setOption("role", role);
|
|
101
119
|
}
|
|
102
120
|
getToken() {
|
|
103
|
-
return this.getOption(
|
|
121
|
+
return this.getOption("token");
|
|
104
122
|
}
|
|
105
123
|
setToken(token) {
|
|
106
|
-
this.setOption(
|
|
124
|
+
this.setOption("token", token);
|
|
107
125
|
}
|
|
108
126
|
getAuthenticator() {
|
|
109
|
-
return this.getOption(
|
|
127
|
+
return this.getOption("authenticator");
|
|
110
128
|
}
|
|
111
129
|
setAuthenticator(authenticator) {
|
|
112
|
-
this.setOption(
|
|
130
|
+
this.setOption("authenticator", authenticator);
|
|
113
131
|
}
|
|
114
132
|
middleware(config) {
|
|
115
133
|
if (this.locale) {
|
|
116
|
-
config.headers[
|
|
134
|
+
config.headers["X-Locale"] = this.locale;
|
|
117
135
|
}
|
|
118
136
|
if (this.role) {
|
|
119
|
-
config.headers[
|
|
137
|
+
config.headers["X-Role"] = this.role;
|
|
120
138
|
}
|
|
121
|
-
if (this.authenticator && !config.headers[
|
|
122
|
-
config.headers[
|
|
139
|
+
if (this.authenticator && !config.headers["X-Authenticator"]) {
|
|
140
|
+
config.headers["X-Authenticator"] = this.authenticator;
|
|
123
141
|
}
|
|
124
142
|
if (this.token) {
|
|
125
|
-
config.headers[
|
|
143
|
+
config.headers["Authorization"] = `Bearer ${this.token}`;
|
|
126
144
|
}
|
|
127
145
|
return config;
|
|
128
146
|
}
|
|
129
|
-
signIn(values, authenticator) {
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
data: values,
|
|
154
|
-
headers: {
|
|
155
|
-
'X-Authenticator': authenticator
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
})();
|
|
159
|
-
}
|
|
160
|
-
signOut() {
|
|
161
|
-
var _this3 = this;
|
|
162
|
-
return _asyncToGenerator(function* () {
|
|
163
|
-
const response = yield _this3.api.request({
|
|
164
|
-
method: 'post',
|
|
165
|
-
url: 'auth:signOut'
|
|
166
|
-
});
|
|
167
|
-
_this3.setToken(null);
|
|
168
|
-
_this3.setRole(null);
|
|
169
|
-
_this3.setAuthenticator(null);
|
|
170
|
-
return response;
|
|
171
|
-
})();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.Auth = Auth;
|
|
175
|
-
class Storage {}
|
|
176
|
-
exports.Storage = Storage;
|
|
177
|
-
class MemoryStorage extends Storage {
|
|
178
|
-
constructor(...args) {
|
|
179
|
-
super(...args);
|
|
180
|
-
this.items = new Map();
|
|
147
|
+
async signIn(values, authenticator) {
|
|
148
|
+
var _a;
|
|
149
|
+
const response = await this.api.request({
|
|
150
|
+
method: "post",
|
|
151
|
+
url: "auth:signIn",
|
|
152
|
+
data: values,
|
|
153
|
+
headers: {
|
|
154
|
+
"X-Authenticator": authenticator
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const data = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data;
|
|
158
|
+
this.setToken(data == null ? void 0 : data.token);
|
|
159
|
+
this.setAuthenticator(authenticator);
|
|
160
|
+
return response;
|
|
161
|
+
}
|
|
162
|
+
async signUp(values, authenticator) {
|
|
163
|
+
return await this.api.request({
|
|
164
|
+
method: "post",
|
|
165
|
+
url: "auth:signUp",
|
|
166
|
+
data: values,
|
|
167
|
+
headers: {
|
|
168
|
+
"X-Authenticator": authenticator
|
|
169
|
+
}
|
|
170
|
+
});
|
|
181
171
|
}
|
|
172
|
+
async signOut() {
|
|
173
|
+
const response = await this.api.request({
|
|
174
|
+
method: "post",
|
|
175
|
+
url: "auth:signOut"
|
|
176
|
+
});
|
|
177
|
+
this.setToken(null);
|
|
178
|
+
this.setRole(null);
|
|
179
|
+
this.setAuthenticator(null);
|
|
180
|
+
return response;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
__name(_Auth, "Auth");
|
|
184
|
+
let Auth = _Auth;
|
|
185
|
+
const _Storage = class _Storage {
|
|
186
|
+
};
|
|
187
|
+
__name(_Storage, "Storage");
|
|
188
|
+
let Storage = _Storage;
|
|
189
|
+
const _MemoryStorage = class _MemoryStorage extends Storage {
|
|
190
|
+
items = /* @__PURE__ */ new Map();
|
|
182
191
|
clear() {
|
|
183
192
|
this.items.clear();
|
|
184
193
|
}
|
|
@@ -191,21 +200,19 @@ class MemoryStorage extends Storage {
|
|
|
191
200
|
removeItem(key) {
|
|
192
201
|
return this.items.delete(key);
|
|
193
202
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
203
|
+
};
|
|
204
|
+
__name(_MemoryStorage, "MemoryStorage");
|
|
205
|
+
let MemoryStorage = _MemoryStorage;
|
|
206
|
+
const _APIClient = class _APIClient {
|
|
207
|
+
axios;
|
|
208
|
+
auth;
|
|
209
|
+
storage;
|
|
197
210
|
constructor(instance) {
|
|
198
|
-
|
|
199
|
-
this.auth = void 0;
|
|
200
|
-
this.storage = void 0;
|
|
201
|
-
if (typeof instance === 'function') {
|
|
211
|
+
if (typeof instance === "function") {
|
|
202
212
|
this.axios = instance;
|
|
203
213
|
} else {
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
storageClass = _ref.storageClass,
|
|
207
|
-
others = _objectWithoutProperties(_ref, _excluded);
|
|
208
|
-
this.axios = _axios.default.create(others);
|
|
214
|
+
const { authClass, storageClass, ...others } = instance || {};
|
|
215
|
+
this.axios = import_axios.default.create(others);
|
|
209
216
|
this.initStorage(storageClass);
|
|
210
217
|
if (authClass) {
|
|
211
218
|
this.auth = new authClass(this);
|
|
@@ -222,77 +229,74 @@ class APIClient {
|
|
|
222
229
|
initStorage(storage) {
|
|
223
230
|
if (storage) {
|
|
224
231
|
this.storage = new storage(this);
|
|
225
|
-
} else if (typeof localStorage !==
|
|
232
|
+
} else if (typeof localStorage !== "undefined") {
|
|
226
233
|
this.storage = localStorage;
|
|
227
234
|
} else {
|
|
228
235
|
this.storage = new MemoryStorage();
|
|
229
236
|
}
|
|
230
237
|
}
|
|
231
238
|
interceptors() {
|
|
232
|
-
this.axios.interceptors.request.use(config => {
|
|
233
|
-
config.paramsSerializer = params => {
|
|
234
|
-
return
|
|
239
|
+
this.axios.interceptors.request.use((config) => {
|
|
240
|
+
config.paramsSerializer = (params) => {
|
|
241
|
+
return import_qs.default.stringify(params, {
|
|
235
242
|
strictNullHandling: true,
|
|
236
|
-
arrayFormat:
|
|
243
|
+
arrayFormat: "brackets"
|
|
237
244
|
});
|
|
238
245
|
};
|
|
239
246
|
return config;
|
|
240
247
|
});
|
|
241
248
|
}
|
|
242
249
|
request(config) {
|
|
243
|
-
const resource = config
|
|
244
|
-
resourceOf = config.resourceOf,
|
|
245
|
-
action = config.action,
|
|
246
|
-
params = config.params;
|
|
250
|
+
const { resource, resourceOf, action, params } = config;
|
|
247
251
|
if (resource) {
|
|
248
252
|
return this.resource(resource, resourceOf)[action](params);
|
|
249
253
|
}
|
|
250
254
|
return this.axios.request(config);
|
|
251
255
|
}
|
|
252
256
|
resource(name, of) {
|
|
253
|
-
var _this4 = this;
|
|
254
257
|
const target = {};
|
|
255
258
|
const handler = {
|
|
256
259
|
get: (_, actionName) => {
|
|
257
|
-
let url = name.split(
|
|
260
|
+
let url = name.split(".").join(`/${of || "_"}/`);
|
|
258
261
|
url += `:${actionName}`;
|
|
259
|
-
const config = {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (['get', 'list'].includes(actionName)) {
|
|
263
|
-
config['method'] = 'get';
|
|
262
|
+
const config = { url };
|
|
263
|
+
if (["get", "list"].includes(actionName)) {
|
|
264
|
+
config["method"] = "get";
|
|
264
265
|
} else {
|
|
265
|
-
config[
|
|
266
|
+
config["method"] = "post";
|
|
266
267
|
}
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
config['params']['filter'] = filter;
|
|
277
|
-
} else {
|
|
278
|
-
if (filter['*']) {
|
|
279
|
-
delete filter['*'];
|
|
280
|
-
}
|
|
281
|
-
config['params']['filter'] = JSON.stringify(filter);
|
|
268
|
+
return async (params, opts) => {
|
|
269
|
+
const { values, filter, ...others } = params || {};
|
|
270
|
+
config["params"] = others;
|
|
271
|
+
if (filter) {
|
|
272
|
+
if (typeof filter === "string") {
|
|
273
|
+
config["params"]["filter"] = filter;
|
|
274
|
+
} else {
|
|
275
|
+
if (filter["*"]) {
|
|
276
|
+
delete filter["*"];
|
|
282
277
|
}
|
|
278
|
+
config["params"]["filter"] = JSON.stringify(filter);
|
|
283
279
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
280
|
+
}
|
|
281
|
+
if (config.method !== "get") {
|
|
282
|
+
config["data"] = values || {};
|
|
283
|
+
}
|
|
284
|
+
return await this.request({
|
|
285
|
+
...config,
|
|
286
|
+
...opts
|
|
288
287
|
});
|
|
289
|
-
|
|
290
|
-
return _ref2.apply(this, arguments);
|
|
291
|
-
};
|
|
292
|
-
}();
|
|
288
|
+
};
|
|
293
289
|
}
|
|
294
290
|
};
|
|
295
291
|
return new Proxy(target, handler);
|
|
296
292
|
}
|
|
297
|
-
}
|
|
298
|
-
|
|
293
|
+
};
|
|
294
|
+
__name(_APIClient, "APIClient");
|
|
295
|
+
let APIClient = _APIClient;
|
|
296
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
297
|
+
0 && (module.exports = {
|
|
298
|
+
APIClient,
|
|
299
|
+
Auth,
|
|
300
|
+
MemoryStorage,
|
|
301
|
+
Storage
|
|
302
|
+
});
|
package/lib/getSubAppName.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getSubAppName_exports = {};
|
|
20
|
+
__export(getSubAppName_exports, {
|
|
21
|
+
default: () => getSubAppName_default
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
const getSubAppName = () => {
|
|
23
|
+
module.exports = __toCommonJS(getSubAppName_exports);
|
|
24
|
+
const getSubAppName = /* @__PURE__ */ __name(() => {
|
|
8
25
|
const match = window.location.pathname.match(/^\/apps\/([^/]*)\/?/);
|
|
9
26
|
if (!match) {
|
|
10
|
-
return
|
|
27
|
+
return "";
|
|
11
28
|
}
|
|
12
29
|
return match[1];
|
|
13
|
-
};
|
|
14
|
-
var
|
|
15
|
-
exports.default = _default;
|
|
30
|
+
}, "getSubAppName");
|
|
31
|
+
var getSubAppName_default = getSubAppName;
|
package/lib/index.js
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
16
|
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
getSubAppName: () => import_getSubAppName.default
|
|
14
32
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
get: function get() {
|
|
23
|
-
return _APIClient[key];
|
|
24
|
-
}
|
|
25
|
-
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("./APIClient"), module.exports);
|
|
35
|
+
var import_getSubAppName = __toESM(require("./getSubAppName"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
getSubAppName,
|
|
39
|
+
...require("./APIClient")
|
|
26
40
|
});
|
|
27
|
-
var _getSubAppName = _interopRequireDefault(require("./getSubAppName"));
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/sdk",
|
|
3
|
-
"version": "0.13.0-alpha.
|
|
3
|
+
"version": "0.13.0-alpha.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"main": "lib",
|
|
6
|
-
"
|
|
7
|
-
"typings": "es/index.d.ts",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
8
7
|
"dependencies": {
|
|
9
8
|
"axios": "^0.26.1",
|
|
10
9
|
"qs": "^6.10.1"
|
|
@@ -12,5 +11,5 @@
|
|
|
12
11
|
"devDependencies": {
|
|
13
12
|
"axios-mock-adapter": "^1.20.0"
|
|
14
13
|
},
|
|
15
|
-
"gitHead": "
|
|
14
|
+
"gitHead": "9eabe607b4a20c356fdb2fd95e40fa476986dcb0"
|
|
16
15
|
}
|
package/.buildrc.ts
DELETED
package/es/APIClient.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
-
export interface ActionParams {
|
|
3
|
-
filterByTk?: any;
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}
|
|
6
|
-
type ResourceActionOptions<P = any> = {
|
|
7
|
-
resource?: string;
|
|
8
|
-
resourceOf?: any;
|
|
9
|
-
action?: string;
|
|
10
|
-
params?: P;
|
|
11
|
-
};
|
|
12
|
-
export interface IResource {
|
|
13
|
-
list?: (params?: ActionParams) => Promise<any>;
|
|
14
|
-
get?: (params?: ActionParams) => Promise<any>;
|
|
15
|
-
create?: (params?: ActionParams) => Promise<any>;
|
|
16
|
-
update?: (params?: ActionParams) => Promise<any>;
|
|
17
|
-
destroy?: (params?: ActionParams) => Promise<any>;
|
|
18
|
-
[key: string]: (params?: ActionParams) => Promise<any>;
|
|
19
|
-
}
|
|
20
|
-
export declare class Auth {
|
|
21
|
-
protected api: APIClient;
|
|
22
|
-
protected KEYS: {
|
|
23
|
-
locale: string;
|
|
24
|
-
role: string;
|
|
25
|
-
token: string;
|
|
26
|
-
authenticator: string;
|
|
27
|
-
theme: string;
|
|
28
|
-
};
|
|
29
|
-
protected options: {
|
|
30
|
-
locale: any;
|
|
31
|
-
role: any;
|
|
32
|
-
authenticator: any;
|
|
33
|
-
token: any;
|
|
34
|
-
};
|
|
35
|
-
constructor(api: APIClient);
|
|
36
|
-
initKeys(): void;
|
|
37
|
-
get locale(): string;
|
|
38
|
-
set locale(value: string);
|
|
39
|
-
get role(): string;
|
|
40
|
-
set role(value: string);
|
|
41
|
-
get token(): string;
|
|
42
|
-
set token(value: string);
|
|
43
|
-
get authenticator(): string;
|
|
44
|
-
set authenticator(value: string);
|
|
45
|
-
getOption(key: string): string;
|
|
46
|
-
setOption(key: string, value?: string): void;
|
|
47
|
-
getLocale(): string;
|
|
48
|
-
setLocale(locale: string): void;
|
|
49
|
-
getRole(): string;
|
|
50
|
-
setRole(role: string): void;
|
|
51
|
-
getToken(): string;
|
|
52
|
-
setToken(token: string): void;
|
|
53
|
-
getAuthenticator(): string;
|
|
54
|
-
setAuthenticator(authenticator: string): void;
|
|
55
|
-
middleware(config: AxiosRequestConfig): AxiosRequestConfig<any>;
|
|
56
|
-
signIn(values: any, authenticator?: string): Promise<AxiosResponse<any>>;
|
|
57
|
-
signUp(values: any, authenticator?: string): Promise<AxiosResponse<any>>;
|
|
58
|
-
signOut(): Promise<AxiosResponse<any, any>>;
|
|
59
|
-
}
|
|
60
|
-
export declare abstract class Storage {
|
|
61
|
-
abstract clear(): void;
|
|
62
|
-
abstract getItem(key: string): string | null;
|
|
63
|
-
abstract removeItem(key: string): void;
|
|
64
|
-
abstract setItem(key: string, value: string): void;
|
|
65
|
-
}
|
|
66
|
-
export declare class MemoryStorage extends Storage {
|
|
67
|
-
items: Map<any, any>;
|
|
68
|
-
clear(): void;
|
|
69
|
-
getItem(key: string): any;
|
|
70
|
-
setItem(key: string, value: string): Map<any, any>;
|
|
71
|
-
removeItem(key: string): boolean;
|
|
72
|
-
}
|
|
73
|
-
interface ExtendedOptions {
|
|
74
|
-
authClass?: any;
|
|
75
|
-
storageClass?: any;
|
|
76
|
-
}
|
|
77
|
-
export type APIClientOptions = AxiosInstance | (AxiosRequestConfig & ExtendedOptions);
|
|
78
|
-
export declare class APIClient {
|
|
79
|
-
axios: AxiosInstance;
|
|
80
|
-
auth: Auth;
|
|
81
|
-
storage: Storage;
|
|
82
|
-
constructor(instance?: APIClientOptions);
|
|
83
|
-
private initStorage;
|
|
84
|
-
interceptors(): void;
|
|
85
|
-
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D> | ResourceActionOptions): Promise<R>;
|
|
86
|
-
resource(name: string, of?: any): IResource;
|
|
87
|
-
}
|
|
88
|
-
export {};
|
package/es/APIClient.js
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
const _excluded = ["authClass", "storageClass"],
|
|
2
|
-
_excluded2 = ["values", "filter"];
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
-
import axios from 'axios';
|
|
13
|
-
import qs from 'qs';
|
|
14
|
-
import getSubAppName from './getSubAppName';
|
|
15
|
-
export class Auth {
|
|
16
|
-
constructor(api) {
|
|
17
|
-
this.api = void 0;
|
|
18
|
-
this.KEYS = {
|
|
19
|
-
locale: 'NOCOBASE_LOCALE',
|
|
20
|
-
role: 'NOCOBASE_ROLE',
|
|
21
|
-
token: 'NOCOBASE_TOKEN',
|
|
22
|
-
authenticator: 'NOCOBASE_AUTH',
|
|
23
|
-
theme: 'NOCOBASE_THEME'
|
|
24
|
-
};
|
|
25
|
-
this.options = {
|
|
26
|
-
locale: null,
|
|
27
|
-
role: null,
|
|
28
|
-
authenticator: null,
|
|
29
|
-
token: null
|
|
30
|
-
};
|
|
31
|
-
this.api = api;
|
|
32
|
-
this.initKeys();
|
|
33
|
-
this.api.axios.interceptors.request.use(this.middleware.bind(this));
|
|
34
|
-
}
|
|
35
|
-
initKeys() {
|
|
36
|
-
if (typeof window === 'undefined') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const appName = getSubAppName();
|
|
40
|
-
if (!appName) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.KEYS['role'] = `${appName.toUpperCase()}_` + this.KEYS['role'];
|
|
44
|
-
this.KEYS['locale'] = `${appName.toUpperCase()}_` + this.KEYS['locale'];
|
|
45
|
-
}
|
|
46
|
-
get locale() {
|
|
47
|
-
return this.getLocale();
|
|
48
|
-
}
|
|
49
|
-
set locale(value) {
|
|
50
|
-
this.setLocale(value);
|
|
51
|
-
}
|
|
52
|
-
get role() {
|
|
53
|
-
return this.getRole();
|
|
54
|
-
}
|
|
55
|
-
set role(value) {
|
|
56
|
-
this.setRole(value);
|
|
57
|
-
}
|
|
58
|
-
get token() {
|
|
59
|
-
return this.getToken();
|
|
60
|
-
}
|
|
61
|
-
set token(value) {
|
|
62
|
-
this.setToken(value);
|
|
63
|
-
}
|
|
64
|
-
get authenticator() {
|
|
65
|
-
return this.getAuthenticator();
|
|
66
|
-
}
|
|
67
|
-
set authenticator(value) {
|
|
68
|
-
this.setAuthenticator(value);
|
|
69
|
-
}
|
|
70
|
-
getOption(key) {
|
|
71
|
-
if (!this.KEYS[key]) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
return this.api.storage.getItem(this.KEYS[key]);
|
|
75
|
-
}
|
|
76
|
-
setOption(key, value) {
|
|
77
|
-
if (!this.KEYS[key]) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this.options[key] = value;
|
|
81
|
-
return this.api.storage.setItem(this.KEYS[key], value || '');
|
|
82
|
-
}
|
|
83
|
-
getLocale() {
|
|
84
|
-
return this.getOption('locale');
|
|
85
|
-
}
|
|
86
|
-
setLocale(locale) {
|
|
87
|
-
this.setOption('locale', locale);
|
|
88
|
-
}
|
|
89
|
-
getRole() {
|
|
90
|
-
return this.getOption('role');
|
|
91
|
-
}
|
|
92
|
-
setRole(role) {
|
|
93
|
-
this.setOption('role', role);
|
|
94
|
-
}
|
|
95
|
-
getToken() {
|
|
96
|
-
return this.getOption('token');
|
|
97
|
-
}
|
|
98
|
-
setToken(token) {
|
|
99
|
-
this.setOption('token', token);
|
|
100
|
-
}
|
|
101
|
-
getAuthenticator() {
|
|
102
|
-
return this.getOption('authenticator');
|
|
103
|
-
}
|
|
104
|
-
setAuthenticator(authenticator) {
|
|
105
|
-
this.setOption('authenticator', authenticator);
|
|
106
|
-
}
|
|
107
|
-
middleware(config) {
|
|
108
|
-
if (this.locale) {
|
|
109
|
-
config.headers['X-Locale'] = this.locale;
|
|
110
|
-
}
|
|
111
|
-
if (this.role) {
|
|
112
|
-
config.headers['X-Role'] = this.role;
|
|
113
|
-
}
|
|
114
|
-
if (this.authenticator && !config.headers['X-Authenticator']) {
|
|
115
|
-
config.headers['X-Authenticator'] = this.authenticator;
|
|
116
|
-
}
|
|
117
|
-
if (this.token) {
|
|
118
|
-
config.headers['Authorization'] = `Bearer ${this.token}`;
|
|
119
|
-
}
|
|
120
|
-
return config;
|
|
121
|
-
}
|
|
122
|
-
signIn(values, authenticator) {
|
|
123
|
-
var _this = this;
|
|
124
|
-
return _asyncToGenerator(function* () {
|
|
125
|
-
var _response$data;
|
|
126
|
-
const response = yield _this.api.request({
|
|
127
|
-
method: 'post',
|
|
128
|
-
url: 'auth:signIn',
|
|
129
|
-
data: values,
|
|
130
|
-
headers: {
|
|
131
|
-
'X-Authenticator': authenticator
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
const data = response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data;
|
|
135
|
-
_this.setToken(data === null || data === void 0 ? void 0 : data.token);
|
|
136
|
-
_this.setAuthenticator(authenticator);
|
|
137
|
-
return response;
|
|
138
|
-
})();
|
|
139
|
-
}
|
|
140
|
-
signUp(values, authenticator) {
|
|
141
|
-
var _this2 = this;
|
|
142
|
-
return _asyncToGenerator(function* () {
|
|
143
|
-
return yield _this2.api.request({
|
|
144
|
-
method: 'post',
|
|
145
|
-
url: 'auth:signUp',
|
|
146
|
-
data: values,
|
|
147
|
-
headers: {
|
|
148
|
-
'X-Authenticator': authenticator
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
})();
|
|
152
|
-
}
|
|
153
|
-
signOut() {
|
|
154
|
-
var _this3 = this;
|
|
155
|
-
return _asyncToGenerator(function* () {
|
|
156
|
-
const response = yield _this3.api.request({
|
|
157
|
-
method: 'post',
|
|
158
|
-
url: 'auth:signOut'
|
|
159
|
-
});
|
|
160
|
-
_this3.setToken(null);
|
|
161
|
-
_this3.setRole(null);
|
|
162
|
-
_this3.setAuthenticator(null);
|
|
163
|
-
return response;
|
|
164
|
-
})();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
export class Storage {}
|
|
168
|
-
export class MemoryStorage extends Storage {
|
|
169
|
-
constructor(...args) {
|
|
170
|
-
super(...args);
|
|
171
|
-
this.items = new Map();
|
|
172
|
-
}
|
|
173
|
-
clear() {
|
|
174
|
-
this.items.clear();
|
|
175
|
-
}
|
|
176
|
-
getItem(key) {
|
|
177
|
-
return this.items.get(key);
|
|
178
|
-
}
|
|
179
|
-
setItem(key, value) {
|
|
180
|
-
return this.items.set(key, value);
|
|
181
|
-
}
|
|
182
|
-
removeItem(key) {
|
|
183
|
-
return this.items.delete(key);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
export class APIClient {
|
|
187
|
-
constructor(instance) {
|
|
188
|
-
this.axios = void 0;
|
|
189
|
-
this.auth = void 0;
|
|
190
|
-
this.storage = void 0;
|
|
191
|
-
if (typeof instance === 'function') {
|
|
192
|
-
this.axios = instance;
|
|
193
|
-
} else {
|
|
194
|
-
const _ref = instance || {},
|
|
195
|
-
authClass = _ref.authClass,
|
|
196
|
-
storageClass = _ref.storageClass,
|
|
197
|
-
others = _objectWithoutProperties(_ref, _excluded);
|
|
198
|
-
this.axios = axios.create(others);
|
|
199
|
-
this.initStorage(storageClass);
|
|
200
|
-
if (authClass) {
|
|
201
|
-
this.auth = new authClass(this);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (!this.storage) {
|
|
205
|
-
this.initStorage();
|
|
206
|
-
}
|
|
207
|
-
if (!this.auth) {
|
|
208
|
-
this.auth = new Auth(this);
|
|
209
|
-
}
|
|
210
|
-
this.interceptors();
|
|
211
|
-
}
|
|
212
|
-
initStorage(storage) {
|
|
213
|
-
if (storage) {
|
|
214
|
-
this.storage = new storage(this);
|
|
215
|
-
} else if (typeof localStorage !== 'undefined') {
|
|
216
|
-
this.storage = localStorage;
|
|
217
|
-
} else {
|
|
218
|
-
this.storage = new MemoryStorage();
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
interceptors() {
|
|
222
|
-
this.axios.interceptors.request.use(config => {
|
|
223
|
-
config.paramsSerializer = params => {
|
|
224
|
-
return qs.stringify(params, {
|
|
225
|
-
strictNullHandling: true,
|
|
226
|
-
arrayFormat: 'brackets'
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
return config;
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
request(config) {
|
|
233
|
-
const resource = config.resource,
|
|
234
|
-
resourceOf = config.resourceOf,
|
|
235
|
-
action = config.action,
|
|
236
|
-
params = config.params;
|
|
237
|
-
if (resource) {
|
|
238
|
-
return this.resource(resource, resourceOf)[action](params);
|
|
239
|
-
}
|
|
240
|
-
return this.axios.request(config);
|
|
241
|
-
}
|
|
242
|
-
resource(name, of) {
|
|
243
|
-
var _this4 = this;
|
|
244
|
-
const target = {};
|
|
245
|
-
const handler = {
|
|
246
|
-
get: (_, actionName) => {
|
|
247
|
-
let url = name.split('.').join(`/${of || '_'}/`);
|
|
248
|
-
url += `:${actionName}`;
|
|
249
|
-
const config = {
|
|
250
|
-
url
|
|
251
|
-
};
|
|
252
|
-
if (['get', 'list'].includes(actionName)) {
|
|
253
|
-
config['method'] = 'get';
|
|
254
|
-
} else {
|
|
255
|
-
config['method'] = 'post';
|
|
256
|
-
}
|
|
257
|
-
return /*#__PURE__*/function () {
|
|
258
|
-
var _ref2 = _asyncToGenerator(function* (params, opts) {
|
|
259
|
-
const _ref3 = params || {},
|
|
260
|
-
values = _ref3.values,
|
|
261
|
-
filter = _ref3.filter,
|
|
262
|
-
others = _objectWithoutProperties(_ref3, _excluded2);
|
|
263
|
-
config['params'] = others;
|
|
264
|
-
if (filter) {
|
|
265
|
-
if (typeof filter === 'string') {
|
|
266
|
-
config['params']['filter'] = filter;
|
|
267
|
-
} else {
|
|
268
|
-
if (filter['*']) {
|
|
269
|
-
delete filter['*'];
|
|
270
|
-
}
|
|
271
|
-
config['params']['filter'] = JSON.stringify(filter);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (config.method !== 'get') {
|
|
275
|
-
config['data'] = values || {};
|
|
276
|
-
}
|
|
277
|
-
return yield _this4.request(_objectSpread(_objectSpread({}, config), opts));
|
|
278
|
-
});
|
|
279
|
-
return function (_x, _x2) {
|
|
280
|
-
return _ref2.apply(this, arguments);
|
|
281
|
-
};
|
|
282
|
-
}();
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
return new Proxy(target, handler);
|
|
286
|
-
}
|
|
287
|
-
}
|
package/es/getSubAppName.d.ts
DELETED
package/es/getSubAppName.js
DELETED
package/es/index.d.ts
DELETED
package/es/index.js
DELETED