@xata.io/client 0.8.1 → 0.8.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3d81e7a: Make db model references stable
8
+
3
9
  ## 0.8.1
4
10
 
5
11
  ### Patch Changes
@@ -17,6 +17,7 @@ export declare type SchemaPluginResult<Schemas extends Record<string, BaseData>>
17
17
  [Key in keyof Schemas]: Repository<Schemas[Key]>;
18
18
  };
19
19
  export declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
20
+ #private;
20
21
  private links?;
21
22
  constructor(links?: LinkDictionary | undefined);
22
23
  build(options: XataPluginOptions): SchemaPluginResult<Schemas>;
@@ -13,6 +13,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
+ };
21
+ var _SchemaPlugin_tables;
16
22
  Object.defineProperty(exports, "__esModule", { value: true });
17
23
  exports.SchemaPlugin = exports.RestRepository = exports.Repository = exports.isXataRecord = exports.isIdentifiable = exports.Query = void 0;
18
24
  const plugins_1 = require("../plugins");
@@ -33,6 +39,7 @@ class SchemaPlugin extends plugins_1.XataPlugin {
33
39
  constructor(links) {
34
40
  super();
35
41
  this.links = links;
42
+ _SchemaPlugin_tables.set(this, {});
36
43
  }
37
44
  build(options) {
38
45
  const { getFetchProps } = options;
@@ -41,10 +48,13 @@ class SchemaPlugin extends plugins_1.XataPlugin {
41
48
  get: (_target, table) => {
42
49
  if (!(0, lang_1.isString)(table))
43
50
  throw new Error('Invalid table name');
44
- return new repository_1.RestRepository({ db, getFetchProps, table, links });
51
+ if (!__classPrivateFieldGet(this, _SchemaPlugin_tables, "f")[table])
52
+ __classPrivateFieldGet(this, _SchemaPlugin_tables, "f")[table] = new repository_1.RestRepository({ db, getFetchProps, table, links });
53
+ return __classPrivateFieldGet(this, _SchemaPlugin_tables, "f")[table];
45
54
  }
46
55
  });
47
56
  return db;
48
57
  }
49
58
  }
50
59
  exports.SchemaPlugin = SchemaPlugin;
60
+ _SchemaPlugin_tables = new WeakMap();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xata.io/client",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Xata.io SDK for TypeScript and JavaScript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -23,5 +23,5 @@
23
23
  "url": "https://github.com/xataio/client-ts/issues"
24
24
  },
25
25
  "homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
26
- "gitHead": "e0277aa65a86bd878e236c28677bab8aeff9a051"
26
+ "gitHead": "af614392d9eac48c72ae01598f11689f409778df"
27
27
  }