@xata.io/client 0.0.0-alpha.ve441614 → 0.0.0-alpha.ve4c82ef
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 +18 -0
- package/dist/index.cjs +124 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +131 -5
- package/dist/index.mjs +102 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @xata.io/client
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#409](https://github.com/xataio/client-ts/pull/409) [`8812380`](https://github.com/xataio/client-ts/commit/881238062b5eeac2dc8b9ba156720e0acc22c5c5) Thanks [@SferaDev](https://github.com/SferaDev)! - Infer types from schema in codegen
|
|
8
|
+
|
|
9
|
+
* [#457](https://github.com/xataio/client-ts/pull/457) [`0584a5b`](https://github.com/xataio/client-ts/commit/0584a5b207a21dbc36ddc1d44b276f1d5bb60dc5) Thanks [@SferaDev](https://github.com/SferaDev)! - Load env variables so that code analysis detects them
|
|
10
|
+
|
|
11
|
+
- [#469](https://github.com/xataio/client-ts/pull/469) [`8d8a912`](https://github.com/xataio/client-ts/commit/8d8a9129e36452266c4c12fe35b421f66e572498) Thanks [@gimenete](https://github.com/gimenete)! - Treat branch name specified with third party env variables as git branches in the resolution algorithm
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#462](https://github.com/xataio/client-ts/pull/462) [`7547b7e`](https://github.com/xataio/client-ts/commit/7547b7edbc9a95c6620784cc5348316f27502c73) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix bug with RecordArray.map
|
|
16
|
+
|
|
17
|
+
* [#472](https://github.com/xataio/client-ts/pull/472) [`e99010c`](https://github.com/xataio/client-ts/commit/e99010c9ab9d355abadcfbcf98b5a3fcc80c307a) Thanks [@SferaDev](https://github.com/SferaDev)! - Add id as entity property
|
|
18
|
+
|
|
19
|
+
- [#443](https://github.com/xataio/client-ts/pull/443) [`c4be404`](https://github.com/xataio/client-ts/commit/c4be404a3ecb34df9b1ef4501c92f5bdc221f19c) Thanks [@SferaDev](https://github.com/SferaDev)! - Improve performance with `create([])` operation
|
|
20
|
+
|
|
3
21
|
## 0.13.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n["default"] = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
function notEmpty(value) {
|
|
6
24
|
return value !== null && value !== void 0;
|
|
7
25
|
}
|
|
@@ -88,20 +106,21 @@ function getGlobalFallbackBranch() {
|
|
|
88
106
|
}
|
|
89
107
|
}
|
|
90
108
|
async function getGitBranch() {
|
|
109
|
+
const cmd = ["git", "branch", "--show-current"];
|
|
110
|
+
const fullCmd = cmd.join(" ");
|
|
111
|
+
const nodeModule = ["child", "process"].join("_");
|
|
112
|
+
const execOptions = { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] };
|
|
91
113
|
try {
|
|
92
114
|
if (typeof require === "function") {
|
|
93
|
-
|
|
94
|
-
return req("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
115
|
+
return require(nodeModule).execSync(fullCmd, execOptions).trim();
|
|
95
116
|
}
|
|
117
|
+
const { execSync } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(nodeModule);
|
|
118
|
+
return execSync(fullCmd, execOptions).toString().trim();
|
|
96
119
|
} catch (err) {
|
|
97
120
|
}
|
|
98
121
|
try {
|
|
99
122
|
if (isObject(Deno)) {
|
|
100
|
-
const process2 = Deno.run({
|
|
101
|
-
cmd: ["git", "branch", "--show-current"],
|
|
102
|
-
stdout: "piped",
|
|
103
|
-
stderr: "piped"
|
|
104
|
-
});
|
|
123
|
+
const process2 = Deno.run({ cmd, stdout: "piped", stderr: "null" });
|
|
105
124
|
return new TextDecoder().decode(await process2.output()).trim();
|
|
106
125
|
}
|
|
107
126
|
} catch (err) {
|
|
@@ -126,7 +145,7 @@ function getFetchImplementation(userFetch) {
|
|
|
126
145
|
return fetchImpl;
|
|
127
146
|
}
|
|
128
147
|
|
|
129
|
-
const VERSION = "0.0.0-alpha.
|
|
148
|
+
const VERSION = "0.0.0-alpha.ve4c82ef";
|
|
130
149
|
|
|
131
150
|
class ErrorWithCause extends Error {
|
|
132
151
|
constructor(message, options) {
|
|
@@ -291,6 +310,7 @@ const removeWorkspaceMember = (variables) => fetch$1({
|
|
|
291
310
|
...variables
|
|
292
311
|
});
|
|
293
312
|
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
|
313
|
+
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
|
294
314
|
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
|
295
315
|
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
|
296
316
|
method: "delete",
|
|
@@ -463,6 +483,7 @@ const operationsByTag = {
|
|
|
463
483
|
updateWorkspaceMemberRole,
|
|
464
484
|
removeWorkspaceMember,
|
|
465
485
|
inviteWorkspaceMember,
|
|
486
|
+
updateWorkspaceMemberInvite,
|
|
466
487
|
cancelWorkspaceMemberInvite,
|
|
467
488
|
resendWorkspaceMemberInvite,
|
|
468
489
|
acceptWorkspaceMemberInvite
|
|
@@ -694,6 +715,13 @@ class WorkspaceApi {
|
|
|
694
715
|
...this.extraProps
|
|
695
716
|
});
|
|
696
717
|
}
|
|
718
|
+
updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
|
|
719
|
+
return operationsByTag.workspaces.updateWorkspaceMemberInvite({
|
|
720
|
+
pathParams: { workspaceId, inviteId },
|
|
721
|
+
body: { role },
|
|
722
|
+
...this.extraProps
|
|
723
|
+
});
|
|
724
|
+
}
|
|
697
725
|
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
|
698
726
|
return operationsByTag.workspaces.cancelWorkspaceMemberInvite({
|
|
699
727
|
pathParams: { workspaceId, inviteId },
|
|
@@ -1808,7 +1836,7 @@ class SchemaPlugin extends XataPlugin {
|
|
|
1808
1836
|
if (!isString(table))
|
|
1809
1837
|
throw new Error("Invalid table name");
|
|
1810
1838
|
if (__privateGet$2(this, _tables)[table] === void 0) {
|
|
1811
|
-
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table });
|
|
1839
|
+
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
|
1812
1840
|
}
|
|
1813
1841
|
return __privateGet$2(this, _tables)[table];
|
|
1814
1842
|
}
|
|
@@ -2077,6 +2105,88 @@ const buildClient = (plugins) => {
|
|
|
2077
2105
|
class BaseClient extends buildClient() {
|
|
2078
2106
|
}
|
|
2079
2107
|
|
|
2108
|
+
const META = "__";
|
|
2109
|
+
const VALUE = "___";
|
|
2110
|
+
class Serializer {
|
|
2111
|
+
constructor() {
|
|
2112
|
+
this.classes = {};
|
|
2113
|
+
}
|
|
2114
|
+
add(clazz) {
|
|
2115
|
+
this.classes[clazz.name] = clazz;
|
|
2116
|
+
}
|
|
2117
|
+
toJSON(data) {
|
|
2118
|
+
function visit(obj) {
|
|
2119
|
+
if (Array.isArray(obj))
|
|
2120
|
+
return obj.map(visit);
|
|
2121
|
+
const type = typeof obj;
|
|
2122
|
+
if (type === "undefined")
|
|
2123
|
+
return { [META]: "undefined" };
|
|
2124
|
+
if (type === "bigint")
|
|
2125
|
+
return { [META]: "bigint", [VALUE]: obj.toString() };
|
|
2126
|
+
if (obj === null || type !== "object")
|
|
2127
|
+
return obj;
|
|
2128
|
+
const constructor = obj.constructor;
|
|
2129
|
+
const o = { [META]: constructor.name };
|
|
2130
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2131
|
+
o[key] = visit(value);
|
|
2132
|
+
}
|
|
2133
|
+
if (constructor === Date)
|
|
2134
|
+
o[VALUE] = obj.toISOString();
|
|
2135
|
+
if (constructor === Map)
|
|
2136
|
+
o[VALUE] = Object.fromEntries(obj);
|
|
2137
|
+
if (constructor === Set)
|
|
2138
|
+
o[VALUE] = [...obj];
|
|
2139
|
+
return o;
|
|
2140
|
+
}
|
|
2141
|
+
return JSON.stringify(visit(data));
|
|
2142
|
+
}
|
|
2143
|
+
fromJSON(json) {
|
|
2144
|
+
return JSON.parse(json, (key, value) => {
|
|
2145
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2146
|
+
const { [META]: clazz, [VALUE]: val, ...rest } = value;
|
|
2147
|
+
const constructor = this.classes[clazz];
|
|
2148
|
+
if (constructor) {
|
|
2149
|
+
return Object.assign(Object.create(constructor.prototype), rest);
|
|
2150
|
+
}
|
|
2151
|
+
if (clazz === "Date")
|
|
2152
|
+
return new Date(val);
|
|
2153
|
+
if (clazz === "Set")
|
|
2154
|
+
return new Set(val);
|
|
2155
|
+
if (clazz === "Map")
|
|
2156
|
+
return new Map(Object.entries(val));
|
|
2157
|
+
if (clazz === "bigint")
|
|
2158
|
+
return BigInt(val);
|
|
2159
|
+
if (clazz === "undefined")
|
|
2160
|
+
return void 0;
|
|
2161
|
+
return rest;
|
|
2162
|
+
}
|
|
2163
|
+
return value;
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
const serialize = () => {
|
|
2168
|
+
throw new Error("Not implemented");
|
|
2169
|
+
};
|
|
2170
|
+
const deserialize = () => {
|
|
2171
|
+
throw new Error("Not implemented");
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
function buildWorkerRunner(config) {
|
|
2175
|
+
return function xataWorker(name, _worker) {
|
|
2176
|
+
return async (...args) => {
|
|
2177
|
+
const result = await fetch("http://localhost:64749", {
|
|
2178
|
+
method: "POST",
|
|
2179
|
+
headers: { "Content-Type": "application/json" },
|
|
2180
|
+
body: JSON.stringify({
|
|
2181
|
+
name,
|
|
2182
|
+
payload: args
|
|
2183
|
+
})
|
|
2184
|
+
});
|
|
2185
|
+
return result.json();
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2080
2190
|
class XataError extends Error {
|
|
2081
2191
|
constructor(message, status) {
|
|
2082
2192
|
super(message);
|
|
@@ -2097,6 +2207,7 @@ exports.Repository = Repository;
|
|
|
2097
2207
|
exports.RestRepository = RestRepository;
|
|
2098
2208
|
exports.SchemaPlugin = SchemaPlugin;
|
|
2099
2209
|
exports.SearchPlugin = SearchPlugin;
|
|
2210
|
+
exports.Serializer = Serializer;
|
|
2100
2211
|
exports.SimpleCache = SimpleCache;
|
|
2101
2212
|
exports.XataApiClient = XataApiClient;
|
|
2102
2213
|
exports.XataApiPlugin = XataApiPlugin;
|
|
@@ -2106,6 +2217,7 @@ exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
|
|
2106
2217
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
|
2107
2218
|
exports.addTableColumn = addTableColumn;
|
|
2108
2219
|
exports.buildClient = buildClient;
|
|
2220
|
+
exports.buildWorkerRunner = buildWorkerRunner;
|
|
2109
2221
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
2110
2222
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
|
2111
2223
|
exports.contains = contains;
|
|
@@ -2122,6 +2234,7 @@ exports.deleteTable = deleteTable;
|
|
|
2122
2234
|
exports.deleteUser = deleteUser;
|
|
2123
2235
|
exports.deleteUserAPIKey = deleteUserAPIKey;
|
|
2124
2236
|
exports.deleteWorkspace = deleteWorkspace;
|
|
2237
|
+
exports.deserialize = deserialize;
|
|
2125
2238
|
exports.endsWith = endsWith;
|
|
2126
2239
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
|
2127
2240
|
exports.exists = exists;
|
|
@@ -2174,6 +2287,7 @@ exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
|
|
2174
2287
|
exports.resolveBranch = resolveBranch;
|
|
2175
2288
|
exports.searchBranch = searchBranch;
|
|
2176
2289
|
exports.searchTable = searchTable;
|
|
2290
|
+
exports.serialize = serialize;
|
|
2177
2291
|
exports.setTableSchema = setTableSchema;
|
|
2178
2292
|
exports.startsWith = startsWith;
|
|
2179
2293
|
exports.updateBranchMetadata = updateBranchMetadata;
|
|
@@ -2182,6 +2296,7 @@ exports.updateRecordWithID = updateRecordWithID;
|
|
|
2182
2296
|
exports.updateTable = updateTable;
|
|
2183
2297
|
exports.updateUser = updateUser;
|
|
2184
2298
|
exports.updateWorkspace = updateWorkspace;
|
|
2299
|
+
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
|
2185
2300
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
|
2186
2301
|
exports.upsertRecordWithID = upsertRecordWithID;
|
|
2187
2302
|
//# sourceMappingURL=index.cjs.map
|