@aws-amplify/data-schema 1.19.0 → 1.20.1

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.
Files changed (198) hide show
  1. package/dist/cjs/Authorization.js.map +1 -1
  2. package/dist/cjs/ClientSchema/utilities/index.js.map +1 -1
  3. package/dist/cjs/CombineSchema.js +2 -2
  4. package/dist/cjs/CombineSchema.js.map +1 -1
  5. package/dist/cjs/CustomOperation.js +5 -5
  6. package/dist/cjs/CustomOperation.js.map +1 -1
  7. package/dist/cjs/CustomType.js +1 -2
  8. package/dist/cjs/CustomType.js.map +1 -1
  9. package/dist/cjs/EnumType.js +1 -2
  10. package/dist/cjs/EnumType.js.map +1 -1
  11. package/dist/cjs/Handler.js +2 -2
  12. package/dist/cjs/Handler.js.map +1 -1
  13. package/dist/cjs/ModelField.js +24 -17
  14. package/dist/cjs/ModelField.js.map +1 -1
  15. package/dist/cjs/ModelIndex.js +1 -2
  16. package/dist/cjs/ModelIndex.js.map +1 -1
  17. package/dist/cjs/ModelRelationshipField.js +4 -4
  18. package/dist/cjs/ModelRelationshipField.js.map +1 -1
  19. package/dist/cjs/ModelSchema.js +3 -3
  20. package/dist/cjs/ModelSchema.js.map +1 -1
  21. package/dist/cjs/ModelType.js +2 -2
  22. package/dist/cjs/ModelType.js.map +1 -1
  23. package/dist/cjs/RefType.js +1 -2
  24. package/dist/cjs/RefType.js.map +1 -1
  25. package/dist/cjs/SchemaProcessor.js +36 -5
  26. package/dist/cjs/SchemaProcessor.js.map +1 -1
  27. package/dist/cjs/Validate.js +145 -0
  28. package/dist/cjs/Validate.js.map +1 -0
  29. package/dist/cjs/a.js.map +1 -1
  30. package/dist/cjs/ai/ConversationSchemaGraphQLTypes.js.map +1 -1
  31. package/dist/cjs/ai/ConversationSchemaProcessor.js.map +1 -1
  32. package/dist/cjs/ai/ConversationType.js +3 -3
  33. package/dist/cjs/ai/ConversationType.js.map +1 -1
  34. package/dist/cjs/ai/ModelType.js +1 -2
  35. package/dist/cjs/ai/ModelType.js.map +1 -1
  36. package/dist/cjs/index.js.map +1 -1
  37. package/dist/cjs/internals/index.js.map +1 -1
  38. package/dist/cjs/runtime/addSchemaToClient.js +1 -2
  39. package/dist/cjs/runtime/addSchemaToClient.js.map +1 -1
  40. package/dist/cjs/runtime/addSchemaToClientWithInstance.js +1 -2
  41. package/dist/cjs/runtime/addSchemaToClientWithInstance.js.map +1 -1
  42. package/dist/cjs/runtime/bridge-types.js.map +1 -1
  43. package/dist/cjs/runtime/client/index.js.map +1 -1
  44. package/dist/cjs/runtime/client/index.v3.js.map +1 -1
  45. package/dist/cjs/runtime/index.js.map +1 -1
  46. package/dist/cjs/runtime/index.v3.js.map +1 -1
  47. package/dist/cjs/runtime/internals/APIClient.js +10 -10
  48. package/dist/cjs/runtime/internals/APIClient.js.map +1 -1
  49. package/dist/cjs/runtime/internals/ai/conversationMessageDeserializers.js.map +1 -1
  50. package/dist/cjs/runtime/internals/ai/conversationMessageSerializers.js.map +1 -1
  51. package/dist/cjs/runtime/internals/ai/conversationStreamEventDeserializers.js.map +1 -1
  52. package/dist/cjs/runtime/internals/ai/convertItemToConversation.js.map +1 -1
  53. package/dist/cjs/runtime/internals/ai/convertItemToConversationMessage.js.map +1 -1
  54. package/dist/cjs/runtime/internals/ai/createCreateConversationFunction.js.map +1 -1
  55. package/dist/cjs/runtime/internals/ai/createDeleteConversationFunction.js.map +1 -1
  56. package/dist/cjs/runtime/internals/ai/createGetConversationFunction.js.map +1 -1
  57. package/dist/cjs/runtime/internals/ai/createListConversationsFunction.js.map +1 -1
  58. package/dist/cjs/runtime/internals/ai/createListMessagesFunction.js.map +1 -1
  59. package/dist/cjs/runtime/internals/ai/createOnStreamEventFunction.js.map +1 -1
  60. package/dist/cjs/runtime/internals/ai/createSendMessageFunction.js.map +1 -1
  61. package/dist/cjs/runtime/internals/ai/createUpdateConversationFunction.js.map +1 -1
  62. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js +2 -2
  63. package/dist/cjs/runtime/internals/ai/getCustomUserAgentDetails.js.map +1 -1
  64. package/dist/cjs/runtime/internals/cancellation.js +2 -3
  65. package/dist/cjs/runtime/internals/cancellation.js.map +1 -1
  66. package/dist/cjs/runtime/internals/clientUtils.js.map +1 -1
  67. package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js +4 -5
  68. package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js.map +1 -1
  69. package/dist/cjs/runtime/internals/index.js.map +1 -1
  70. package/dist/cjs/runtime/internals/operations/custom.js +1 -2
  71. package/dist/cjs/runtime/internals/operations/custom.js.map +1 -1
  72. package/dist/cjs/runtime/internals/operations/get.js +1 -2
  73. package/dist/cjs/runtime/internals/operations/get.js.map +1 -1
  74. package/dist/cjs/runtime/internals/operations/indexQuery.js +1 -2
  75. package/dist/cjs/runtime/internals/operations/indexQuery.js.map +1 -1
  76. package/dist/cjs/runtime/internals/operations/list.js +1 -2
  77. package/dist/cjs/runtime/internals/operations/list.js.map +1 -1
  78. package/dist/cjs/runtime/internals/operations/observeQuery.js +1 -2
  79. package/dist/cjs/runtime/internals/operations/observeQuery.js.map +1 -1
  80. package/dist/cjs/runtime/internals/operations/subscription.js +1 -2
  81. package/dist/cjs/runtime/internals/operations/subscription.js.map +1 -1
  82. package/dist/cjs/runtime/internals/operations/utils.js +2 -3
  83. package/dist/cjs/runtime/internals/operations/utils.js.map +1 -1
  84. package/dist/cjs/runtime/internals/server/generateModelsProperty.js +1 -2
  85. package/dist/cjs/runtime/internals/server/generateModelsProperty.js.map +1 -1
  86. package/dist/cjs/runtime/internals/server/index.js.map +1 -1
  87. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js +1 -2
  88. package/dist/cjs/runtime/internals/utils/clientProperties/generateConversationsProperty.js.map +1 -1
  89. package/dist/cjs/runtime/internals/utils/clientProperties/generateEnumsProperty.js.map +1 -1
  90. package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js +1 -2
  91. package/dist/cjs/runtime/internals/utils/clientProperties/generateGenerationsProperty.js.map +1 -1
  92. package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js +1 -2
  93. package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js.map +1 -1
  94. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +1 -2
  95. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -1
  96. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +1 -2
  97. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -1
  98. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +1 -2
  99. package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -1
  100. package/dist/cjs/runtime/utils/findIndexByFields.js +1 -2
  101. package/dist/cjs/runtime/utils/findIndexByFields.js.map +1 -1
  102. package/dist/cjs/runtime/utils/index.js.map +1 -1
  103. package/dist/cjs/runtime/utils/resolveOwnerFields.js +1 -2
  104. package/dist/cjs/runtime/utils/resolveOwnerFields.js.map +1 -1
  105. package/dist/cjs/runtime/utils/resolvePKFields.js +1 -2
  106. package/dist/cjs/runtime/utils/resolvePKFields.js.map +1 -1
  107. package/dist/cjs/runtime/utils/selfAwareAsync.js +1 -2
  108. package/dist/cjs/runtime/utils/selfAwareAsync.js.map +1 -1
  109. package/dist/cjs/runtime/utils/stringTransformation.js +1 -2
  110. package/dist/cjs/runtime/utils/stringTransformation.js.map +1 -1
  111. package/dist/cjs/util/Brand.js +3 -3
  112. package/dist/cjs/util/Brand.js.map +1 -1
  113. package/dist/cjs/util/index.js.map +1 -1
  114. package/dist/esm/Authorization.d.ts +8 -8
  115. package/dist/esm/Authorization.mjs.map +1 -1
  116. package/dist/esm/CombineSchema.mjs.map +1 -1
  117. package/dist/esm/CustomOperation.mjs.map +1 -1
  118. package/dist/esm/CustomType.mjs.map +1 -1
  119. package/dist/esm/EnumType.mjs.map +1 -1
  120. package/dist/esm/Handler.mjs.map +1 -1
  121. package/dist/esm/ModelField.d.ts +39 -24
  122. package/dist/esm/ModelField.mjs +9 -2
  123. package/dist/esm/ModelField.mjs.map +1 -1
  124. package/dist/esm/ModelIndex.mjs.map +1 -1
  125. package/dist/esm/ModelRelationshipField.mjs.map +1 -1
  126. package/dist/esm/ModelSchema.mjs.map +1 -1
  127. package/dist/esm/ModelType.d.ts +1 -1
  128. package/dist/esm/ModelType.mjs.map +1 -1
  129. package/dist/esm/RefType.mjs.map +1 -1
  130. package/dist/esm/SchemaProcessor.mjs +36 -4
  131. package/dist/esm/SchemaProcessor.mjs.map +1 -1
  132. package/dist/esm/Validate.d.ts +218 -0
  133. package/dist/esm/Validate.mjs +142 -0
  134. package/dist/esm/Validate.mjs.map +1 -0
  135. package/dist/esm/ai/ConversationSchemaGraphQLTypes.mjs.map +1 -1
  136. package/dist/esm/ai/ConversationSchemaProcessor.mjs.map +1 -1
  137. package/dist/esm/ai/ConversationType.mjs.map +1 -1
  138. package/dist/esm/ai/ModelType.mjs.map +1 -1
  139. package/dist/esm/index.d.ts +1 -1
  140. package/dist/esm/runtime/addSchemaToClient.mjs.map +1 -1
  141. package/dist/esm/runtime/addSchemaToClientWithInstance.mjs.map +1 -1
  142. package/dist/esm/runtime/bridge-types.mjs.map +1 -1
  143. package/dist/esm/runtime/internals/APIClient.mjs.map +1 -1
  144. package/dist/esm/runtime/internals/ai/conversationMessageDeserializers.mjs.map +1 -1
  145. package/dist/esm/runtime/internals/ai/conversationMessageSerializers.mjs.map +1 -1
  146. package/dist/esm/runtime/internals/ai/conversationStreamEventDeserializers.mjs.map +1 -1
  147. package/dist/esm/runtime/internals/ai/convertItemToConversation.mjs.map +1 -1
  148. package/dist/esm/runtime/internals/ai/createCreateConversationFunction.d.ts +1 -1
  149. package/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs.map +1 -1
  150. package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.d.ts +1 -1
  151. package/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs.map +1 -1
  152. package/dist/esm/runtime/internals/ai/createGetConversationFunction.d.ts +1 -1
  153. package/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs.map +1 -1
  154. package/dist/esm/runtime/internals/ai/createListConversationsFunction.d.ts +1 -1
  155. package/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs.map +1 -1
  156. package/dist/esm/runtime/internals/ai/createListMessagesFunction.d.ts +1 -1
  157. package/dist/esm/runtime/internals/ai/createListMessagesFunction.mjs.map +1 -1
  158. package/dist/esm/runtime/internals/ai/createOnStreamEventFunction.d.ts +1 -1
  159. package/dist/esm/runtime/internals/ai/createOnStreamEventFunction.mjs.map +1 -1
  160. package/dist/esm/runtime/internals/ai/createSendMessageFunction.d.ts +1 -1
  161. package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs +1 -1
  162. package/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs.map +1 -1
  163. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.d.ts +1 -1
  164. package/dist/esm/runtime/internals/ai/createUpdateConversationFunction.mjs.map +1 -1
  165. package/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs.map +1 -1
  166. package/dist/esm/runtime/internals/cancellation.mjs.map +1 -1
  167. package/dist/esm/runtime/internals/clientUtils.mjs.map +1 -1
  168. package/dist/esm/runtime/internals/generateCustomOperationsProperty.d.ts +3 -3
  169. package/dist/esm/runtime/internals/generateCustomOperationsProperty.mjs.map +1 -1
  170. package/dist/esm/runtime/internals/operations/custom.mjs.map +1 -1
  171. package/dist/esm/runtime/internals/operations/get.mjs.map +1 -1
  172. package/dist/esm/runtime/internals/operations/indexQuery.mjs +1 -1
  173. package/dist/esm/runtime/internals/operations/indexQuery.mjs.map +1 -1
  174. package/dist/esm/runtime/internals/operations/list.mjs.map +1 -1
  175. package/dist/esm/runtime/internals/operations/observeQuery.mjs.map +1 -1
  176. package/dist/esm/runtime/internals/operations/subscription.mjs.map +1 -1
  177. package/dist/esm/runtime/internals/operations/utils.mjs.map +1 -1
  178. package/dist/esm/runtime/internals/server/generateModelsProperty.mjs.map +1 -1
  179. package/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs.map +1 -1
  180. package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.d.ts +1 -1
  181. package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.mjs.map +1 -1
  182. package/dist/esm/runtime/internals/utils/clientProperties/generateGenerationsProperty.mjs.map +1 -1
  183. package/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.mjs.map +1 -1
  184. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -1
  185. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -1
  186. package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -1
  187. package/dist/esm/runtime/utils/findIndexByFields.mjs.map +1 -1
  188. package/dist/esm/runtime/utils/resolveOwnerFields.mjs.map +1 -1
  189. package/dist/esm/runtime/utils/resolvePKFields.mjs.map +1 -1
  190. package/dist/esm/runtime/utils/selfAwareAsync.mjs.map +1 -1
  191. package/dist/esm/runtime/utils/stringTransformation.mjs.map +1 -1
  192. package/dist/esm/util/Brand.mjs.map +1 -1
  193. package/dist/meta/cjs.tsbuildinfo +1 -1
  194. package/package.json +1 -1
  195. package/src/ModelField.ts +70 -29
  196. package/src/SchemaProcessor.ts +46 -2
  197. package/src/Validate.ts +418 -0
  198. package/src/index.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Authorization.js","sources":["../../src/Authorization.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.accessSchemaData = exports.accessData = exports.allowForConversations = exports.allowForCustomOperations = exports.allow = exports.ResourceOperations = exports.Operations = exports.Strategies = exports.CustomProviders = exports.GroupProviders = exports.OwnerProviders = exports.PrivateProviders = exports.PublicProviders = exports.Providers = void 0;\nconst __data = Symbol('data');\n/**\n * All possible providers.\n *\n * This list should not be used if you need to restrict available providers\n * according to an auth strategcy. E.g., `public` auth can only be facilitated\n * by `apiKey` and `identityPool` providers.\n */\nexports.Providers = [\n 'apiKey',\n 'identityPool',\n 'userPools',\n 'oidc',\n 'function',\n];\n/**\n * The subset of auth providers that can facilitate `public` auth.\n */\nexports.PublicProviders = ['apiKey', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexports.PrivateProviders = ['userPools', 'oidc', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexports.OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexports.GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexports.CustomProviders = ['function'];\nexports.Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexports.Operations = [\n 'create',\n 'update',\n 'delete',\n 'read',\n 'get',\n 'list',\n 'sync',\n 'listen',\n 'search',\n];\n/**\n * The operations that can be performed against an API by a Lambda function.\n */\nexports.ResourceOperations = ['query', 'mutate', 'listen'];\n/**\n * Creates a shallow copy of an object with an individual field pruned away.\n *\n * @param original The original object to prune.\n * @param without The field to prune.\n * @returns The pruned object.\n */\nfunction omit(original, without) {\n const pruned = { ...original };\n delete pruned[without];\n return pruned;\n}\nfunction to(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\n/**\n * Specifies a property of the identity JWT to use in place of `sub::username`\n * as the value to match against the owner field for authorization.\n *\n * @param this Authorization object to operate against.\n * @param property A property of identity JWT.\n * @returns A copy of the Authorization object with the claim attached.\n */\nfunction identityClaim(property) {\n this[__data].identityClaim = property;\n return omit(this, 'identityClaim');\n}\nfunction withClaimIn(property) {\n this[__data].groupClaim = property;\n return omit(this, 'withClaimIn');\n}\nfunction validateProvider(needle, haystack) {\n if (needle && !haystack.includes(needle)) {\n throw new Error(`Invalid provider (${needle}) given!`);\n }\n}\nfunction authData(defaults, builderMethods) {\n return {\n [__data]: {\n strategy: 'public',\n provider: undefined,\n operations: undefined,\n groupOrOwnerField: undefined,\n multiOwner: false,\n identityClaim: undefined,\n groups: undefined,\n ...defaults,\n },\n ...builderMethods,\n };\n}\n/**\n * Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,\n * `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `identitypool`, `userPools`, `oidc`, or `function`)\n * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.\n */\nexports.allow = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {\n to,\n });\n },\n /**\n * Authorize unauthenticated users by using IDENTITYPOOL based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {\n to,\n });\n },\n /**\n * Authorize authenticated users. By default, `.authenticated()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use identityPool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, exports.PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {\n to,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`\n * field will be added to the model to store which user \"owns\" the item. Upon item creation, the \"owner field\" is\n * auto-populated with the authenticated user's information. If you want to specify which field should be used as\n * the owner field, you can use the `ownerDefinedIn` builder function instead.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.owner(\"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n owner(provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: 'owner',\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis with specifying which field should be used as the owner field.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownerDefinedIn(\"owner\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownerField the field that contains the owner information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownerDefinedIn(ownerField, provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownerField,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`\n * field will be added to the model to store which users \"own\" the item. Upon item creation, the \"owners field\" is\n * auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.\n *\n * You can specify which field should be used as the owners field by passing the `ownersField` parameter.\n *\n * By default, `.ownersDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownersDefinedIn(\"owners\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owners field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownersField the field that contains the owners information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownersDefinedIn(ownersField, provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownersField,\n multiOwner: true,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a group defined in a data model field.\n *\n * By default, `.groupDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the authorized user group information\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a one of the groups defined in a data model field.\n *\n * By default, `.groupsDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupsDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the list of authorized user groups\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupsDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n multiOwner: true,\n }, {\n to,\n withClaimIn,\n });\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {\n to,\n });\n },\n resource(fn) {\n return resourceAuthData(fn, {\n to: resourceTo,\n });\n },\n};\n/**\n * This is a copy of the {@link allow} defined above, with modifications for custom operations.\n *\n * Removed builder methods:\n *\n * * `owner`\n * * `ownerDefinedIn`\n * * `ownersDefinedIn`\n * * `groupDefinedIn`\n * * `groupsDefinedIn`\n * * `resource`\n * * `.to()` builder method from each available rule builder\n */\nexports.allowForCustomOperations = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {});\n },\n /**\n * Authorize unauthenticated users by using identityPool based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {});\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use Identity Pool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, exports.PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {});\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {});\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {});\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {});\n },\n};\nexports.allowForConversations = {\n owner() {\n return authData({\n strategy: 'owner',\n provider: 'userPools',\n }, {\n to,\n identityClaim,\n });\n },\n};\nfunction resourceTo(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\nfunction resourceAuthData(resource, builderMethods) {\n return {\n [__data]: {\n strategy: 'resource',\n resource,\n },\n ...builderMethods,\n };\n}\nconst accessData = (authorization) => authorization[__data];\nexports.accessData = accessData;\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nconst accessSchemaData = (authorization) => authorization[__data];\nexports.accessSchemaData = accessSchemaData;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,wBAAwB,GA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AAG,UAAU,CAAC;AAChC;AACA,MAAM,gBAAgB,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC;AAClE,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
1
+ {"version":3,"file":"Authorization.js","sources":["../../src/Authorization.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.accessSchemaData = exports.accessData = exports.allowForConversations = exports.allowForCustomOperations = exports.allow = exports.ResourceOperations = exports.Operations = exports.Strategies = exports.CustomProviders = exports.GroupProviders = exports.OwnerProviders = exports.PrivateProviders = exports.PublicProviders = exports.Providers = void 0;\nconst __data = Symbol('data');\n/**\n * All possible providers.\n *\n * This list should not be used if you need to restrict available providers\n * according to an auth strategcy. E.g., `public` auth can only be facilitated\n * by `apiKey` and `identityPool` providers.\n */\nexports.Providers = [\n 'apiKey',\n 'identityPool',\n 'userPools',\n 'oidc',\n 'function',\n];\n/**\n * The subset of auth providers that can facilitate `public` auth.\n */\nexports.PublicProviders = ['apiKey', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexports.PrivateProviders = ['userPools', 'oidc', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexports.OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexports.GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexports.CustomProviders = ['function'];\nexports.Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexports.Operations = [\n 'create',\n 'update',\n 'delete',\n 'read',\n 'get',\n 'list',\n 'sync',\n 'listen',\n 'search',\n];\n/**\n * The operations that can be performed against an API by a Lambda function.\n */\nexports.ResourceOperations = ['query', 'mutate', 'listen'];\n/**\n * Creates a shallow copy of an object with an individual field pruned away.\n *\n * @param original The original object to prune.\n * @param without The field to prune.\n * @returns The pruned object.\n */\nfunction omit(original, without) {\n const pruned = { ...original };\n delete pruned[without];\n return pruned;\n}\nfunction to(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\n/**\n * Specifies a property of the identity JWT to use in place of `sub::username`\n * as the value to match against the owner field for authorization.\n *\n * @param this Authorization object to operate against.\n * @param property A property of identity JWT.\n * @returns A copy of the Authorization object with the claim attached.\n */\nfunction identityClaim(property) {\n this[__data].identityClaim = property;\n return omit(this, 'identityClaim');\n}\nfunction withClaimIn(property) {\n this[__data].groupClaim = property;\n return omit(this, 'withClaimIn');\n}\nfunction validateProvider(needle, haystack) {\n if (needle && !haystack.includes(needle)) {\n throw new Error(`Invalid provider (${needle}) given!`);\n }\n}\nfunction authData(defaults, builderMethods) {\n return {\n [__data]: {\n strategy: 'public',\n provider: undefined,\n operations: undefined,\n groupOrOwnerField: undefined,\n multiOwner: false,\n identityClaim: undefined,\n groups: undefined,\n ...defaults,\n },\n ...builderMethods,\n };\n}\n/**\n * Defines an authorization rule for your data models and fields. First choose an authorization strategy (`public`,\n * `private`, `owner`, `group`, or `custom`), then choose an auth provider (`apiKey`, `identitypool`, `userPools`, `oidc`, or `function`)\n * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.\n */\nexports.allow = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {\n to,\n });\n },\n /**\n * Authorize unauthenticated users by using IDENTITYPOOL based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {\n to,\n });\n },\n /**\n * Authorize authenticated users. By default, `.authenticated()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use identityPool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, exports.PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {\n to,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`\n * field will be added to the model to store which user \"owns\" the item. Upon item creation, the \"owner field\" is\n * auto-populated with the authenticated user's information. If you want to specify which field should be used as\n * the owner field, you can use the `ownerDefinedIn` builder function instead.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.owner(\"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n owner(provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: 'owner',\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access on a per-user (owner) basis with specifying which field should be used as the owner field.\n *\n * By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownerDefinedIn(\"owner\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owner field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownerField the field that contains the owner information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownerDefinedIn(ownerField, provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownerField,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`\n * field will be added to the model to store which users \"own\" the item. Upon item creation, the \"owners field\" is\n * auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.\n *\n * You can specify which field should be used as the owners field by passing the `ownersField` parameter.\n *\n * By default, `.ownersDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.ownersDefinedIn(\"owners\", \"oidc\")` to use OIDC based authentication to designate the owner.\n *\n * To change the specific claim that should be used as the user identifier within the owners field, chain the\n * `.identityClaim(...)` method.\n *\n * @param ownersField the field that contains the owners information\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownersDefinedIn(ownersField, provider) {\n validateProvider(provider, exports.OwnerProviders);\n return authData({\n strategy: 'owner',\n provider,\n groupOrOwnerField: ownersField,\n multiOwner: true,\n }, {\n to,\n identityClaim,\n });\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier, chain the\n * `.withClaimIn(...)` method.\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a group defined in a data model field.\n *\n * By default, `.groupDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the authorized user group information\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n }, {\n to,\n withClaimIn,\n });\n },\n /**\n * Authorize if a user is part of a one of the groups defined in a data model field.\n *\n * By default, `.groupsDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groupsDefinedIn(\"field-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * To change the specific claim that should be used as the user group identifier within the groups field, chain the\n * `.withClaimIn(...)` method.\n * @param groupsField the field that should store the list of authorized user groups\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groupsDefinedIn(groupsField, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groupOrOwnerField: groupsField,\n multiOwner: true,\n }, {\n to,\n withClaimIn,\n });\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {\n to,\n });\n },\n resource(fn) {\n return resourceAuthData(fn, {\n to: resourceTo,\n });\n },\n};\n/**\n * This is a copy of the {@link allow} defined above, with modifications for custom operations.\n *\n * Removed builder methods:\n *\n * * `owner`\n * * `ownerDefinedIn`\n * * `ownersDefinedIn`\n * * `groupDefinedIn`\n * * `groupsDefinedIn`\n * * `resource`\n * * `.to()` builder method from each available rule builder\n */\nexports.allowForCustomOperations = {\n /**\n * Authorize unauthenticated users by using API key based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n publicApiKey() {\n return authData({\n strategy: 'public',\n provider: 'apiKey',\n }, {});\n },\n /**\n * Authorize unauthenticated users by using identityPool based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'identityPool',\n }, {});\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"identityPool\")` or `.authenticated(\"oidc\")` to use Identity Pool or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"identityPool\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, exports.PrivateProviders);\n return authData({\n strategy: 'private',\n provider,\n }, {});\n },\n /**\n * Authorize a specific user group. Provide the name of the specific user group to have access.\n *\n * By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.group(\"group-name\", \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param group the name of the group to authorize\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n group(group, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups: [group],\n }, {});\n },\n /**\n * Authorize multiple specific user groups. Provide the names of the specific user groups to have access.\n *\n * By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.groups([\"group-a\", \"group-b\"], \"oidc\")` to use OIDC based authentication to designate the user group.\n *\n * @param groups the names of the group to authorize defined as an array\n * @param provider the authentication provider - supports \"userPools\" or \"oidc\"\n * @returns an authorization rule to grant access by a specific group\n */\n groups(groups, provider) {\n return authData({\n strategy: 'groups',\n provider,\n groups,\n }, {});\n },\n custom(provider) {\n return authData({\n strategy: 'custom',\n provider,\n }, {});\n },\n};\nexports.allowForConversations = {\n owner() {\n return authData({\n strategy: 'owner',\n provider: 'userPools',\n }, {\n to,\n identityClaim,\n });\n },\n};\nfunction resourceTo(operations) {\n this[__data].operations = operations;\n return omit(this, 'to');\n}\nfunction resourceAuthData(resource, builderMethods) {\n return {\n [__data]: {\n strategy: 'resource',\n resource,\n },\n ...builderMethods,\n };\n}\nconst accessData = (authorization) => authorization[__data];\nexports.accessData = accessData;\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nconst accessSchemaData = (authorization) => authorization[__data];\nexports.accessSchemaData = accessSchemaData;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,qBAAqB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,MAAM;AACrW,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC,SAAS,GAAG;AACpB,IAAI,QAAQ;AACZ,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,UAAU;AACd,CAAC;AACD;AACA;AACA;AACA,OAAO,CAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC;AACpD;AACA;AACA;AACA,OAAO,CAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC;AAChE;AACA;AACA;AACA,OAAO,CAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;AAC9C;AACA;AACA;AACA,OAAO,CAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC;AAC9C;AACA;AACA;AACA,OAAO,CAAC,eAAe,GAAG,CAAC,UAAU,CAAC;AACtC,OAAO,CAAC,UAAU,GAAG;AACrB,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ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BAAgB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/ClientSchema/utilities/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./ExtractNestedTypes\"), exports);\ntslib_1.__exportStar(require(\"./ResolveField\"), exports);\ntslib_1.__exportStar(require(\"./ResolveRef\"), exports);\ntslib_1.__exportStar(require(\"./SchemaMetadata\"), exports);\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AACjC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC,CAAC;AAC/D,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC;AACzD,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;AACvD,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/ClientSchema/utilities/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./ExtractNestedTypes\"), exports);\ntslib_1.__exportStar(require(\"./ResolveField\"), exports);\ntslib_1.__exportStar(require(\"./ResolveRef\"), exports);\ntslib_1.__exportStar(require(\"./SchemaMetadata\"), exports);\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAChC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;AAC9D,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;AACxD,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;AACtD,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;;"}
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.combine = exports.combinedSchemaBrand = void 0;
4
+ exports.combinedSchemaBrand = void 0;
5
+ exports.combine = combine;
5
6
  const util_1 = require("./util");
