@aws-amplify/data-schema
Advanced tools
Comparing version 0.12.3 to 0.12.4
@@ -1,6 +0,7 @@ | ||
import { Brand, SetTypeSubArg } from '@aws-amplify/data-schema-types'; | ||
import { SetTypeSubArg, Brand } from '@aws-amplify/data-schema-types'; | ||
import { ModelField, InternalField } from './ModelField'; | ||
import { Authorization } from './Authorization'; | ||
import { RefType, InternalRef } from './RefType'; | ||
type CustomArguments = Record<string, ModelField<any, any>>; | ||
import { EnumType, EnumTypeParamShape } from './EnumType'; | ||
type CustomArguments = Record<string, ModelField<any, any> | EnumType<EnumTypeParamShape>>; | ||
type CustomReturnType = RefType<any>; | ||
@@ -10,2 +11,3 @@ type CustomFunctionRefType = string; | ||
type InternalCustomReturnType = InternalRef; | ||
declare const brandName = "customOperation"; | ||
export declare const CustomOperationNames: readonly ["Query", "Mutation", "Subscription"]; | ||
@@ -33,3 +35,3 @@ type CustomOperationName = (typeof CustomOperationNames)[number]; | ||
}; | ||
export type CustomOperation<T extends CustomOperationParamShape, K extends keyof CustomOperation<T> = never> = Brand<Omit<{ | ||
export type CustomOperation<T extends CustomOperationParamShape, K extends keyof CustomOperation<T> = never> = Omit<{ | ||
arguments<Arguments extends CustomArguments>(args: Arguments): CustomOperation<SetTypeSubArg<T, 'arguments', Arguments>, K | 'arguments'>; | ||
@@ -39,3 +41,3 @@ returns<ReturnType extends CustomReturnType>(returnType: ReturnType): CustomOperation<SetTypeSubArg<T, 'returnType', ReturnType>, K | 'returns'>; | ||
authorization<AuthRuleType extends Authorization<any, any, any>>(rules: AuthRuleType[]): CustomOperation<SetTypeSubArg<T, 'authorization', AuthRuleType[]>, K | 'authorization'>; | ||
}, K>, 'customOperation'>; | ||
}, K> & Brand<object, typeof brandName>; | ||
/** | ||
@@ -42,0 +44,0 @@ * Internal representation of Custom Type that exposes the `data` property. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.subscription = exports.mutation = exports.query = exports.CustomOperationNames = void 0; | ||
const brandName = 'customOperation'; | ||
exports.CustomOperationNames = [ | ||
@@ -5,0 +6,0 @@ 'Query', |
@@ -0,1 +1,2 @@ | ||
import { Brand } from '@aws-amplify/data-schema-types'; | ||
import { Authorization } from './Authorization'; | ||
@@ -6,2 +7,3 @@ /** | ||
export declare const __auth: unique symbol; | ||
declare const brandName = "modelField"; | ||
export declare enum ModelFieldType { | ||
@@ -75,3 +77,3 @@ Id = "ID", | ||
[__auth]?: Auth; | ||
}; | ||
} & Brand<object, typeof brandName>; | ||
/** | ||
@@ -78,0 +80,0 @@ * Internal representation of Model Field that exposes the `data` property. |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.__auth = Symbol('__auth'); | ||
const brandName = 'modelField'; | ||
var ModelFieldType; | ||
@@ -10,0 +11,0 @@ (function (ModelFieldType) { |
@@ -1,2 +0,2 @@ | ||
import { SetTypeSubArg } from '@aws-amplify/data-schema-types'; | ||
import { SetTypeSubArg, Brand } from '@aws-amplify/data-schema-types'; | ||
import { Authorization } from './Authorization'; | ||
@@ -7,2 +7,3 @@ /** | ||
export declare const __auth: unique symbol; | ||
declare const brandName = "modelRelationalField"; | ||
export declare enum ModelRelationshipTypes { | ||
@@ -34,3 +35,3 @@ hasOne = "hasOne", | ||
}; | ||
export type ModelRelationalField<T extends ModelRelationalFieldParamShape, RM extends string | symbol, K extends keyof ModelRelationalField<T, RM> = never, Auth = undefined> = Omit<{ | ||
type ModelRelationalFieldFunctions<T extends ModelRelationalFieldParamShape, RM extends string | symbol, K extends keyof ModelRelationalField<T, RM> = never> = { | ||
/** | ||
@@ -53,5 +54,6 @@ * When set, it requires the value of the relationship type to be required. | ||
authorization<AuthRuleType extends Authorization<any, any, any>>(rules: AuthRuleType[]): ModelRelationalField<T, K | 'authorization', K, AuthRuleType>; | ||
}, K> & { | ||
}; | ||
export type ModelRelationalField<T extends ModelRelationalFieldParamShape, RM extends string | symbol, K extends keyof ModelRelationalField<T, RM> = never, Auth = undefined> = Omit<ModelRelationalFieldFunctions<T, RM, K>, K> & { | ||
[__auth]?: Auth; | ||
}; | ||
} & Brand<object, typeof brandName>; | ||
/** | ||
@@ -58,0 +60,0 @@ * Internal representation of Model Field that exposes the `data` property. |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.__auth = Symbol('__auth'); | ||
const brandName = 'modelRelationalField'; | ||
var ModelRelationshipTypes; | ||
@@ -10,0 +11,0 @@ (function (ModelRelationshipTypes) { |
@@ -6,3 +6,5 @@ import type { SetTypeSubArg } from '@aws-amplify/data-schema-types'; | ||
import { RefType } from './RefType'; | ||
type ModelFields = Record<string, ModelField<any, any> | ModelRelationalField<any, string, any> | RefType<any, any>>; | ||
import { EnumType, EnumTypeParamShape } from './EnumType'; | ||
import { CustomType, CustomTypeParamShape } from './CustomType'; | ||
type ModelFields = Record<string, ModelField<any, any, any> | ModelRelationalField<any, string, any, any> | RefType<any, any, any> | EnumType<EnumTypeParamShape> | CustomType<CustomTypeParamShape>>; | ||
type InternalModelFields = Record<string, InternalField | InternalRelationalField>; | ||
@@ -9,0 +11,0 @@ type ModelData = { |
@@ -1,4 +0,5 @@ | ||
import { Brand, SetTypeSubArg } from '@aws-amplify/data-schema-types'; | ||
import { SetTypeSubArg, Brand } from '@aws-amplify/data-schema-types'; | ||
import { Authorization } from './Authorization'; | ||
import { __auth } from './ModelField'; | ||
declare const brandName = "ref"; | ||
type RefTypeData = { | ||
@@ -16,3 +17,3 @@ type: 'ref'; | ||
}; | ||
export type RefType<T extends RefTypeParamShape, K extends keyof RefType<T> = never, Auth = undefined> = Brand<Omit<{ | ||
export type RefType<T extends RefTypeParamShape, K extends keyof RefType<T> = never, Auth = undefined> = Omit<{ | ||
/** | ||
@@ -29,3 +30,3 @@ * Marks a field as required. | ||
[__auth]?: Auth; | ||
}, 'ref'>; | ||
} & Brand<object, typeof brandName>; | ||
/** | ||
@@ -32,0 +33,0 @@ * Internal representation of Ref that exposes the `data` property. |
@@ -5,2 +5,3 @@ "use strict"; | ||
const ModelField_1 = require("./ModelField"); | ||
const brandName = 'ref'; | ||
function brandedBuilder(builder) { | ||
@@ -7,0 +8,0 @@ return builder; |
{ | ||
"name": "@aws-amplify/data-schema", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
200867
2590