@sheet2db/sdk 1.0.8 → 2.0.0
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 +116 -264
- package/dist/index.d.mts +141 -0
- package/dist/index.d.ts +129 -116
- package/dist/index.js +125 -145
- package/dist/index.mjs +93 -0
- package/jest.config.js +2 -3
- package/package.json +21 -28
- package/src/index.test.ts +116 -0
- package/src/index.ts +45 -234
- package/tsconfig.json +103 -7
- package/tests/index.test.ts +0 -334
package/dist/index.d.ts
CHANGED
@@ -1,128 +1,141 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
35
|
-
|
36
|
-
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
data: Record<string, any
|
48
|
-
|
49
|
-
};
|
50
|
-
export type UpdateRowOptions = {
|
1
|
+
import { AxiosInstance } from 'axios';
|
2
|
+
import { z } from 'zod';
|
3
|
+
|
4
|
+
declare const DataAPIReadOptionsDTO: z.ZodObject<{
|
5
|
+
limit: z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>;
|
6
|
+
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodString>>, number, string | undefined>;
|
7
|
+
sortColumn: z.ZodOptional<z.ZodString>;
|
8
|
+
sortDirection: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
9
|
+
sortColumnFormat: z.ZodOptional<z.ZodLiteral<"date">>;
|
10
|
+
filter: z.ZodOptional<z.ZodString>;
|
11
|
+
format: z.ZodDefault<z.ZodOptional<z.ZodEnum<["rows", "columns", "matrix"]>>>;
|
12
|
+
columns: z.ZodEffects<z.ZodOptional<z.ZodString>, string[] | undefined, string | undefined>;
|
13
|
+
castNumbers: z.ZodEffects<z.ZodOptional<z.ZodString>, string[] | undefined, string | undefined>;
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
15
|
+
offset: number;
|
16
|
+
sortDirection: "asc" | "desc";
|
17
|
+
format: "rows" | "columns" | "matrix";
|
18
|
+
limit?: number | undefined;
|
19
|
+
filter?: string | undefined;
|
20
|
+
sortColumn?: string | undefined;
|
21
|
+
sortColumnFormat?: "date" | undefined;
|
22
|
+
columns?: string[] | undefined;
|
23
|
+
castNumbers?: string[] | undefined;
|
24
|
+
}, {
|
25
|
+
limit?: string | undefined;
|
26
|
+
filter?: string | undefined;
|
27
|
+
offset?: string | undefined;
|
28
|
+
sortColumn?: string | undefined;
|
29
|
+
sortDirection?: "asc" | "desc" | undefined;
|
30
|
+
sortColumnFormat?: "date" | undefined;
|
31
|
+
columns?: string | undefined;
|
32
|
+
format?: "rows" | "columns" | "matrix" | undefined;
|
33
|
+
castNumbers?: string | undefined;
|
34
|
+
}>;
|
35
|
+
declare const DataAPIInsertOptionsDTO: z.ZodObject<{
|
36
|
+
data: z.ZodArray<z.ZodAny, "many">;
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
38
|
+
data: any[];
|
39
|
+
}, {
|
40
|
+
data: any[];
|
41
|
+
}>;
|
42
|
+
declare const DataAPIUpdateOptionsDTO: z.ZodUnion<[z.ZodObject<{
|
43
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
44
|
+
row: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
45
|
+
type: z.ZodDefault<z.ZodLiteral<"row">>;
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
47
|
+
data: Record<string, any>;
|
48
|
+
type: "row";
|
51
49
|
row: number;
|
52
|
-
|
50
|
+
}, {
|
51
|
+
data: Record<string, any>;
|
52
|
+
row: string | number;
|
53
|
+
type?: "row" | undefined;
|
54
|
+
}>, z.ZodObject<{
|
55
|
+
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
56
|
+
filter: z.ZodString;
|
57
|
+
type: z.ZodDefault<z.ZodLiteral<"filter">>;
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
53
59
|
data: Record<string, any>;
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
query: string;
|
60
|
+
filter: string;
|
61
|
+
type: "filter";
|
62
|
+
}, {
|
58
63
|
data: Record<string, any>;
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}[];
|
66
|
-
};
|
67
|
-
export type DeleteRowOptions = {
|
68
|
-
sheet?: string;
|
64
|
+
filter: string;
|
65
|
+
type?: "filter" | undefined;
|
66
|
+
}>]>;
|
67
|
+
declare const DataAPIDeleteOptionsDTO: z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
68
|
+
row: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
69
70
|
row: number;
|
70
|
-
}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
71
|
+
}, {
|
72
|
+
row: string | number;
|
73
|
+
}>, {
|
74
|
+
row: number;
|
75
|
+
type: "row";
|
76
|
+
}, {
|
77
|
+
row: string | number;
|
78
|
+
}>, z.ZodObject<{
|
79
|
+
filter: z.ZodString;
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
81
|
+
filter: string;
|
82
|
+
}, {
|
83
|
+
filter: string;
|
84
|
+
}>]>, {
|
85
|
+
row: number;
|
86
|
+
type: "row";
|
87
|
+
} | {
|
88
|
+
filter: string;
|
89
|
+
type: "filter";
|
90
|
+
}, {
|
91
|
+
row: string | number;
|
92
|
+
} | {
|
93
|
+
filter: string;
|
94
|
+
}>;
|
95
|
+
declare const DataAPIAddSheetOptionsDTO: z.ZodObject<{
|
96
|
+
name: z.ZodString;
|
97
|
+
firstRow: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
98
|
+
copyColumnsFrom: z.ZodOptional<z.ZodString>;
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
100
|
+
name: string;
|
101
|
+
firstRow?: string[] | undefined;
|
102
|
+
copyColumnsFrom?: string | undefined;
|
103
|
+
}, {
|
104
|
+
name: string;
|
105
|
+
firstRow?: string[] | undefined;
|
106
|
+
copyColumnsFrom?: string | undefined;
|
107
|
+
}>;
|
108
|
+
|
109
|
+
type ReadOptions = z.infer<typeof DataAPIReadOptionsDTO>;
|
110
|
+
type InsertOptions = z.infer<typeof DataAPIInsertOptionsDTO>;
|
111
|
+
type UpdateOptions = z.infer<typeof DataAPIUpdateOptionsDTO>;
|
112
|
+
type DeleteOptions = z.infer<typeof DataAPIDeleteOptionsDTO>;
|
113
|
+
type AddSheetOptions = z.infer<typeof DataAPIAddSheetOptionsDTO>;
|
114
|
+
|
115
|
+
declare class Sheet2DBClient {
|
116
|
+
authentication: string | null;
|
117
|
+
axios: AxiosInstance;
|
118
|
+
constructor(apiId: string, version?: "v1");
|
119
|
+
private endpoint;
|
120
|
+
useBasicAuthentication(username: string, password: string): void;
|
121
|
+
useJWTAuthentication(token: string): void;
|
122
|
+
useBearerTokenAuthentication(token: string): void;
|
123
|
+
Read<T = any>(options: ReadOptions, sheet?: string): Promise<T>;
|
124
|
+
Update(options: UpdateOptions, sheet?: string): Promise<{
|
111
125
|
updated: number;
|
112
126
|
}>;
|
113
|
-
|
114
|
-
|
127
|
+
Insert(options: InsertOptions, sheet?: string): Promise<{
|
128
|
+
inserted: number;
|
115
129
|
}>;
|
116
|
-
|
130
|
+
Delete(options: DeleteOptions, sheet?: string): Promise<{
|
117
131
|
deleted: number;
|
118
132
|
}>;
|
119
|
-
|
120
|
-
|
121
|
-
}>;
|
122
|
-
CreateSheet(options: CreateSheetOptions): Promise<{
|
123
|
-
success: boolean;
|
133
|
+
AddSheet(options: AddSheetOptions): Promise<{
|
134
|
+
ok: true;
|
124
135
|
}>;
|
125
|
-
DeleteSheet(
|
126
|
-
|
136
|
+
DeleteSheet(sheet: string): Promise<{
|
137
|
+
ok: true;
|
127
138
|
}>;
|
128
139
|
}
|
140
|
+
|
141
|
+
export { Sheet2DBClient };
|
package/dist/index.js
CHANGED
@@ -1,147 +1,127 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
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 __async = (__this, __arguments, generator) => {
|
30
|
+
return new Promise((resolve, reject) => {
|
31
|
+
var fulfilled = (value) => {
|
32
|
+
try {
|
33
|
+
step(generator.next(value));
|
34
|
+
} catch (e) {
|
35
|
+
reject(e);
|
36
|
+
}
|
14
37
|
};
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
}
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
UpdateWithQuery(options) {
|
106
|
-
const { sheet, data, query } = options;
|
107
|
-
let path = '';
|
108
|
-
if (sheet) {
|
109
|
-
path = `/${sheet}`;
|
110
|
-
}
|
111
|
-
return this.fetch(path, "PATCH", encodeURIComponent(query), data);
|
112
|
-
}
|
113
|
-
BatchUpdate(options) {
|
114
|
-
const { batches, sheet } = options;
|
115
|
-
let path = '/batch';
|
116
|
-
if (sheet) {
|
117
|
-
path = path + '/' + sheet;
|
118
|
-
}
|
119
|
-
return this.fetch(path, "PATCH", undefined, batches);
|
120
|
-
}
|
121
|
-
DeleteRow(options) {
|
122
|
-
const { row, ...queryParams } = options;
|
123
|
-
const query = new URLSearchParams(queryParams);
|
124
|
-
return this.fetch(`/row/${row}`, "DELETE", query);
|
125
|
-
}
|
126
|
-
DeleteWithQuery(options) {
|
127
|
-
const { query, sheet } = options;
|
128
|
-
let path = '';
|
129
|
-
if (sheet) {
|
130
|
-
path = `/${sheet}`;
|
131
|
-
}
|
132
|
-
return this.fetch(path, "DELETE", encodeURIComponent(query));
|
133
|
-
}
|
134
|
-
Clear(options) {
|
135
|
-
const path = `/clear/${options.sheet}`;
|
136
|
-
return this.fetch(path, "DELETE");
|
137
|
-
}
|
138
|
-
CreateSheet(options) {
|
139
|
-
const query = new URLSearchParams(options);
|
140
|
-
return this.fetch('/sheet', "POST", query);
|
141
|
-
}
|
142
|
-
DeleteSheet(options) {
|
143
|
-
const path = `/sheet/${options.sheet}`;
|
144
|
-
return this.fetch(path, "DELETE");
|
145
|
-
}
|
146
|
-
}
|
147
|
-
exports.Sheet2DB = Sheet2DB;
|
38
|
+
var rejected = (value) => {
|
39
|
+
try {
|
40
|
+
step(generator.throw(value));
|
41
|
+
} catch (e) {
|
42
|
+
reject(e);
|
43
|
+
}
|
44
|
+
};
|
45
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
46
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
47
|
+
});
|
48
|
+
};
|
49
|
+
|
50
|
+
// src/index.ts
|
51
|
+
var index_exports = {};
|
52
|
+
__export(index_exports, {
|
53
|
+
Sheet2DBClient: () => Sheet2DBClient
|
54
|
+
});
|
55
|
+
module.exports = __toCommonJS(index_exports);
|
56
|
+
var import_axios = __toESM(require("axios"));
|
57
|
+
var isNode = typeof window == "undefined";
|
58
|
+
var Sheet2DBClient = class {
|
59
|
+
constructor(apiId, version = "v1") {
|
60
|
+
this.authentication = null;
|
61
|
+
if (!(apiId == null ? void 0 : apiId.trim())) throw new Error("apiId is required to create a Sheet2DBClient.");
|
62
|
+
this.axios = import_axios.default.create({
|
63
|
+
baseURL: process.env.SHEET2DB_BASE_URL || "https://api.sheet2db.io/" + version + "/data/" + apiId,
|
64
|
+
paramsSerializer: {
|
65
|
+
serialize: (params) => new URLSearchParams(params).toString()
|
66
|
+
}
|
67
|
+
});
|
68
|
+
this.axios.interceptors.request.use((config) => {
|
69
|
+
if (this.authentication) {
|
70
|
+
config.headers.Authorization = this.authentication;
|
71
|
+
}
|
72
|
+
return config;
|
73
|
+
});
|
74
|
+
}
|
75
|
+
endpoint(sheet) {
|
76
|
+
return sheet ? `/${sheet}` : "/";
|
77
|
+
}
|
78
|
+
useBasicAuthentication(username, password) {
|
79
|
+
const token = isNode ? Buffer.from(`${username}:${password}`).toString("base64") : btoa(`${username}:${password}`);
|
80
|
+
this.authentication = `Basic ${token}`;
|
81
|
+
}
|
82
|
+
useJWTAuthentication(token) {
|
83
|
+
this.authentication = "Bearer " + token;
|
84
|
+
}
|
85
|
+
useBearerTokenAuthentication(token) {
|
86
|
+
this.authentication = "Bearer " + token;
|
87
|
+
}
|
88
|
+
Read(options, sheet) {
|
89
|
+
return __async(this, null, function* () {
|
90
|
+
return this.axios.get(this.endpoint(sheet), {
|
91
|
+
params: options
|
92
|
+
}).then((res) => res.data);
|
93
|
+
});
|
94
|
+
}
|
95
|
+
Update(options, sheet) {
|
96
|
+
return __async(this, null, function* () {
|
97
|
+
return this.axios.patch(this.endpoint(sheet), options).then((res) => res.data);
|
98
|
+
});
|
99
|
+
}
|
100
|
+
Insert(options, sheet) {
|
101
|
+
return __async(this, null, function* () {
|
102
|
+
return this.axios.post(this.endpoint(sheet), options).then((res) => res.data);
|
103
|
+
});
|
104
|
+
}
|
105
|
+
Delete(options, sheet) {
|
106
|
+
return __async(this, null, function* () {
|
107
|
+
return this.axios.delete(this.endpoint(sheet), {
|
108
|
+
params: options
|
109
|
+
}).then((res) => res.data);
|
110
|
+
});
|
111
|
+
}
|
112
|
+
AddSheet(options) {
|
113
|
+
return __async(this, null, function* () {
|
114
|
+
return this.axios.post("/sheet", options).then((res) => res.data);
|
115
|
+
});
|
116
|
+
}
|
117
|
+
DeleteSheet(sheet) {
|
118
|
+
return __async(this, null, function* () {
|
119
|
+
if (!sheet) throw new Error("sheet is required to Delete Sheet");
|
120
|
+
return this.axios.delete(this.endpoint(sheet)).then((res) => res.data);
|
121
|
+
});
|
122
|
+
}
|
123
|
+
};
|
124
|
+
// Annotate the CommonJS export names for ESM import in node:
|
125
|
+
0 && (module.exports = {
|
126
|
+
Sheet2DBClient
|
127
|
+
});
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
2
|
+
return new Promise((resolve, reject) => {
|
3
|
+
var fulfilled = (value) => {
|
4
|
+
try {
|
5
|
+
step(generator.next(value));
|
6
|
+
} catch (e) {
|
7
|
+
reject(e);
|
8
|
+
}
|
9
|
+
};
|
10
|
+
var rejected = (value) => {
|
11
|
+
try {
|
12
|
+
step(generator.throw(value));
|
13
|
+
} catch (e) {
|
14
|
+
reject(e);
|
15
|
+
}
|
16
|
+
};
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
19
|
+
});
|
20
|
+
};
|
21
|
+
|
22
|
+
// src/index.ts
|
23
|
+
import axios from "axios";
|
24
|
+
var isNode = typeof window == "undefined";
|
25
|
+
var Sheet2DBClient = class {
|
26
|
+
constructor(apiId, version = "v1") {
|
27
|
+
this.authentication = null;
|
28
|
+
if (!(apiId == null ? void 0 : apiId.trim())) throw new Error("apiId is required to create a Sheet2DBClient.");
|
29
|
+
this.axios = axios.create({
|
30
|
+
baseURL: process.env.SHEET2DB_BASE_URL || "https://api.sheet2db.io/" + version + "/data/" + apiId,
|
31
|
+
paramsSerializer: {
|
32
|
+
serialize: (params) => new URLSearchParams(params).toString()
|
33
|
+
}
|
34
|
+
});
|
35
|
+
this.axios.interceptors.request.use((config) => {
|
36
|
+
if (this.authentication) {
|
37
|
+
config.headers.Authorization = this.authentication;
|
38
|
+
}
|
39
|
+
return config;
|
40
|
+
});
|
41
|
+
}
|
42
|
+
endpoint(sheet) {
|
43
|
+
return sheet ? `/${sheet}` : "/";
|
44
|
+
}
|
45
|
+
useBasicAuthentication(username, password) {
|
46
|
+
const token = isNode ? Buffer.from(`${username}:${password}`).toString("base64") : btoa(`${username}:${password}`);
|
47
|
+
this.authentication = `Basic ${token}`;
|
48
|
+
}
|
49
|
+
useJWTAuthentication(token) {
|
50
|
+
this.authentication = "Bearer " + token;
|
51
|
+
}
|
52
|
+
useBearerTokenAuthentication(token) {
|
53
|
+
this.authentication = "Bearer " + token;
|
54
|
+
}
|
55
|
+
Read(options, sheet) {
|
56
|
+
return __async(this, null, function* () {
|
57
|
+
return this.axios.get(this.endpoint(sheet), {
|
58
|
+
params: options
|
59
|
+
}).then((res) => res.data);
|
60
|
+
});
|
61
|
+
}
|
62
|
+
Update(options, sheet) {
|
63
|
+
return __async(this, null, function* () {
|
64
|
+
return this.axios.patch(this.endpoint(sheet), options).then((res) => res.data);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
Insert(options, sheet) {
|
68
|
+
return __async(this, null, function* () {
|
69
|
+
return this.axios.post(this.endpoint(sheet), options).then((res) => res.data);
|
70
|
+
});
|
71
|
+
}
|
72
|
+
Delete(options, sheet) {
|
73
|
+
return __async(this, null, function* () {
|
74
|
+
return this.axios.delete(this.endpoint(sheet), {
|
75
|
+
params: options
|
76
|
+
}).then((res) => res.data);
|
77
|
+
});
|
78
|
+
}
|
79
|
+
AddSheet(options) {
|
80
|
+
return __async(this, null, function* () {
|
81
|
+
return this.axios.post("/sheet", options).then((res) => res.data);
|
82
|
+
});
|
83
|
+
}
|
84
|
+
DeleteSheet(sheet) {
|
85
|
+
return __async(this, null, function* () {
|
86
|
+
if (!sheet) throw new Error("sheet is required to Delete Sheet");
|
87
|
+
return this.axios.delete(this.endpoint(sheet)).then((res) => res.data);
|
88
|
+
});
|
89
|
+
}
|
90
|
+
};
|
91
|
+
export {
|
92
|
+
Sheet2DBClient
|
93
|
+
};
|
package/jest.config.js
CHANGED