6
7
  const CombinedSchemaBrandName = 'CombinedSchema';
7
8
  exports.combinedSchemaBrand = (0, util_1.brand)(CombinedSchemaBrandName);
@@ -14,7 +15,6 @@ exports.combinedSchemaBrand = (0, util_1.brand)(CombinedSchemaBrandName);
14
15
  function combine(schemas) {
15
16
  return internalCombine(schemas);
16
17
  }
17
- exports.combine = combine;
18
18
  function internalCombine(schemas) {
19
19
  validateDuplicateTypeNames(schemas);
20
20
  const combined = {
@@ -1 +1 @@
1
- {"version":3,"file":"CombineSchema.js","sources":["../../src/CombineSchema.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.combine = exports.combinedSchemaBrand = void 0;\nconst util_1 = require(\"./util\");\nconst COMBINED_SCHEMA_LIMIT = 50;\nconst CombinedSchemaBrandName = 'CombinedSchema';\nexports.combinedSchemaBrand = (0, util_1.brand)(CombinedSchemaBrandName);\n/**\n * The interface for merging up to 50 schemas into a single API.\n * @param schemas The schemas to combine into a single API\n * @returns An API and data model definition to be deployed with Amplify (Gen 2) experience (`processSchema(...)`)\n * or with the Amplify Data CDK construct (`@aws-amplify/data-construct`)\n */\nfunction combine(schemas) {\n return internalCombine(schemas);\n}\nexports.combine = combine;\nfunction internalCombine(schemas) {\n validateDuplicateTypeNames(schemas);\n const combined = {\n ...exports.combinedSchemaBrand,\n schemas: schemas,\n };\n for (const schema of combined.schemas) {\n schema.context = combined;\n }\n return combined;\n}\nfunction validateDuplicateTypeNames(schemas) {\n const allSchemaKeys = schemas.flatMap((s) => Object.keys(s.data.types));\n const keySet = new Set();\n const duplicateKeySet = new Set();\n allSchemaKeys.forEach((key) => {\n if (keySet.has(key)) {\n duplicateKeySet.add(key);\n }\n else {\n keySet.add(key);\n }\n });\n if (duplicateKeySet.size > 0) {\n throw new Error(`The schemas you are attempting to combine have a name collision. Please remove or rename ${Array.from(duplicateKeySet).join(', ')}.`);\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AACvD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAM,uBAAuB,GAAG,gBAAgB,CAAC;AACjD,OAAO,CAAC,mBAAmB,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,OAAO,EAAE;AAC1B,IAAI,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AACD,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;AAC1B,SAAS,eAAe,CAAC,OAAO,EAAE;AAClC,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACxC,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,GAAG,OAAO,CAAC,mBAAmB;AACtC,QAAQ,OAAO,EAAE,OAAO;AACxB,KAAK,CAAC;AACN,IAAI,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE;AAC3C,QAAQ,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;AAClC,KAAK;AACL,IAAI,OAAO,QAAQ,CAAC;AACpB,CAAC;AACD,SAAS,0BAA0B,CAAC,OAAO,EAAE;AAC7C,IAAI,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5E,IAAI,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AAC7B,IAAI,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;AACtC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AACnC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC7B,YAAY,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACrC,SAAS;AACT,aAAa;AACb,YAAY,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC5B,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,IAAI,eAAe,CAAC,IAAI,GAAG,CAAC,EAAE;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,yFAAyF,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/J,KAAK;AACL;;"}
1
+ {"version":3,"file":"CombineSchema.js","sources":["../../src/CombineSchema.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.combinedSchemaBrand = void 0;\nexports.combine = combine;\nconst util_1 = require(\"./util\");\nconst COMBINED_SCHEMA_LIMIT = 50;\nconst CombinedSchemaBrandName = 'CombinedSchema';\nexports.combinedSchemaBrand = (0, util_1.brand)(CombinedSchemaBrandName);\n/**\n * The interface for merging up to 50 schemas into a single API.\n * @param schemas The schemas to combine into a single API\n * @returns An API and data model definition to be deployed with Amplify (Gen 2) experience (`processSchema(...)`)\n * or with the Amplify Data CDK construct (`@aws-amplify/data-construct`)\n */\nfunction combine(schemas) {\n return internalCombine(schemas);\n}\nfunction internalCombine(schemas) {\n validateDuplicateTypeNames(schemas);\n const combined = {\n ...exports.combinedSchemaBrand,\n schemas: schemas,\n };\n for (const schema of combined.schemas) {\n schema.context = combined;\n }\n return combined;\n}\nfunction validateDuplicateTypeNames(schemas) {\n const allSchemaKeys = schemas.flatMap((s) => Object.keys(s.data.types));\n const keySet = new Set();\n const duplicateKeySet = new Set();\n allSchemaKeys.forEach((key) => {\n if (keySet.has(key)) {\n duplicateKeySet.add(key);\n }\n else {\n keySet.add(key);\n }\n });\n if (duplicateKeySet.size > 0) {\n throw new Error(`The schemas you are attempting to combine have a name collision. Please remove or rename ${Array.from(duplicateKeySet).join(', ')}.`);\n }\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mBAAmB,GAAG,MAAM;AACpC,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAEhC,MAAM,uBAAuB,GAAG,gBAAgB;AAChD,OAAO,CAAC,mBAAmB,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,uBAAuB,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,OAAO,EAAE;AAC1B,IAAI,OAAO,eAAe,CAAC,OAAO,CAAC;AACnC;AACA,SAAS,eAAe,CAAC,OAAO,EAAE;AAClC,IAAI,0BAA0B,CAAC,OAAO,CAAC;AACvC,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,GAAG,OAAO,CAAC,mBAAmB;AACtC,QAAQ,OAAO,EAAE,OAAO;AACxB,KAAK;AACL,IAAI,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE;AAC3C,QAAQ,MAAM,CAAC,OAAO,GAAG,QAAQ;AACjC;AACA,IAAI,OAAO,QAAQ;AACnB;AACA,SAAS,0BAA0B,CAAC,OAAO,EAAE;AAC7C,IAAI,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3E,IAAI,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE;AAC5B,IAAI,MAAM,eAAe,GAAG,IAAI,GAAG,EAAE;AACrC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK;AACnC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC7B,YAAY,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;AACpC;AACA,aAAa;AACb,YAAY,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3B;AACA,KAAK,CAAC;AACN,IAAI,IAAI,eAAe,CAAC,IAAI,GAAG,CAAC,EAAE;AAClC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,yFAAyF,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9J;AACA;;"}
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.generation = exports.subscription = exports.mutation = exports.query = exports.CustomOperationNames = void 0;
4
+ exports.CustomOperationNames = void 0;
5
+ exports.query = query;
6
+ exports.mutation = mutation;
7
+ exports.subscription = subscription;
8
+ exports.generation = generation;
5
9
  const util_1 = require("./util");
6
10
  const Authorization_1 = require("./Authorization");
7
11
  const Brand_1 = require("./util/Brand");
@@ -81,7 +85,6 @@ function _custom(typeName, brand, input) {
81
85
  function query() {
82
86
  return _custom('Query', queryBrand);
83
87
  }
84
- exports.query = query;
85
88
  /**
86
89
  * Use a custom mutation to define an API request that will modify backend data or trigger a subscription event.
87
90
  * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}
@@ -97,7 +100,6 @@ exports.query = query;
97
100
  function mutation() {
98
101
  return _custom('Mutation', mutationBrand);
99
102
  }
100
- exports.mutation = mutation;
101
103
  /**
102
104
  * Define a custom subscription to receive an event when a mutation is triggered
103
105
  * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-subscription/}
@@ -115,7 +117,6 @@ exports.mutation = mutation;
115
117
  function subscription() {
116
118
  return _custom('Subscription', subscriptionBrand);
117
119
  }
118
- exports.subscription = subscription;
119
120
  const eventInvocationResponse = {
120
121
  data: {
121
122
  type: 'ref',
@@ -147,5 +148,4 @@ function lastHandlerIsAsyncFunction(handlers) {
147
148
  function generation(input) {
148
149
  return _custom('Generation', generationBrand, input);
149
150
  }
150
- exports.generation = generation;
151
151
  //# sourceMappingURL=CustomOperation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomOperation.js","sources":["../../src/CustomOperation.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generation = exports.subscription = exports.mutation = exports.query = exports.CustomOperationNames = void 0;\nconst util_1 = require(\"./util\");\nconst Authorization_1 = require(\"./Authorization\");\nconst Brand_1 = require(\"./util/Brand\");\nconst queryBrand = 'queryCustomOperation';\nconst mutationBrand = 'mutationCustomOperation';\nconst subscriptionBrand = 'subscriptionCustomOperation';\nconst generationBrand = 'generationCustomOperation';\nexports.CustomOperationNames = [\n 'Query',\n 'Mutation',\n 'Subscription',\n 'Generation',\n];\nfunction brandedBuilder(builder, brandValue) {\n return { ...builder, ...(0, util_1.brand)(brandValue) };\n}\nfunction _custom(typeName, brand, input) {\n const data = {\n arguments: {},\n returnType: null,\n authorization: [],\n typeName: typeName,\n handlers: null,\n subscriptionSource: [],\n input,\n };\n const builder = brandedBuilder({\n arguments(args) {\n data.arguments = args;\n return this;\n },\n returns(returnType) {\n data.returnType = returnType;\n return this;\n },\n authorization(callback) {\n const rules = callback(Authorization_1.allowForCustomOperations);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n handler(handlers) {\n data.handlers = Array.isArray(handlers)\n ? handlers\n : [handlers];\n if (lastHandlerIsAsyncFunction(handlers)) {\n data.returnType = eventInvocationResponse;\n }\n return this;\n },\n for(source) {\n data.subscriptionSource = Array.isArray(source) ? source : [source];\n return this;\n },\n }, brand);\n return { ...builder, data };\n}\n/**\n * Use a custom query to define an API request that will retrieve backend data.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}\n * @example\n * const schema = a.schema({\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 * EchoResponse: a.customType({\n * content: a.string(),\n * executionDuration: a.float()\n * }),\n * });\n * @returns a custom query\n */\nfunction query() {\n return _custom('Query', queryBrand);\n}\nexports.query = query;\n/**\n * Use a custom mutation to define an API request that will modify backend data or trigger a subscription event.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}\n * @example\n * likePost: a\n * .mutation()\n * .arguments({ postId: a.string() })\n * .returns(a.ref('Post'))\n * .authorization(allow => [allow.publicApiKey()])\n * .handler(a.handler.function(echoHandler))\n * @returns a custom mutation\n */\nfunction mutation() {\n return _custom('Mutation', mutationBrand);\n}\nexports.mutation = mutation;\n/**\n * Define a custom subscription to receive an event when a mutation is triggered\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-subscription/}\n * @example\n * // Subscribe to incoming messages\n * receive: a.subscription()\n * // subscribes to the 'publish' mutation\n * .for(a.ref('publish'))\n * // subscription handler to set custom filters\n * .handler(a.handler.custom({entry: './receive.js'}))\n * // authorization rules as to who can subscribe to the data\n * .authorization(allow => [allow.publicApiKey()]),\n * @returns a custom subscription\n */\nfunction subscription() {\n return _custom('Subscription', subscriptionBrand);\n}\nexports.subscription = subscription;\nconst eventInvocationResponse = {\n data: {\n type: 'ref',\n link: 'EventInvocationResponse',\n valueRequired: false,\n array: false,\n arrayRequired: false,\n mutationOperations: [],\n authorization: [],\n },\n};\nfunction lastHandlerIsAsyncFunction(handlers) {\n const lastHandlerBrandSymbol = Array.isArray(handlers)\n ? handlers[handlers.length - 1][Brand_1.brandSymbol]\n : handlers[Brand_1.brandSymbol];\n return lastHandlerBrandSymbol === 'asyncFunctionHandler';\n}\n/**\n * Define an AI generation route for single request-response interaction with specified AI model.\n * @example\n * makeRecipe: a.generation({\n * aiModel: { resourcePath },\n * systemPrompt: 'Please make a recipe from the provided ingredients',\n * })\n * .arguments({ ingredients: a.string().array() })\n * .returns(a.ref(\"Recipe\"))\n * @returns a generation route definition\n */\nfunction generation(input) {\n return _custom('Generation', generationBrand, input);\n}\nexports.generation = generation;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;AACrH,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AACxC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AACxD,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,OAAO,CAAC,oBAAoB,GAAG;AAC/B,I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,QAAQ,IAAI,EAAE,KAAK;AACnB,QAAQ,IAAI,EAAE,yBAAyB;AACvC,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ,KAAK,EAAE,KAAK;AACpB,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ,kBAAkB,EAAE,EAAE;AAC9B,QAAQ,aAAa,EAAE,EAAE;AACzB,KAAK;AACL,CAAC,CAAC;AACF,SAAS,0BAA0B,CAAC,QAAQ,EAAE;AAC9C,IAAI,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;AAC1D,UAAU,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;AAC5D,UAAU,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACxC,IAAI,OAAO,sBAAsB,KAAK,sBAAsB,CAAC;AAC7D,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,KAAK,EAAE;AAC3B,IAAI,OAAO,OAAO,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC;AACD,OAAO,CAAC,UAAU,GAAG,UAAU;;"}
1
+ {"version":3,"file":"CustomOperation.js","sources":["../../src/CustomOperation.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CustomOperationNames = void 0;\nexports.query = query;\nexports.mutation = mutation;\nexports.subscription = subscription;\nexports.generation = generation;\nconst util_1 = require(\"./util\");\nconst Authorization_1 = require(\"./Authorization\");\nconst Brand_1 = require(\"./util/Brand\");\nconst queryBrand = 'queryCustomOperation';\nconst mutationBrand = 'mutationCustomOperation';\nconst subscriptionBrand = 'subscriptionCustomOperation';\nconst generationBrand = 'generationCustomOperation';\nexports.CustomOperationNames = [\n 'Query',\n 'Mutation',\n 'Subscription',\n 'Generation',\n];\nfunction brandedBuilder(builder, brandValue) {\n return { ...builder, ...(0, util_1.brand)(brandValue) };\n}\nfunction _custom(typeName, brand, input) {\n const data = {\n arguments: {},\n returnType: null,\n authorization: [],\n typeName: typeName,\n handlers: null,\n subscriptionSource: [],\n input,\n };\n const builder = brandedBuilder({\n arguments(args) {\n data.arguments = args;\n return this;\n },\n returns(returnType) {\n data.returnType = returnType;\n return this;\n },\n authorization(callback) {\n const rules = callback(Authorization_1.allowForCustomOperations);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n return this;\n },\n handler(handlers) {\n data.handlers = Array.isArray(handlers)\n ? handlers\n : [handlers];\n if (lastHandlerIsAsyncFunction(handlers)) {\n data.returnType = eventInvocationResponse;\n }\n return this;\n },\n for(source) {\n data.subscriptionSource = Array.isArray(source) ? source : [source];\n return this;\n },\n }, brand);\n return { ...builder, data };\n}\n/**\n * Use a custom query to define an API request that will retrieve backend data.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}\n * @example\n * const schema = a.schema({\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 * EchoResponse: a.customType({\n * content: a.string(),\n * executionDuration: a.float()\n * }),\n * });\n * @returns a custom query\n */\nfunction query() {\n return _custom('Query', queryBrand);\n}\n/**\n * Use a custom mutation to define an API request that will modify backend data or trigger a subscription event.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/}\n * @example\n * likePost: a\n * .mutation()\n * .arguments({ postId: a.string() })\n * .returns(a.ref('Post'))\n * .authorization(allow => [allow.publicApiKey()])\n * .handler(a.handler.function(echoHandler))\n * @returns a custom mutation\n */\nfunction mutation() {\n return _custom('Mutation', mutationBrand);\n}\n/**\n * Define a custom subscription to receive an event when a mutation is triggered\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/custom-subscription/}\n * @example\n * // Subscribe to incoming messages\n * receive: a.subscription()\n * // subscribes to the 'publish' mutation\n * .for(a.ref('publish'))\n * // subscription handler to set custom filters\n * .handler(a.handler.custom({entry: './receive.js'}))\n * // authorization rules as to who can subscribe to the data\n * .authorization(allow => [allow.publicApiKey()]),\n * @returns a custom subscription\n */\nfunction subscription() {\n return _custom('Subscription', subscriptionBrand);\n}\nconst eventInvocationResponse = {\n data: {\n type: 'ref',\n link: 'EventInvocationResponse',\n valueRequired: false,\n array: false,\n arrayRequired: false,\n mutationOperations: [],\n authorization: [],\n },\n};\nfunction lastHandlerIsAsyncFunction(handlers) {\n const lastHandlerBrandSymbol = Array.isArray(handlers)\n ? handlers[handlers.length - 1][Brand_1.brandSymbol]\n : handlers[Brand_1.brandSymbol];\n return lastHandlerBrandSymbol === 'asyncFunctionHandler';\n}\n/**\n * Define an AI generation route for single request-response interaction with specified AI model.\n * @example\n * makeRecipe: a.generation({\n * aiModel: { resourcePath },\n * systemPrompt: 'Please make a recipe from the provided ingredients',\n * })\n * .arguments({ ingredients: a.string().array() })\n * .returns(a.ref(\"Recipe\"))\n * @returns a generation route definition\n */\nfunction generation(input) {\n return _custom('Generation', generationBrand, input);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,MAAM;AACrC,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,OAAO,CAAC,YAAY,GAAG,YAAY;AACnC,OAAO,CAAC,UAAU,GAAG,UAAU;AAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAClD,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC;AACvC,MAAM,UAAU,GAAG,sBAAsB;AACzC,MAAM,aAAa,GAAG,yBAAyB;AAC/C,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QAAQ,aAAa,EAAE,EAAE;AACzB,KAAK;AACL,CAAC;AACD,SAAS,0BAA0B,CAAC,QAAQ,EAAE;AAC9C,IAAI,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ;AACzD,UAAU,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW;AAC3D,UAAU,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC;AACvC,IAAI,OAAO,sBAAsB,KAAK,sBAAsB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,UAAU,CAAC,KAAK,EAAE;AAC3B,IAAI,OAAO,OAAO,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,CAAC;AACxD;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.customType = void 0;
4
+ exports.customType = customType;
5
5
  function _customType(fields) {
6
6
  const data = {
7
7
  fields,
@@ -44,5 +44,4 @@ function _customType(fields) {
44
44
  function customType(fields) {
45
45
  return _customType(fields);
46
46
  }
47
- exports.customType = customType;
48
47
  //# sourceMappingURL=CustomType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomType.js","sources":["../../src/CustomType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.customType = void 0;\nfunction _customType(fields) {\n const data = {\n fields,\n type: 'customType',\n };\n return { data };\n}\n/**\n * Define a custom type. This type represents an inline, typed JSON object.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/add-fields/#specify-a-custom-field-type}\n * @param fields the fields to be added to the custom type\n * @returns a custom type\n * @example\n * a.schema({\n * Post: a.model({\n * location: a.customType({\n * lat: a.float(),\n * long: a.float(),\n * }),\n * content: a.string(),\n * }),\n * });\n * @example\n * a.schema({\n * Location: a.customType({\n * lat: a.float(),\n * long: a.float(),\n * }),\n *\n * Post: a.model({\n * location: a.ref('Location'),\n * content: a.string(),\n * }),\n *\n * User: a.model({\n * lastKnownLocation: a.ref('Location'),\n * }),\n * });\n */\nfunction customType(fields) {\n return _customType(fields);\n}\nexports.customType = customType;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,CAAC;AAC5B,SAAS,WAAW,CAAC,MAAM,EAAE;AAC7B,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,MAAM;AACd,QAAQ,IAAI,EAAE,YAAY;AAC1B,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,IAAI,EAAE,CAAC;AACpB,CAAC;AACD;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,UAAU,CAAC,MAAM,EAAE;AAC5B,IAAI,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AACD,OAAO,CAAC,UAAU,GAAG,UAAU;;"}
1
+ {"version":3,"file":"CustomType.js","sources":["../../src/CustomType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.customType = customType;\nfunction _customType(fields) {\n const data = {\n fields,\n type: 'customType',\n };\n return { data };\n}\n/**\n * Define a custom type. This type represents an inline, typed JSON object.\n * @see {@link https://docs.amplify.aws/react/build-a-backend/data/data-modeling/add-fields/#specify-a-custom-field-type}\n * @param fields the fields to be added to the custom type\n * @returns a custom type\n * @example\n * a.schema({\n * Post: a.model({\n * location: a.customType({\n * lat: a.float(),\n * long: a.float(),\n * }),\n * content: a.string(),\n * }),\n * });\n * @example\n * a.schema({\n * Location: a.customType({\n * lat: a.float(),\n * long: a.float(),\n * }),\n *\n * Post: a.model({\n * location: a.ref('Location'),\n * content: a.string(),\n * }),\n *\n * User: a.model({\n * lastKnownLocation: a.ref('Location'),\n * }),\n * });\n */\nfunction customType(fields) {\n return _customType(fields);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,UAAU,GAAG,UAAU;AAC/B,SAAS,WAAW,CAAC,MAAM,EAAE;AAC7B,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,MAAM;AACd,QAAQ,IAAI,EAAE,YAAY;AAC1B,KAAK;AACL,IAAI,OAAO,EAAE,IAAI,EAAE;AACnB;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,UAAU,CAAC,MAAM,EAAE;AAC5B,IAAI,OAAO,WAAW,CAAC,MAAM,CAAC;AAC9B;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.enumType = void 0;
4
+ exports.enumType = enumType;
5
5
  function _enum(values) {
6
6
  const data = {
7
7
  type: 'enum',
@@ -15,5 +15,4 @@ function _enum(values) {
15
15
  function enumType(values) {
16
16
  return _enum(values);
17
17
  }
18
- exports.enumType = enumType;
19
18
  //# sourceMappingURL=EnumType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnumType.js","sources":["../../src/EnumType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.enumType = void 0;\nfunction _enum(values) {\n const data = {\n type: 'enum',\n values,\n };\n return data;\n}\n/**\n * this type param pattern allows us to infer literal type values from the array without using the `as const` suffix\n */\nfunction enumType(values) {\n return _enum(values);\n}\nexports.enumType = enumType;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC;AAC1B,SAAS,KAAK,CAAC,MAAM,EAAE;AACvB,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,EAAE,MAAM;AACpB,QAAQ,MAAM;AACd,KAAK,CAAC;AACN,IAAI,OAAO,IAAI,CAAC;AAChB,CAAC;AACD;AACA;AACA;AACA,SAAS,QAAQ,CAAC,MAAM,EAAE;AAC1B,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AACD,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"EnumType.js","sources":["../../src/EnumType.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.enumType = enumType;\nfunction _enum(values) {\n const data = {\n type: 'enum',\n values,\n };\n return data;\n}\n/**\n * this type param pattern allows us to infer literal type values from the array without using the `as const` suffix\n */\nfunction enumType(values) {\n return _enum(values);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,SAAS,KAAK,CAAC,MAAM,EAAE;AACvB,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,IAAI,EAAE,MAAM;AACpB,QAAQ,MAAM;AACd,KAAK;AACL,IAAI,OAAO,IAAI;AACf;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,MAAM,EAAE;AAC1B,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC;AACxB;;"}
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.handler = exports.getHandlerData = void 0;
4
+ exports.handler = void 0;
5
+ exports.getHandlerData = getHandlerData;
5
6
  const util_1 = require("./util");
6
7
  const dataSymbol = Symbol('Data');
7
8
  function buildHandler(brandName) {
@@ -10,7 +11,6 @@ function buildHandler(brandName) {
10
11
  function getHandlerData(handler) {
11
12
  return handler[dataSymbol];
12
13
  }
13
- exports.getHandlerData = getHandlerData;
14
14
  //#region handler.inlineSql
15
15
  const inlineSqlBrand = 'inlineSql';
16
16
  function inlineSql(sql) {
@@ -1 +1 @@
1
- {"version":3,"file":"Handler.js","sources":["../../src/Handler.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handler = exports.getHandlerData = void 0;\nconst util_1 = require(\"./util\");\nconst dataSymbol = Symbol('Data');\nfunction buildHandler(brandName) {\n return (0, util_1.brand)(brandName);\n}\nfunction getHandlerData(handler) {\n return handler[dataSymbol];\n}\nexports.getHandlerData = getHandlerData;\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';\nconst asyncFunctionHandlerBrand = 'asyncFunctionHandler';\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 {\n [dataSymbol]: {\n handler: fn,\n invocationType: 'RequestResponse',\n },\n async() {\n return _async(this);\n },\n ...buildHandler(functionHandlerBrand),\n };\n}\nfunction _async(fnHandler) {\n return {\n [dataSymbol]: {\n handler: fnHandler[dataSymbol].handler,\n invocationType: 'Event',\n },\n ...buildHandler(asyncFunctionHandlerBrand),\n };\n}\n//#endregion\nexports.handler = {\n inlineSql,\n sqlReference,\n custom,\n function: fcn,\n};\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAClC,SAAS,YAAY,CAAC,SAAS,EAAE;AACjC,IAAI,OAAO,IAAI,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACxC,CAAC;AACD,SAAS,cAAc,CAAC,OAAO,EAAE;AACjC,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AACD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;AACxC;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;AAC3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,OAAO,CAAC,OAAO,GAAG;AAClB,IAAI,SAAS;AACb,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,GAAG;AACjB,CAAC;;"}
1
+ {"version":3,"file":"Handler.js","sources":["../../src/Handler.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handler = void 0;\nexports.getHandlerData = getHandlerData;\nconst util_1 = require(\"./util\");\nconst dataSymbol = Symbol('Data');\nfunction buildHandler(brandName) {\n return (0, util_1.brand)(brandName);\n}\nfunction 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';\nconst asyncFunctionHandlerBrand = 'asyncFunctionHandler';\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 {\n [dataSymbol]: {\n handler: fn,\n invocationType: 'RequestResponse',\n },\n async() {\n return _async(this);\n },\n ...buildHandler(functionHandlerBrand),\n };\n}\nfunction _async(fnHandler) {\n return {\n [dataSymbol]: {\n handler: fnHandler[dataSymbol].handler,\n invocationType: 'Event',\n },\n ...buildHandler(asyncFunctionHandlerBrand),\n };\n}\n//#endregion\nexports.handler = {\n inlineSql,\n sqlReference,\n custom,\n function: fcn,\n};\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,C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AACL;AACA,MAAM,oBAAoB,GAAG,iBAAiB;AAC9C,MAAM,yBAAyB,GAAG,sBAAsB;AACxD;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;AACX,QAAQ,CAAC,UAAU,GAAG;AACtB,YAAY,OAAO,EAAE,EAAE;AACvB,YAAY,cAAc,EAAE,iBAAiB;AAC7C,SAAS;AACT,QAAQ,KAAK,GAAG;AAChB,YAAY,OAAO,MAAM,CAAC,IAAI,CAAC;AAC/B,SAAS;AACT,QAAQ,GAAG,YAAY,CAAC,oBAAoB,CAAC;AAC7C,KAAK;AACL;AACA,SAAS,MAAM,CAAC,SAAS,EAAE;AAC3B,IAAI,OAAO;AACX,QAAQ,CAAC,UAAU,GAAG;AACtB,YAAY,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,OAAO;AAClD,YAAY,cAAc,EAAE,OAAO;AACnC,SAAS;AACT,QAAQ,GAAG,YAAY,CAAC,yBAAyB,CAAC;AAClD,KAAK;AACL;AACA;AACA,OAAO,CAAC,OAAO,GAAG;AAClB,IAAI,SAAS;AACb,IAAI,YAAY;AAChB,IAAI,MAAM;AACV,IAAI,QAAQ,EAAE,GAAG;AACjB,CAAC;;"}
@@ -1,9 +1,24 @@
1
1
  'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- 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.__generated = exports.__auth = void 0;
4
+ exports.ModelFieldDataType = exports.ModelFieldType = exports.__generated = exports.__auth = void 0;
5
+ exports.id = id;
6
+ exports.string = string;
7
+ exports.integer = integer;
8
+ exports.float = float;
9
+ exports.boolean = boolean;
10
+ exports.date = date;
11
+ exports.time = time;
12
+ exports.datetime = datetime;
13
+ exports.timestamp = timestamp;
14
+ exports.email = email;
15
+ exports.json = json;
16
+ exports.phone = phone;
17
+ exports.url = url;
18
+ exports.ipAddress = ipAddress;
5
19
  const util_1 = require("./util");
6
20
  const Authorization_1 = require("./Authorization");
21
+ const Validate_1 = require("./Validate");
7
22
  /**
8
23
  * Used to "attach" auth types to ModelField without exposing them on the builder.
9
24
  */
@@ -62,6 +77,7 @@ function _field(fieldType) {
62
77
  arrayRequired: false,
63
78
  default: undefined,
64
79
  authorization: [],
80
+ validation: [],
65
81
  };
66
82
  const builder = {
67
83
  required() {
@@ -91,13 +107,18 @@ function _field(fieldType) {
91
107
  _meta.lastInvokedMethod = 'authorization';
92
108
  return this;
93
109
  },
110
+ validate(callback) {
111
+ const { builder, getRules } = (0, Validate_1.createValidationBuilder)();
112
+ callback(builder);
113
+ data.validation = getRules();
114
+ _meta.lastInvokedMethod = 'validate';
115
+ return this;
116
+ },
94
117
  ...(0, util_1.brand)(brandName),
95
118
  [internal]() {
96
119
  return this;
97
120
  },
98
121
  };
99
- // this double cast gives us a Subtyping Constraint i.e., hides `data` from the public API,
100
- // but makes it available internally when needed
101
122
  return { ...builder, data };
102
123
  }
103
124
  /**
@@ -108,7 +129,6 @@ function _field(fieldType) {
108
129
  function id() {
109
130
  return _field(ModelFieldType.Id);
110
131
  }
111
- exports.id = id;
112
132
  /**
113
133
  * A string scalar type that is represented server-side as a UTF-8 character sequence.
114
134
  * @returns string field definition
@@ -116,7 +136,6 @@ exports.id = id;
116
136
  function string() {
117
137
  return _field(ModelFieldType.String);
118
138
  }
119
- exports.string = string;
120
139
  /**
121
140
  * An integer scalar type with a supported value range between -(2^31) and 2^31-1.
122
141
  * @returns integer field definition
@@ -124,7 +143,6 @@ exports.string = string;
124
143
  function integer() {
125
144
  return _field(ModelFieldType.Integer);
126
145
  }
127
- exports.integer = integer;
128
146
  /**
129
147
  * A float scalar type following represented server-side as an IEEE 754 floating point value.
130
148
  * @returns float field definition
@@ -132,7 +150,6 @@ exports.integer = integer;
132
150
  function float() {
133
151
  return _field(ModelFieldType.Float);
134
152
  }
135
- exports.float = float;
136
153
  /**
137
154
  * A boolean scalar type that can be either true or false.
138
155
  * @returns boolean field definition
@@ -140,7 +157,6 @@ exports.float = float;
140
157
  function boolean() {
141
158
  return _field(ModelFieldType.Boolean);
142
159
  }
143
- exports.boolean = boolean;
144
160
  /**
145
161
  * A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.
146
162
  * @returns date field definition
@@ -148,7 +164,6 @@ exports.boolean = boolean;
148
164
  function date() {
149
165
  return _field(ModelFieldType.Date);
150
166
  }
151
- exports.date = date;
152
167
  /**
153
168
  * A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.
154
169
  * @returns time field definition
@@ -156,7 +171,6 @@ exports.date = date;
156
171
  function time() {
157
172
  return _field(ModelFieldType.Time);
158
173
  }
159
- exports.time = time;
160
174
  /**
161
175
  * 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`.
162
176
  * @returns datetime field definition
@@ -164,7 +178,6 @@ exports.time = time;
164
178
  function datetime() {
165
179
  return _field(ModelFieldType.DateTime);
166
180
  }
167
- exports.datetime = datetime;
168
181
  /**
169
182
  * A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.
170
183
  * @returns timestamp field definition
@@ -172,7 +185,6 @@ exports.datetime = datetime;
172
185
  function timestamp() {
173
186
  return _field(ModelFieldType.Timestamp);
174
187
  }
175
- exports.timestamp = timestamp;
176
188
  /**
177
189
  * An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.
178
190
  * @returns email field definition
@@ -180,7 +192,6 @@ exports.timestamp = timestamp;
180
192
  function email() {
181
193
  return _field(ModelFieldType.Email);
182
194
  }
183
- exports.email = email;
184
195
  /**
185
196
  * A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values
186
197
  * rather than as the literal input strings.
@@ -189,7 +200,6 @@ exports.email = email;
189
200
  function json() {
190
201
  return _field(ModelFieldType.JSON);
191
202
  }
192
- exports.json = json;
193
203
  /**
194
204
  * A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces
195
205
  * or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering
@@ -199,7 +209,6 @@ exports.json = json;
199
209
  function phone() {
200
210
  return _field(ModelFieldType.Phone);
201
211
  }
202
- exports.phone = phone;
203
212
  /**
204
213
  * A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.
205
214
  * URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.
@@ -208,7 +217,6 @@ exports.phone = phone;
208
217
  function url() {
209
218
  return _field(ModelFieldType.Url);
210
219
  }
211
- exports.url = url;
212
220
  /**
213
221
  * A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses
214
222
  * are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)
@@ -218,5 +226,4 @@ exports.url = url;
218
226
  function ipAddress() {
219
227
  return _field(ModelFieldType.IPAddress);
220
228
  }
221
- exports.ipAddress = ipAddress;
222
229
  //# sourceMappingURL=ModelField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelField.js","sources":["../../src/ModelField.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.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.__generated = exports.__auth = void 0;\nconst util_1 = require(\"./util\");\nconst Authorization_1 = require(\"./Authorization\");\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexports.__auth = Symbol('__auth');\n/**\n * Used by `.default()` to represent a generated field (SQL).\n */\nexports.__generated = Symbol('__generated');\nconst brandName = 'modelField';\nconst internal = Symbol('internal');\nvar ModelFieldType;\n(function (ModelFieldType) {\n ModelFieldType[\"Id\"] = \"ID\";\n ModelFieldType[\"String\"] = \"String\";\n ModelFieldType[\"Integer\"] = \"Int\";\n ModelFieldType[\"Float\"] = \"Float\";\n ModelFieldType[\"Boolean\"] = \"Boolean\";\n ModelFieldType[\"Date\"] = \"AWSDate\";\n ModelFieldType[\"Time\"] = \"AWSTime\";\n ModelFieldType[\"DateTime\"] = \"AWSDateTime\";\n ModelFieldType[\"Timestamp\"] = \"AWSTimestamp\";\n ModelFieldType[\"Email\"] = \"AWSEmail\";\n ModelFieldType[\"JSON\"] = \"AWSJSON\";\n ModelFieldType[\"Phone\"] = \"AWSPhone\";\n ModelFieldType[\"Url\"] = \"AWSURL\";\n ModelFieldType[\"IPAddress\"] = \"AWSIPAddress\";\n})(ModelFieldType || (exports.ModelFieldType = ModelFieldType = {}));\nvar ModelFieldDataType;\n(function (ModelFieldDataType) {\n ModelFieldDataType[\"String\"] = \"string\";\n ModelFieldDataType[\"Number\"] = \"number\";\n ModelFieldDataType[\"Boolean\"] = \"boolean\";\n ModelFieldDataType[\"Date\"] = \"Date\";\n ModelFieldDataType[\"JSON\"] = \"any\";\n})(ModelFieldDataType || (exports.ModelFieldDataType = ModelFieldDataType = {}));\n/**\n * Model Field Implementation\n *\n * @typeParam T - holds the JS data type of the field; invoking the public methods changes this type accordingly\n * @example\n * string() => T = string | null\n * string().array() => T = Array<string | null> | null\n * string().array().required() => T = Array<string | null>\n * string().required().array().required() => T = Array<string>\n *\n * @param fieldType - stores the GraphQL data type of the field\n */\nfunction _field(fieldType) {\n const _meta = {\n lastInvokedMethod: null,\n };\n const data = {\n fieldType,\n required: false,\n array: false,\n arrayRequired: false,\n default: undefined,\n authorization: [],\n };\n const builder = {\n required() {\n if (_meta.lastInvokedMethod === 'array') {\n data.arrayRequired = true;\n }\n else {\n data.required = true;\n }\n _meta.lastInvokedMethod = 'required';\n return this;\n },\n array() {\n data.array = true;\n _meta.lastInvokedMethod = 'array';\n return this;\n },\n default(val) {\n data.default = typeof val === 'undefined' ? exports.__generated : val;\n _meta.lastInvokedMethod = 'default';\n return this;\n },\n authorization(callback) {\n const { resource: _, ...rest } = Authorization_1.allow;\n const rules = callback(rest);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n _meta.lastInvokedMethod = 'authorization';\n return this;\n },\n ...(0, util_1.brand)(brandName),\n [internal]() {\n return this;\n },\n };\n // this double cast gives us a Subtyping Constraint i.e., hides `data` from the public API,\n // but makes it available internally when needed\n return { ...builder, data };\n}\n/**\n * A unique identifier scalar type. This scalar is serialized like a String but isn't meant to be human-readable.\n * If not specified on create operations, a ULID will be auto-generated service-side.\n * @returns ID field definition\n */\nfunction id() {\n return _field(ModelFieldType.Id);\n}\nexports.id = id;\n/**\n * A string scalar type that is represented server-side as a UTF-8 character sequence.\n * @returns string field definition\n */\nfunction string() {\n return _field(ModelFieldType.String);\n}\nexports.string = string;\n/**\n * An integer scalar type with a supported value range between -(2^31) and 2^31-1.\n * @returns integer field definition\n */\nfunction integer() {\n return _field(ModelFieldType.Integer);\n}\nexports.integer = integer;\n/**\n * A float scalar type following represented server-side as an IEEE 754 floating point value.\n * @returns float field definition\n */\nfunction float() {\n return _field(ModelFieldType.Float);\n}\nexports.float = float;\n/**\n * A boolean scalar type that can be either true or false.\n * @returns boolean field definition\n */\nfunction boolean() {\n return _field(ModelFieldType.Boolean);\n}\nexports.boolean = boolean;\n/**\n * A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.\n * @returns date field definition\n */\nfunction date() {\n return _field(ModelFieldType.Date);\n}\nexports.date = date;\n/**\n * A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.\n * @returns time field definition\n */\nfunction time() {\n return _field(ModelFieldType.Time);\n}\nexports.time = time;\n/**\n * 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`.\n * @returns datetime field definition\n */\nfunction datetime() {\n return _field(ModelFieldType.DateTime);\n}\nexports.datetime = datetime;\n/**\n * A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.\n * @returns timestamp field definition\n */\nfunction timestamp() {\n return _field(ModelFieldType.Timestamp);\n}\nexports.timestamp = timestamp;\n/**\n * An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.\n * @returns email field definition\n */\nfunction email() {\n return _field(ModelFieldType.Email);\n}\nexports.email = email;\n/**\n * A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values\n * rather than as the literal input strings.\n * @returns JSON field definition\n */\nfunction json() {\n return _field(ModelFieldType.JSON);\n}\nexports.json = json;\n/**\n * A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces\n * or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering\n * to the North American Numbering Plan.\n * @returns phone number field definition\n */\nfunction phone() {\n return _field(ModelFieldType.Phone);\n}\nexports.phone = phone;\n/**\n * A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.\n * URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.\n * @returns URL field definition\n */\nfunction url() {\n return _field(ModelFieldType.Url);\n}\nexports.url = url;\n/**\n * A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses\n * are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)\n * to indicate subnet mask.\n * @returns IP address field definition\n */\nfunction ipAddress() {\n return _field(ModelFieldType.IPAddress);\n}\nexports.ipAddress = ipAddress;\n"],"names":[],"mappings":";;AACA,M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AS,SAAS,GAAG;AACrB,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAC5C,CAAC;AACD,OAAO,CAAC,SAAS,GAAG,SAAS;;"}
1
+ {"version":3,"file":"ModelField.js","sources":["../../src/ModelField.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ModelFieldDataType = exports.ModelFieldType = exports.__generated = exports.__auth = void 0;\nexports.id = id;\nexports.string = string;\nexports.integer = integer;\nexports.float = float;\nexports.boolean = boolean;\nexports.date = date;\nexports.time = time;\nexports.datetime = datetime;\nexports.timestamp = timestamp;\nexports.email = email;\nexports.json = json;\nexports.phone = phone;\nexports.url = url;\nexports.ipAddress = ipAddress;\nconst util_1 = require(\"./util\");\nconst Authorization_1 = require(\"./Authorization\");\nconst Validate_1 = require(\"./Validate\");\n/**\n * Used to \"attach\" auth types to ModelField without exposing them on the builder.\n */\nexports.__auth = Symbol('__auth');\n/**\n * Used by `.default()` to represent a generated field (SQL).\n */\nexports.__generated = Symbol('__generated');\nconst brandName = 'modelField';\nconst internal = Symbol('internal');\nvar ModelFieldType;\n(function (ModelFieldType) {\n ModelFieldType[\"Id\"] = \"ID\";\n ModelFieldType[\"String\"] = \"String\";\n ModelFieldType[\"Integer\"] = \"Int\";\n ModelFieldType[\"Float\"] = \"Float\";\n ModelFieldType[\"Boolean\"] = \"Boolean\";\n ModelFieldType[\"Date\"] = \"AWSDate\";\n ModelFieldType[\"Time\"] = \"AWSTime\";\n ModelFieldType[\"DateTime\"] = \"AWSDateTime\";\n ModelFieldType[\"Timestamp\"] = \"AWSTimestamp\";\n ModelFieldType[\"Email\"] = \"AWSEmail\";\n ModelFieldType[\"JSON\"] = \"AWSJSON\";\n ModelFieldType[\"Phone\"] = \"AWSPhone\";\n ModelFieldType[\"Url\"] = \"AWSURL\";\n ModelFieldType[\"IPAddress\"] = \"AWSIPAddress\";\n})(ModelFieldType || (exports.ModelFieldType = ModelFieldType = {}));\nvar ModelFieldDataType;\n(function (ModelFieldDataType) {\n ModelFieldDataType[\"String\"] = \"string\";\n ModelFieldDataType[\"Number\"] = \"number\";\n ModelFieldDataType[\"Boolean\"] = \"boolean\";\n ModelFieldDataType[\"Date\"] = \"Date\";\n ModelFieldDataType[\"JSON\"] = \"any\";\n})(ModelFieldDataType || (exports.ModelFieldDataType = ModelFieldDataType = {}));\n/**\n * Model Field Implementation\n *\n * @typeParam T - holds the JS data type of the field; invoking the public methods changes this type accordingly\n * @example\n * string() => T = string | null\n * string().array() => T = Array<string | null> | null\n * string().array().required() => T = Array<string | null>\n * string().required().array().required() => T = Array<string>\n *\n * @param fieldType - stores the GraphQL data type of the field\n */\nfunction _field(fieldType) {\n const _meta = {\n lastInvokedMethod: null,\n };\n const data = {\n fieldType,\n required: false,\n array: false,\n arrayRequired: false,\n default: undefined,\n authorization: [],\n validation: [],\n };\n const builder = {\n required() {\n if (_meta.lastInvokedMethod === 'array') {\n data.arrayRequired = true;\n }\n else {\n data.required = true;\n }\n _meta.lastInvokedMethod = 'required';\n return this;\n },\n array() {\n data.array = true;\n _meta.lastInvokedMethod = 'array';\n return this;\n },\n default(val) {\n data.default = typeof val === 'undefined' ? exports.__generated : val;\n _meta.lastInvokedMethod = 'default';\n return this;\n },\n authorization(callback) {\n const { resource: _, ...rest } = Authorization_1.allow;\n const rules = callback(rest);\n data.authorization = Array.isArray(rules) ? rules : [rules];\n _meta.lastInvokedMethod = 'authorization';\n return this;\n },\n validate(callback) {\n const { builder, getRules } = (0, Validate_1.createValidationBuilder)();\n callback(builder);\n data.validation = getRules();\n _meta.lastInvokedMethod = 'validate';\n return this;\n },\n ...(0, util_1.brand)(brandName),\n [internal]() {\n return this;\n },\n };\n return { ...builder, data };\n}\n/**\n * A unique identifier scalar type. This scalar is serialized like a String but isn't meant to be human-readable.\n * If not specified on create operations, a ULID will be auto-generated service-side.\n * @returns ID field definition\n */\nfunction id() {\n return _field(ModelFieldType.Id);\n}\n/**\n * A string scalar type that is represented server-side as a UTF-8 character sequence.\n * @returns string field definition\n */\nfunction string() {\n return _field(ModelFieldType.String);\n}\n/**\n * An integer scalar type with a supported value range between -(2^31) and 2^31-1.\n * @returns integer field definition\n */\nfunction integer() {\n return _field(ModelFieldType.Integer);\n}\n/**\n * A float scalar type following represented server-side as an IEEE 754 floating point value.\n * @returns float field definition\n */\nfunction float() {\n return _field(ModelFieldType.Float);\n}\n/**\n * A boolean scalar type that can be either true or false.\n * @returns boolean field definition\n */\nfunction boolean() {\n return _field(ModelFieldType.Boolean);\n}\n/**\n * A date scalar type that is represented server-side as an extended ISO 8601 date string in the format `YYYY-MM-DD`.\n * @returns date field definition\n */\nfunction date() {\n return _field(ModelFieldType.Date);\n}\n/**\n * A time scalar type that is represented server-side as an extended ISO 8601 time string in the format `hh:mm:ss.sss`.\n * @returns time field definition\n */\nfunction time() {\n return _field(ModelFieldType.Time);\n}\n/**\n * 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`.\n * @returns datetime field definition\n */\nfunction datetime() {\n return _field(ModelFieldType.DateTime);\n}\n/**\n * A timestamp scalar type that is represented by an integer value of the number of seconds before or after `1970-01-01-T00:00Z`.\n * @returns timestamp field definition\n */\nfunction timestamp() {\n return _field(ModelFieldType.Timestamp);\n}\n/**\n * An email scalar type that is represented server-side in the format `local-part@domain-part` as defined by RFC 822.\n * @returns email field definition\n */\nfunction email() {\n return _field(ModelFieldType.Email);\n}\n/**\n * A JSON scalar type that is automatically parsed and loaded server-side as maps, lists, or scalar values\n * rather than as the literal input strings.\n * @returns JSON field definition\n */\nfunction json() {\n return _field(ModelFieldType.JSON);\n}\n/**\n * A phone number scalar type thas is stored as a string server-side. Phone numbers can contain either spaces\n * or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering\n * to the North American Numbering Plan.\n * @returns phone number field definition\n */\nfunction phone() {\n return _field(ModelFieldType.Phone);\n}\n/**\n * A URL scalar type as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com.\n * URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.\n * @returns URL field definition\n */\nfunction url() {\n return _field(ModelFieldType.Url);\n}\n/**\n * A valid IPv4 or IPv6 address scalar type. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses\n * are expected in non-bracketed, colon-separated format (1a2b:3c4b:🔢4567). You can include an optional CIDR suffix (123.45.67.89/16)\n * to indicate subnet mask.\n * @returns IP address field definition\n */\nfunction ipAddress() {\n return _field(ModelFieldType.IPAddress);\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM;AACnG,OAAO,CAAC,EAAE,GAAG,EAAE;AACf,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,OAAO,CAAC,OAAO,GAAG,OAAO;AACzB,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,OAAO,CAAC,IAAI,GAAG,IAAI;AACnB,OAAO,CAAC,KAAK,GAAG,KAAK;AACrB,OAAO,CAAC,GAAG,GAAG,GAAG;AACjB,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAClD,MAAM,UAAU,GAAG,OAAO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use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.modelIndex = void 0;
4
+ exports.modelIndex = modelIndex;
5
5
  const util_1 = require("./util");
6
6
  const brandName = 'modelIndexType';
7
7
  function _modelIndex(partitionKeyFieldName) {
@@ -31,5 +31,4 @@ function _modelIndex(partitionKeyFieldName) {
31
31
  function modelIndex(partitionKeyFieldName) {
32
32
  return _modelIndex(partitionKeyFieldName);
33
33
  }
34
- exports.modelIndex = modelIndex;
35
34
  //# sourceMappingURL=ModelIndex.js.map