@aws-amplify/data-schema-types
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -94,2 +94,8 @@ /** | ||
}; | ||
/** | ||
* @experimental | ||
*/ | ||
export type AiModel = { | ||
resourcePath: string; | ||
}; | ||
export {}; |
@@ -9,3 +9,3 @@ import type { DeepReadOnlyObject, UnwrapArray, UnionToIntersection, Prettify, Equal } from '../util'; | ||
*/ | ||
type NonRelationalFields<M extends Model> = { | ||
type NonRelationshipFields<M extends Model> = { | ||
[Field in keyof M as UnwrapArray<M[Field]> extends Record<string, unknown> ? never : Field]: M[Field]; | ||
@@ -72,3 +72,3 @@ }; | ||
type DeepPickFromPath<FlatModel extends Model, Path extends string> = FlatModel extends undefined ? DeepPickFromPath<NonNullable<FlatModel>, Path> | undefined : FlatModel extends null ? DeepPickFromPath<NonNullable<FlatModel>, Path> | null : FlatModel extends any[] ? DeepPickFromPath<UnwrapArray<FlatModel>, Path> : Path extends `${infer Head}.${infer Tail}` ? Head extends keyof FlatModel ? Tail extends '*' ? { | ||
[k in Head]: NonRelationalFields<UnwrapArray<FlatModel[Head]>>; | ||
[k in Head]: NonRelationshipFields<UnwrapArray<FlatModel[Head]>>; | ||
} : { | ||
@@ -160,3 +160,3 @@ [k in Head]: DeepPickFromPath<FlatModel[Head], Tail>; | ||
type ResolvedModel<Model extends Record<string, unknown>, Depth extends number = 7, RecursionLoop extends number[] = [-1, 0, 1, 2, 3, 4, 5, 6]> = { | ||
done: NonRelationalFields<Model>; | ||
done: NonRelationshipFields<Model>; | ||
recur: { | ||
@@ -177,3 +177,3 @@ [Field in keyof Model]: Model[Field] extends (...args: any) => ListReturnValue<infer M> ? NonNullable<M> extends Record<string, any> ? ResolvedModel<NonNullable<M>, RecursionLoop[Depth]>[] : never : Model[Field] extends (...args: any) => SingularReturnValue<infer M> ? NonNullable<M> extends Record<string, any> ? ResolvedModel<NonNullable<M>, RecursionLoop[Depth]> : never : Model[Field]; | ||
/** | ||
* All required fields and relational fields, exclude readonly fields | ||
* All required fields and relationship fields, exclude readonly fields | ||
*/ | ||
@@ -180,0 +180,0 @@ type MutationInput<Fields, WritableFields = Pick<Fields, WritableKeys<Fields>>> = { |
{ | ||
"name": "@aws-amplify/data-schema-types", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"license": "Apache-2.0", | ||
@@ -23,3 +23,3 @@ "main": "./dist/cjs/index.js", | ||
"docs:temp": "api-extractor run && api-documenter markdown --input-folder temp --output-folder temp/docs", | ||
"check:api": "rimraf temp && npm run docs:temp && node ../../scripts/shallow-dir-diff.js docs temp/docs", | ||
"check:api": "rimraf temp && npm run docs:temp && tsx ../../scripts/shallow-dir-diff.ts docs temp/docs", | ||
"test": "echo \"No tests\"", | ||
@@ -26,0 +26,0 @@ "lint": "eslint ." |
@@ -115,1 +115,8 @@ /** | ||
}; | ||
/** | ||
* @experimental | ||
*/ | ||
export type AiModel = { | ||
resourcePath: string; | ||
} |
@@ -22,3 +22,3 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
*/ | ||
type NonRelationalFields<M extends Model> = { | ||
type NonRelationshipFields<M extends Model> = { | ||
[Field in keyof M as UnwrapArray<M[Field]> extends Record<string, unknown> | ||
@@ -124,3 +124,7 @@ ? never | ||
? Tail extends '*' | ||
? { [k in Head]: NonRelationalFields<UnwrapArray<FlatModel[Head]>> } | ||
? { | ||
[k in Head]: NonRelationshipFields< | ||
UnwrapArray<FlatModel[Head]> | ||
>; | ||
} | ||
: { [k in Head]: DeepPickFromPath<FlatModel[Head], Tail> } | ||
@@ -234,3 +238,3 @@ : never | ||
> = { | ||
done: NonRelationalFields<Model>; | ||
done: NonRelationshipFields<Model>; | ||
recur: { | ||
@@ -276,3 +280,3 @@ [Field in keyof Model]: Model[Field] extends ( | ||
/** | ||
* All required fields and relational fields, exclude readonly fields | ||
* All required fields and relationship fields, exclude readonly fields | ||
*/ | ||
@@ -279,0 +283,0 @@ type MutationInput< |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165683
1842