@aws-amplify/data-schema 0.0.0-20240412222732
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/LICENSE +175 -0
- package/NOTICE +1 -0
- package/internals/package.json +6 -0
- package/lib-esm/index.d.ts +5 -0
- package/lib-esm/index.d.ts.map +1 -0
- package/lib-esm/index.js +28 -0
- package/lib-esm/src/Authorization.d.ts +287 -0
- package/lib-esm/src/Authorization.d.ts.map +1 -0
- package/lib-esm/src/Authorization.js +332 -0
- package/lib-esm/src/ClientSchema.d.ts +54 -0
- package/lib-esm/src/ClientSchema.d.ts.map +1 -0
- package/lib-esm/src/ClientSchema.js +2 -0
- package/lib-esm/src/CombineSchema.d.ts +19 -0
- package/lib-esm/src/CombineSchema.d.ts.map +1 -0
- package/lib-esm/src/CombineSchema.js +40 -0
- package/lib-esm/src/CustomOperation.d.ts +98 -0
- package/lib-esm/src/CustomOperation.d.ts.map +1 -0
- package/lib-esm/src/CustomOperation.js +67 -0
- package/lib-esm/src/CustomType.d.ts +36 -0
- package/lib-esm/src/CustomType.d.ts.map +1 -0
- package/lib-esm/src/CustomType.js +14 -0
- package/lib-esm/src/EnumType.d.ts +16 -0
- package/lib-esm/src/EnumType.d.ts.map +1 -0
- package/lib-esm/src/EnumType.js +17 -0
- package/lib-esm/src/Handler.d.ts +58 -0
- package/lib-esm/src/Handler.d.ts.map +1 -0
- package/lib-esm/src/Handler.js +48 -0
- package/lib-esm/src/MappedTypes/CustomOperations.d.ts +127 -0
- package/lib-esm/src/MappedTypes/CustomOperations.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/CustomOperations.js +2 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts +74 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.js +2 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.d.ts +84 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ForeignKeys.js +2 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts +38 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.js +2 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.d.ts +61 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.js +2 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.d.ts +26 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ModelMetadata.js +2 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts +70 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.js +2 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.d.ts +65 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.d.ts.map +1 -0
- package/lib-esm/src/MappedTypes/ResolveSchema.js +2 -0
- package/lib-esm/src/ModelField.d.ts +162 -0
- package/lib-esm/src/ModelField.d.ts.map +1 -0
- package/lib-esm/src/ModelField.js +209 -0
- package/lib-esm/src/ModelIndex.d.ts +19 -0
- package/lib-esm/src/ModelIndex.d.ts.map +1 -0
- package/lib-esm/src/ModelIndex.js +33 -0
- package/lib-esm/src/ModelRelationalField.d.ts +119 -0
- package/lib-esm/src/ModelRelationalField.d.ts.map +1 -0
- package/lib-esm/src/ModelRelationalField.js +120 -0
- package/lib-esm/src/ModelSchema.d.ts +107 -0
- package/lib-esm/src/ModelSchema.d.ts.map +1 -0
- package/lib-esm/src/ModelSchema.js +162 -0
- package/lib-esm/src/ModelType.d.ts +85 -0
- package/lib-esm/src/ModelType.d.ts.map +1 -0
- package/lib-esm/src/ModelType.js +64 -0
- package/lib-esm/src/RefType.d.ts +59 -0
- package/lib-esm/src/RefType.d.ts.map +1 -0
- package/lib-esm/src/RefType.js +47 -0
- package/lib-esm/src/SchemaProcessor.d.ts +11 -0
- package/lib-esm/src/SchemaProcessor.d.ts.map +1 -0
- package/lib-esm/src/SchemaProcessor.js +1106 -0
- package/lib-esm/src/index.d.ts +13 -0
- package/lib-esm/src/index.d.ts.map +1 -0
- package/lib-esm/src/index.js +43 -0
- package/lib-esm/src/internals/index.d.ts +2 -0
- package/lib-esm/src/internals/index.d.ts.map +1 -0
- package/lib-esm/src/internals/index.js +5 -0
- package/lib-esm/src/util/Brand.d.ts +36 -0
- package/lib-esm/src/util/Brand.d.ts.map +1 -0
- package/lib-esm/src/util/Brand.js +32 -0
- package/lib-esm/src/util/IndexLimit.d.ts +8 -0
- package/lib-esm/src/util/IndexLimit.d.ts.map +1 -0
- package/lib-esm/src/util/IndexLimit.js +2 -0
- package/lib-esm/src/util/SpreadTuple.d.ts +7 -0
- package/lib-esm/src/util/SpreadTuple.d.ts.map +1 -0
- package/lib-esm/src/util/SpreadTuple.js +2 -0
- package/lib-esm/src/util/index.d.ts +4 -0
- package/lib-esm/src/util/index.d.ts.map +1 -0
- package/lib-esm/src/util/index.js +6 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ipAddress = exports.url = exports.phone = exports.json = exports.email = exports.timestamp = exports.datetime = exports.time = exports.date = exports.boolean = exports.float = exports.integer = exports.string = exports.id = exports.ModelFieldDataType = exports.ModelFieldType = exports.__auth = void 0;
|
|
4
|
+
const util_1 = require("./util");
|
|
5
|
+
/**
|
|
6
|
+
* Used to "attach" auth types to ModelField without exposing them on the builder.
|
|
7
|
+
*/
|
|
8
|
+
exports.__auth = Symbol('__auth');
|
|
9
|
+
const brandName = 'modelField';
|
|
10
|
+
var ModelFieldType;
|
|
11
|
+
(function (ModelFieldType) {
|
|
12
|
+
ModelFieldType["Id"] = "ID";
|
|
13
|
+
ModelFieldType["String"] = "String";
|
|
14
|
+
ModelFieldType["Integer"] = "Int";
|
|
15
|
+
ModelFieldType["Float"] = "Float";
|
|
16
|
+
ModelFieldType["Boolean"] = "Boolean";
|
|
17
|
+
ModelFieldType["Date"] = "AWSDate";
|
|
18
|
+
ModelFieldType["Time"] = "AWSTime";
|
|
19
|
+
ModelFieldType["DateTime"] = "AWSDateTime";
|
|
20
|
+
ModelFieldType["Timestamp"] = "AWSTimestamp";
|
|
21
|
+
ModelFieldType["Email"] = "AWSEmail";
|
|
22
|
+
ModelFieldType["JSON"] = "AWSJSON";
|
|
23
|
+
ModelFieldType["Phone"] = "AWSPhone";
|
|
24
|
+
ModelFieldType["Url"] = "AWSURL";
|
|
25
|
+
ModelFieldType["IPAddress"] = "AWSIPAddress";
|
|
26
|
+
})(ModelFieldType || (exports.ModelFieldType = ModelFieldType = {}));
|
|
27
|
+
var ModelFieldDataType;
|
|
28
|
+
(function (ModelFieldDataType) {
|
|
29
|
+
ModelFieldDataType["String"] = "string";
|
|
30
|
+
ModelFieldDataType["Number"] = "number";
|
|
31
|
+
ModelFieldDataType["Boolean"] = "boolean";
|
|
32
|
+
ModelFieldDataType["Date"] = "Date";
|
|
33
|
+
ModelFieldDataType["JSON"] = "any";
|
|
34
|
+
})(ModelFieldDataType || (exports.ModelFieldDataType = ModelFieldDataType = {}));
|
|
35
|
+
/**
|
|
36
|
+
* Model Field Implementation
|
|
37
|
+
*
|
|
38
|
+
* @typeParam T - holds the JS data type of the field; invoking the public methods changes this type accordingly
|
|
39
|
+
* @example
|
|
40
|
+
* string() => T = string | null
|
|
41
|
+
* string().array() => T = Array<string | null> | null
|
|
42
|
+
* string().array().required() => T = Array<string | null>
|
|
43
|
+
* string().required().array().required() => T = Array<string>
|
|
44
|
+
*
|
|
45
|
+
* @param fieldType - stores the GraphQL data type of the field
|
|
46
|
+
*/
|
|
47
|
+
function _field(fieldType) {
|
|
48
|
+
const _meta = {
|
|
49
|
+
lastInvokedMethod: null,
|
|
50
|
+
};
|
|
51
|
+
const data = {
|
|
52
|
+
fieldType,
|
|
53
|
+
required: false,
|
|
54
|
+
array: false,
|
|
55
|
+
arrayRequired: false,
|
|
56
|
+
default: undefined,
|
|
57
|
+
authorization: [],
|
|
58
|
+
};
|
|
59
|
+
const builder = {
|
|
60
|
+
required() {
|
|
61
|
+
if (_meta.lastInvokedMethod === 'array') {
|
|
62
|
+
data.arrayRequired = true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
data.required = true;
|
|
66
|
+
}
|
|
67
|
+
_meta.lastInvokedMethod = 'required';
|
|
68
|
+
return this;
|
|
69
|
+
},
|
|
70
|
+
array() {
|
|
71
|
+
data.array = true;
|
|
72
|
+
_meta.lastInvokedMethod = 'array';
|
|
73
|
+
return this;
|
|
74
|
+
},
|
|
75
|
+
default(val) {
|
|
76
|
+
data.default = val;
|
|
77
|
+
_meta.lastInvokedMethod = 'default';
|
|
78
|
+
return this;
|
|
79
|
+
},
|
|
80
|
+
authorization(rules) {
|
|
81
|
+
data.authorization = rules;
|
|
82
|
+
_meta.lastInvokedMethod = 'authorization';
|
|
83
|
+
return this;
|
|
84
|
+
},
|
|
85
|
+
...(0, util_1.brand)(brandName),
|
|
86
|
+
};
|
|
87
|
+
// this double cast gives us a Subtyping Constraint i.e., hides `data` from the public API,
|
|
88
|
+
// but makes it available internally when needed
|
|
89
|
+
return { ...builder, data };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A unique identifier scalar type. This scalar is serialized like a String but isn't meant to be human-readable.
|
|
93
|
+
* If not specified on create operations, a ULID will be auto-generated service-side.
|
|
94
|
+
* @returns ID field definition
|
|
95
|
+
*/
|
|
96
|
+
function id() {
|
|
97
|
+
return _field(ModelFieldType.Id);
|
|
98
|
+
}
|
|
99
|
+
exports.id = id;
|
|
100
|
+
/**
|
|
101
|
+
* A string scalar type that is represented server-side as a UTF-8 character sequence.
|
|
102
|
+
* @returns string field definition
|
|
103
|
+
*/
|
|
104
|
+
function string() {
|
|
105
|
+
return _field(ModelFieldType.String);
|
|
106
|
+
}
|
|
107
|
+
exports.string = string;
|
|
108
|
+
/**
|
|
109
|
+
* An integer scalar type with a supported value range between -(2^31) and 2^31-1.
|
|
110
|
+
* @returns integer field definition
|
|
111
|
+
*/
|
|
112
|
+
function integer() {
|
|
113
|
+
return _field(ModelFieldType.Integer);
|
|
114
|
+
}
|
|
115
|
+
exports.integer = integer;
|
|
116
|
+
/**
|
|
117
|
+
* A float scalar type following represented server-side as an IEEE 754 floating point value.
|
|
118
|
+
* @returns float field definition
|
|
119
|
+
*/
|
|
120
|
+
function float() {
|
|
121
|
+
return _field(ModelFieldType.Float);
|
|
122
|
+
}
|
|
123
|
+
exports.float = float;
|
|
124
|
+
/**
|
|
125
|
+
* A boolean scalar type that can be either true or false.
|
|
126
|
+
* @returns boolean field definition
|
|
127
|
+
*/
|
|
128
|
+
function boolean() {
|
|
129
|
+
return _field(ModelFieldType.Boolean);
|
|
130
|
+
}
|
|
131
|
+
exports.boolean = boolean;
|
|
132
|
+
/**
|
|
133
|
+
* A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.
|
|
134
|
+
* @returns date field definition
|
|
135
|
+
*/
|
|
136
|
+
function date() {
|
|
137
|
+
return _field(ModelFieldType.Date);
|
|
138
|
+
}
|
|
139
|
+
exports.date = date;
|
|
140
|
+
/**
|
|
141
|
+
* A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.
|
|
142
|
+
* @returns time field definition
|
|
143
|
+
*/
|
|
144
|
+
function time() {
|
|
145
|
+
return _field(ModelFieldType.Time);
|
|
146
|
+
}
|
|
147
|
+
exports.time = time;
|
|
148
|
+
/**
|
|
149
|
+
* A date time scalar type that is represented server-side as an extended ISO 8601 date and time string in the format `YYYY-MM-DDThh:mm:ss.sssZ`.
|
|
150
|
+
* @returns datetime field definition
|
|
151
|
+
*/
|
|
152
|
+
function datetime() {
|
|
153
|
+
return _field(ModelFieldType.DateTime);
|
|
154
|
+
}
|
|
155
|
+
exports.datetime = datetime;
|
|
156
|
+
/**
|
|
157
|
+
* A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.
|
|
158
|
+
* @returns timestamp field definition
|
|
159
|
+
*/
|
|
160
|
+
function timestamp() {
|
|
161
|
+
return _field(ModelFieldType.Timestamp);
|
|
162
|
+
}
|
|
163
|
+
exports.timestamp = timestamp;
|
|
164
|
+
/**
|
|
165
|
+
* An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.
|
|
166
|
+
* @returns email field definition
|
|
167
|
+
*/
|
|
168
|
+
function email() {
|
|
169
|
+
return _field(ModelFieldType.Email);
|
|
170
|
+
}
|
|
171
|
+
exports.email = email;
|
|
172
|
+
/**
|
|
173
|
+
* A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values
|
|
174
|
+
* rather than as the literal input strings.
|
|
175
|
+
* @returns JSON field definition
|
|
176
|
+
*/
|
|
177
|
+
function json() {
|
|
178
|
+
return _field(ModelFieldType.JSON);
|
|
179
|
+
}
|
|
180
|
+
exports.json = json;
|
|
181
|
+
/**
|
|
182
|
+
* A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces
|
|
183
|
+
* or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering
|
|
184
|
+
* to the North American Numbering Plan.
|
|
185
|
+
* @returns phone number field definition
|
|
186
|
+
*/
|
|
187
|
+
function phone() {
|
|
188
|
+
return _field(ModelFieldType.Phone);
|
|
189
|
+
}
|
|
190
|
+
exports.phone = phone;
|
|
191
|
+
/**
|
|
192
|
+
* A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.
|
|
193
|
+
* URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.
|
|
194
|
+
* @returns URL field definition
|
|
195
|
+
*/
|
|
196
|
+
function url() {
|
|
197
|
+
return _field(ModelFieldType.Url);
|
|
198
|
+
}
|
|
199
|
+
exports.url = url;
|
|
200
|
+
/**
|
|
201
|
+
* A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses
|
|
202
|
+
* are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)
|
|
203
|
+
* to indicate subnet mask.
|
|
204
|
+
* @returns IP address field definition
|
|
205
|
+
*/
|
|
206
|
+
function ipAddress() {
|
|
207
|
+
return _field(ModelFieldType.IPAddress);
|
|
208
|
+
}
|
|
209
|
+
exports.ipAddress = ipAddress;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Brand } from './util';
|
|
2
|
+
declare const brandName = "modelIndexType";
|
|
3
|
+
export type ModelIndexData = {
|
|
4
|
+
partitionKey: string;
|
|
5
|
+
sortKeys: readonly unknown[];
|
|
6
|
+
indexName: string;
|
|
7
|
+
queryField: string;
|
|
8
|
+
};
|
|
9
|
+
export type InternalModelIndexType = ModelIndexType<any, any, any, any> & {
|
|
10
|
+
data: ModelIndexData;
|
|
11
|
+
};
|
|
12
|
+
export type ModelIndexType<ModelFieldKeys extends string, PK, SK = readonly [], QueryField = never, K extends keyof ModelIndexType<any, any, any, any> = never> = Omit<{
|
|
13
|
+
sortKeys<FieldKeys extends ModelFieldKeys = ModelFieldKeys, const SK extends ReadonlyArray<Exclude<FieldKeys, PK>> = readonly []>(sortKeys: SK): ModelIndexType<FieldKeys, PK, SK, QueryField, K | 'sortKeys'>;
|
|
14
|
+
name(name: string): ModelIndexType<ModelFieldKeys, PK, SK, QueryField, K | 'name'>;
|
|
15
|
+
queryField<QF extends string = never, MF extends ModelFieldKeys = ModelFieldKeys>(field: QF): ModelIndexType<MF, PK, SK, QF, K | 'queryField'>;
|
|
16
|
+
}, K> & Brand<typeof brandName>;
|
|
17
|
+
export declare function modelIndex<ModelFieldKeys extends string, PK extends ModelFieldKeys, SK = readonly [], QueryField = never>(partitionKeyFieldName: PK): ModelIndexType<ModelFieldKeys, PK, SK, QueryField, never>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=ModelIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelIndex.d.ts","sourceRoot":"","sources":["../../src/ModelIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,MAAM,QAAQ,CAAC;AAEtC,QAAA,MAAM,SAAS,mBAAmB,CAAC;AAEnC,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG;IACxE,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,cAAc,SAAS,MAAM,EAC7B,EAAE,EACF,EAAE,GAAG,SAAS,EAAE,EAChB,UAAU,GAAG,KAAK,EAClB,CAAC,SAAS,MAAM,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,IACxD,IAAI,CACN;IACE,QAAQ,CACN,SAAS,SAAS,cAAc,GAAG,cAAc,EACjD,KAAK,CAAC,EAAE,SAAS,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,EAEpE,QAAQ,EAAE,EAAE,GACX,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;IACjE,IAAI,CACF,IAAI,EAAE,MAAM,GACX,cAAc,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC;IAClE,UAAU,CACR,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,cAAc,GAAG,cAAc,EAE1C,KAAK,EAAE,EAAE,GACR,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC;CACrD,EACD,CAAC,CACF,GACC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AA0C1B,wBAAgB,UAAU,CACxB,cAAc,SAAS,MAAM,EAC7B,EAAE,SAAS,cAAc,EACzB,EAAE,GAAG,SAAS,EAAE,EAChB,UAAU,GAAG,KAAK,EAClB,qBAAqB,EAAE,EAAE,6DAE1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modelIndex = void 0;
|
|
4
|
+
const util_1 = require("./util");
|
|
5
|
+
const brandName = 'modelIndexType';
|
|
6
|
+
function _modelIndex(partitionKeyFieldName) {
|
|
7
|
+
const data = {
|
|
8
|
+
partitionKey: partitionKeyFieldName,
|
|
9
|
+
sortKeys: [],
|
|
10
|
+
indexName: '',
|
|
11
|
+
queryField: '',
|
|
12
|
+
};
|
|
13
|
+
const builder = {
|
|
14
|
+
sortKeys(sortKeys) {
|
|
15
|
+
data.sortKeys = sortKeys;
|
|
16
|
+
return this;
|
|
17
|
+
},
|
|
18
|
+
name(name) {
|
|
19
|
+
data.indexName = name;
|
|
20
|
+
return this;
|
|
21
|
+
},
|
|
22
|
+
queryField(field) {
|
|
23
|
+
data.queryField = field;
|
|
24
|
+
return this;
|
|
25
|
+
},
|
|
26
|
+
...(0, util_1.brand)(brandName),
|
|
27
|
+
};
|
|
28
|
+
return { ...builder, data };
|
|
29
|
+
}
|
|
30
|
+
function modelIndex(partitionKeyFieldName) {
|
|
31
|
+
return _modelIndex(partitionKeyFieldName);
|
|
32
|
+
}
|
|
33
|
+
exports.modelIndex = modelIndex;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SetTypeSubArg } from '@aws-amplify/data-schema-types';
|
|
2
|
+
import { Brand } from './util';
|
|
3
|
+
import { Authorization } from './Authorization';
|
|
4
|
+
/**
|
|
5
|
+
* Used to "attach" auth types to ModelField without exposing them on the builder.
|
|
6
|
+
*/
|
|
7
|
+
export declare const __auth: unique symbol;
|
|
8
|
+
declare const brandName = "modelRelationalField";
|
|
9
|
+
export declare enum ModelRelationshipTypes {
|
|
10
|
+
hasOne = "hasOne",
|
|
11
|
+
hasMany = "hasMany",
|
|
12
|
+
belongsTo = "belongsTo",
|
|
13
|
+
manyToMany = "manyToMany"
|
|
14
|
+
}
|
|
15
|
+
type RelationshipTypes = `${ModelRelationshipTypes}`;
|
|
16
|
+
type ModelRelationalFieldData = {
|
|
17
|
+
fieldType: 'model';
|
|
18
|
+
type: ModelRelationshipTypes;
|
|
19
|
+
relatedModel: string;
|
|
20
|
+
array: boolean;
|
|
21
|
+
valueRequired: boolean;
|
|
22
|
+
arrayRequired: boolean;
|
|
23
|
+
relationName?: string;
|
|
24
|
+
references?: string[];
|
|
25
|
+
authorization: Authorization<any, any, any>[];
|
|
26
|
+
};
|
|
27
|
+
export type ModelRelationalFieldParamShape = {
|
|
28
|
+
type: 'model';
|
|
29
|
+
relationshipType: string;
|
|
30
|
+
relatedModel: string;
|
|
31
|
+
array: boolean;
|
|
32
|
+
valueRequired: boolean;
|
|
33
|
+
references?: string[];
|
|
34
|
+
arrayRequired: boolean;
|
|
35
|
+
relationName?: string;
|
|
36
|
+
};
|
|
37
|
+
type ModelRelationalFieldFunctions<T extends ModelRelationalFieldParamShape, RM extends string | symbol, K extends keyof ModelRelationalField<T, RM> = never> = {
|
|
38
|
+
/**
|
|
39
|
+
* When set, it requires the value of the relationship type to be required.
|
|
40
|
+
*/
|
|
41
|
+
valueRequired(): ModelRelationalField<SetTypeSubArg<T, 'valueRequired', true>, K | 'valueRequired'>;
|
|
42
|
+
/**
|
|
43
|
+
* Reference sets the foreign key on which to establish the relationship
|
|
44
|
+
*/
|
|
45
|
+
references(references: string[]): ModelRelationalField<SetTypeSubArg<T, 'references', string[]>, K | 'references'>;
|
|
46
|
+
/**
|
|
47
|
+
* When set, it requires the relationship to always return a value
|
|
48
|
+
*/
|
|
49
|
+
required(): ModelRelationalField<SetTypeSubArg<T, 'arrayRequired', true>, K | 'required'>;
|
|
50
|
+
/**
|
|
51
|
+
* When set, it requires the relationship to always return an array value
|
|
52
|
+
* @deprecated this modifier should not be used and will be removed
|
|
53
|
+
* in the next minor version of this package.
|
|
54
|
+
*/
|
|
55
|
+
arrayRequired(): ModelRelationalField<SetTypeSubArg<T, 'arrayRequired', true>, K | 'arrayRequired'>;
|
|
56
|
+
/**
|
|
57
|
+
* Configures field-level authorization rules. Pass in an array of authorizations `(a.allow.____)` to mix and match
|
|
58
|
+
* multiple authorization rules for this field.
|
|
59
|
+
*/
|
|
60
|
+
authorization<AuthRuleType extends Authorization<any, any, any>>(rules: AuthRuleType[]): ModelRelationalField<T, K | 'authorization', K, AuthRuleType>;
|
|
61
|
+
};
|
|
62
|
+
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> & {
|
|
63
|
+
[__auth]?: Auth;
|
|
64
|
+
} & Brand<typeof brandName>;
|
|
65
|
+
/**
|
|
66
|
+
* Internal representation of Model Field that exposes the `data` property.
|
|
67
|
+
* Used at buildtime.
|
|
68
|
+
*/
|
|
69
|
+
export type InternalRelationalField = ModelRelationalField<ModelRelationalFieldParamShape, string, never> & {
|
|
70
|
+
data: ModelRelationalFieldData;
|
|
71
|
+
};
|
|
72
|
+
export type RelationTypeFunctionOmitMapping<Type extends ModelRelationshipTypes> = Type extends ModelRelationshipTypes.belongsTo ? 'required' | 'arrayRequired' | 'valueRequired' : Type extends ModelRelationshipTypes.hasMany ? 'required' : Type extends ModelRelationshipTypes.hasOne ? 'arrayRequired' | 'valueRequired' : Type extends ModelRelationshipTypes.manyToMany ? 'required' | 'references' : never;
|
|
73
|
+
export type ModelRelationalTypeArgFactory<RM extends string, RT extends RelationshipTypes, IsArray extends boolean, RelationName extends string | undefined = undefined> = {
|
|
74
|
+
type: 'model';
|
|
75
|
+
relatedModel: RM;
|
|
76
|
+
relationshipType: RT;
|
|
77
|
+
array: IsArray;
|
|
78
|
+
valueRequired: false;
|
|
79
|
+
arrayRequired: false;
|
|
80
|
+
relationName: RelationName;
|
|
81
|
+
references: string[];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Create a one-directional one-to-one relationship between two models using the `hasOne("MODEL_NAME")` method.
|
|
85
|
+
* A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field
|
|
86
|
+
* unless overwritten with the `identifier()` method.
|
|
87
|
+
* @param relatedModel the name of the related model
|
|
88
|
+
* @returns a one-to-one relationship definition
|
|
89
|
+
*/
|
|
90
|
+
export declare function hasOne<RM extends string>(relatedModel: RM): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.hasOne, false, undefined>, RM, "valueRequired" | "arrayRequired", undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* Create a one-directional one-to-many relationship between two models using the `hasMany()` method.
|
|
93
|
+
* @param relatedModel the name of the related model
|
|
94
|
+
* @returns a one-to-many relationship definition
|
|
95
|
+
*/
|
|
96
|
+
export declare function hasMany<RM extends string>(relatedModel: RM): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.hasMany, true, undefined>, RM, "required", undefined>;
|
|
97
|
+
/**
|
|
98
|
+
* Make a `hasOne()` or `hasMany()` relationship bi-directional using the `belongsTo()` method.
|
|
99
|
+
* The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from
|
|
100
|
+
* parent to the related model.
|
|
101
|
+
* @param relatedModel name of the related `.hasOne()` or `.hasMany()` model
|
|
102
|
+
* @returns a belong-to relationship definition
|
|
103
|
+
*/
|
|
104
|
+
export declare function belongsTo<RM extends string>(relatedModel: RM): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.belongsTo, false, undefined>, RM, "required" | "valueRequired" | "arrayRequired", undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* Create a many-to-many relationship between two models with the manyToMany() method.
|
|
107
|
+
* Provide a common relationName on both models to join them into a many-to-many relationship.
|
|
108
|
+
* Under the hood a many-to-many relationship is modeled with a "join table" with corresponding
|
|
109
|
+
* `hasMany()` relationships between the two related models. You must set the same `manyToMany()`
|
|
110
|
+
* field on both models of the relationship.
|
|
111
|
+
* @param relatedModel name of the related model
|
|
112
|
+
* @param opts pass in the `relationName` that will serve as the join table name for this many-to-many relationship
|
|
113
|
+
* @returns a many-to-many relationship definition
|
|
114
|
+
*/
|
|
115
|
+
export declare function manyToMany<RM extends string, RN extends string>(relatedModel: RM, opts: {
|
|
116
|
+
relationName: RN;
|
|
117
|
+
}): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.manyToMany, true, RN>, RM, "required" | "references", undefined>;
|
|
118
|
+
export {};
|
|
119
|
+
//# sourceMappingURL=ModelRelationalField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelRelationalField.d.ts","sourceRoot":"","sources":["../../src/ModelRelationalField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,MAAM,eAAmB,CAAC;AAEvC,QAAA,MAAM,SAAS,yBAA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B,CAAC,OAAO,GACzC,UAAU,GACV,IAAI,SAAS,sBAAsB,CAAC,MAAM,GACxC,eAAe,GAAG,eAAe,GACjC,IAAI,SAAS,sBAAsB,CAAC,UAAU,GAC5C,UAAU,GAAG,YAAY,GACzB,KAAK,CAAC;AAmEhB,MAAM,MAAM,6BAA6B,CACvC,EAAE,SAAS,MAAM,EACjB,EAAE,SAAS,iBAAiB,EAC5B,OAAO,SAAS,OAAO,EACvB,YAAY,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,IACjD;IACF,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,EAAE,CAAC;IACjB,gBAAgB,EAAE,EAAE,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,KAAK,CAAC;IACrB,aAAa,EAAE,KAAK,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,YAAY,EAAE,EAAE,8JAMzD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,YAAY,EAAE,EAAE,uIAM1D;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,YAAY,EAAE,EAAE,8KAM5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,MAAM,EAC7D,YAAY,EAAE,EAAE,EAChB,IAAI,EAAE;IAAE,YAAY,EAAE,EAAE,CAAA;CAAE,kJAY3B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.manyToMany = exports.belongsTo = exports.hasMany = exports.hasOne = exports.ModelRelationshipTypes = exports.__auth = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Used to "attach" auth types to ModelField without exposing them on the builder.
|
|
6
|
+
*/
|
|
7
|
+
exports.__auth = Symbol('__auth');
|
|
8
|
+
const brandName = 'modelRelationalField';
|
|
9
|
+
var ModelRelationshipTypes;
|
|
10
|
+
(function (ModelRelationshipTypes) {
|
|
11
|
+
ModelRelationshipTypes["hasOne"] = "hasOne";
|
|
12
|
+
ModelRelationshipTypes["hasMany"] = "hasMany";
|
|
13
|
+
ModelRelationshipTypes["belongsTo"] = "belongsTo";
|
|
14
|
+
ModelRelationshipTypes["manyToMany"] = "manyToMany";
|
|
15
|
+
})(ModelRelationshipTypes || (exports.ModelRelationshipTypes = ModelRelationshipTypes = {}));
|
|
16
|
+
const arrayTypeRelationships = ['hasMany', 'manyToMany'];
|
|
17
|
+
const relationalModifiers = [
|
|
18
|
+
'required',
|
|
19
|
+
'arrayRequired',
|
|
20
|
+
'valueRequired',
|
|
21
|
+
'references',
|
|
22
|
+
'authorization',
|
|
23
|
+
];
|
|
24
|
+
const relationModifierMap = {
|
|
25
|
+
belongsTo: ['authorization', 'references'],
|
|
26
|
+
hasMany: ['arrayRequired', 'valueRequired', 'authorization', 'references'],
|
|
27
|
+
hasOne: ['required', 'authorization', 'references'],
|
|
28
|
+
manyToMany: ['arrayRequired', 'valueRequired', 'authorization'],
|
|
29
|
+
};
|
|
30
|
+
function _modelRelationalField(type, relatedModel, relationName) {
|
|
31
|
+
const data = {
|
|
32
|
+
relatedModel,
|
|
33
|
+
type,
|
|
34
|
+
fieldType: 'model',
|
|
35
|
+
array: false,
|
|
36
|
+
valueRequired: false,
|
|
37
|
+
arrayRequired: false,
|
|
38
|
+
references: undefined,
|
|
39
|
+
relationName,
|
|
40
|
+
authorization: [],
|
|
41
|
+
};
|
|
42
|
+
if (arrayTypeRelationships.includes(type)) {
|
|
43
|
+
data.array = true;
|
|
44
|
+
}
|
|
45
|
+
const relationshipBuilderFunctions = {
|
|
46
|
+
required() {
|
|
47
|
+
data.arrayRequired = true;
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
arrayRequired() {
|
|
51
|
+
data.arrayRequired = true;
|
|
52
|
+
return this;
|
|
53
|
+
},
|
|
54
|
+
valueRequired() {
|
|
55
|
+
data.valueRequired = true;
|
|
56
|
+
return this;
|
|
57
|
+
},
|
|
58
|
+
references(references) {
|
|
59
|
+
data.references = references;
|
|
60
|
+
return this;
|
|
61
|
+
},
|
|
62
|
+
authorization(rules) {
|
|
63
|
+
data.authorization = rules;
|
|
64
|
+
return this;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const builder = Object.fromEntries(relationModifierMap[type].map((key) => [
|
|
68
|
+
key,
|
|
69
|
+
relationshipBuilderFunctions[key],
|
|
70
|
+
]));
|
|
71
|
+
return {
|
|
72
|
+
...builder,
|
|
73
|
+
data,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Create a one-directional one-to-one relationship between two models using the `hasOne("MODEL_NAME")` method.
|
|
78
|
+
* A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field
|
|
79
|
+
* unless overwritten with the `identifier()` method.
|
|
80
|
+
* @param relatedModel the name of the related model
|
|
81
|
+
* @returns a one-to-one relationship definition
|
|
82
|
+
*/
|
|
83
|
+
function hasOne(relatedModel) {
|
|
84
|
+
return _modelRelationalField(ModelRelationshipTypes.hasOne, relatedModel);
|
|
85
|
+
}
|
|
86
|
+
exports.hasOne = hasOne;
|
|
87
|
+
/**
|
|
88
|
+
* Create a one-directional one-to-many relationship between two models using the `hasMany()` method.
|
|
89
|
+
* @param relatedModel the name of the related model
|
|
90
|
+
* @returns a one-to-many relationship definition
|
|
91
|
+
*/
|
|
92
|
+
function hasMany(relatedModel) {
|
|
93
|
+
return _modelRelationalField(ModelRelationshipTypes.hasMany, relatedModel);
|
|
94
|
+
}
|
|
95
|
+
exports.hasMany = hasMany;
|
|
96
|
+
/**
|
|
97
|
+
* Make a `hasOne()` or `hasMany()` relationship bi-directional using the `belongsTo()` method.
|
|
98
|
+
* The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from
|
|
99
|
+
* parent to the related model.
|
|
100
|
+
* @param relatedModel name of the related `.hasOne()` or `.hasMany()` model
|
|
101
|
+
* @returns a belong-to relationship definition
|
|
102
|
+
*/
|
|
103
|
+
function belongsTo(relatedModel) {
|
|
104
|
+
return _modelRelationalField(ModelRelationshipTypes.belongsTo, relatedModel);
|
|
105
|
+
}
|
|
106
|
+
exports.belongsTo = belongsTo;
|
|
107
|
+
/**
|
|
108
|
+
* Create a many-to-many relationship between two models with the manyToMany() method.
|
|
109
|
+
* Provide a common relationName on both models to join them into a many-to-many relationship.
|
|
110
|
+
* Under the hood a many-to-many relationship is modeled with a "join table" with corresponding
|
|
111
|
+
* `hasMany()` relationships between the two related models. You must set the same `manyToMany()`
|
|
112
|
+
* field on both models of the relationship.
|
|
113
|
+
* @param relatedModel name of the related model
|
|
114
|
+
* @param opts pass in the `relationName` that will serve as the join table name for this many-to-many relationship
|
|
115
|
+
* @returns a many-to-many relationship definition
|
|
116
|
+
*/
|
|
117
|
+
function manyToMany(relatedModel, opts) {
|
|
118
|
+
return _modelRelationalField(ModelRelationshipTypes.manyToMany, relatedModel, opts.relationName);
|
|
119
|
+
}
|
|
120
|
+
exports.manyToMany = manyToMany;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { DerivedApiDefinition, SetTypeSubArg, SchemaConfiguration, DataSourceConfiguration, DatasourceEngine, UnionToIntersection } from '@aws-amplify/data-schema-types';
|
|
2
|
+
import { type ModelType, type ModelTypeParamShape, type InternalModel, SchemaModelType, AddRelationshipFieldsToModelTypeFields } from './ModelType';
|
|
3
|
+
import type { EnumType, EnumTypeParamShape } from './EnumType';
|
|
4
|
+
import type { CustomType, CustomTypeParamShape } from './CustomType';
|
|
5
|
+
import type { CustomOperation, CustomOperationParamShape, InternalCustom, MutationCustomOperation, QueryCustomOperation, SubscriptionCustomOperation } from './CustomOperation';
|
|
6
|
+
import { SchemaAuthorization } from './Authorization';
|
|
7
|
+
import { Brand } from './util';
|
|
8
|
+
import { ModelRelationalField, ModelRelationalFieldParamShape } from './ModelRelationalField';
|
|
9
|
+
export declare const rdsSchemaBrandName = "RDSSchema";
|
|
10
|
+
export declare const rdsSchemaBrand: Brand<"RDSSchema">;
|
|
11
|
+
export type RDSSchemaBrand = Brand<typeof rdsSchemaBrandName>;
|
|
12
|
+
export declare const ddbSchemaBrandName = "DDBSchema";
|
|
13
|
+
export type DDBSchemaBrand = Brand<typeof ddbSchemaBrandName>;
|
|
14
|
+
type SchemaContent = ModelType<ModelTypeParamShape, any> | CustomType<CustomTypeParamShape> | EnumType<EnumTypeParamShape> | CustomOperation<CustomOperationParamShape, any>;
|
|
15
|
+
type ModelSchemaContents = Record<string, SchemaContent>;
|
|
16
|
+
type InternalSchemaModels = Record<string, InternalModel | EnumType<any> | CustomType<any> | InternalCustom>;
|
|
17
|
+
export type ModelSchemaParamShape = {
|
|
18
|
+
types: ModelSchemaContents;
|
|
19
|
+
authorization: SchemaAuthorization<any, any, any>[];
|
|
20
|
+
configuration: SchemaConfiguration<any, any>;
|
|
21
|
+
};
|
|
22
|
+
export type RDSModelSchemaParamShape = ModelSchemaParamShape;
|
|
23
|
+
export type InternalSchema = {
|
|
24
|
+
data: {
|
|
25
|
+
types: InternalSchemaModels;
|
|
26
|
+
authorization: SchemaAuthorization<any, any, any>[];
|
|
27
|
+
configuration: SchemaConfiguration<any, any>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type BaseSchema<T extends ModelSchemaParamShape, IsRDS extends boolean = false> = {
|
|
31
|
+
data: T;
|
|
32
|
+
models: {
|
|
33
|
+
[TypeKey in keyof T['types']]: T['types'][TypeKey] extends ModelType<ModelTypeParamShape, never | 'identifier'> ? SchemaModelType<T['types'][TypeKey], TypeKey & string, IsRDS> : never;
|
|
34
|
+
};
|
|
35
|
+
transform: () => DerivedApiDefinition;
|
|
36
|
+
};
|
|
37
|
+
export type GenericModelSchema<T extends ModelSchemaParamShape> = BaseSchema<T> & Brand<typeof rdsSchemaBrandName | typeof ddbSchemaBrandName>;
|
|
38
|
+
export type ModelSchema<T extends ModelSchemaParamShape, UsedMethods extends 'authorization' | 'addRelationships' = never> = Omit<{
|
|
39
|
+
authorization: <AuthRules extends SchemaAuthorization<any, any, any>>(auth: AuthRules[]) => ModelSchema<SetTypeSubArg<T, 'authorization', AuthRules[]>, UsedMethods | 'authorization'>;
|
|
40
|
+
}, UsedMethods> & BaseSchema<T> & DDBSchemaBrand;
|
|
41
|
+
type RDSModelSchemaFunctions = 'addQueries' | 'addMutations' | 'addSubscriptions' | 'authorization' | 'relationships' | 'setAuthorization' | 'renameModelFields' | 'renameModels';
|
|
42
|
+
export type RDSModelSchema<T extends RDSModelSchemaParamShape, UsedMethods extends RDSModelSchemaFunctions = never, RelationshipTemplate extends Record<string, ModelRelationalField<ModelRelationalFieldParamShape, string, any, any>> = Record<string, ModelRelationalField<ModelRelationalFieldParamShape, string, any, any>>> = Omit<{
|
|
43
|
+
addQueries: <Queries extends Record<string, QueryCustomOperation>>(types: Queries) => RDSModelSchema<SetTypeSubArg<T, 'types', T['types'] & Queries>, UsedMethods | 'addQueries'>;
|
|
44
|
+
addMutations: <Mutations extends Record<string, MutationCustomOperation>>(types: Mutations) => RDSModelSchema<SetTypeSubArg<T, 'types', T['types'] & Mutations>, UsedMethods | 'addMutations'>;
|
|
45
|
+
addSubscriptions: <Subscriptions extends Record<string, SubscriptionCustomOperation>>(types: Subscriptions) => RDSModelSchema<SetTypeSubArg<T, 'types', T['types'] & Subscriptions>, UsedMethods | 'addSubscriptions'>;
|
|
46
|
+
authorization: <AuthRules extends SchemaAuthorization<any, any, any>>(auth: AuthRules[]) => RDSModelSchema<SetTypeSubArg<T, 'authorization', AuthRules[]>, UsedMethods | 'authorization'>;
|
|
47
|
+
setAuthorization: (callback: (models: BaseSchema<T, true>['models'], schema: RDSModelSchema<T, UsedMethods | 'setAuthorization'>) => void) => RDSModelSchema<T>;
|
|
48
|
+
relationships: <Relationships extends ReadonlyArray<Partial<Record<keyof T['types'], RelationshipTemplate>>>>(callback: (models: BaseSchema<T, true>['models']) => Relationships) => RDSModelSchema<UnionToIntersection<Relationships[number]> extends infer RelationshipsDefs ? RelationshipsDefs extends Record<string, RelationshipTemplate> ? SetTypeSubArg<T, 'types', {
|
|
49
|
+
[ModelName in keyof T['types']]: ModelName extends keyof RelationshipsDefs ? AddRelationshipFieldsToModelTypeFields<T['types'][ModelName], RelationshipsDefs[ModelName]> : T['types'][ModelName];
|
|
50
|
+
}> : T : T, UsedMethods | 'relationships'>;
|
|
51
|
+
renameModels: <NewName extends string, CurName extends string = keyof BaseSchema<T>['models'] & string, const ChangeLog extends readonly [CurName, NewName][] = []>(callback: () => ChangeLog) => RDSModelSchema<SetTypeSubArg<T, 'types', RenameModelArr<ChangeLog, T['types']>>, UsedMethods | 'renameModels'>;
|
|
52
|
+
}, UsedMethods> & BaseSchema<T, true> & RDSSchemaBrand;
|
|
53
|
+
type RenameModel<CurName extends string, NewName extends string, Types extends ModelSchemaContents> = {
|
|
54
|
+
[Type in keyof Types as Type extends CurName ? NewName : Type]: Types[Type];
|
|
55
|
+
};
|
|
56
|
+
type RenameModelArr<ChangeLog extends readonly [string, string][], Types extends ModelSchemaContents> = ChangeLog extends readonly [
|
|
57
|
+
infer CurPair extends [string, string],
|
|
58
|
+
...infer Rest extends readonly [string, string][]
|
|
59
|
+
] ? RenameModelArr<Rest, RenameModel<CurPair[0], CurPair[1], Types>> : Types;
|
|
60
|
+
/**
|
|
61
|
+
* Amplify API Next Model Schema shape
|
|
62
|
+
*/
|
|
63
|
+
export type ModelSchemaType = ModelSchema<ModelSchemaParamShape>;
|
|
64
|
+
/**
|
|
65
|
+
* Model Schema type guard
|
|
66
|
+
* @param schema - api-next ModelSchema or string
|
|
67
|
+
* @returns true if the given value is a ModelSchema
|
|
68
|
+
*/
|
|
69
|
+
export declare const isModelSchema: (schema: string | ModelSchemaType) => schema is ModelSchemaType;
|
|
70
|
+
type SchemaReturnType<DE extends DatasourceEngine, Types extends ModelSchemaContents> = DE extends 'dynamodb' ? ModelSchema<{
|
|
71
|
+
types: Types;
|
|
72
|
+
authorization: [];
|
|
73
|
+
configuration: any;
|
|
74
|
+
}> : RDSModelSchema<{
|
|
75
|
+
types: Types;
|
|
76
|
+
authorization: [];
|
|
77
|
+
configuration: any;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* The API and data model definition for Amplify Data. Pass in `{ <NAME>: a.model(...) }` to create a database table
|
|
81
|
+
* and exposes CRUDL operations via an API.
|
|
82
|
+
* @param types The API and data model definition
|
|
83
|
+
* @returns An API and data model definition to be deployed with Amplify (Gen 2) experience (`processSchema(...)`)
|
|
84
|
+
* or with the Amplify Data CDK construct (`@aws-amplify/data-construct`)
|
|
85
|
+
*/
|
|
86
|
+
export declare const schema: <Types extends ModelSchemaContents>(types: Types) => ModelSchema<{
|
|
87
|
+
types: Types;
|
|
88
|
+
authorization: [];
|
|
89
|
+
configuration: any;
|
|
90
|
+
}, never>;
|
|
91
|
+
/**
|
|
92
|
+
* Configure wraps schema definition with non-default config to allow usecases other than
|
|
93
|
+
* the default DynamoDB use-case.
|
|
94
|
+
*
|
|
95
|
+
* @param config The SchemaConfig augments the schema with content like the database type
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
export declare function configure<DE extends DatasourceEngine>(config: SchemaConfiguration<DE, DataSourceConfiguration<DE>>): {
|
|
99
|
+
schema: <Types extends ModelSchemaContents>(types: Types) => SchemaReturnType<DE, Types>;
|
|
100
|
+
};
|
|
101
|
+
export declare function isCustomPathData(obj: any): obj is CustomPathData;
|
|
102
|
+
export type CustomPathData = {
|
|
103
|
+
stack: string | undefined;
|
|
104
|
+
entry: string;
|
|
105
|
+
};
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=ModelSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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