tinacms 0.0.0-9d5e351-20241023053720 → 0.0.0-a4a2eeb-20250102014725

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.
@@ -25,6 +25,9 @@ export interface DocumentNode {
25
25
  }
26
26
  export interface DocumentForm {
27
27
  _values: Object;
28
+ _sys?: {
29
+ hasReferences?: boolean;
30
+ };
28
31
  }
29
32
  export interface DocumentSys {
30
33
  _sys: {
@@ -1,2 +1,3 @@
1
1
  import type { Cache } from './index';
2
+ export declare const makeCacheDir: (dir: string, fs: any, path: any, os: any) => Promise<string>;
2
3
  export declare const NodeCache: (dir: string) => Promise<Cache>;
package/dist/client.js CHANGED
@@ -1,10 +1,7 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
- })(this, function(exports2, fetchPonyfill) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
3
+ })(this, function(exports2) {
4
4
  "use strict";
5
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
6
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
7
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
8
5
  const TINA_HOST = "content.tinajs.io";
9
6
  class TinaClient {
10
7
  constructor({
@@ -39,7 +36,7 @@
39
36
  var _a;
40
37
  await this.init();
41
38
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
42
- const headers = new HeadersDefined();
39
+ const headers = new Headers();
43
40
  if (this.readonlyToken) {
44
41
  headers.append("X-API-KEY", this.readonlyToken);
45
42
  }
@@ -72,7 +69,7 @@
72
69
  return value;
73
70
  }
74
71
  }
75
- const res = await fetchDefined(url, optionsObject);
72
+ const res = await fetch(url, optionsObject);
76
73
  if (!res.ok) {
77
74
  let additionalInfo = "";
78
75
  if (res.status === 401) {
@@ -105,16 +102,12 @@
105
102
  const client = new TinaClient(args);
106
103
  return client;
107
104
  }
108
- const makeCacheDir = async (dir, fs) => {
109
- const path = await Promise.resolve().then(() => __viteBrowserExternal$1);
110
- const os = await Promise.resolve().then(() => __viteBrowserExternal$1);
111
- if (typeof dir !== "string" || !dir.trim()) {
112
- throw new Error("Invalid directory path");
113
- }
114
- const pathParts = dir.split(path.sep);
105
+ const makeCacheDir = async (dir, fs, path, os) => {
106
+ const pathParts = dir.split(path.sep).filter(Boolean);
115
107
  const cacheHash = pathParts[pathParts.length - 1];
108
+ const rootUser = pathParts[0];
116
109
  let cacheDir = dir;
117
- if (!fs.existsSync(dir)) {
110
+ if (!fs.existsSync(path.join(path.sep, rootUser))) {
118
111
  cacheDir = path.join(os.tmpdir(), cacheHash);
119
112
  }
120
113
  try {
@@ -125,10 +118,11 @@
125
118
  return cacheDir;
126
119
  };
127
120
  const NodeCache = async (dir) => {
128
- const fs = (await Promise.resolve().then(() => __viteBrowserExternal$1)).default;
129
- console.log("fs", JSON.stringify(fs));
130
- const { createHash } = await Promise.resolve().then(() => __viteBrowserExternal$1);
131
- const cacheDir = await makeCacheDir(dir, fs);
121
+ const fs = require("node:fs");
122
+ const path = require("node:path");
123
+ const os = require("node:os");
124
+ const { createHash } = require("node:crypto");
125
+ const cacheDir = await makeCacheDir(dir, fs, path, os);
132
126
  return {
133
127
  makeKey: (key) => {
134
128
  const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
@@ -156,12 +150,8 @@
156
150
  };
157
151
  const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
158
152
  __proto__: null,
159
- NodeCache
160
- }, Symbol.toStringTag, { value: "Module" }));
161
- const __viteBrowserExternal = {};
162
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
163
- __proto__: null,
164
- default: __viteBrowserExternal
153
+ NodeCache,
154
+ makeCacheDir
165
155
  }, Symbol.toStringTag, { value: "Module" }));
166
156
  exports2.TINA_HOST = TINA_HOST;
167
157
  exports2.TinaClient = TinaClient;
package/dist/client.mjs CHANGED
@@ -1,7 +1,3 @@
1
- import fetchPonyfill from "fetch-ponyfill";
2
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
3
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
5
1
  const TINA_HOST = "content.tinajs.io";
6
2
  class TinaClient {
7
3
  constructor({
@@ -24,7 +20,7 @@ class TinaClient {
24
20
  }
25
21
  try {
26
22
  if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
27
- const { NodeCache } = await import("./node-cache-8f9e873e.mjs");
23
+ const { NodeCache } = await import("./node-cache-4c336858.mjs");
28
24
  this.cache = await NodeCache(this.cacheDir);
29
25
  }
30
26
  } catch (e) {
@@ -36,7 +32,7 @@ class TinaClient {
36
32
  var _a;
37
33
  await this.init();
38
34
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
39
- const headers = new HeadersDefined();
35
+ const headers = new Headers();
40
36
  if (this.readonlyToken) {
41
37
  headers.append("X-API-KEY", this.readonlyToken);
42
38
  }
@@ -69,7 +65,7 @@ class TinaClient {
69
65
  return value;
70
66
  }
71
67
  }
72
- const res = await fetchDefined(url, optionsObject);
68
+ const res = await fetch(url, optionsObject);
73
69
  if (!res.ok) {
74
70
  let additionalInfo = "";
75
71
  if (res.status === 401) {
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ export type TinaCollection = Collection;
53
53
  export type TinaCloudSchema = Schema;
54
54
  export declare const defineSchema: (config: Schema) => Schema<false>;
55
55
  export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, "children">) => Omit<TinaCMSProviderDefaultProps, "children">;
56
- interface MediaStoreClass {
56
+ export interface MediaStoreClass {
57
57
  new (...args: any[]): MediaStore;
58
58
  }
59
59
  export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, DocumentCreatorCallback, MediaStoreClass>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;