@eide/uniformgen 0.1.0 → 0.1.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/commands/push.js +2 -2
- package/dist/fetcher/fetch-schemas.d.ts.map +1 -1
- package/dist/fetcher/fetch-schemas.js +1 -15
- package/dist/generators/cms/route.d.ts.map +1 -1
- package/dist/generators/cms/route.js +20 -2
- package/dist/generators/resolve/platform.d.ts.map +1 -1
- package/dist/generators/resolve/platform.js +20 -2
- package/dist/generators/types/field-types.d.ts.map +1 -1
- package/dist/generators/types/field-types.js +10 -2
- package/dist/graphql/generated/graphql.d.ts +87 -15
- package/dist/graphql/generated/graphql.d.ts.map +1 -1
- package/dist/graphql/generated/graphql.js +6 -0
- package/dist/schema/define-entity-model.d.ts +29 -18
- package/dist/schema/define-entity-model.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/commands/push.js
CHANGED
|
@@ -94,7 +94,7 @@ async function createEntityModel(apiUrl, accessToken, tenantId, projectId, model
|
|
|
94
94
|
},
|
|
95
95
|
modes: model.modes,
|
|
96
96
|
editorMode: model.editorMode,
|
|
97
|
-
|
|
97
|
+
extensions: model.extensions,
|
|
98
98
|
hooks: model.hooks,
|
|
99
99
|
},
|
|
100
100
|
},
|
|
@@ -147,7 +147,7 @@ async function updateEntityModelSchema(apiUrl, accessToken, tenantId, projectId,
|
|
|
147
147
|
},
|
|
148
148
|
modes: model.modes,
|
|
149
149
|
editorMode: model.editorMode,
|
|
150
|
-
|
|
150
|
+
extensions: model.extensions,
|
|
151
151
|
hooks: model.hooks,
|
|
152
152
|
changeDescription: `Updated via uniformgen push`,
|
|
153
153
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-schemas.d.ts","sourceRoot":"","sources":["../../src/fetcher/fetch-schemas.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KA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
|
isSystemModel
|
|
22
22
|
isInfrastructure
|
|
23
|
-
|
|
24
|
-
enabled
|
|
25
|
-
sitemap {
|
|
26
|
-
changefreq
|
|
27
|
-
priority
|
|
28
|
-
}
|
|
29
|
-
defaultTemplate {
|
|
30
|
-
modelKey
|
|
31
|
-
naturalKey
|
|
32
|
-
}
|
|
33
|
-
parentModels {
|
|
34
|
-
modelKey
|
|
35
|
-
cascadeDelete
|
|
36
|
-
}
|
|
37
|
-
}
|
|
23
|
+
extensions
|
|
38
24
|
hooks
|
|
39
25
|
metadataSchema
|
|
40
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/generators/cms/route.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAEtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/generators/cms/route.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAEtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,CAsM/E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,GAAG,MAAM,CA0M/E"}
|
|
@@ -35,6 +35,7 @@ export function generateResolveRouteReact(routableModels) {
|
|
|
35
35
|
* @generated by UniformGen - DO NOT EDIT MANUALLY
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
+
import { useMemo } from 'react';
|
|
38
39
|
import { useQuery, type QueryHookOptions } from '@apollo/client';
|
|
39
40
|
import { gql } from '@apollo/client';
|
|
40
41
|
import type {
|
|
@@ -181,12 +182,22 @@ export function useResolveRoute(
|
|
|
181
182
|
) {
|
|
182
183
|
const { queryOptions, referenceOptions } = options ?? {};
|
|
183
184
|
|
|
185
|
+
// Build contexts object from variant context fields
|
|
186
|
+
// NOTE: Security-sensitive fields (authenticated, customerId, userData) are injected server-side
|
|
187
|
+
const contexts = useMemo(() => {
|
|
188
|
+
const ctx: Record<string, unknown> = {};
|
|
189
|
+
if (context?.device) ctx.device = context.device;
|
|
190
|
+
if (context?.region) ctx.region = context.region;
|
|
191
|
+
if (context?.contexts) Object.assign(ctx, context.contexts);
|
|
192
|
+
return Object.keys(ctx).length > 0 ? ctx : undefined;
|
|
193
|
+
}, [context?.device, context?.region, context?.contexts]);
|
|
194
|
+
|
|
184
195
|
const result = useQuery(RESOLVE_ROUTE_QUERY, {
|
|
185
196
|
...queryOptions,
|
|
186
197
|
variables: {
|
|
187
198
|
path,
|
|
188
199
|
locale: context?.locale,
|
|
189
|
-
contexts
|
|
200
|
+
contexts,
|
|
190
201
|
referenceOptions,
|
|
191
202
|
},
|
|
192
203
|
skip: !path,
|
|
@@ -384,12 +395,19 @@ export async function resolveRoute(
|
|
|
384
395
|
referenceOptions?: ReferenceResolutionOptions;
|
|
385
396
|
}
|
|
386
397
|
): Promise<ResolvedRoute | null> {
|
|
398
|
+
// Build contexts object from variant context fields
|
|
399
|
+
// NOTE: Security-sensitive fields (authenticated, customerId, userData) are injected server-side
|
|
400
|
+
const contexts: Record<string, unknown> = {};
|
|
401
|
+
if (context?.device) contexts.device = context.device;
|
|
402
|
+
if (context?.region) contexts.region = context.region;
|
|
403
|
+
if (context?.contexts) Object.assign(contexts, context.contexts);
|
|
404
|
+
|
|
387
405
|
const result = await client.request<{ resolveRoute: ResolvedRoute | null }>(
|
|
388
406
|
RESOLVE_ROUTE_QUERY,
|
|
389
407
|
{
|
|
390
408
|
path,
|
|
391
409
|
locale: context?.locale,
|
|
392
|
-
contexts:
|
|
410
|
+
contexts: Object.keys(contexts).length > 0 ? contexts : undefined,
|
|
393
411
|
referenceOptions: options?.referenceOptions,
|
|
394
412
|
}
|
|
395
413
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../src/generators/resolve/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gCAAgC,CAAC;AA6FvF;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,WAAW,EAAE,GACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../src/generators/resolve/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gCAAgC,CAAC;AA6FvF;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,WAAW,EAAE,GACxB,MAAM,CAoNR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,WAAW,EAAE,GACxB,MAAM,CA+IR;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAoC/E;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAyC/E"}
|
|
@@ -112,6 +112,7 @@ export function generatePlatformResolveReact(model, _allModels) {
|
|
|
112
112
|
lines.push(` */`);
|
|
113
113
|
lines.push('');
|
|
114
114
|
// Imports
|
|
115
|
+
lines.push(`import { useMemo } from 'react';`);
|
|
115
116
|
lines.push(`import { useQuery, type QueryHookOptions } from '@apollo/client';`);
|
|
116
117
|
lines.push(`import { gql } from '@apollo/client';`);
|
|
117
118
|
lines.push(`import type { ${dataTypeName} } from '../../types/models/${model.key}.js';`);
|
|
@@ -261,12 +262,22 @@ export function generatePlatformResolveReact(model, _allModels) {
|
|
|
261
262
|
lines.push(` context?: VariantContext,`);
|
|
262
263
|
lines.push(` options?: Omit<QueryHookOptions, 'variables'>`);
|
|
263
264
|
lines.push(`) {`);
|
|
265
|
+
lines.push(` // Build contexts object from variant context fields`);
|
|
266
|
+
lines.push(` // NOTE: Security-sensitive fields (authenticated, customerId, userData) are injected server-side`);
|
|
267
|
+
lines.push(` const contexts = useMemo(() => {`);
|
|
268
|
+
lines.push(` const ctx: Record<string, unknown> = {};`);
|
|
269
|
+
lines.push(` if (context?.device) ctx.device = context.device;`);
|
|
270
|
+
lines.push(` if (context?.region) ctx.region = context.region;`);
|
|
271
|
+
lines.push(` if (context?.contexts) Object.assign(ctx, context.contexts);`);
|
|
272
|
+
lines.push(` return Object.keys(ctx).length > 0 ? ctx : undefined;`);
|
|
273
|
+
lines.push(` }, [context?.device, context?.region, context?.contexts]);`);
|
|
274
|
+
lines.push('');
|
|
264
275
|
lines.push(` const result = useQuery(RESOLVE_${typeName.toUpperCase()}_QUERY, {`);
|
|
265
276
|
lines.push(` ...options,`);
|
|
266
277
|
lines.push(` variables: {`);
|
|
267
278
|
lines.push(` naturalKey,`);
|
|
268
279
|
lines.push(` locale: context?.locale,`);
|
|
269
|
-
lines.push(` contexts
|
|
280
|
+
lines.push(` contexts,`);
|
|
270
281
|
lines.push(` },`);
|
|
271
282
|
lines.push(` skip: !naturalKey,`);
|
|
272
283
|
lines.push(` });`);
|
|
@@ -386,10 +397,17 @@ export function generatePlatformResolveRemix(model, _allModels) {
|
|
|
386
397
|
lines.push(` naturalKey: string,`);
|
|
387
398
|
lines.push(` context?: VariantContext`);
|
|
388
399
|
lines.push(`): Promise<Resolved${typeName} | null> {`);
|
|
400
|
+
lines.push(` // Build contexts object from variant context fields`);
|
|
401
|
+
lines.push(` // NOTE: Security-sensitive fields (authenticated, customerId, userData) are injected server-side`);
|
|
402
|
+
lines.push(` const contexts: Record<string, unknown> = {};`);
|
|
403
|
+
lines.push(` if (context?.device) contexts.device = context.device;`);
|
|
404
|
+
lines.push(` if (context?.region) contexts.region = context.region;`);
|
|
405
|
+
lines.push(` if (context?.contexts) Object.assign(contexts, context.contexts);`);
|
|
406
|
+
lines.push('');
|
|
389
407
|
lines.push(` const result = await client.request<{ resolveEntity: any }>(RESOLVE_${typeName.toUpperCase()}_QUERY, {`);
|
|
390
408
|
lines.push(` naturalKey,`);
|
|
391
409
|
lines.push(` locale: context?.locale,`);
|
|
392
|
-
lines.push(` contexts:
|
|
410
|
+
lines.push(` contexts: Object.keys(contexts).length > 0 ? contexts : undefined,`);
|
|
393
411
|
lines.push(` });`);
|
|
394
412
|
lines.push(` if (!result.resolveEntity) return null;`);
|
|
395
413
|
lines.push(` const data = result.resolveEntity;`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../../src/generators/types/field-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,sBAAsB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../../src/generators/types/field-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,sBAAsB,IAAI,MAAM,CA2oB/C"}
|
|
@@ -219,12 +219,20 @@ export interface SortInput {
|
|
|
219
219
|
* Used to select the appropriate variant based on user context
|
|
220
220
|
*
|
|
221
221
|
* Context dimensions are configured in the CMS as "context" entities.
|
|
222
|
-
*
|
|
222
|
+
* You can pass common contexts as top-level properties for convenience,
|
|
223
|
+
* or use the generic \`contexts\` object for custom context dimensions.
|
|
224
|
+
*
|
|
225
|
+
* NOTE: Security-sensitive fields (authenticated, customerId, userData) are
|
|
226
|
+
* injected server-side by middleware and should NOT be passed from the client.
|
|
223
227
|
*/
|
|
224
228
|
export interface VariantContext {
|
|
225
229
|
/** Locale code for translation resolution (e.g., 'en-US', 'ja-JP') */
|
|
226
230
|
locale?: string;
|
|
227
|
-
/**
|
|
231
|
+
/** Device type for variant selection (e.g., 'mobile', 'desktop', 'tablet') */
|
|
232
|
+
device?: string;
|
|
233
|
+
/** Region for variant selection (e.g., 'us', 'eu', 'apac') */
|
|
234
|
+
region?: string;
|
|
235
|
+
/** Generic context dimensions for variant selection (custom contexts configured in CMS) */
|
|
228
236
|
contexts?: Record<string, unknown>;
|
|
229
237
|
}
|
|
230
238
|
|
|
@@ -737,8 +737,12 @@ export type AvailabilityResult = {
|
|
|
737
737
|
*/
|
|
738
738
|
export type AvailableContext = {
|
|
739
739
|
__typename?: 'AvailableContext';
|
|
740
|
+
/** Built-in values for contexts with fixed values (e.g., ['desktop', 'mobile', 'tablet']) */
|
|
741
|
+
builtInValues?: Maybe<Array<Scalars['String']['output']>>;
|
|
740
742
|
/** Description for admin UI */
|
|
741
743
|
description?: Maybe<Scalars['String']['output']>;
|
|
744
|
+
/** Entity model key for entity-backed contexts (e.g., 'locale', 'shopify-market') */
|
|
745
|
+
entityModelKey?: Maybe<Scalars['String']['output']>;
|
|
742
746
|
/** Whether this is a system context (code-defined, not user-editable) */
|
|
743
747
|
isSystem: Scalars['Boolean']['output'];
|
|
744
748
|
/** Context key (e.g., 'device', 'market') */
|
|
@@ -919,14 +923,14 @@ export type BillingOverviewMetrics = {
|
|
|
919
923
|
export type BillingPackageLimit = {
|
|
920
924
|
__typename?: 'BillingPackageLimit';
|
|
921
925
|
id: Scalars['ID']['output'];
|
|
922
|
-
includedQuantity?: Maybe<Scalars['
|
|
923
|
-
maxQuantity?: Maybe<Scalars['
|
|
926
|
+
includedQuantity?: Maybe<Scalars['Float']['output']>;
|
|
927
|
+
maxQuantity?: Maybe<Scalars['Float']['output']>;
|
|
924
928
|
metric: BillingMetric;
|
|
925
929
|
overagePriceCents?: Maybe<Scalars['Int']['output']>;
|
|
926
930
|
};
|
|
927
931
|
export type BillingPackageLimitInput = {
|
|
928
|
-
includedQuantity?: InputMaybe<Scalars['
|
|
929
|
-
maxQuantity?: InputMaybe<Scalars['
|
|
932
|
+
includedQuantity?: InputMaybe<Scalars['Float']['input']>;
|
|
933
|
+
maxQuantity?: InputMaybe<Scalars['Float']['input']>;
|
|
930
934
|
metric: BillingMetric;
|
|
931
935
|
overagePriceCents?: InputMaybe<Scalars['Int']['input']>;
|
|
932
936
|
};
|
|
@@ -954,16 +958,16 @@ export type BillingPlan = {
|
|
|
954
958
|
export type BillingPlanLimit = {
|
|
955
959
|
__typename?: 'BillingPlanLimit';
|
|
956
960
|
id: Scalars['ID']['output'];
|
|
957
|
-
includedQuantity: Scalars['
|
|
958
|
-
maxQuantity?: Maybe<Scalars['
|
|
961
|
+
includedQuantity: Scalars['Float']['output'];
|
|
962
|
+
maxQuantity?: Maybe<Scalars['Float']['output']>;
|
|
959
963
|
metric: BillingMetric;
|
|
960
964
|
overagePriceCents?: Maybe<Scalars['Int']['output']>;
|
|
961
965
|
overageUnitSize: Scalars['Int']['output'];
|
|
962
966
|
stripePriceId?: Maybe<Scalars['String']['output']>;
|
|
963
967
|
};
|
|
964
968
|
export type BillingPlanLimitInput = {
|
|
965
|
-
includedQuantity: Scalars['
|
|
966
|
-
maxQuantity?: InputMaybe<Scalars['
|
|
969
|
+
includedQuantity: Scalars['Float']['input'];
|
|
970
|
+
maxQuantity?: InputMaybe<Scalars['Float']['input']>;
|
|
967
971
|
metric: BillingMetric;
|
|
968
972
|
overagePriceCents?: InputMaybe<Scalars['Int']['input']>;
|
|
969
973
|
overageUnitSize?: InputMaybe<Scalars['Int']['input']>;
|
|
@@ -5390,8 +5394,8 @@ export type PublicBillingPlan = {
|
|
|
5390
5394
|
};
|
|
5391
5395
|
export type PublicBillingPlanLimit = {
|
|
5392
5396
|
__typename?: 'PublicBillingPlanLimit';
|
|
5393
|
-
includedQuantity: Scalars['
|
|
5394
|
-
maxQuantity?: Maybe<Scalars['
|
|
5397
|
+
includedQuantity: Scalars['Float']['output'];
|
|
5398
|
+
maxQuantity?: Maybe<Scalars['Float']['output']>;
|
|
5395
5399
|
metric: BillingMetric;
|
|
5396
5400
|
};
|
|
5397
5401
|
/** A publish batch containing multiple versions to publish together */
|
|
@@ -5809,8 +5813,8 @@ export type Query = {
|
|
|
5809
5813
|
recentlyOpened: Array<RecentlyOpenedItem>;
|
|
5810
5814
|
/** Get a single redirect by ID */
|
|
5811
5815
|
redirect?: Maybe<Redirect>;
|
|
5812
|
-
/** List all redirects for the project */
|
|
5813
|
-
redirects:
|
|
5816
|
+
/** List all redirects for the project with pagination */
|
|
5817
|
+
redirects: RedirectsConnection;
|
|
5814
5818
|
/**
|
|
5815
5819
|
* Get all repeatable (cron) jobs across all queues.
|
|
5816
5820
|
* Platform admin only.
|
|
@@ -5892,6 +5896,8 @@ export type Query = {
|
|
|
5892
5896
|
tenant?: Maybe<Tenant>;
|
|
5893
5897
|
tenantBillingStatus: TenantBillingStatusResult;
|
|
5894
5898
|
tenants: TenantList;
|
|
5899
|
+
/** List unified redirects (manual + route aliases) with pagination */
|
|
5900
|
+
unifiedRedirects: UnifiedRedirectsConnection;
|
|
5895
5901
|
/**
|
|
5896
5902
|
* Get unread notification count for badge.
|
|
5897
5903
|
* Uses headers for user context.
|
|
@@ -6281,6 +6287,7 @@ export type QueryRedirectsArgs = {
|
|
|
6281
6287
|
activeOnly?: InputMaybe<Scalars['Boolean']['input']>;
|
|
6282
6288
|
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
6283
6289
|
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
6290
|
+
search?: InputMaybe<Scalars['String']['input']>;
|
|
6284
6291
|
};
|
|
6285
6292
|
export type QueryResolutionDistributionArgs = {
|
|
6286
6293
|
dateRange: DateRangeInput;
|
|
@@ -6370,6 +6377,12 @@ export type QueryTenantsArgs = {
|
|
|
6370
6377
|
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
6371
6378
|
search?: InputMaybe<Scalars['String']['input']>;
|
|
6372
6379
|
};
|
|
6380
|
+
export type QueryUnifiedRedirectsArgs = {
|
|
6381
|
+
limit?: InputMaybe<Scalars['Int']['input']>;
|
|
6382
|
+
offset?: InputMaybe<Scalars['Int']['input']>;
|
|
6383
|
+
search?: InputMaybe<Scalars['String']['input']>;
|
|
6384
|
+
type?: InputMaybe<UnifiedRedirectType>;
|
|
6385
|
+
};
|
|
6373
6386
|
export type QueryValidateInvitationArgs = {
|
|
6374
6387
|
token: Scalars['String']['input'];
|
|
6375
6388
|
};
|
|
@@ -6549,6 +6562,16 @@ export type Redirect = {
|
|
|
6549
6562
|
targetPattern: Scalars['String']['output'];
|
|
6550
6563
|
updatedAt: Scalars['DateTime']['output'];
|
|
6551
6564
|
};
|
|
6565
|
+
/** Connection type for paginated redirects */
|
|
6566
|
+
export type RedirectsConnection = {
|
|
6567
|
+
__typename?: 'RedirectsConnection';
|
|
6568
|
+
/** Whether there are more items to fetch */
|
|
6569
|
+
hasMore: Scalars['Boolean']['output'];
|
|
6570
|
+
/** List of redirects */
|
|
6571
|
+
items: Array<Redirect>;
|
|
6572
|
+
/** Total count of redirects matching the filter */
|
|
6573
|
+
total: Scalars['Int']['output'];
|
|
6574
|
+
};
|
|
6552
6575
|
/** Reference resolution options */
|
|
6553
6576
|
export type ReferenceResolutionOptionsInput = {
|
|
6554
6577
|
/** Maximum depth for nested resolution (null = unlimited with cycle detection) */
|
|
@@ -7674,6 +7697,55 @@ export type TypographyVariantInput = {
|
|
|
7674
7697
|
name: Scalars['String']['input'];
|
|
7675
7698
|
textTransform?: InputMaybe<Scalars['String']['input']>;
|
|
7676
7699
|
};
|
|
7700
|
+
/** Unified redirect record combining manual redirects and route aliases */
|
|
7701
|
+
export type UnifiedRedirect = {
|
|
7702
|
+
__typename?: 'UnifiedRedirect';
|
|
7703
|
+
/** Entity type (route alias only) */
|
|
7704
|
+
entityType?: Maybe<Scalars['String']['output']>;
|
|
7705
|
+
/** Number of times this redirect has been used (manual only) */
|
|
7706
|
+
hitCount?: Maybe<Scalars['Int']['output']>;
|
|
7707
|
+
/** Unique identifier */
|
|
7708
|
+
id: Scalars['ID']['output'];
|
|
7709
|
+
/** Last time this redirect was matched (manual only) */
|
|
7710
|
+
lastHitAt?: Maybe<Scalars['DateTime']['output']>;
|
|
7711
|
+
/** Priority for matching (manual only) */
|
|
7712
|
+
priority?: Maybe<Scalars['Int']['output']>;
|
|
7713
|
+
/** Optional reason/note (manual only) */
|
|
7714
|
+
reason?: Maybe<Scalars['String']['output']>;
|
|
7715
|
+
/** Source URL pattern */
|
|
7716
|
+
source: Scalars['String']['output'];
|
|
7717
|
+
/** HTTP status code */
|
|
7718
|
+
statusCode: Scalars['Int']['output'];
|
|
7719
|
+
/** Target URL pattern */
|
|
7720
|
+
target: Scalars['String']['output'];
|
|
7721
|
+
/** Type of redirect */
|
|
7722
|
+
type: UnifiedRedirectType;
|
|
7723
|
+
};
|
|
7724
|
+
/** Counts of redirects by type */
|
|
7725
|
+
export type UnifiedRedirectCounts = {
|
|
7726
|
+
__typename?: 'UnifiedRedirectCounts';
|
|
7727
|
+
/** Number of manual redirects */
|
|
7728
|
+
manual: Scalars['Int']['output'];
|
|
7729
|
+
/** Number of route aliases */
|
|
7730
|
+
routeAlias: Scalars['Int']['output'];
|
|
7731
|
+
};
|
|
7732
|
+
/** Type of redirect */
|
|
7733
|
+
export declare enum UnifiedRedirectType {
|
|
7734
|
+
Manual = "MANUAL",
|
|
7735
|
+
RouteAlias = "ROUTE_ALIAS"
|
|
7736
|
+
}
|
|
7737
|
+
/** Connection type for unified redirects with pagination */
|
|
7738
|
+
export type UnifiedRedirectsConnection = {
|
|
7739
|
+
__typename?: 'UnifiedRedirectsConnection';
|
|
7740
|
+
/** Counts by type */
|
|
7741
|
+
counts: UnifiedRedirectCounts;
|
|
7742
|
+
/** Whether there are more items */
|
|
7743
|
+
hasMore: Scalars['Boolean']['output'];
|
|
7744
|
+
/** List of unified redirects */
|
|
7745
|
+
items: Array<UnifiedRedirect>;
|
|
7746
|
+
/** Total count matching the filter */
|
|
7747
|
+
total: Scalars['Int']['output'];
|
|
7748
|
+
};
|
|
7677
7749
|
/** Input for unpublishing an entity record variant */
|
|
7678
7750
|
export type UnpublishEntityRecordVariantInput = {
|
|
7679
7751
|
variantId: Scalars['ID']['input'];
|
|
@@ -7934,9 +8006,9 @@ export type UsageLimitStatus = {
|
|
|
7934
8006
|
};
|
|
7935
8007
|
export type UsageMetricValue = {
|
|
7936
8008
|
__typename?: 'UsageMetricValue';
|
|
7937
|
-
current: Scalars['
|
|
7938
|
-
included: Scalars['
|
|
7939
|
-
max?: Maybe<Scalars['
|
|
8009
|
+
current: Scalars['Float']['output'];
|
|
8010
|
+
included: Scalars['Float']['output'];
|
|
8011
|
+
max?: Maybe<Scalars['Float']['output']>;
|
|
7940
8012
|
metric: BillingMetric;
|
|
7941
8013
|
percentUsed: Scalars['Float']['output'];
|
|
7942
8014
|
};
|