@tinacms/schema-tools 1.0.0 → 1.0.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/dist/index.es.js CHANGED
@@ -793,7 +793,7 @@ const TinaCloudSchemaZod = z.object({
793
793
  collections: z.array(TinaCloudCollection),
794
794
  config: tinaConfigZod.optional()
795
795
  }).superRefine((val, ctx) => {
796
- var _a, _b, _c;
796
+ var _a, _b;
797
797
  const dups = findDuplicates((_a = val.collections) == null ? void 0 : _a.map((x) => x.name));
798
798
  if (dups) {
799
799
  ctx.addIssue({
@@ -802,12 +802,7 @@ const TinaCloudSchemaZod = z.object({
802
802
  fatal: true
803
803
  });
804
804
  }
805
- (_b = val == null ? void 0 : val.collections) == null ? void 0 : _b.map((x) => {
806
- if (!x.format) {
807
- console.warn(`No format provided for collection ${x.name}, defaulting to .md`);
808
- }
809
- });
810
- const media = (_c = val == null ? void 0 : val.config) == null ? void 0 : _c.media;
805
+ const media = (_b = val == null ? void 0 : val.config) == null ? void 0 : _b.media;
811
806
  if (media && media.tina && media.loadCustomStore) {
812
807
  ctx.addIssue({
813
808
  code: z.ZodIssueCode.custom,
package/dist/index.js CHANGED
@@ -820,7 +820,7 @@ ${JSON.stringify(val, null, 2)}
820
820
  collections: z.z.array(TinaCloudCollection),
821
821
  config: tinaConfigZod.optional()
822
822
  }).superRefine((val, ctx) => {
823
- var _a, _b, _c;
823
+ var _a, _b;
824
824
  const dups = findDuplicates((_a = val.collections) == null ? void 0 : _a.map((x) => x.name));
825
825
  if (dups) {
826
826
  ctx.addIssue({
@@ -829,12 +829,7 @@ ${JSON.stringify(val, null, 2)}
829
829
  fatal: true
830
830
  });
831
831
  }
832
- (_b = val == null ? void 0 : val.collections) == null ? void 0 : _b.map((x) => {
833
- if (!x.format) {
834
- console.warn(`No format provided for collection ${x.name}, defaulting to .md`);
835
- }
836
- });
837
- const media = (_c = val == null ? void 0 : val.config) == null ? void 0 : _c.media;
832
+ const media = (_b = val == null ? void 0 : val.config) == null ? void 0 : _b.media;
838
833
  if (media && media.tina && media.loadCustomStore) {
839
834
  ctx.addIssue({
840
835
  code: z.z.ZodIssueCode.custom,
@@ -12,6 +12,7 @@ limitations under the License.
12
12
  */
13
13
  import type { FC } from 'react';
14
14
  import { TinaSchema } from '../schema';
15
+ import { Config } from '../types';
15
16
  import type { TinaCloudSchemaConfig } from './config';
16
17
  export declare type UIField<F extends UIField = any, Shape = any> = {
17
18
  label?: string;
@@ -31,7 +32,7 @@ export interface TinaCloudSchema<WithNamespace extends boolean, Store = any> {
31
32
  /**
32
33
  * @deprecated use `defineConfig` in a config.{js,ts} file instead
33
34
  */
34
- config?: TinaCloudSchemaConfig<Store>;
35
+ config?: Config;
35
36
  }
36
37
  export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
37
38
  export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
package/dist/types.d.ts CHANGED
@@ -63,6 +63,14 @@ export interface UICollection {
63
63
  document: Doc;
64
64
  collection: Collection;
65
65
  }) => string | undefined;
66
+ /**
67
+ * Determines whether or not this collection can accept new docments
68
+ * or allow documents to be deleted from the CMS.
69
+ */
70
+ allowedActions?: {
71
+ create?: boolean;
72
+ delete?: boolean;
73
+ };
66
74
  }
67
75
  export declare type Option = string | {
68
76
  label: string;
@@ -365,7 +373,19 @@ export interface Schema {
365
373
  */
366
374
  collections: Collection[];
367
375
  }
376
+ export declare type TokenObject = {
377
+ id_token: string;
378
+ access_token: string;
379
+ refresh_token: string;
380
+ };
368
381
  export interface Config<CMSCallback = undefined, FormifyCallback = undefined, DocumentCreatorCallback = undefined, Store = undefined> {
382
+ admin?: {
383
+ auth?: {
384
+ onLogin?: (args: {
385
+ token: TokenObject;
386
+ }) => Promise<void>;
387
+ };
388
+ };
369
389
  /**
370
390
  * The Schema is used to define the shape of the content.
371
391
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/schema-tools",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {