@diagonal-hq/cli 0.2.0 → 0.3.0
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/README.md +43 -11
- package/dist/cli.mjs +468 -376
- package/dist/fields.generated.d.ts +1 -1
- package/dist/index.d.ts +19 -14
- package/package.json +1 -1
|
@@ -371,7 +371,7 @@ export type RelationInverse = {
|
|
|
371
371
|
settings?: Omit<RelationFieldSettings, 'inverse'> & { "max_connections"?: number | null };
|
|
372
372
|
};
|
|
373
373
|
|
|
374
|
-
/** A relation names its target resource by
|
|
374
|
+
/** A relation names its target resource by slug, as `Resources.<Name>`. The type defaults to `belongs_to`. */
|
|
375
375
|
export type RelationFieldOptions = Omit<BaseFieldOptions<RelationFieldSettings>, 'settings'> & { resource: string } & (
|
|
376
376
|
| { type?: "belongs_to"; settings?: RelationFieldSettings }
|
|
377
377
|
| { type: "belongs_to_many"; settings?: RelationFieldSettings & { "max_connections"?: number | null } }
|
package/dist/index.d.ts
CHANGED
|
@@ -76,13 +76,8 @@ export type ResourceDataApi = {
|
|
|
76
76
|
export type ResourceDefinition<
|
|
77
77
|
TFields extends Record<string, FieldDefinition> = Record<string, FieldDefinition>
|
|
78
78
|
> = {
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
* `diagonal check` suggests a new one when the id is not v7. Keep it
|
|
82
|
-
* stable: records and workflows refer to it.
|
|
83
|
-
*/
|
|
84
|
-
id: string;
|
|
85
|
-
slug: string;
|
|
79
|
+
/** Only a platform resource reference sets `platform`. */
|
|
80
|
+
platform?: never;
|
|
86
81
|
name: string;
|
|
87
82
|
singularName: string;
|
|
88
83
|
displayField?: Extract<keyof TFields, string>;
|
|
@@ -112,16 +107,22 @@ export type ResourceDefinition<
|
|
|
112
107
|
capabilities?: ResourceCapabilities<TFields>;
|
|
113
108
|
};
|
|
114
109
|
|
|
110
|
+
/**
|
|
111
|
+
* A resource that the platform provisions and owns, such as the roles. The
|
|
112
|
+
* file gives it a `Resources` entry. The deploy does not change it.
|
|
113
|
+
*/
|
|
114
|
+
export type PlatformResourceDefinition = { platform: true };
|
|
115
|
+
|
|
115
116
|
export declare function defineResource<const TFields extends Record<string, FieldDefinition>>(
|
|
116
|
-
resource: ResourceDefinition<TFields>
|
|
117
|
-
): ResourceDefinition<TFields
|
|
117
|
+
resource: ResourceDefinition<TFields> | PlatformResourceDefinition
|
|
118
|
+
): ResourceDefinition<TFields> | PlatformResourceDefinition;
|
|
118
119
|
|
|
119
120
|
/** A TipTap document whose mentions resolve against the page's bound records. */
|
|
120
121
|
export type PageMetaResolver = { readonly type: string; readonly [key: string]: unknown };
|
|
121
122
|
|
|
122
123
|
export type PageRouteParam = {
|
|
123
|
-
/** The
|
|
124
|
-
resource:
|
|
124
|
+
/** The resource whose record the parameter names, as `Resources.<Name>`. */
|
|
125
|
+
resource: ResourceReference;
|
|
125
126
|
/** The field the parameter matches. Defaults to the record id. */
|
|
126
127
|
lookupField?: string | null;
|
|
127
128
|
/** Relation fields to load with the record. */
|
|
@@ -133,8 +134,8 @@ export type PageAuthorizer =
|
|
|
133
134
|
| null
|
|
134
135
|
| 'authenticated'
|
|
135
136
|
| {
|
|
136
|
-
/** The
|
|
137
|
-
resource?:
|
|
137
|
+
/** The resource whose signed-in records may view the page, as `Resources.<Name>`. */
|
|
138
|
+
resource?: ResourceReference | null;
|
|
138
139
|
/** Permission ids. A viewer needs any one of them. */
|
|
139
140
|
permissions?: readonly string[];
|
|
140
141
|
};
|
|
@@ -180,7 +181,11 @@ export type NavigationDefinition = { id: string; items: readonly NavigationItem[
|
|
|
180
181
|
|
|
181
182
|
export declare function defineNavigation<const T extends NavigationDefinition>(navigation: T): T;
|
|
182
183
|
|
|
183
|
-
/**
|
|
184
|
+
/**
|
|
185
|
+
* The slug of a resource: its file name in `resources/`. Use `Resources.<Name>`
|
|
186
|
+
* from `@app/generated/resources`, which `diagonal check` writes, so the editor
|
|
187
|
+
* and the build catch a wrong name. A slug string builds with a warning.
|
|
188
|
+
*/
|
|
184
189
|
export type ResourceReference = string;
|
|
185
190
|
|
|
186
191
|
export type WorkflowRunAs =
|