@aws-amplify/data-schema 1.1.4 → 1.1.5
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/cjs/CustomOperation.js +46 -0
- package/dist/cjs/CustomOperation.js.map +1 -1
- package/dist/cjs/CustomType.js +32 -0
- package/dist/cjs/CustomType.js.map +1 -1
- package/dist/cjs/Handler.js +62 -0
- package/dist/cjs/Handler.js.map +1 -1
- package/dist/cjs/ModelRelationalField.js +82 -3
- package/dist/cjs/ModelRelationalField.js.map +1 -1
- package/dist/esm/CustomOperation.d.ts +46 -0
- package/dist/esm/CustomOperation.mjs +46 -0
- package/dist/esm/CustomOperation.mjs.map +1 -1
- package/dist/esm/CustomType.d.ts +32 -0
- package/dist/esm/CustomType.mjs +32 -0
- package/dist/esm/CustomType.mjs.map +1 -1
- package/dist/esm/Handler.d.ts +62 -0
- package/dist/esm/Handler.mjs +62 -0
- package/dist/esm/Handler.mjs.map +1 -1
- package/dist/esm/ModelField.d.ts +1 -1
- package/dist/esm/ModelRelationalField.d.ts +83 -4
- package/dist/esm/ModelRelationalField.mjs +82 -3
- package/dist/esm/ModelRelationalField.mjs.map +1 -1
- package/dist/esm/RefType.d.ts +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/CustomOperation.ts +46 -0
- package/src/CustomType.ts +32 -0
- package/src/Handler.ts +62 -0
- package/src/ModelField.ts +1 -1
- package/src/ModelRelationalField.ts +83 -4
- package/src/RefType.ts +1 -1
package/dist/esm/Handler.d.ts
CHANGED
|
@@ -41,12 +41,74 @@ declare const customHandlerBrand = "customHandler";
|
|
|
41
41
|
export type CustomHandler = {
|
|
42
42
|
[dataSymbol]: CustomHandlerData;
|
|
43
43
|
} & Brand<typeof customHandlerBrand>;
|
|
44
|
+
/**
|
|
45
|
+
* Use a custom JavaScript resolver to handle a query, mutation, or subscription.
|
|
46
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/#step-2---configure-custom-business-logic-handler-code}
|
|
47
|
+
* @param customHandler `{ entry: "path-to-javascript-resolver-file.js", dataSource: "Data Source name added via "backend.data.add*DataSoruce(...)"}`
|
|
48
|
+
* @returns A JavaScript resolver attached to the query, mutation, or subscription.
|
|
49
|
+
* @example
|
|
50
|
+
* const schema = a.schema({
|
|
51
|
+
* Post: a.model({
|
|
52
|
+
* content: a.string(),
|
|
53
|
+
* likes: a.integer()
|
|
54
|
+
* .authorization(allow => [allow.authenticated().to(['read'])])
|
|
55
|
+
* }).authorization(allow => [
|
|
56
|
+
* allow.owner(),
|
|
57
|
+
* allow.authenticated().to(['read'])
|
|
58
|
+
* ]),
|
|
59
|
+
*
|
|
60
|
+
* likePost: a
|
|
61
|
+
* .mutation()
|
|
62
|
+
* .arguments({ postId: a.id() })
|
|
63
|
+
* .returns(a.ref('Post'))
|
|
64
|
+
* .authorization(allow => [allow.authenticated()])
|
|
65
|
+
* .handler(a.handler.custom({
|
|
66
|
+
* dataSource: a.ref('Post'),
|
|
67
|
+
* entry: './increment-like.js'
|
|
68
|
+
* }))
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
44
71
|
declare function custom(customHandler: CustomHandlerInput): CustomHandler;
|
|
45
72
|
export type FunctionHandlerData = DefineFunction | string;
|
|
46
73
|
declare const functionHandlerBrand = "functionHandler";
|
|
47
74
|
export type FunctionHandler = {
|
|
48
75
|
[dataSymbol]: FunctionHandlerData;
|
|
49
76
|
} & Brand<typeof functionHandlerBrand>;
|
|
77
|
+
/**
|
|
78
|
+
* Use a function created via `defineFunction` to handle the custom query/mutation/subscription. In your function handler,
|
|
79
|
+
* you can use the `Schema["YOUR_QUERY_OR_MUTATION_NAME"]["functionHandler"]` utility type to type the handler function.
|
|
80
|
+
* @example
|
|
81
|
+
* import {
|
|
82
|
+
* type ClientSchema,
|
|
83
|
+
* a,
|
|
84
|
+
* defineData,
|
|
85
|
+
* defineFunction // 1.Import "defineFunction" to create new functions
|
|
86
|
+
* } from '@aws-amplify/backend';
|
|
87
|
+
*
|
|
88
|
+
* // 2. define a function
|
|
89
|
+
* const echoHandler = defineFunction({
|
|
90
|
+
* entry: './echo-handler/handler.ts'
|
|
91
|
+
* })
|
|
92
|
+
*
|
|
93
|
+
* const schema = a.schema({
|
|
94
|
+
* EchoResponse: a.customType({
|
|
95
|
+
* content: a.string(),
|
|
96
|
+
* executionDuration: a.float()
|
|
97
|
+
* }),
|
|
98
|
+
*
|
|
99
|
+
* echo: a
|
|
100
|
+
* .query()
|
|
101
|
+
* .arguments({ content: a.string() })
|
|
102
|
+
* .returns(a.ref('EchoResponse'))
|
|
103
|
+
* .authorization(allow => [allow.publicApiKey()])
|
|
104
|
+
* // 3. set the function has the handler
|
|
105
|
+
* .handler(a.handler.function(echoHandler))
|
|
106
|
+
* });
|
|
107
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}
|
|
108
|
+
* @param fn A function created via `defineFunction`. Alternatively, you can pass in a "string" of the function name and pass
|
|
109
|
+
* in a corresponding value into the `functionMap` property of defineData.
|
|
110
|
+
* @returns A handler for the query / mutation / subscription
|
|
111
|
+
*/
|
|
50
112
|
declare function fcn(fn: FunctionHandlerData): FunctionHandler;
|
|
51
113
|
export declare const handler: {
|
|
52
114
|
inlineSql: typeof inlineSql;
|
package/dist/esm/Handler.mjs
CHANGED
|
@@ -24,6 +24,33 @@ function sqlReference(sqlFilePath) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
const customHandlerBrand = 'customHandler';
|
|
27
|
+
/**
|
|
28
|
+
* Use a custom JavaScript resolver to handle a query, mutation, or subscription.
|
|
29
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/#step-2---configure-custom-business-logic-handler-code}
|
|
30
|
+
* @param customHandler `{ entry: "path-to-javascript-resolver-file.js", dataSource: "Data Source name added via "backend.data.add*DataSoruce(...)"}`
|
|
31
|
+
* @returns A JavaScript resolver attached to the query, mutation, or subscription.
|
|
32
|
+
* @example
|
|
33
|
+
* const schema = a.schema({
|
|
34
|
+
* Post: a.model({
|
|
35
|
+
* content: a.string(),
|
|
36
|
+
* likes: a.integer()
|
|
37
|
+
* .authorization(allow => [allow.authenticated().to(['read'])])
|
|
38
|
+
* }).authorization(allow => [
|
|
39
|
+
* allow.owner(),
|
|
40
|
+
* allow.authenticated().to(['read'])
|
|
41
|
+
* ]),
|
|
42
|
+
*
|
|
43
|
+
* likePost: a
|
|
44
|
+
* .mutation()
|
|
45
|
+
* .arguments({ postId: a.id() })
|
|
46
|
+
* .returns(a.ref('Post'))
|
|
47
|
+
* .authorization(allow => [allow.authenticated()])
|
|
48
|
+
* .handler(a.handler.custom({
|
|
49
|
+
* dataSource: a.ref('Post'),
|
|
50
|
+
* entry: './increment-like.js'
|
|
51
|
+
* }))
|
|
52
|
+
* });
|
|
53
|
+
*/
|
|
27
54
|
function custom(customHandler) {
|
|
28
55
|
// used to determine caller directory in order to resolve relative path downstream
|
|
29
56
|
const stack = new Error().stack;
|
|
@@ -33,6 +60,41 @@ function custom(customHandler) {
|
|
|
33
60
|
};
|
|
34
61
|
}
|
|
35
62
|
const functionHandlerBrand = 'functionHandler';
|
|
63
|
+
/**
|
|
64
|
+
* Use a function created via `defineFunction` to handle the custom query/mutation/subscription. In your function handler,
|
|
65
|
+
* you can use the `Schema["YOUR_QUERY_OR_MUTATION_NAME"]["functionHandler"]` utility type to type the handler function.
|
|
66
|
+
* @example
|
|
67
|
+
* import {
|
|
68
|
+
* type ClientSchema,
|
|
69
|
+
* a,
|
|
70
|
+
* defineData,
|
|
71
|
+
* defineFunction // 1.Import "defineFunction" to create new functions
|
|
72
|
+
* } from '@aws-amplify/backend';
|
|
73
|
+
*
|
|
74
|
+
* // 2. define a function
|
|
75
|
+
* const echoHandler = defineFunction({
|
|
76
|
+
* entry: './echo-handler/handler.ts'
|
|
77
|
+
* })
|
|
78
|
+
*
|
|
79
|
+
* const schema = a.schema({
|
|
80
|
+
* EchoResponse: a.customType({
|
|
81
|
+
* content: a.string(),
|
|
82
|
+
* executionDuration: a.float()
|
|
83
|
+
* }),
|
|
84
|
+
*
|
|
85
|
+
* echo: a
|
|
86
|
+
* .query()
|
|
87
|
+
* .arguments({ content: a.string() })
|
|
88
|
+
* .returns(a.ref('EchoResponse'))
|
|
89
|
+
* .authorization(allow => [allow.publicApiKey()])
|
|
90
|
+
* // 3. set the function has the handler
|
|
91
|
+
* .handler(a.handler.function(echoHandler))
|
|
92
|
+
* });
|
|
93
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}
|
|
94
|
+
* @param fn A function created via `defineFunction`. Alternatively, you can pass in a "string" of the function name and pass
|
|
95
|
+
* in a corresponding value into the `functionMap` property of defineData.
|
|
96
|
+
* @returns A handler for the query / mutation / subscription
|
|
97
|
+
*/
|
|
36
98
|
function fcn(fn) {
|
|
37
99
|
return { [dataSymbol]: fn, ...buildHandler(functionHandlerBrand) };
|
|
38
100
|
}
|
package/dist/esm/Handler.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handler.mjs","sources":["../../src/Handler.ts"],"sourcesContent":["import { brand } from './util';\nconst dataSymbol = Symbol('Data');\nfunction buildHandler(brandName) {\n return brand(brandName);\n}\nexport function getHandlerData(handler) {\n return handler[dataSymbol];\n}\n//#region handler.inlineSql\nconst inlineSqlBrand = 'inlineSql';\nfunction inlineSql(sql) {\n return { [dataSymbol]: sql, ...buildHandler(inlineSqlBrand) };\n}\n//#endregion\n//#region handler.sqlReference\nconst sqlReferenceBrand = 'sqlReference';\nfunction sqlReference(sqlFilePath) {\n // used to determine caller directory in order to resolve relative path downstream\n const stack = new Error().stack;\n return {\n [dataSymbol]: { stack, entry: sqlFilePath },\n ...buildHandler(sqlReferenceBrand),\n };\n}\nconst customHandlerBrand = 'customHandler';\nfunction custom(customHandler) {\n // used to determine caller directory in order to resolve relative path downstream\n const stack = new Error().stack;\n return {\n [dataSymbol]: { ...customHandler, stack },\n ...buildHandler(customHandlerBrand),\n };\n}\nconst functionHandlerBrand = 'functionHandler';\nfunction fcn(fn) {\n return { [dataSymbol]: fn, ...buildHandler(functionHandlerBrand) };\n}\n//#endregion\nexport const handler = {\n inlineSql,\n sqlReference,\n custom,\n function: fcn,\n};\n"],"names":[],"mappings":";;AACA,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAClC,SAAS,YAAY,CAAC,SAAS,EAAE;AACjC,IAAI,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AACM,SAAS,cAAc,CAAC,OAAO,EAAE;AACxC,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AACD;AACA,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,SAAS,SAAS,CAAC,GAAG,EAAE;AACxB,IAAI,OAAO,EAAE,CAAC,UAAU,GAAG,GAAG,EAAE,GAAG,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;AAClE,CAAC;AACD;AACA;AACA,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,SAAS,YAAY,CAAC,WAAW,EAAE;AACnC;AACA,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO;AACX,QAAQ,CAAC,UAAU,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE;AACnD,QAAQ,GAAG,YAAY,CAAC,iBAAiB,CAAC;AAC1C,KAAK,CAAC;AACN,CAAC;AACD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,SAAS,MAAM,CAAC,aAAa,EAAE;AAC/B;AACA,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO;AACX,QAAQ,CAAC,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,KAAK,EAAE;AACjD,QAAQ,GAAG,YAAY,CAAC,kBAAkB,CAAC;AAC3C,KAAK,CAAC;AACN,CAAC;AACD,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAC/C,SAAS,GAAG,CAAC,EAAE,EAAE;AACjB,IAAI,OAAO,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,GAAG,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC;AACvE,CAAC;AACD;AACY,MAAC,OAAO,GAAG;AACvB,IAAI,SAAS;AACb,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,GAAG;AACjB;;;;"}
|
|
1
|
+
{"version":3,"file":"Handler.mjs","sources":["../../src/Handler.ts"],"sourcesContent":["import { brand } from './util';\nconst dataSymbol = Symbol('Data');\nfunction buildHandler(brandName) {\n return brand(brandName);\n}\nexport function getHandlerData(handler) {\n return handler[dataSymbol];\n}\n//#region handler.inlineSql\nconst inlineSqlBrand = 'inlineSql';\nfunction inlineSql(sql) {\n return { [dataSymbol]: sql, ...buildHandler(inlineSqlBrand) };\n}\n//#endregion\n//#region handler.sqlReference\nconst sqlReferenceBrand = 'sqlReference';\nfunction sqlReference(sqlFilePath) {\n // used to determine caller directory in order to resolve relative path downstream\n const stack = new Error().stack;\n return {\n [dataSymbol]: { stack, entry: sqlFilePath },\n ...buildHandler(sqlReferenceBrand),\n };\n}\nconst customHandlerBrand = 'customHandler';\n/**\n * Use a custom JavaScript resolver to handle a query, mutation, or subscription.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/#step-2---configure-custom-business-logic-handler-code}\n * @param customHandler `{ entry: \"path-to-javascript-resolver-file.js\", dataSource: \"Data Source name added via \"backend.data.add*DataSoruce(...)\"}`\n * @returns A JavaScript resolver attached to the query, mutation, or subscription.\n * @example\n * const schema = a.schema({\n * Post: a.model({\n * content: a.string(),\n * likes: a.integer()\n * .authorization(allow => [allow.authenticated().to(['read'])])\n * }).authorization(allow => [\n * allow.owner(),\n * allow.authenticated().to(['read'])\n * ]),\n *\n * likePost: a\n * .mutation()\n * .arguments({ postId: a.id() })\n * .returns(a.ref('Post'))\n * .authorization(allow => [allow.authenticated()])\n * .handler(a.handler.custom({\n * dataSource: a.ref('Post'),\n * entry: './increment-like.js'\n * }))\n * });\n */\nfunction custom(customHandler) {\n // used to determine caller directory in order to resolve relative path downstream\n const stack = new Error().stack;\n return {\n [dataSymbol]: { ...customHandler, stack },\n ...buildHandler(customHandlerBrand),\n };\n}\nconst functionHandlerBrand = 'functionHandler';\n/**\n * Use a function created via `defineFunction` to handle the custom query/mutation/subscription. In your function handler,\n * you can use the `Schema[\"YOUR_QUERY_OR_MUTATION_NAME\"][\"functionHandler\"]` utility type to type the handler function.\n * @example\n * import {\n * type ClientSchema,\n * a,\n * defineData,\n * defineFunction // 1.Import \"defineFunction\" to create new functions\n * } from '@aws-amplify/backend';\n *\n * // 2. define a function\n * const echoHandler = defineFunction({\n * entry: './echo-handler/handler.ts'\n * })\n *\n * const schema = a.schema({\n * EchoResponse: a.customType({\n * content: a.string(),\n * executionDuration: a.float()\n * }),\n *\n * echo: a\n * .query()\n * .arguments({ content: a.string() })\n * .returns(a.ref('EchoResponse'))\n * .authorization(allow => [allow.publicApiKey()])\n * // 3. set the function has the handler\n * .handler(a.handler.function(echoHandler))\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}\n * @param fn A function created via `defineFunction`. Alternatively, you can pass in a \"string\" of the function name and pass\n * in a corresponding value into the `functionMap` property of defineData.\n * @returns A handler for the query / mutation / subscription\n */\nfunction fcn(fn) {\n return { [dataSymbol]: fn, ...buildHandler(functionHandlerBrand) };\n}\n//#endregion\nexport const handler = {\n inlineSql,\n sqlReference,\n custom,\n function: fcn,\n};\n"],"names":[],"mappings":";;AACA,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAClC,SAAS,YAAY,CAAC,SAAS,EAAE;AACjC,IAAI,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC;AAC5B,CAAC;AACM,SAAS,cAAc,CAAC,OAAO,EAAE;AACxC,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AACD;AACA,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,SAAS,SAAS,CAAC,GAAG,EAAE;AACxB,IAAI,OAAO,EAAE,CAAC,UAAU,GAAG,GAAG,EAAE,GAAG,YAAY,CAAC,cAAc,CAAC,EAAE,CAAC;AAClE,CAAC;AACD;AACA;AACA,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,SAAS,YAAY,CAAC,WAAW,EAAE;AACnC;AACA,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO;AACX,QAAQ,CAAC,UAAU,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE;AACnD,QAAQ,GAAG,YAAY,CAAC,iBAAiB,CAAC;AAC1C,KAAK,CAAC;AACN,CAAC;AACD,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,MAAM,CAAC,aAAa,EAAE;AAC/B;AACA,IAAI,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;AACpC,IAAI,OAAO;AACX,QAAQ,CAAC,UAAU,GAAG,EAAE,GAAG,aAAa,EAAE,KAAK,EAAE;AACjD,QAAQ,GAAG,YAAY,CAAC,kBAAkB,CAAC;AAC3C,KAAK,CAAC;AACN,CAAC;AACD,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,GAAG,CAAC,EAAE,EAAE;AACjB,IAAI,OAAO,EAAE,CAAC,UAAU,GAAG,EAAE,EAAE,GAAG,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC;AACvE,CAAC;AACD;AACY,MAAC,OAAO,GAAG;AACvB,IAAI,SAAS;AACb,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,GAAG;AACjB;;;;"}
|
package/dist/esm/ModelField.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export type ModelField<T extends ModelFieldTypeParamOuter, K extends keyof Model
|
|
|
67
67
|
*/
|
|
68
68
|
default(value: ModelFieldTypeParamOuter): ModelField<T, K | 'default'>;
|
|
69
69
|
/**
|
|
70
|
-
* Configures field-level authorization rules. Pass in an array of authorizations `(
|
|
70
|
+
* Configures field-level authorization rules. Pass in an array of authorizations `(allow => allow.____)` to mix and match
|
|
71
71
|
* multiple authorization rules for this field.
|
|
72
72
|
*/
|
|
73
73
|
authorization<AuthRuleType extends Authorization<any, any, any>>(callback: (allow: Omit<AllowModifier, 'resource'>) => AuthRuleType | AuthRuleType[]): ModelField<T, K | 'authorization', AuthRuleType>;
|
|
@@ -41,7 +41,7 @@ type ModelRelationalFieldFunctions<T extends ModelRelationalFieldParamShape, RM
|
|
|
41
41
|
*/
|
|
42
42
|
required(): ModelRelationalField<SetTypeSubArg<T, 'arrayRequired', true>, K | 'required'>;
|
|
43
43
|
/**
|
|
44
|
-
* Configures field-level authorization rules. Pass in an array of authorizations `(
|
|
44
|
+
* Configures field-level authorization rules. Pass in an array of authorizations `(allow => allow.____)` to mix and match
|
|
45
45
|
* multiple authorization rules for this field.
|
|
46
46
|
*/
|
|
47
47
|
authorization<AuthRuleType extends Authorization<any, any, any>>(callback: (allow: AllowModifier) => AuthRuleType | AuthRuleType[]): ModelRelationalField<T, K | 'authorization', K, AuthRuleType>;
|
|
@@ -67,24 +67,103 @@ export type ModelRelationalTypeArgFactory<RM extends string, RT extends Relation
|
|
|
67
67
|
references: string[];
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
|
-
* Create
|
|
70
|
+
* Create one-to-one relationship between two models using the `hasOne("MODEL_NAME", "REFERENCE_FIELD(s)")` method.
|
|
71
71
|
* A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field
|
|
72
72
|
* unless overwritten with the `identifier()` method.
|
|
73
|
+
* @example
|
|
74
|
+
* const schema = a.schema({
|
|
75
|
+
* Cart: a.model({
|
|
76
|
+
* items: a.string().required().array(),
|
|
77
|
+
* // 1. Create reference field
|
|
78
|
+
* customerId: a.id(),
|
|
79
|
+
* // 2. Create relationship field with the reference field
|
|
80
|
+
* customer: a.belongsTo('Customer', 'customerId'),
|
|
81
|
+
* }),
|
|
82
|
+
* Customer: a.model({
|
|
83
|
+
* name: a.string(),
|
|
84
|
+
* // 3. Create relationship field with the reference field
|
|
85
|
+
* // from the Cart model
|
|
86
|
+
* activeCart: a.hasOne('Cart', 'customerId')
|
|
87
|
+
* }),
|
|
88
|
+
* });
|
|
89
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-a-one-to-one-relationship}
|
|
73
90
|
* @param relatedModel the name of the related model
|
|
91
|
+
* @param references the field(s) that should be used to reference the related model
|
|
74
92
|
* @returns a one-to-one relationship definition
|
|
75
93
|
*/
|
|
76
94
|
export declare function hasOne<RM extends string>(relatedModel: RM, references: string | string[]): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.hasOne, false>, RM, "valueRequired", undefined>;
|
|
77
95
|
/**
|
|
78
|
-
* Create a one-directional one-to-many relationship between two models using the `hasMany()` method.
|
|
96
|
+
* Create a one-directional one-to-many relationship between two models using the `hasMany("MODEL_NAME", "REFERENCE_FIELD(s)")` method.
|
|
97
|
+
* @example
|
|
98
|
+
* const schema = a.schema({
|
|
99
|
+
* Member: a.model({
|
|
100
|
+
* name: a.string().required(),
|
|
101
|
+
* // 1. Create a reference field
|
|
102
|
+
* teamId: a.id(),
|
|
103
|
+
* // 2. Create a belongsTo relationship with the reference field
|
|
104
|
+
* team: a.belongsTo('Team', 'teamId'),
|
|
105
|
+
* })
|
|
106
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
107
|
+
*
|
|
108
|
+
* Team: a.model({
|
|
109
|
+
* mantra: a.string().required(),
|
|
110
|
+
* // 3. Create a hasMany relationship with the reference field
|
|
111
|
+
* // from the `Member`s model.
|
|
112
|
+
* members: a.hasMany('Member', 'teamId'),
|
|
113
|
+
* })
|
|
114
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
115
|
+
* });
|
|
116
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-one-to-many-relationships}
|
|
79
117
|
* @param relatedModel the name of the related model
|
|
118
|
+
* @param references the field(s) that should be used to reference the related model
|
|
80
119
|
* @returns a one-to-many relationship definition
|
|
81
120
|
*/
|
|
82
121
|
export declare function hasMany<RM extends string>(relatedModel: RM, references: string | string[]): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.hasMany, true>, RM, "required", undefined>;
|
|
83
122
|
/**
|
|
84
|
-
*
|
|
123
|
+
* Use `belongsTo()` to create a field to query the related `hasOne()` or `hasMany()` relationship.
|
|
85
124
|
* The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from
|
|
86
125
|
* parent to the related model.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // one-to-many relationship
|
|
129
|
+
* const schema = a.schema({
|
|
130
|
+
* Member: a.model({
|
|
131
|
+
* name: a.string().required(),
|
|
132
|
+
* // 1. Create a reference field
|
|
133
|
+
* teamId: a.id(),
|
|
134
|
+
* // 2. Create a belongsTo relationship with the reference field
|
|
135
|
+
* team: a.belongsTo('Team', 'teamId'),
|
|
136
|
+
* })
|
|
137
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
138
|
+
*
|
|
139
|
+
* Team: a.model({
|
|
140
|
+
* mantra: a.string().required(),
|
|
141
|
+
* // 3. Create a hasMany relationship with the reference field
|
|
142
|
+
* // from the `Member`s model.
|
|
143
|
+
* members: a.hasMany('Member', 'teamId'),
|
|
144
|
+
* })
|
|
145
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
146
|
+
* });
|
|
147
|
+
* @example
|
|
148
|
+
* // one-to-one relationship
|
|
149
|
+
* const schema = a.schema({
|
|
150
|
+
* Cart: a.model({
|
|
151
|
+
* items: a.string().required().array(),
|
|
152
|
+
* // 1. Create reference field
|
|
153
|
+
* customerId: a.id(),
|
|
154
|
+
* // 2. Create relationship field with the reference field
|
|
155
|
+
* customer: a.belongsTo('Customer', 'customerId'),
|
|
156
|
+
* }),
|
|
157
|
+
* Customer: a.model({
|
|
158
|
+
* name: a.string(),
|
|
159
|
+
* // 3. Create relationship field with the reference field
|
|
160
|
+
* // from the Cart model
|
|
161
|
+
* activeCart: a.hasOne('Cart', 'customerId')
|
|
162
|
+
* }),
|
|
163
|
+
* });
|
|
164
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/}
|
|
87
165
|
* @param relatedModel name of the related `.hasOne()` or `.hasMany()` model
|
|
166
|
+
* @param references the field(s) that should be used to reference the related model
|
|
88
167
|
* @returns a belong-to relationship definition
|
|
89
168
|
*/
|
|
90
169
|
export declare function belongsTo<RM extends string>(relatedModel: RM, references: string | string[]): ModelRelationalField<ModelRelationalTypeArgFactory<RM, ModelRelationshipTypes.belongsTo, false>, RM, "required" | "valueRequired", undefined>;
|
|
@@ -52,28 +52,107 @@ function _modelRelationalField(type, relatedModel, references) {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Create
|
|
55
|
+
* Create one-to-one relationship between two models using the `hasOne("MODEL_NAME", "REFERENCE_FIELD(s)")` method.
|
|
56
56
|
* A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field
|
|
57
57
|
* unless overwritten with the `identifier()` method.
|
|
58
|
+
* @example
|
|
59
|
+
* const schema = a.schema({
|
|
60
|
+
* Cart: a.model({
|
|
61
|
+
* items: a.string().required().array(),
|
|
62
|
+
* // 1. Create reference field
|
|
63
|
+
* customerId: a.id(),
|
|
64
|
+
* // 2. Create relationship field with the reference field
|
|
65
|
+
* customer: a.belongsTo('Customer', 'customerId'),
|
|
66
|
+
* }),
|
|
67
|
+
* Customer: a.model({
|
|
68
|
+
* name: a.string(),
|
|
69
|
+
* // 3. Create relationship field with the reference field
|
|
70
|
+
* // from the Cart model
|
|
71
|
+
* activeCart: a.hasOne('Cart', 'customerId')
|
|
72
|
+
* }),
|
|
73
|
+
* });
|
|
74
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-a-one-to-one-relationship}
|
|
58
75
|
* @param relatedModel the name of the related model
|
|
76
|
+
* @param references the field(s) that should be used to reference the related model
|
|
59
77
|
* @returns a one-to-one relationship definition
|
|
60
78
|
*/
|
|
61
79
|
function hasOne(relatedModel, references) {
|
|
62
80
|
return _modelRelationalField(ModelRelationshipTypes.hasOne, relatedModel, Array.isArray(references) ? references : [references]);
|
|
63
81
|
}
|
|
64
82
|
/**
|
|
65
|
-
* Create a one-directional one-to-many relationship between two models using the `hasMany()` method.
|
|
83
|
+
* Create a one-directional one-to-many relationship between two models using the `hasMany("MODEL_NAME", "REFERENCE_FIELD(s)")` method.
|
|
84
|
+
* @example
|
|
85
|
+
* const schema = a.schema({
|
|
86
|
+
* Member: a.model({
|
|
87
|
+
* name: a.string().required(),
|
|
88
|
+
* // 1. Create a reference field
|
|
89
|
+
* teamId: a.id(),
|
|
90
|
+
* // 2. Create a belongsTo relationship with the reference field
|
|
91
|
+
* team: a.belongsTo('Team', 'teamId'),
|
|
92
|
+
* })
|
|
93
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
94
|
+
*
|
|
95
|
+
* Team: a.model({
|
|
96
|
+
* mantra: a.string().required(),
|
|
97
|
+
* // 3. Create a hasMany relationship with the reference field
|
|
98
|
+
* // from the `Member`s model.
|
|
99
|
+
* members: a.hasMany('Member', 'teamId'),
|
|
100
|
+
* })
|
|
101
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
102
|
+
* });
|
|
103
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-one-to-many-relationships}
|
|
66
104
|
* @param relatedModel the name of the related model
|
|
105
|
+
* @param references the field(s) that should be used to reference the related model
|
|
67
106
|
* @returns a one-to-many relationship definition
|
|
68
107
|
*/
|
|
69
108
|
function hasMany(relatedModel, references) {
|
|
70
109
|
return _modelRelationalField(ModelRelationshipTypes.hasMany, relatedModel, Array.isArray(references) ? references : [references]);
|
|
71
110
|
}
|
|
72
111
|
/**
|
|
73
|
-
*
|
|
112
|
+
* Use `belongsTo()` to create a field to query the related `hasOne()` or `hasMany()` relationship.
|
|
74
113
|
* The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from
|
|
75
114
|
* parent to the related model.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* // one-to-many relationship
|
|
118
|
+
* const schema = a.schema({
|
|
119
|
+
* Member: a.model({
|
|
120
|
+
* name: a.string().required(),
|
|
121
|
+
* // 1. Create a reference field
|
|
122
|
+
* teamId: a.id(),
|
|
123
|
+
* // 2. Create a belongsTo relationship with the reference field
|
|
124
|
+
* team: a.belongsTo('Team', 'teamId'),
|
|
125
|
+
* })
|
|
126
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
127
|
+
*
|
|
128
|
+
* Team: a.model({
|
|
129
|
+
* mantra: a.string().required(),
|
|
130
|
+
* // 3. Create a hasMany relationship with the reference field
|
|
131
|
+
* // from the `Member`s model.
|
|
132
|
+
* members: a.hasMany('Member', 'teamId'),
|
|
133
|
+
* })
|
|
134
|
+
* .authorization(allow => [allow.publicApiKey()]),
|
|
135
|
+
* });
|
|
136
|
+
* @example
|
|
137
|
+
* // one-to-one relationship
|
|
138
|
+
* const schema = a.schema({
|
|
139
|
+
* Cart: a.model({
|
|
140
|
+
* items: a.string().required().array(),
|
|
141
|
+
* // 1. Create reference field
|
|
142
|
+
* customerId: a.id(),
|
|
143
|
+
* // 2. Create relationship field with the reference field
|
|
144
|
+
* customer: a.belongsTo('Customer', 'customerId'),
|
|
145
|
+
* }),
|
|
146
|
+
* Customer: a.model({
|
|
147
|
+
* name: a.string(),
|
|
148
|
+
* // 3. Create relationship field with the reference field
|
|
149
|
+
* // from the Cart model
|
|
150
|
+
* activeCart: a.hasOne('Cart', 'customerId')
|
|
151
|
+
* }),
|
|
152
|
+
* });
|
|
153
|
+
* @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/}
|
|
76
154
|
* @param relatedModel name of the related `.hasOne()` or `.hasMany()` model
|
|
155
|
+
* @param references the field(s) that should be used to reference the related model
|
|
77
156
|
* @returns a belong-to relationship definition
|
|
78
157
|
*/
|
|
79
158
|
function belongsTo(relatedModel, references) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelRelationalField.mjs","sources":["../../src/ModelRelationalField.ts"],"sourcesContent":["import { allow } from './Authorization';\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexport const __auth = Symbol('__auth');\nconst brandName = 'modelRelationalField';\nexport var ModelRelationshipTypes;\n(function (ModelRelationshipTypes) {\n ModelRelationshipTypes[\"hasOne\"] = \"hasOne\";\n ModelRelationshipTypes[\"hasMany\"] = \"hasMany\";\n ModelRelationshipTypes[\"belongsTo\"] = \"belongsTo\";\n})(ModelRelationshipTypes || (ModelRelationshipTypes = {}));\nconst relationalModifiers = [\n 'required',\n 'valueRequired',\n 'authorization',\n];\nconst relationModifierMap = {\n belongsTo: ['authorization'],\n hasMany: ['valueRequired', 'authorization'],\n hasOne: ['required', 'authorization'],\n};\nfunction _modelRelationalField(type, relatedModel, references) {\n const data = {\n relatedModel,\n type,\n fieldType: 'model',\n array: false,\n valueRequired: false,\n arrayRequired: false,\n references,\n authorization: [],\n };\n data.array = type === 'hasMany';\n const relationshipBuilderFunctions = {\n required() {\n data.arrayRequired = true;\n return this;\n },\n valueRequired() {\n data.valueRequired = true;\n return this;\n },\n authorization(callback) {\n const rules = callback(allow);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n };\n const builder = Object.fromEntries(relationModifierMap[type].map((key) => [\n key,\n relationshipBuilderFunctions[key],\n ]));\n return {\n ...builder,\n data,\n };\n}\n/**\n * Create
|
|
1
|
+
{"version":3,"file":"ModelRelationalField.mjs","sources":["../../src/ModelRelationalField.ts"],"sourcesContent":["import { allow } from './Authorization';\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexport const __auth = Symbol('__auth');\nconst brandName = 'modelRelationalField';\nexport var ModelRelationshipTypes;\n(function (ModelRelationshipTypes) {\n ModelRelationshipTypes[\"hasOne\"] = \"hasOne\";\n ModelRelationshipTypes[\"hasMany\"] = \"hasMany\";\n ModelRelationshipTypes[\"belongsTo\"] = \"belongsTo\";\n})(ModelRelationshipTypes || (ModelRelationshipTypes = {}));\nconst relationalModifiers = [\n 'required',\n 'valueRequired',\n 'authorization',\n];\nconst relationModifierMap = {\n belongsTo: ['authorization'],\n hasMany: ['valueRequired', 'authorization'],\n hasOne: ['required', 'authorization'],\n};\nfunction _modelRelationalField(type, relatedModel, references) {\n const data = {\n relatedModel,\n type,\n fieldType: 'model',\n array: false,\n valueRequired: false,\n arrayRequired: false,\n references,\n authorization: [],\n };\n data.array = type === 'hasMany';\n const relationshipBuilderFunctions = {\n required() {\n data.arrayRequired = true;\n return this;\n },\n valueRequired() {\n data.valueRequired = true;\n return this;\n },\n authorization(callback) {\n const rules = callback(allow);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n };\n const builder = Object.fromEntries(relationModifierMap[type].map((key) => [\n key,\n relationshipBuilderFunctions[key],\n ]));\n return {\n ...builder,\n data,\n };\n}\n/**\n * Create one-to-one relationship between two models using the `hasOne(\"MODEL_NAME\", \"REFERENCE_FIELD(s)\")` method.\n * A hasOne relationship always uses a reference to the related model's identifier. Typically this is the `id` field\n * unless overwritten with the `identifier()` method.\n * @example\n * const schema = a.schema({\n * Cart: a.model({\n * items: a.string().required().array(),\n * // 1. Create reference field\n * customerId: a.id(),\n * // 2. Create relationship field with the reference field\n * customer: a.belongsTo('Customer', 'customerId'),\n * }),\n * Customer: a.model({\n * name: a.string(),\n * // 3. Create relationship field with the reference field\n * // from the Cart model\n * activeCart: a.hasOne('Cart', 'customerId')\n * }),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-a-one-to-one-relationship}\n * @param relatedModel the name of the related model\n * @param references the field(s) that should be used to reference the related model\n * @returns a one-to-one relationship definition\n */\nexport function hasOne(relatedModel, references) {\n return _modelRelationalField(ModelRelationshipTypes.hasOne, relatedModel, Array.isArray(references) ? references : [references]);\n}\n/**\n * Create a one-directional one-to-many relationship between two models using the `hasMany(\"MODEL_NAME\", \"REFERENCE_FIELD(s)\")` method.\n * @example\n * const schema = a.schema({\n * Member: a.model({\n * name: a.string().required(),\n * // 1. Create a reference field\n * teamId: a.id(),\n * // 2. Create a belongsTo relationship with the reference field\n * team: a.belongsTo('Team', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n *\n * Team: a.model({\n * mantra: a.string().required(),\n * // 3. Create a hasMany relationship with the reference field\n * // from the `Member`s model.\n * members: a.hasMany('Member', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/#model-one-to-many-relationships}\n * @param relatedModel the name of the related model\n * @param references the field(s) that should be used to reference the related model\n * @returns a one-to-many relationship definition\n */\nexport function hasMany(relatedModel, references) {\n return _modelRelationalField(ModelRelationshipTypes.hasMany, relatedModel, Array.isArray(references) ? references : [references]);\n}\n/**\n * Use `belongsTo()` to create a field to query the related `hasOne()` or `hasMany()` relationship.\n * The belongsTo() method requires that a hasOne() or hasMany() relationship already exists from\n * parent to the related model.\n *\n * @example\n * // one-to-many relationship\n * const schema = a.schema({\n * Member: a.model({\n * name: a.string().required(),\n * // 1. Create a reference field\n * teamId: a.id(),\n * // 2. Create a belongsTo relationship with the reference field\n * team: a.belongsTo('Team', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n *\n * Team: a.model({\n * mantra: a.string().required(),\n * // 3. Create a hasMany relationship with the reference field\n * // from the `Member`s model.\n * members: a.hasMany('Member', 'teamId'),\n * })\n * .authorization(allow => [allow.publicApiKey()]),\n * });\n * @example\n * // one-to-one relationship\n * const schema = a.schema({\n * Cart: a.model({\n * items: a.string().required().array(),\n * // 1. Create reference field\n * customerId: a.id(),\n * // 2. Create relationship field with the reference field\n * customer: a.belongsTo('Customer', 'customerId'),\n * }),\n * Customer: a.model({\n * name: a.string(),\n * // 3. Create relationship field with the reference field\n * // from the Cart model\n * activeCart: a.hasOne('Cart', 'customerId')\n * }),\n * });\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/relationships/}\n * @param relatedModel name of the related `.hasOne()` or `.hasMany()` model\n * @param references the field(s) that should be used to reference the related model\n * @returns a belong-to relationship definition\n */\nexport function belongsTo(relatedModel, references) {\n return _modelRelationalField(ModelRelationshipTypes.belongsTo, relatedModel, Array.isArray(references) ? references : [references]);\n}\n"],"names":[],"mappings":"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"}
|
package/dist/esm/RefType.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type RefType<T extends RefTypeParamShape, K extends keyof RefType<T> = ne
|
|
|
31
31
|
*/
|
|
32
32
|
array(): RefType<SetTypeSubArg<T, 'array', true>, Exclude<K, 'required'> | 'array'>;
|
|
33
33
|
/**
|
|
34
|
-
* Configures field-level authorization rules. Pass in an array of authorizations `(
|
|
34
|
+
* Configures field-level authorization rules. Pass in an array of authorizations `(allow => allow.____)` to mix and match
|
|
35
35
|
* multiple authorization rules for this field.
|
|
36
36
|
*/
|
|
37
37
|
authorization<AuthRuleType extends Authorization<any, any, any>>(callback: (allow: AllowModifier) => AuthRuleType | AuthRuleType[]): RefType<T, K | 'authorization', AuthRuleType>;
|