@xata.io/client 0.0.0-beta.d4d1df0 → 0.0.0-beta.d4fe58e
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/schema/record.d.ts
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
import { Selectable } from './selection';
|
2
2
|
/**
|
3
|
-
* Represents
|
3
|
+
* Represents an identifiable record from the database.
|
4
4
|
*/
|
5
|
-
export interface
|
5
|
+
export interface Identifiable {
|
6
6
|
/**
|
7
7
|
* Unique id of this record.
|
8
8
|
*/
|
9
9
|
id: string;
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Represents a persisted record from the database.
|
13
|
+
*/
|
14
|
+
export interface XataRecord extends Identifiable {
|
10
15
|
/**
|
11
16
|
* Metadata of this record.
|
12
17
|
*/
|
@@ -76,10 +76,9 @@ class RestRepository extends Repository {
|
|
76
76
|
const fetchProps = yield __classPrivateFieldGet(this, _RestRepository_instances, "m", _RestRepository_getFetchProps).call(this);
|
77
77
|
const records = objects.map((object) => transformObjectLinks(object));
|
78
78
|
const response = yield (0, api_1.bulkInsertTableRecords)(Object.assign({ pathParams: { workspace: '{workspaceId}', dbBranchName: '{dbBranch}', tableName: __classPrivateFieldGet(this, _RestRepository_table, "f") }, body: { records } }, fetchProps));
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
throw new Error('The server failed to save the record');
|
79
|
+
const finalObjects = yield this.any(...response.recordIDs.map((id) => this.filter('id', id))).getMany();
|
80
|
+
if (finalObjects.length !== objects.length) {
|
81
|
+
throw new Error('The server failed to save some records');
|
83
82
|
}
|
84
83
|
return finalObjects;
|
85
84
|
});
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { XataRecord } from '..';
|
2
2
|
import { StringKeys, UnionToIntersection, Values } from '../util/types';
|
3
3
|
import { Query } from './query';
|
4
|
+
import { Identifiable } from './record';
|
4
5
|
declare type Queries<T> = {
|
5
6
|
[key in keyof T as T[key] extends Query<any> ? key : never]: T[key];
|
6
7
|
};
|
7
8
|
declare type InternalProperties = keyof XataRecord;
|
8
|
-
export declare type Selectable<T extends XataRecord> = Omit<T, InternalProperties
|
9
|
+
export declare type Selectable<T extends XataRecord> = Omit<T, InternalProperties> & Identifiable;
|
9
10
|
export declare type SelectableColumn<O> = '*' | (O extends Array<unknown> ? never : O extends Record<string, any> ? '*' | Values<{
|
10
11
|
[K in StringKeys<O>]: O[K] extends Record<string, any> ? `${K}.${SelectableColumn<O[K]>}` : K;
|
11
12
|
}> : '');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xata.io/client",
|
3
|
-
"version": "0.0.0-beta.
|
3
|
+
"version": "0.0.0-beta.d4fe58e",
|
4
4
|
"description": "Xata.io SDK for TypeScript and JavaScript",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -20,5 +20,5 @@
|
|
20
20
|
"url": "https://github.com/xataio/client-ts/issues"
|
21
21
|
},
|
22
22
|
"homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
|
23
|
-
"gitHead": "
|
23
|
+
"gitHead": "d4fe58ea450da82ce2cb04f661d5b5600c3d4991"
|
24
24
|
}
|