@aws-amplify/data-schema-types
Advanced tools
Comparing version 0.7.9 to 0.7.10
@@ -1,2 +0,2 @@ | ||
import { DeepReadOnlyObject, UnwrapArray, UnionToIntersection, Prettify, Equal } from '../util'; | ||
import type { DeepReadOnlyObject, UnwrapArray, UnionToIntersection, Prettify, Equal } from '../util'; | ||
import type { Observable } from 'rxjs'; | ||
@@ -457,19 +457,19 @@ export declare const __modelMeta__: unique symbol; | ||
export type CustomMutations<Schema extends Record<any, any>, Context extends ContextType = 'CLIENT', ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = CustomOperations<Schema, 'Mutation', Context, ModelMeta>; | ||
export type CustomSubscriptions<Schema extends Record<any, any>, Context extends ContextType = 'CLIENT', ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = CustomOperations<Schema, 'Subscription', Context, ModelMeta>; | ||
type CustomOperationMethodOptions = { | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}; | ||
/** | ||
* Generates Custom Operations function params based on whether .arguments() were specified in the schema builder | ||
*/ | ||
type CustomOperationFnParams<Args extends Record<string, unknown> | never> = [ | ||
Args | ||
] extends [never] ? [CustomOperationMethodOptions?] : [Args, CustomOperationMethodOptions?]; | ||
export type CustomOperations<Schema extends Record<any, any>, OperationType extends 'Query' | 'Mutation' | 'Subscription', Context extends ContextType = 'CLIENT', ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = { | ||
[OpName in keyof ModelMeta['customOperations'] as ModelMeta['customOperations'][OpName]['typeName'] extends OperationType ? OpName : never]: { | ||
CLIENT: (input: ModelMeta['customOperations'][OpName]['arguments'], options?: { | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}) => SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
COOKIES: (input: ModelMeta['customOperations'][OpName]['arguments'], options?: { | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}) => SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
REQUEST: (contextSpec: any, input: ModelMeta['customOperations'][OpName]['arguments'], options?: { | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}) => SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
CLIENT: (...params: CustomOperationFnParams<ModelMeta['customOperations'][OpName]['arguments']>) => ModelMeta['customOperations'][OpName]['typeName'] extends 'Subscription' ? ObservedReturnValue<ModelMeta['customOperations'][OpName]['returnType']> : SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
COOKIES: (...params: CustomOperationFnParams<ModelMeta['customOperations'][OpName]['arguments']>) => SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
REQUEST: (contextSpec: any, ...params: CustomOperationFnParams<ModelMeta['customOperations'][OpName]['arguments']>) => SingularReturnValue<ModelMeta['customOperations'][OpName]['returnType']>; | ||
}[Context]; | ||
@@ -476,0 +476,0 @@ }; |
@@ -14,1 +14,2 @@ export declare const __modelMeta__: unique symbol; | ||
export type CustomMutations<Schema extends Record<any, any>, _Context extends string = 'CLIENT', _ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = any; | ||
export type CustomSubscriptions<Schema extends Record<any, any>, _Context extends string = 'CLIENT', _ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>> = any; |
{ | ||
"name": "@aws-amplify/data-schema-types", | ||
"version": "0.7.9", | ||
"version": "0.7.10", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "./lib-esm/index.d.ts", |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { | ||
import type { | ||
DeepReadOnlyObject, | ||
@@ -747,2 +747,24 @@ UnwrapArray, | ||
export type CustomSubscriptions< | ||
Schema extends Record<any, any>, | ||
Context extends ContextType = 'CLIENT', | ||
ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>, | ||
> = CustomOperations<Schema, 'Subscription', Context, ModelMeta>; | ||
type CustomOperationMethodOptions = { | ||
// selectionSet?: SelectionSet; | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}; | ||
/** | ||
* Generates Custom Operations function params based on whether .arguments() were specified in the schema builder | ||
*/ | ||
type CustomOperationFnParams<Args extends Record<string, unknown> | never> = [ | ||
Args, | ||
] extends [never] | ||
? [CustomOperationMethodOptions?] | ||
: [Args, CustomOperationMethodOptions?]; | ||
export type CustomOperations< | ||
@@ -758,20 +780,15 @@ Schema extends Record<any, any>, | ||
CLIENT: ( | ||
input: ModelMeta['customOperations'][OpName]['arguments'], | ||
options?: { | ||
// selectionSet?: SelectionSet; | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}, | ||
) => SingularReturnValue< | ||
ModelMeta['customOperations'][OpName]['returnType'] | ||
>; | ||
...params: CustomOperationFnParams< | ||
ModelMeta['customOperations'][OpName]['arguments'] | ||
> | ||
) => // we only generate subscriptions on the clientside; so this isn't applied to COOKIES | REQUEST | ||
ModelMeta['customOperations'][OpName]['typeName'] extends 'Subscription' | ||
? ObservedReturnValue<ModelMeta['customOperations'][OpName]['returnType']> | ||
: SingularReturnValue< | ||
ModelMeta['customOperations'][OpName]['returnType'] | ||
>; | ||
COOKIES: ( | ||
input: ModelMeta['customOperations'][OpName]['arguments'], | ||
options?: { | ||
// selectionSet?: SelectionSet; | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}, | ||
...params: CustomOperationFnParams< | ||
ModelMeta['customOperations'][OpName]['arguments'] | ||
> | ||
) => SingularReturnValue< | ||
@@ -782,9 +799,5 @@ ModelMeta['customOperations'][OpName]['returnType'] | ||
contextSpec: any, | ||
input: ModelMeta['customOperations'][OpName]['arguments'], | ||
options?: { | ||
// selectionSet?: SelectionSet; | ||
authMode?: AuthMode; | ||
authToken?: string; | ||
headers?: CustomHeaders; | ||
}, | ||
...params: CustomOperationFnParams< | ||
ModelMeta['customOperations'][OpName]['arguments'] | ||
> | ||
) => SingularReturnValue< | ||
@@ -791,0 +804,0 @@ ModelMeta['customOperations'][OpName]['returnType'] |
@@ -41,1 +41,7 @@ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
> = any; | ||
export type CustomSubscriptions< | ||
Schema extends Record<any, any>, | ||
_Context extends string = 'CLIENT', | ||
_ModelMeta extends Record<any, any> = ExtractModelMeta<Schema>, | ||
> = any; |
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
73736
1684