@aws-amplify/data-schema 0.18.1 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Authorization.js +17 -17
- package/dist/cjs/Authorization.js.map +1 -1
- package/dist/cjs/SchemaProcessor.js +27 -6
- package/dist/cjs/SchemaProcessor.js.map +1 -1
- package/dist/cjs/runtime/internals/APIClient.js +6 -2
- package/dist/cjs/runtime/internals/APIClient.js.map +1 -1
- package/dist/esm/Authorization.d.ts +16 -16
- package/dist/esm/Authorization.mjs +17 -17
- package/dist/esm/Authorization.mjs.map +1 -1
- package/dist/esm/ModelType.d.ts +20 -5
- package/dist/esm/SchemaProcessor.mjs +27 -6
- package/dist/esm/SchemaProcessor.mjs.map +1 -1
- package/dist/esm/runtime/bridge-types.d.ts +1 -1
- package/dist/esm/runtime/client/index.d.ts +15 -12
- package/dist/esm/runtime/internals/APIClient.mjs +6 -2
- package/dist/esm/runtime/internals/APIClient.mjs.map +1 -1
- package/dist/meta/cjs.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/Authorization.ts +17 -17
- package/src/ModelType.ts +44 -14
- package/src/SchemaProcessor.ts +42 -4
- package/src/runtime/bridge-types.ts +1 -0
- package/src/runtime/client/index.ts +46 -14
- package/src/runtime/internals/APIClient.ts +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.mjs","sources":["../../src/Authorization.ts"],"sourcesContent":["const __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 `iam` providers.\n */\nexport const Providers = [\n 'apiKey',\n 'iam',\n 'userPools',\n 'oidc',\n 'function',\n];\n/**\n * The subset of auth providers that can facilitate `public` auth.\n */\nexport const PublicProviders = ['apiKey', 'iam'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexport const PrivateProviders = ['userPools', 'oidc', 'iam'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexport const OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexport const GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexport const CustomProviders = ['function'];\nexport const Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexport const 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 */\nexport const 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`, `iam`, `userPools`, `oidc`, or `function`)\n * and optionally use `.to(...)` to specify the operations that can be performed against your data models and fields.\n */\nexport const 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 IAM based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'iam',\n }, {\n to,\n });\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"iam\")` or `.authenticated(\"oidc\")` to use IAM or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, 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\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n owner(provider) {\n validateProvider(provider, 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\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownerDefinedIn(ownerField, provider) {\n validateProvider(provider, 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\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n ownersDefinedIn(ownersField, provider) {\n validateProvider(provider, 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 */\nexport const 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 IAM based authorization.\n * @returns an authorization rule for unauthenticated users\n */\n guest() {\n return authData({\n strategy: 'public',\n provider: 'iam',\n }, {});\n },\n /**\n * Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally\n * use `.authenticated(\"iam\")` or `.authenticated(\"oidc\")` to use IAM or OIDC based authorization for authenticated users.\n * @param provider the authentication provider - supports \"userPools\", \"iam\", or \"oidc\"\n * @returns an authorization rule for authenticated users\n */\n authenticated(provider) {\n validateProvider(provider, 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};\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}\nexport const accessData = (authorization) => authorization[__data];\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nexport const accessSchemaData = (authorization) => authorization[__data];\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,UAAU;AACd,EAAE;AACF;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE;AACjD;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE;AAC7D;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,UAAU,EAAE;AAChC,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,EAAE;AACF;AACA;AACA;AACY,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV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AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE;AAC7B,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,YAAY,MAAM;AAClB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,EAAE;AACrB,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,EAAE;AACF,SAAS,UAAU,CAAC,UAAU,EAAE;AAChC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;AACzC,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE;AACpD,IAAI,OAAO;AACX,QAAQ,CAAC,MAAM,GAAG;AAClB,YAAY,QAAQ,EAAE,UAAU;AAChC,YAAY,QAAQ;AACpB,SAAS;AACT,QAAQ,GAAG,cAAc;AACzB,KAAK,CAAC;AACN,CAAC;AACW,MAAC,UAAU,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,EAAE;AACnE;AACY,MAAC,gBAAgB,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"Authorization.mjs","sources":["../../src/Authorization.ts"],"sourcesContent":["const __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 */\nexport const 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 */\nexport const PublicProviders = ['apiKey', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `private` auth.\n */\nexport const PrivateProviders = ['userPools', 'oidc', 'identityPool'];\n/**\n * The subset of auth providers that can facilitate `owner` auth.\n */\nexport const OwnerProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `group` auth.\n */\nexport const GroupProviders = ['userPools', 'oidc'];\n/**\n * The subset of auth providers that can facilitate `custom` auth.\n */\nexport const CustomProviders = ['function'];\nexport const Strategies = [\n 'public',\n 'private',\n 'owner',\n 'groups',\n 'custom',\n];\n/**\n * The operations that can be performed against an API.\n */\nexport const 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 */\nexport const 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 */\nexport const 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, 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, 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, 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, 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 */\nexport const 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, 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};\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}\nexport const accessData = (authorization) => authorization[__data];\n// TODO: delete when we make resource auth available at each level in the schema (model, field)\nexport const accessSchemaData = (authorization) => authorization[__data];\n"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,SAAS,GAAG;AACzB,IAAI,QAAQ;AACZ,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,UAAU;AACd,EAAE;AACF;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE;AAC1D;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE;AACtE;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,cAAc,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE;AACpD;AACA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,UAAU,EAAE;AAChC,MAAC,UAAU,GAAG;AAC1B,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,EAAE;AACF;AACA;AACA;AACY,MAAC,UAAU,GAAG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B,YAAY,QAAQ;AACpB,YAAY,MAAM,EAAE,CAAC,KAAK,CAAC;AAC3B,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE;AAC7B,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,YAAY,MAAM;AAClB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,IAAI,MAAM,CAAC,QAAQ,EAAE;AACrB,QAAQ,OAAO,QAAQ,CAAC;AACxB,YAAY,QAAQ,EAAE,QAAQ;AAC9B,YAAY,QAAQ;AACpB,SAAS,EAAE,EAAE,CAAC,CAAC;AACf,KAAK;AACL,EAAE;AACF,SAAS,UAAU,CAAC,UAAU,EAAE;AAChC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;AACzC,IAAI,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE;AACpD,IAAI,OAAO;AACX,QAAQ,CAAC,MAAM,GAAG;AAClB,YAAY,QAAQ,EAAE,UAAU;AAChC,YAAY,QAAQ;AACpB,SAAS;AACT,QAAQ,GAAG,cAAc;AACzB,KAAK,CAAC;AACN,CAAC;AACW,MAAC,UAAU,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,EAAE;AACnE;AACY,MAAC,gBAAgB,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM;;;;"}
|
package/dist/esm/ModelType.d.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { Brand } from './util';
|
|
|
3
3
|
import { ModelField, InternalField } from './ModelField';
|
|
4
4
|
import type { ModelRelationalField, InternalRelationalField, ModelRelationalFieldParamShape } from './ModelRelationalField';
|
|
5
5
|
import { AllowModifier, Authorization } from './Authorization';
|
|
6
|
-
import { RefType } from './RefType';
|
|
6
|
+
import { RefType, RefTypeParamShape } from './RefType';
|
|
7
7
|
import { EnumType, EnumTypeParamShape } from './EnumType';
|
|
8
8
|
import { CustomType, CustomTypeParamShape } from './CustomType';
|
|
9
9
|
import { ModelIndexType, InternalModelIndexType } from './ModelIndex';
|
|
10
10
|
import { SecondaryIndexToIR } from './MappedTypes/MapSecondaryIndexes';
|
|
11
11
|
declare const brandName = "modelType";
|
|
12
|
+
export type deferredRefResolvingPrefix = 'deferredRefResolving:';
|
|
12
13
|
type ModelFields = Record<string, ModelField<any, any, any> | ModelRelationalField<any, string, any, any> | RefType<any, any, any> | EnumType<EnumTypeParamShape> | CustomType<CustomTypeParamShape>>;
|
|
13
14
|
type InternalModelFields = Record<string, InternalField | InternalRelationalField>;
|
|
14
15
|
type ModelData = {
|
|
@@ -29,9 +30,23 @@ export type ModelTypeParamShape = {
|
|
|
29
30
|
secondaryIndexes: ReadonlyArray<SecondaryIndexIrShape>;
|
|
30
31
|
authorization: Authorization<any, any, any>[];
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Extract fields that are eligible to be PK or SK fields with their resolved type.
|
|
35
|
+
*
|
|
36
|
+
* Eligible fields include:
|
|
37
|
+
* 1. ModelField that contains string or number
|
|
38
|
+
* 2. inline EnumType
|
|
39
|
+
* 3. RefType that refers to a top level defined EnumType (this is enforced by
|
|
40
|
+
* validation that happens in the Schema Processor)
|
|
41
|
+
*
|
|
42
|
+
* NOTE: at this point, there is no way to resolve the type from a RefType as
|
|
43
|
+
* we don't have access to the NonModelType at this location. So we generate am
|
|
44
|
+
* indicator string, and resolve its corresponding type later in
|
|
45
|
+
* packages/data-schema/src/runtime/client/index.ts
|
|
46
|
+
*/
|
|
47
|
+
type ExtractSecondaryIndexIRFields<T extends ModelTypeParamShape> = {
|
|
48
|
+
[FieldProp in keyof T['fields'] as T['fields'][FieldProp] extends ModelField<infer R, any, any> ? NonNullable<R> extends string | number ? FieldProp : never : T['fields'][FieldProp] extends EnumType<EnumTypeParamShape> ? FieldProp : T['fields'][FieldProp] extends RefType<RefTypeParamShape, any, any> ? FieldProp : never]: T['fields'][FieldProp] extends ModelField<infer R, any, any> ? R : T['fields'][FieldProp] extends EnumType<infer R> ? R['values'][number] : T['fields'][FieldProp] extends RefType<infer R, any, any> ? `${deferredRefResolvingPrefix}${R['link']}` : never;
|
|
49
|
+
};
|
|
35
50
|
type ExtractType<T extends ModelTypeParamShape> = {
|
|
36
51
|
[FieldProp in keyof T['fields'] as T['fields'][FieldProp] extends ModelField<any, any, any> ? FieldProp : never]: T['fields'][FieldProp] extends ModelField<infer R, any, any> ? R : never;
|
|
37
52
|
};
|
|
@@ -44,7 +59,7 @@ type IdentifierType<T extends ModelTypeParamShape, Fields extends string = Ident
|
|
|
44
59
|
export type AddRelationshipFieldsToModelTypeFields<Model, RelationshipFields extends Record<string, ModelRelationalField<ModelRelationalFieldParamShape, string, any, any>>> = Model extends ModelType<infer ModelParam extends ModelTypeParamShape, infer HiddenKeys> ? ModelType<SetTypeSubArg<ModelParam, 'fields', ModelParam['fields'] & RelationshipFields>, HiddenKeys> : never;
|
|
45
60
|
export type ModelType<T extends ModelTypeParamShape, K extends keyof ModelType<T> = never> = Omit<{
|
|
46
61
|
identifier<ID extends IdentifierType<T> = []>(identifier: ID): ModelType<SetTypeSubArg<T, 'identifier', ID>, K | 'identifier'>;
|
|
47
|
-
secondaryIndexes<const SecondaryIndexPKPool extends string = SecondaryIndexFields
|
|
62
|
+
secondaryIndexes<const SecondaryIndexFields = ExtractSecondaryIndexIRFields<T>, const SecondaryIndexPKPool extends string = keyof SecondaryIndexFields & string, const Indexes extends readonly ModelIndexType<string, string, unknown, readonly [], any>[] = readonly [], const IndexesIR extends readonly any[] = SecondaryIndexToIR<Indexes, SecondaryIndexFields>>(callback: (index: <PK extends SecondaryIndexPKPool>(pk: PK) => ModelIndexType<SecondaryIndexPKPool, PK, ReadonlyArray<Exclude<SecondaryIndexPKPool, PK>>>) => Indexes): ModelType<SetTypeSubArg<T, 'secondaryIndexes', IndexesIR>, K | 'secondaryIndexes'>;
|
|
48
63
|
authorization<AuthRuleType extends Authorization<any, any, any>>(callback: (allow: Omit<AllowModifier, 'resource'>) => AuthRuleType | AuthRuleType[]): ModelType<SetTypeSubArg<T, 'authorization', AuthRuleType[]>, K | 'authorization'>;
|
|
49
64
|
}, K> & Brand<typeof brandName>;
|
|
50
65
|
/**
|
|
@@ -111,7 +111,7 @@ function modelFieldToGql(fieldDef) {
|
|
|
111
111
|
}
|
|
112
112
|
return field;
|
|
113
113
|
}
|
|
114
|
-
function refFieldToGql(fieldDef) {
|
|
114
|
+
function refFieldToGql(fieldDef, secondaryIndexes = []) {
|
|
115
115
|
const { link, valueRequired, array, arrayRequired } = fieldDef;
|
|
116
116
|
let field = link;
|
|
117
117
|
if (valueRequired === true) {
|
|
@@ -123,6 +123,16 @@ function refFieldToGql(fieldDef) {
|
|
|
123
123
|
if (arrayRequired === true) {
|
|
124
124
|
field += '!';
|
|
125
125
|
}
|
|
126
|
+
for (const index of secondaryIndexes) {
|
|
127
|
+
field += ` ${index}`;
|
|
128
|
+
}
|
|
129
|
+
return field;
|
|
130
|
+
}
|
|
131
|
+
function enumFieldToGql(enumName, secondaryIndexes = []) {
|
|
132
|
+
let field = enumName;
|
|
133
|
+
for (const index of secondaryIndexes) {
|
|
134
|
+
field += ` ${index}`;
|
|
135
|
+
}
|
|
126
136
|
return field;
|
|
127
137
|
}
|
|
128
138
|
function transformFunctionHandler(handlers, functionFieldName) {
|
|
@@ -374,7 +384,9 @@ function calculateAuth(authorization) {
|
|
|
374
384
|
};
|
|
375
385
|
}
|
|
376
386
|
if (rule.provider) {
|
|
377
|
-
|
|
387
|
+
// identityPool maps to iam in the transform
|
|
388
|
+
const provider = rule.provider === 'identityPool' ? 'iam' : rule.provider;
|
|
389
|
+
ruleParts.push(`provider: ${provider}`);
|
|
378
390
|
}
|
|
379
391
|
if (rule.operations) {
|
|
380
392
|
ruleParts.push(`operations: [${rule.operations.join(', ')}]`);
|
|
@@ -506,14 +518,14 @@ function processFields(typeName, fields, impliedFields, fieldLevelAuthRules, ide
|
|
|
506
518
|
gqlFields.push(`${fieldName}: ${scalarFieldToGql(fieldDef.data, identifier, secondaryIndexes[fieldName])}${fieldAuth}`);
|
|
507
519
|
}
|
|
508
520
|
else if (isRefField(fieldDef)) {
|
|
509
|
-
gqlFields.push(`${fieldName}: ${refFieldToGql(fieldDef.data)}${fieldAuth}`);
|
|
521
|
+
gqlFields.push(`${fieldName}: ${refFieldToGql(fieldDef.data, secondaryIndexes[fieldName])}${fieldAuth}`);
|
|
510
522
|
}
|
|
511
523
|
else if (isEnumType(fieldDef)) {
|
|
512
524
|
// The inline enum type name should be `<TypeName><FieldName>` to avoid
|
|
513
525
|
// enum type name conflicts
|
|
514
526
|
const enumName = `${capitalize(typeName)}${capitalize(fieldName)}`;
|
|
515
527
|
models.push([enumName, fieldDef]);
|
|
516
|
-
gqlFields.push(`${fieldName}: ${enumName}`);
|
|
528
|
+
gqlFields.push(`${fieldName}: ${enumFieldToGql(enumName, secondaryIndexes[fieldName])}`);
|
|
517
529
|
}
|
|
518
530
|
else if (isCustomType(fieldDef)) {
|
|
519
531
|
// The inline CustomType name should be `<TypeName><FieldName>` to avoid
|
|
@@ -547,8 +559,17 @@ const secondaryIndexDefaultQueryField = (modelName, pk, sk) => {
|
|
|
547
559
|
* Given InternalModelIndexType[] returns a map where the key is the model field to be annotated with an @index directive
|
|
548
560
|
* and the value is an array of transformed Amplify @index directives with all supplied attributes
|
|
549
561
|
*/
|
|
550
|
-
const transformedSecondaryIndexesForModel = (modelName, secondaryIndexes) => {
|
|
562
|
+
const transformedSecondaryIndexesForModel = (modelName, secondaryIndexes, modelFields, getRefType) => {
|
|
551
563
|
const indexDirectiveWithAttributes = (partitionKey, sortKeys, indexName, queryField) => {
|
|
564
|
+
for (const keyName of [partitionKey, ...sortKeys]) {
|
|
565
|
+
const field = modelFields[keyName];
|
|
566
|
+
if (isRefField(field)) {
|
|
567
|
+
const { def } = getRefType(field.data.link, modelName);
|
|
568
|
+
if (!isEnumType(def)) {
|
|
569
|
+
throw new Error(`The ref field \`${keyName}\` used in the secondary index of \`${modelName}\` should refer to an enum type. \`${field.data.link}\` is not a enum type.`);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
552
573
|
if (!sortKeys.length && !indexName && !queryField) {
|
|
553
574
|
return `@index(queryField: "${secondaryIndexDefaultQueryField(modelName, partitionKey)}")`;
|
|
554
575
|
}
|
|
@@ -719,7 +740,7 @@ const schemaPreprocessor = (schema) => {
|
|
|
719
740
|
const fields = typeDef.data.fields;
|
|
720
741
|
const identifier = typeDef.data.identifier;
|
|
721
742
|
const [partitionKey] = identifier;
|
|
722
|
-
const transformedSecondaryIndexes = transformedSecondaryIndexesForModel(typeName, typeDef.data.secondaryIndexes);
|
|
743
|
+
const transformedSecondaryIndexes = transformedSecondaryIndexesForModel(typeName, typeDef.data.secondaryIndexes, fields, getRefType);
|
|
723
744
|
const { authString, authFields } = calculateAuth(mostRelevantAuthRules);
|
|
724
745
|
if (authString == '') {
|
|
725
746
|
throw new Error(`Model \`${typeName}\` is missing authorization rules. Add global rules to the schema or ensure every model has its own rules.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaProcessor.mjs","sources":["../../src/SchemaProcessor.ts"],"sourcesContent":["import { string, } from './ModelField';\nimport { accessData, accessSchemaData, } from './Authorization';\nimport { CustomOperationNames } from './CustomOperation';\nimport { getBrand } from './util';\nimport { getHandlerData, } from './Handler';\nimport * as os from 'os';\nimport * as path from 'path';\nfunction isInternalModel(model) {\n if (model.data &&\n !isCustomType(model) &&\n !isCustomOperation(model)) {\n return true;\n }\n return false;\n}\nfunction isEnumType(data) {\n if (data?.type === 'enum') {\n return true;\n }\n return false;\n}\nfunction isCustomType(data) {\n if (data?.data?.type === 'customType') {\n return true;\n }\n return false;\n}\nfunction isCustomOperation(type) {\n if (CustomOperationNames.includes(type?.data?.typeName)) {\n return true;\n }\n return false;\n}\nfunction isModelFieldDef(data) {\n return data?.fieldType === 'model';\n}\nfunction isScalarFieldDef(data) {\n return data?.fieldType !== 'model';\n}\nfunction isRefFieldDef(data) {\n return data?.type === 'ref';\n}\nfunction isModelField(field) {\n return isModelFieldDef(field?.data);\n}\nfunction dataSourceIsRef(dataSource) {\n return (typeof dataSource !== 'string' &&\n dataSource?.data &&\n dataSource.data.type === 'ref');\n}\nfunction isScalarField(field) {\n return isScalarFieldDef(field?.data);\n}\nfunction isRefField(field) {\n return isRefFieldDef(field?.data);\n}\nfunction scalarFieldToGql(fieldDef, identifier, secondaryIndexes = []) {\n const { fieldType, required, array, arrayRequired, default: _default, } = fieldDef;\n let field = fieldType;\n if (identifier !== undefined) {\n field += '!';\n if (identifier.length > 1) {\n const [_pk, ...sk] = identifier;\n field += ` @primaryKey(sortKeyFields: [${sk\n .map((sk) => `\"${sk}\"`)\n .join(', ')}])`;\n }\n else {\n field += ' @primaryKey';\n }\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n }\n if (required === true) {\n field += '!';\n }\n if (array) {\n field = `[${field}]`;\n if (arrayRequired === true) {\n field += '!';\n }\n }\n if (_default !== undefined) {\n field += ` @default(value: \"${_default?.toString()}\")`;\n }\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n}\nfunction modelFieldToGql(fieldDef) {\n const { type, relatedModel, array, valueRequired, arrayRequired, references, } = fieldDef;\n let field = relatedModel;\n if (valueRequired === true) {\n field += '!';\n }\n if (array) {\n field = `[${field}]`;\n }\n if (arrayRequired === true) {\n field += '!';\n }\n if (references && Array.isArray(references) && references.length > 0) {\n field += ` @${type}(references: [${references.map((s) => `\"${String(s)}\"`)}])`;\n }\n else {\n field += ` @${type}`;\n }\n return field;\n}\nfunction refFieldToGql(fieldDef) {\n const { link, valueRequired, array, arrayRequired } = fieldDef;\n let field = link;\n if (valueRequired === true) {\n field += '!';\n }\n if (array === true) {\n field = `[${field}]`;\n }\n if (arrayRequired === true) {\n field += '!';\n }\n return field;\n}\nfunction transformFunctionHandler(handlers, functionFieldName) {\n let gqlHandlerContent = '';\n const lambdaFunctionDefinition = {};\n handlers.forEach((handler, idx) => {\n const handlerData = getHandlerData(handler);\n if (typeof handlerData === 'string') {\n gqlHandlerContent += `@function(name: \"${handlerData}\") `;\n }\n else if (typeof handlerData.getInstance === 'function') {\n const fnName = `Fn${capitalize(functionFieldName)}${idx === 0 ? '' : `${idx + 1}`}`;\n lambdaFunctionDefinition[fnName] = handlerData;\n gqlHandlerContent += `@function(name: \"${fnName}\") `;\n }\n else {\n throw new Error(`Invalid value specified for ${functionFieldName} handler.function(). Expected: defineFunction or string.`);\n }\n });\n return { gqlHandlerContent, lambdaFunctionDefinition };\n}\nfunction customOperationToGql(typeName, typeDef, authorization, isCustom = false, databaseType, getRefType) {\n const { arguments: fieldArgs, typeName: opType, returnType, functionRef, handlers, subscriptionSource, } = typeDef.data;\n let callSignature = typeName;\n const implicitModels = [];\n const { authString } = isCustom\n ? calculateCustomAuth(authorization)\n : calculateAuth(authorization);\n /**\n *\n * @param returnType The return type from the `data` field of a customer operation.\n * @param refererTypeName The type the refers {@link returnType} by `a.ref()`.\n * @param shouldAddCustomTypeToImplicitModels A flag indicates wether it should push\n * the return type resolved CustomType to the `implicitModels` list.\n * @returns\n */\n const resolveReturnTypeNameFromReturnType = (returnType, { refererTypeName, shouldAddCustomTypeToImplicitModels = true, }) => {\n if (isRefField(returnType)) {\n return refFieldToGql(returnType?.data);\n }\n else if (isCustomType(returnType)) {\n const returnTypeName = `${capitalize(refererTypeName)}ReturnType`;\n if (shouldAddCustomTypeToImplicitModels) {\n implicitModels.push([returnTypeName, returnType]);\n }\n return returnTypeName;\n }\n else if (isScalarField(returnType)) {\n return scalarFieldToGql(returnType?.data);\n }\n else {\n throw new Error(`Unrecognized return type on ${typeName}`);\n }\n };\n let returnTypeName;\n if (opType === 'Subscription' && returnType === null) {\n // up to this point, we've validated that each subscription resource resolves\n // the same return type, so it's safe to use subscriptionSource[0] here.\n const { type, def } = getRefType(subscriptionSource[0].data.link, typeName);\n if (type === 'CustomOperation') {\n returnTypeName = resolveReturnTypeNameFromReturnType(def.data.returnType, {\n refererTypeName: subscriptionSource[0].data.link,\n shouldAddCustomTypeToImplicitModels: false,\n });\n }\n else {\n returnTypeName = refFieldToGql(subscriptionSource[0].data);\n }\n }\n else {\n returnTypeName = resolveReturnTypeNameFromReturnType(returnType, {\n refererTypeName: typeName,\n });\n }\n if (Object.keys(fieldArgs).length > 0) {\n const { gqlFields, models } = processFields(typeName, fieldArgs, {}, {});\n callSignature += `(${gqlFields.join(', ')})`;\n implicitModels.push(...models);\n }\n const handler = handlers && handlers[0];\n const brand = handler && getBrand(handler);\n let gqlHandlerContent = '';\n let lambdaFunctionDefinition = {};\n let customSqlDataSourceStrategy;\n if (isFunctionHandler(handlers)) {\n ({ gqlHandlerContent, lambdaFunctionDefinition } = transformFunctionHandler(handlers, typeName));\n }\n else if (functionRef) {\n gqlHandlerContent = `@function(name: \"${functionRef}\") `;\n }\n else if (databaseType === 'sql' && handler && brand === 'inlineSql') {\n gqlHandlerContent = `@sql(statement: ${escapeGraphQlString(String(getHandlerData(handler)))}) `;\n customSqlDataSourceStrategy = {\n typeName: opType,\n fieldName: typeName,\n };\n }\n else if (isSqlReferenceHandler(handlers)) {\n const handlerData = getHandlerData(handlers[0]);\n const entry = resolveEntryPath(handlerData, 'Could not determine import path to construct absolute code path for sql reference handler. Consider using an absolute path instead.');\n const reference = typeof entry === 'string' ? entry : entry.relativePath;\n customSqlDataSourceStrategy = {\n typeName: opType,\n fieldName: typeName,\n entry,\n };\n gqlHandlerContent = `@sql(reference: \"${reference}\") `;\n }\n if (opType === 'Subscription') {\n const subscriptionSources = subscriptionSource\n .flatMap((source) => {\n const refTarget = source.data.link;\n const { type } = getRefType(refTarget, typeName);\n if (type === 'CustomOperation') {\n return refTarget;\n }\n if (type === 'Model') {\n return source.data.mutationOperations.map(\n // capitalize explicitly in case customer used lowercase model name\n (op) => `${op}${capitalize(refTarget)}`);\n }\n })\n .join('\", \"');\n gqlHandlerContent += `@aws_subscribe(mutations: [\"${subscriptionSources}\"]) `;\n }\n const gqlField = `${callSignature}: ${returnTypeName} ${gqlHandlerContent}${authString}`;\n return {\n gqlField,\n models: implicitModels,\n lambdaFunctionDefinition,\n customSqlDataSourceStrategy,\n };\n}\n/**\n * Escape a string that will be used inside of a graphql string.\n * @param str The input string to be escaped\n * @returns The string with special charactars escaped\n */\nfunction escapeGraphQlString(str) {\n return JSON.stringify(str);\n}\n/**\n * Tests whether two ModelField definitions are in conflict.\n *\n * This is a shallow check intended to catch conflicts between defined fields\n * and fields implied by authorization rules. Hence, it only compares type\n * and plurality.\n *\n * @param left\n * @param right\n * @returns\n */\nfunction areConflicting(left, right) {\n // These are the only props we care about for this comparison, because the others\n // (required, arrayRequired, etc) are not specified on auth or FK directives.\n const relevantProps = ['array', 'fieldType'];\n for (const prop of relevantProps) {\n if (left.data[prop] !== right.data[prop]) {\n return true;\n }\n }\n return false;\n}\n/**\n * Merges one field defition object onto an existing one, performing\n * validation (conflict detection) along the way.\n *\n * @param existing An existing field map\n * @param additions A field map to merge in\n */\nfunction addFields(existing, additions) {\n for (const [k, addition] of Object.entries(additions)) {\n if (!existing[k]) {\n existing[k] = addition;\n }\n else if (areConflicting(existing[k], addition)) {\n throw new Error(`Field ${k} defined twice with conflicting definitions.`);\n }\n else {\n // fields are defined on both sides, but match.\n }\n }\n}\n/**\n * Validate that no implicit fields are used by the model definition\n *\n * @param existing An existing field map\n * @param implicitFields A field map inferred from other schema usage\n *\n * @throws An error when an undefined field is used or when a field is used in a way that conflicts with its generated definition\n */\nfunction validateStaticFields(existing, implicitFields) {\n if (implicitFields === undefined) {\n return;\n }\n for (const [k, field] of Object.entries(implicitFields)) {\n if (!existing[k]) {\n throw new Error(`Field ${k} isn't defined.`);\n }\n else if (areConflicting(existing[k], field)) {\n throw new Error(`Field ${k} defined twice with conflicting definitions.`);\n }\n }\n}\n/**\n * Validate that no implicit fields conflict with explicitly defined fields.\n *\n * @param existing An existing field map\n * @param implicitFields A field map inferred from other schema usage\n *\n * @throws An error when an undefined field is used or when a field is used in a way that conflicts with its generated definition\n */\nfunction validateImpliedFields(existing, implicitFields) {\n if (implicitFields === undefined) {\n return;\n }\n for (const [k, field] of Object.entries(implicitFields)) {\n if (existing[k] && areConflicting(existing[k], field)) {\n throw new Error(`Implicit field ${k} conflicts with the explicit field definition.`);\n }\n }\n}\n/**\n * Given a list of authorization rules, produces a set of the implied owner and/or\n * group fields, along with the associated graphql `@auth` string directive.\n *\n * This is intended to be called for each model and field to collect the implied\n * fields and directives from that individual \"item's\" auth rules.\n *\n * The computed directives are intended to be appended to the graphql field definition.\n *\n * The computed fields will be used to confirm no conflicts between explicit field definitions\n * and implicit auth fields.\n *\n * @param authorization A list of authorization rules.\n * @returns\n */\nfunction calculateAuth(authorization) {\n const authFields = {};\n const rules = [];\n for (const entry of authorization) {\n const rule = accessData(entry);\n const ruleParts = [];\n if (rule.strategy) {\n ruleParts.push([`allow: ${rule.strategy}`]);\n }\n else {\n return {\n authFields,\n authString: '',\n };\n }\n if (rule.provider) {\n ruleParts.push(`provider: ${rule.provider}`);\n }\n if (rule.operations) {\n ruleParts.push(`operations: [${rule.operations.join(', ')}]`);\n }\n if (rule.groupOrOwnerField) {\n // directive attribute, depending whether it's owner or group auth\n if (rule.strategy === 'groups') {\n // does this need to be escaped?\n ruleParts.push(`groupsField: \"${rule.groupOrOwnerField}\"`);\n }\n else {\n // does this need to be escaped?\n ruleParts.push(`ownerField: \"${rule.groupOrOwnerField}\"`);\n }\n // model field dep, type of which depends on whether multiple owner/group\n // is required.\n if (rule.multiOwner) {\n addFields(authFields, { [rule.groupOrOwnerField]: string().array() });\n }\n else {\n addFields(authFields, { [rule.groupOrOwnerField]: string() });\n }\n }\n if (rule.groups) {\n // does `group` need to be escaped?\n ruleParts.push(`groups: [${rule.groups.map((group) => `\"${group}\"`).join(', ')}]`);\n }\n // identityClaim\n if (rule.identityClaim) {\n // does this need to be escaped?\n ruleParts.push(`identityClaim: \"${rule.identityClaim}\"`);\n }\n // groupClaim\n if (rule.groupClaim) {\n // does this need to be escaped?\n ruleParts.push(`groupClaim: \"${rule.groupClaim}\"`);\n }\n rules.push(`{${ruleParts.join(', ')}}`);\n }\n const authString = rules.length > 0 ? `@auth(rules: [${rules.join(',\\n ')}])` : '';\n return { authString, authFields };\n}\nfunction validateCustomAuthRule(rule) {\n if (rule.groups && rule.provider === 'oidc') {\n throw new Error('OIDC group auth is not supported with a.handler.custom');\n }\n}\nfunction getCustomAuthProvider(rule) {\n const strategyDict = {\n public: {\n default: '@aws_api_key',\n apiKey: '@aws_api_key',\n iam: '@aws_iam',\n },\n private: {\n default: '@aws_cognito_user_pools',\n userPools: '@aws_cognito_user_pools',\n oidc: '@aws_oidc',\n iam: '@aws_iam',\n },\n groups: {\n default: '@aws_cognito_user_pools',\n userPools: '@aws_cognito_user_pools',\n },\n custom: {\n default: '@aws_lambda',\n function: '@aws_lambda',\n },\n };\n const stratProviders = strategyDict[rule.strategy];\n if (stratProviders === undefined) {\n throw new Error(`Unsupported auth strategy for custom handlers: ${rule.strategy}`);\n }\n const provider = rule.provider || 'default';\n const stratProvider = stratProviders[provider];\n if (stratProvider === undefined) {\n throw new Error(`Unsupported provider for custom handlers: ${rule.provider}`);\n }\n return stratProvider;\n}\nfunction calculateCustomAuth(authorization) {\n const rules = [];\n for (const entry of authorization) {\n const rule = accessData(entry);\n validateCustomAuthRule(rule);\n const provider = getCustomAuthProvider(rule);\n if (rule.groups) {\n // example: (cognito_groups: [\"Bloggers\", \"Readers\"])\n rules.push(`${provider}(cognito_groups: [${rule.groups\n .map((group) => `\"${group}\"`)\n .join(', ')}])`);\n }\n else {\n rules.push(provider);\n }\n }\n const authString = rules.join(' ');\n return { authString };\n}\nfunction capitalize(s) {\n return `${s[0].toUpperCase()}${s.slice(1)}`;\n}\nfunction processFieldLevelAuthRules(fields, authFields) {\n const fieldLevelAuthRules = {};\n for (const [fieldName, fieldDef] of Object.entries(fields)) {\n const fieldAuth = fieldDef?.data?.authorization || [];\n const { authString, authFields: fieldAuthField } = calculateAuth(fieldAuth);\n if (authString)\n fieldLevelAuthRules[fieldName] = authString;\n if (fieldAuthField) {\n addFields(authFields, fieldAuthField);\n }\n }\n return fieldLevelAuthRules;\n}\nfunction processFields(typeName, fields, impliedFields, fieldLevelAuthRules, identifier, partitionKey, secondaryIndexes = {}) {\n const gqlFields = [];\n const models = [];\n validateImpliedFields(fields, impliedFields);\n for (const [fieldName, fieldDef] of Object.entries(fields)) {\n const fieldAuth = fieldLevelAuthRules[fieldName]\n ? ` ${fieldLevelAuthRules[fieldName]}`\n : '';\n if (isModelField(fieldDef)) {\n gqlFields.push(`${fieldName}: ${modelFieldToGql(fieldDef.data)}${fieldAuth}`);\n }\n else if (isScalarField(fieldDef)) {\n if (fieldName === partitionKey) {\n gqlFields.push(`${fieldName}: ${scalarFieldToGql(fieldDef.data, identifier, secondaryIndexes[fieldName])}${fieldAuth}`);\n }\n else if (isRefField(fieldDef)) {\n gqlFields.push(`${fieldName}: ${refFieldToGql(fieldDef.data)}${fieldAuth}`);\n }\n else if (isEnumType(fieldDef)) {\n // The inline enum type name should be `<TypeName><FieldName>` to avoid\n // enum type name conflicts\n const enumName = `${capitalize(typeName)}${capitalize(fieldName)}`;\n models.push([enumName, fieldDef]);\n gqlFields.push(`${fieldName}: ${enumName}`);\n }\n else if (isCustomType(fieldDef)) {\n // The inline CustomType name should be `<TypeName><FieldName>` to avoid\n // CustomType name conflicts\n const customTypeName = `${capitalize(typeName)}${capitalize(fieldName)}`;\n models.push([customTypeName, fieldDef]);\n gqlFields.push(`${fieldName}: ${customTypeName}`);\n }\n else {\n gqlFields.push(`${fieldName}: ${scalarFieldToGql(fieldDef.data, undefined, secondaryIndexes[fieldName])}${fieldAuth}`);\n }\n }\n else {\n throw new Error(`Unexpected field definition: ${fieldDef}`);\n }\n }\n return { gqlFields, models };\n}\n/**\n *\n * @param pk - partition key field name\n * @param sk - (optional) array of sort key field names\n * @returns default query field name\n */\nconst secondaryIndexDefaultQueryField = (modelName, pk, sk) => {\n const skName = sk?.length ? 'And' + sk?.map(capitalize).join('And') : '';\n const queryField = `list${capitalize(modelName)}By${capitalize(pk)}${skName}`;\n return queryField;\n};\n/**\n * Given InternalModelIndexType[] returns a map where the key is the model field to be annotated with an @index directive\n * and the value is an array of transformed Amplify @index directives with all supplied attributes\n */\nconst transformedSecondaryIndexesForModel = (modelName, secondaryIndexes) => {\n const indexDirectiveWithAttributes = (partitionKey, sortKeys, indexName, queryField) => {\n if (!sortKeys.length && !indexName && !queryField) {\n return `@index(queryField: \"${secondaryIndexDefaultQueryField(modelName, partitionKey)}\")`;\n }\n const attributes = [];\n if (indexName) {\n attributes.push(`name: \"${indexName}\"`);\n }\n if (sortKeys.length) {\n attributes.push(`sortKeyFields: [${sortKeys.map((sk) => `\"${sk}\"`).join(', ')}]`);\n }\n if (queryField) {\n attributes.push(`queryField: \"${queryField}\"`);\n }\n else {\n attributes.push(`queryField: \"${secondaryIndexDefaultQueryField(modelName, partitionKey, sortKeys)}\"`);\n }\n return `@index(${attributes.join(', ')})`;\n };\n return secondaryIndexes.reduce((acc, { data: { partitionKey, sortKeys, indexName, queryField } }) => {\n acc[partitionKey] = acc[partitionKey] || [];\n acc[partitionKey].push(indexDirectiveWithAttributes(partitionKey, sortKeys, indexName, queryField));\n return acc;\n }, {});\n};\nconst ruleIsResourceAuth = (authRule) => {\n const data = accessSchemaData(authRule);\n return data.strategy === 'resource';\n};\n/**\n * Separates out lambda resource auth rules from remaining schema rules.\n *\n * @param authRules schema auth rules\n */\nconst extractFunctionSchemaAccess = (authRules) => {\n const schemaAuth = [];\n const functionSchemaAccess = [];\n const defaultActions = [\n 'query',\n 'mutate',\n 'listen',\n ];\n for (const rule of authRules) {\n if (ruleIsResourceAuth(rule)) {\n const ruleData = accessSchemaData(rule);\n const fnAccess = {\n resourceProvider: ruleData.resource,\n actions: ruleData.operations || defaultActions,\n };\n functionSchemaAccess.push(fnAccess);\n }\n else {\n schemaAuth.push(rule);\n }\n }\n return { schemaAuth, functionSchemaAccess };\n};\n/**\n * Returns a closure for retrieving reference type and definition from schema\n */\nconst getRefTypeForSchema = (schema) => {\n const getRefType = (source, target) => {\n const typeDef = schema.data.types[source];\n if (typeDef === undefined) {\n throw new Error(`Invalid ref. ${target} is referencing ${source} which is not defined in the schema`);\n }\n if (isInternalModel(typeDef)) {\n return { type: 'Model', def: typeDef };\n }\n if (isCustomOperation(typeDef)) {\n return { type: 'CustomOperation', def: typeDef };\n }\n if (isCustomType(typeDef)) {\n return { type: 'CustomType', def: typeDef };\n }\n if (isEnumType(typeDef)) {\n return { type: 'Enum', def: typeDef };\n }\n throw new Error(`Invalid ref. ${target} is referencing ${source} which is neither a Model, Custom Operation, Custom Type, or Enum`);\n };\n return getRefType;\n};\nconst schemaPreprocessor = (schema) => {\n const gqlModels = [];\n const customQueries = [];\n const customMutations = [];\n const customSubscriptions = [];\n const jsFunctions = [];\n const lambdaFunctions = {};\n const customSqlDataSourceStrategies = [];\n const databaseType = schema.data.configuration.database.engine === 'dynamodb'\n ? 'dynamodb'\n : 'sql';\n const staticSchema = schema.data.configuration.database.engine === 'dynamodb' ? false : true;\n const topLevelTypes = Object.entries(schema.data.types);\n const { schemaAuth, functionSchemaAccess } = extractFunctionSchemaAccess(schema.data.authorization);\n const getRefType = getRefTypeForSchema(schema);\n for (const [typeName, typeDef] of topLevelTypes) {\n const mostRelevantAuthRules = typeDef.data?.authorization?.length > 0\n ? typeDef.data.authorization\n : schemaAuth;\n if (!isInternalModel(typeDef)) {\n if (isEnumType(typeDef)) {\n if (typeDef.values.some((value) => /\\s/.test(value))) {\n throw new Error(`Values of the enum type ${typeName} should not contain any whitespace.`);\n }\n const enumType = `enum ${typeName} {\\n ${typeDef.values.join('\\n ')}\\n}`;\n gqlModels.push(enumType);\n }\n else if (isCustomType(typeDef)) {\n const fields = typeDef.data.fields;\n const fieldAuthApplicableFields = Object.fromEntries(Object.entries(fields).filter((pair) => isModelField(pair[1])));\n const authString = '';\n const authFields = {};\n const fieldLevelAuthRules = processFieldLevelAuthRules(fieldAuthApplicableFields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n const model = `type ${typeName} ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n else if (isCustomOperation(typeDef)) {\n const { typeName: opType } = typeDef.data;\n const { gqlField, models, jsFunctionForField, lambdaFunctionDefinition, customSqlDataSourceStrategy, } = transformCustomOperations(typeDef, typeName, mostRelevantAuthRules, databaseType, getRefType);\n Object.assign(lambdaFunctions, lambdaFunctionDefinition);\n topLevelTypes.push(...models);\n if (jsFunctionForField) {\n jsFunctions.push(jsFunctionForField);\n }\n if (customSqlDataSourceStrategy) {\n customSqlDataSourceStrategies.push(customSqlDataSourceStrategy);\n }\n switch (opType) {\n case 'Query':\n customQueries.push(gqlField);\n break;\n case 'Mutation':\n customMutations.push(gqlField);\n break;\n case 'Subscription':\n customSubscriptions.push(gqlField);\n break;\n default:\n break;\n }\n }\n }\n else if (staticSchema) {\n const fields = { ...typeDef.data.fields };\n const identifier = typeDef.data.identifier;\n const [partitionKey] = identifier;\n const { authString, authFields } = calculateAuth(mostRelevantAuthRules);\n if (authString == '') {\n throw new Error(`Model \\`${typeName}\\` is missing authorization rules. Add global rules to the schema or ensure every model has its own rules.`);\n }\n const fieldLevelAuthRules = processFieldLevelAuthRules(fields, authFields);\n validateStaticFields(fields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules, identifier, partitionKey);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n // TODO: update @model(timestamps: null) once a longer term solution gets\n // determined.\n //\n // Context: SQL schema should not be automatically inserted with timestamp fields,\n // passing (timestamps: null) to @model to suppress this behavior as a short\n // term solution.\n const model = `type ${typeName} @model(timestamps: null) ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n else {\n const fields = typeDef.data.fields;\n const identifier = typeDef.data.identifier;\n const [partitionKey] = identifier;\n const transformedSecondaryIndexes = transformedSecondaryIndexesForModel(typeName, typeDef.data.secondaryIndexes);\n const { authString, authFields } = calculateAuth(mostRelevantAuthRules);\n if (authString == '') {\n throw new Error(`Model \\`${typeName}\\` is missing authorization rules. Add global rules to the schema or ensure every model has its own rules.`);\n }\n const fieldLevelAuthRules = processFieldLevelAuthRules(fields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules, identifier, partitionKey, transformedSecondaryIndexes);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n const model = `type ${typeName} @model ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n }\n const customOperations = {\n queries: customQueries,\n mutations: customMutations,\n subscriptions: customSubscriptions,\n };\n gqlModels.push(...generateCustomOperationTypes(customOperations));\n const processedSchema = gqlModels.join('\\n\\n');\n return {\n schema: processedSchema,\n jsFunctions,\n functionSchemaAccess,\n lambdaFunctions,\n customSqlDataSourceStrategies,\n };\n};\nfunction validateCustomOperations(typeDef, typeName, authRules, getRefType) {\n const { functionRef, handlers, typeName: opType, subscriptionSource, } = typeDef.data;\n // TODO: remove `functionRef` after deprecating\n const handlerConfigured = functionRef !== null || handlers?.length;\n const authConfigured = authRules.length > 0;\n if ((authConfigured && !handlerConfigured) ||\n (handlerConfigured && !authConfigured)) {\n // Deploying a custom operation with auth and no handler reference OR\n // with a handler reference but no auth\n // causes the CFN stack to reach an unrecoverable state. Ideally, this should be fixed\n // in the CDK construct, but we're catching it early here as a stopgap\n throw new Error(`Custom operation ${typeName} requires both an authorization rule and a handler reference`);\n }\n // Handlers must all be of the same type\n if (handlers?.length) {\n const configuredHandlers = new Set();\n for (const handler of handlers) {\n configuredHandlers.add(getBrand(handler));\n }\n if (configuredHandlers.size > 1) {\n const configuredHandlersStr = JSON.stringify(Array.from(configuredHandlers));\n throw new Error(`Field handlers must be of the same type. ${typeName} has been configured with ${configuredHandlersStr}`);\n }\n }\n if (opType !== 'Subscription' && subscriptionSource.length > 0) {\n throw new Error(`The .for() modifier function can only be used with a custom subscription. ${typeName} is not a custom subscription.`);\n }\n if (opType === 'Subscription') {\n if (subscriptionSource.length < 1) {\n throw new Error(`${typeName} is missing a mutation source. Custom subscriptions must reference a mutation source via subscription().for(a.ref('ModelOrOperationName')) `);\n }\n let expectedReturnType;\n for (const source of subscriptionSource) {\n const sourceName = source.data.link;\n const { type, def } = getRefType(sourceName, typeName);\n if (type !== 'Model' && source.data.mutationOperations.length > 0) {\n throw new Error(`Invalid subscription definition. .mutations() modifier can only be used with a Model ref. ${typeName} is referencing ${type}`);\n }\n let resolvedReturnType;\n if (type === 'Model') {\n if (source.data.mutationOperations.length === 0) {\n throw new Error(`Invalid subscription definition. .mutations() modifier must be used with a Model ref subscription source. ${typeName} is referencing ${sourceName} without specifying a mutation`);\n }\n else {\n resolvedReturnType = def;\n }\n }\n if (type === 'CustomOperation') {\n if (def.data.typeName !== 'Mutation') {\n throw new Error(`Invalid subscription definition. .for() can only reference a mutation. ${typeName} is referencing ${sourceName} which is a ${def.data.typeName}`);\n }\n else {\n const returnType = def.data.returnType;\n if (isRefField(returnType)) {\n ({ def: resolvedReturnType } = getRefType(returnType.data.link, typeName));\n }\n else {\n resolvedReturnType = returnType;\n }\n }\n }\n expectedReturnType = expectedReturnType ?? resolvedReturnType;\n // As the return types are resolved from the root `schema` object and they should\n // not be mutated, we compare by references here.\n if (expectedReturnType !== resolvedReturnType) {\n throw new Error(`Invalid subscription definition. .for() can only reference resources that have the same return type. ${typeName} is referencing resources that have different return types.`);\n }\n }\n }\n}\nconst isSqlReferenceHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'sqlReference';\n};\nconst isCustomHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'customHandler';\n};\nconst isFunctionHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'functionHandler';\n};\nconst normalizeDataSourceName = (dataSource) => {\n // default data source\n const noneDataSourceName = 'NONE_DS';\n if (dataSource === undefined) {\n return noneDataSourceName;\n }\n if (dataSourceIsRef(dataSource)) {\n return `${dataSource.data.link}Table`;\n }\n return dataSource;\n};\nconst sanitizeStackTrace = (stackTrace) => {\n // normalize EOL to \\n so that parsing is consistent across platforms\n const normalizedStackTrace = stackTrace.replace(new RegExp(os.EOL), '\\n');\n return (normalizedStackTrace\n .split('\\n')\n .map((line) => line.trim())\n // filters out noise not relevant to the stack trace. All stack trace lines begin with 'at'\n .filter((line) => line.startsWith('at')) || []);\n};\n// copied from the defineFunction path resolution impl:\n// https://github.com/aws-amplify/amplify-backend/blob/main/packages/backend-function/src/get_caller_directory.ts\nconst resolveEntryPath = (data, errorMessage) => {\n if (path.isAbsolute(data.entry)) {\n return data.entry;\n }\n if (!data.stack) {\n throw new Error(errorMessage);\n }\n const stackTraceLines = sanitizeStackTrace(data.stack);\n if (stackTraceLines.length < 2) {\n throw new Error(errorMessage);\n }\n const stackTraceImportLine = stackTraceLines[1]; // the first entry is the file where the error was initialized (our code). The second entry is where the customer called our code which is what we are interested in\n // if entry is relative, compute with respect to the caller directory\n return { relativePath: data.entry, importLine: stackTraceImportLine };\n};\nconst handleCustom = (handlers, opType, typeName) => {\n const transformedHandlers = handlers.map((handler) => {\n const handlerData = getHandlerData(handler);\n return {\n dataSource: normalizeDataSourceName(handlerData.dataSource),\n entry: resolveEntryPath(handlerData, 'Could not determine import path to construct absolute code path for custom handler. Consider using an absolute path instead.'),\n };\n });\n const jsFn = {\n typeName: opType,\n fieldName: typeName,\n handlers: transformedHandlers,\n };\n return jsFn;\n};\nfunction transformCustomOperations(typeDef, typeName, authRules, databaseType, getRefType) {\n const { typeName: opType, handlers } = typeDef.data;\n let jsFunctionForField = undefined;\n validateCustomOperations(typeDef, typeName, authRules, getRefType);\n if (isCustomHandler(handlers)) {\n jsFunctionForField = handleCustom(handlers, opType, typeName);\n }\n const isCustom = Boolean(jsFunctionForField);\n const { gqlField, models, lambdaFunctionDefinition, customSqlDataSourceStrategy, } = customOperationToGql(typeName, typeDef, authRules, isCustom, databaseType, getRefType);\n return {\n gqlField,\n models,\n jsFunctionForField,\n lambdaFunctionDefinition,\n customSqlDataSourceStrategy,\n };\n}\nfunction generateCustomOperationTypes({ queries, mutations, subscriptions, }) {\n const types = [];\n if (mutations.length > 0) {\n types.push(`type Mutation {\\n ${mutations.join('\\n ')}\\n}`);\n }\n if (queries.length > 0) {\n types.push(`type Query {\\n ${queries.join('\\n ')}\\n}`);\n }\n if (subscriptions.length > 0) {\n types.push(`type Subscription {\\n ${subscriptions.join('\\n ')}\\n}`);\n }\n return types;\n}\n/**\n * Returns API definition from ModelSchema or string schema\n * @param arg - { schema }\n * @returns DerivedApiDefinition that conforms to IAmplifyGraphqlDefinition\n */\nexport function processSchema(arg) {\n const { schema, jsFunctions, functionSchemaAccess, lambdaFunctions, customSqlDataSourceStrategies, } = schemaPreprocessor(arg.schema);\n return {\n schema,\n functionSlots: [],\n jsFunctions,\n functionSchemaAccess,\n lambdaFunctions,\n customSqlDataSourceStrategies,\n };\n}\n"],"names":[],"mappings":";;;;;;;;AAOA,SAAS,eAAe,CAAC,KAAK,EAAE;AAChC,IAAI,IAAI,KAAK,CAAC,IAAI;AAClB,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;AAC5B,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;AACnC,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,UAAU,CAAC,IAAI,EAAE;AAC1B,IAAI,IAAI,IAAI,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AAC,CAAC,CAAC;AACtE,KAAK;AACL,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,QAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,KAAK;AACL,IAAI,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;AAClC,QAAQ,KAAK,CAAC,IAAI,CAAC,CAAC,uBAAuB,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,GAAG,EAAE;AACnC,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,EAAE,eAAe,EAAE,6BAA6B,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1I,IAAI,OAAO;AACX,QAAQ,MAAM;AACd,QAAQ,aAAa,EAAE,EAAE;AACzB,QAAQ,WAAW;AACnB,QAAQ,oBAAoB;AAC5B,QAAQ,eAAe;AACvB,QAAQ,6BAA6B;AACrC,KAAK,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaProcessor.mjs","sources":["../../src/SchemaProcessor.ts"],"sourcesContent":["import { string, } from './ModelField';\nimport { accessData, accessSchemaData, } from './Authorization';\nimport { CustomOperationNames } from './CustomOperation';\nimport { getBrand } from './util';\nimport { getHandlerData, } from './Handler';\nimport * as os from 'os';\nimport * as path from 'path';\nfunction isInternalModel(model) {\n if (model.data &&\n !isCustomType(model) &&\n !isCustomOperation(model)) {\n return true;\n }\n return false;\n}\nfunction isEnumType(data) {\n if (data?.type === 'enum') {\n return true;\n }\n return false;\n}\nfunction isCustomType(data) {\n if (data?.data?.type === 'customType') {\n return true;\n }\n return false;\n}\nfunction isCustomOperation(type) {\n if (CustomOperationNames.includes(type?.data?.typeName)) {\n return true;\n }\n return false;\n}\nfunction isModelFieldDef(data) {\n return data?.fieldType === 'model';\n}\nfunction isScalarFieldDef(data) {\n return data?.fieldType !== 'model';\n}\nfunction isRefFieldDef(data) {\n return data?.type === 'ref';\n}\nfunction isModelField(field) {\n return isModelFieldDef(field?.data);\n}\nfunction dataSourceIsRef(dataSource) {\n return (typeof dataSource !== 'string' &&\n dataSource?.data &&\n dataSource.data.type === 'ref');\n}\nfunction isScalarField(field) {\n return isScalarFieldDef(field?.data);\n}\nfunction isRefField(field) {\n return isRefFieldDef(field?.data);\n}\nfunction scalarFieldToGql(fieldDef, identifier, secondaryIndexes = []) {\n const { fieldType, required, array, arrayRequired, default: _default, } = fieldDef;\n let field = fieldType;\n if (identifier !== undefined) {\n field += '!';\n if (identifier.length > 1) {\n const [_pk, ...sk] = identifier;\n field += ` @primaryKey(sortKeyFields: [${sk\n .map((sk) => `\"${sk}\"`)\n .join(', ')}])`;\n }\n else {\n field += ' @primaryKey';\n }\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n }\n if (required === true) {\n field += '!';\n }\n if (array) {\n field = `[${field}]`;\n if (arrayRequired === true) {\n field += '!';\n }\n }\n if (_default !== undefined) {\n field += ` @default(value: \"${_default?.toString()}\")`;\n }\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n}\nfunction modelFieldToGql(fieldDef) {\n const { type, relatedModel, array, valueRequired, arrayRequired, references, } = fieldDef;\n let field = relatedModel;\n if (valueRequired === true) {\n field += '!';\n }\n if (array) {\n field = `[${field}]`;\n }\n if (arrayRequired === true) {\n field += '!';\n }\n if (references && Array.isArray(references) && references.length > 0) {\n field += ` @${type}(references: [${references.map((s) => `\"${String(s)}\"`)}])`;\n }\n else {\n field += ` @${type}`;\n }\n return field;\n}\nfunction refFieldToGql(fieldDef, secondaryIndexes = []) {\n const { link, valueRequired, array, arrayRequired } = fieldDef;\n let field = link;\n if (valueRequired === true) {\n field += '!';\n }\n if (array === true) {\n field = `[${field}]`;\n }\n if (arrayRequired === true) {\n field += '!';\n }\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n}\nfunction enumFieldToGql(enumName, secondaryIndexes = []) {\n let field = enumName;\n for (const index of secondaryIndexes) {\n field += ` ${index}`;\n }\n return field;\n}\nfunction transformFunctionHandler(handlers, functionFieldName) {\n let gqlHandlerContent = '';\n const lambdaFunctionDefinition = {};\n handlers.forEach((handler, idx) => {\n const handlerData = getHandlerData(handler);\n if (typeof handlerData === 'string') {\n gqlHandlerContent += `@function(name: \"${handlerData}\") `;\n }\n else if (typeof handlerData.getInstance === 'function') {\n const fnName = `Fn${capitalize(functionFieldName)}${idx === 0 ? '' : `${idx + 1}`}`;\n lambdaFunctionDefinition[fnName] = handlerData;\n gqlHandlerContent += `@function(name: \"${fnName}\") `;\n }\n else {\n throw new Error(`Invalid value specified for ${functionFieldName} handler.function(). Expected: defineFunction or string.`);\n }\n });\n return { gqlHandlerContent, lambdaFunctionDefinition };\n}\nfunction customOperationToGql(typeName, typeDef, authorization, isCustom = false, databaseType, getRefType) {\n const { arguments: fieldArgs, typeName: opType, returnType, functionRef, handlers, subscriptionSource, } = typeDef.data;\n let callSignature = typeName;\n const implicitModels = [];\n const { authString } = isCustom\n ? calculateCustomAuth(authorization)\n : calculateAuth(authorization);\n /**\n *\n * @param returnType The return type from the `data` field of a customer operation.\n * @param refererTypeName The type the refers {@link returnType} by `a.ref()`.\n * @param shouldAddCustomTypeToImplicitModels A flag indicates wether it should push\n * the return type resolved CustomType to the `implicitModels` list.\n * @returns\n */\n const resolveReturnTypeNameFromReturnType = (returnType, { refererTypeName, shouldAddCustomTypeToImplicitModels = true, }) => {\n if (isRefField(returnType)) {\n return refFieldToGql(returnType?.data);\n }\n else if (isCustomType(returnType)) {\n const returnTypeName = `${capitalize(refererTypeName)}ReturnType`;\n if (shouldAddCustomTypeToImplicitModels) {\n implicitModels.push([returnTypeName, returnType]);\n }\n return returnTypeName;\n }\n else if (isScalarField(returnType)) {\n return scalarFieldToGql(returnType?.data);\n }\n else {\n throw new Error(`Unrecognized return type on ${typeName}`);\n }\n };\n let returnTypeName;\n if (opType === 'Subscription' && returnType === null) {\n // up to this point, we've validated that each subscription resource resolves\n // the same return type, so it's safe to use subscriptionSource[0] here.\n const { type, def } = getRefType(subscriptionSource[0].data.link, typeName);\n if (type === 'CustomOperation') {\n returnTypeName = resolveReturnTypeNameFromReturnType(def.data.returnType, {\n refererTypeName: subscriptionSource[0].data.link,\n shouldAddCustomTypeToImplicitModels: false,\n });\n }\n else {\n returnTypeName = refFieldToGql(subscriptionSource[0].data);\n }\n }\n else {\n returnTypeName = resolveReturnTypeNameFromReturnType(returnType, {\n refererTypeName: typeName,\n });\n }\n if (Object.keys(fieldArgs).length > 0) {\n const { gqlFields, models } = processFields(typeName, fieldArgs, {}, {});\n callSignature += `(${gqlFields.join(', ')})`;\n implicitModels.push(...models);\n }\n const handler = handlers && handlers[0];\n const brand = handler && getBrand(handler);\n let gqlHandlerContent = '';\n let lambdaFunctionDefinition = {};\n let customSqlDataSourceStrategy;\n if (isFunctionHandler(handlers)) {\n ({ gqlHandlerContent, lambdaFunctionDefinition } = transformFunctionHandler(handlers, typeName));\n }\n else if (functionRef) {\n gqlHandlerContent = `@function(name: \"${functionRef}\") `;\n }\n else if (databaseType === 'sql' && handler && brand === 'inlineSql') {\n gqlHandlerContent = `@sql(statement: ${escapeGraphQlString(String(getHandlerData(handler)))}) `;\n customSqlDataSourceStrategy = {\n typeName: opType,\n fieldName: typeName,\n };\n }\n else if (isSqlReferenceHandler(handlers)) {\n const handlerData = getHandlerData(handlers[0]);\n const entry = resolveEntryPath(handlerData, 'Could not determine import path to construct absolute code path for sql reference handler. Consider using an absolute path instead.');\n const reference = typeof entry === 'string' ? entry : entry.relativePath;\n customSqlDataSourceStrategy = {\n typeName: opType,\n fieldName: typeName,\n entry,\n };\n gqlHandlerContent = `@sql(reference: \"${reference}\") `;\n }\n if (opType === 'Subscription') {\n const subscriptionSources = subscriptionSource\n .flatMap((source) => {\n const refTarget = source.data.link;\n const { type } = getRefType(refTarget, typeName);\n if (type === 'CustomOperation') {\n return refTarget;\n }\n if (type === 'Model') {\n return source.data.mutationOperations.map(\n // capitalize explicitly in case customer used lowercase model name\n (op) => `${op}${capitalize(refTarget)}`);\n }\n })\n .join('\", \"');\n gqlHandlerContent += `@aws_subscribe(mutations: [\"${subscriptionSources}\"]) `;\n }\n const gqlField = `${callSignature}: ${returnTypeName} ${gqlHandlerContent}${authString}`;\n return {\n gqlField,\n models: implicitModels,\n lambdaFunctionDefinition,\n customSqlDataSourceStrategy,\n };\n}\n/**\n * Escape a string that will be used inside of a graphql string.\n * @param str The input string to be escaped\n * @returns The string with special charactars escaped\n */\nfunction escapeGraphQlString(str) {\n return JSON.stringify(str);\n}\n/**\n * Tests whether two ModelField definitions are in conflict.\n *\n * This is a shallow check intended to catch conflicts between defined fields\n * and fields implied by authorization rules. Hence, it only compares type\n * and plurality.\n *\n * @param left\n * @param right\n * @returns\n */\nfunction areConflicting(left, right) {\n // These are the only props we care about for this comparison, because the others\n // (required, arrayRequired, etc) are not specified on auth or FK directives.\n const relevantProps = ['array', 'fieldType'];\n for (const prop of relevantProps) {\n if (left.data[prop] !== right.data[prop]) {\n return true;\n }\n }\n return false;\n}\n/**\n * Merges one field defition object onto an existing one, performing\n * validation (conflict detection) along the way.\n *\n * @param existing An existing field map\n * @param additions A field map to merge in\n */\nfunction addFields(existing, additions) {\n for (const [k, addition] of Object.entries(additions)) {\n if (!existing[k]) {\n existing[k] = addition;\n }\n else if (areConflicting(existing[k], addition)) {\n throw new Error(`Field ${k} defined twice with conflicting definitions.`);\n }\n else {\n // fields are defined on both sides, but match.\n }\n }\n}\n/**\n * Validate that no implicit fields are used by the model definition\n *\n * @param existing An existing field map\n * @param implicitFields A field map inferred from other schema usage\n *\n * @throws An error when an undefined field is used or when a field is used in a way that conflicts with its generated definition\n */\nfunction validateStaticFields(existing, implicitFields) {\n if (implicitFields === undefined) {\n return;\n }\n for (const [k, field] of Object.entries(implicitFields)) {\n if (!existing[k]) {\n throw new Error(`Field ${k} isn't defined.`);\n }\n else if (areConflicting(existing[k], field)) {\n throw new Error(`Field ${k} defined twice with conflicting definitions.`);\n }\n }\n}\n/**\n * Validate that no implicit fields conflict with explicitly defined fields.\n *\n * @param existing An existing field map\n * @param implicitFields A field map inferred from other schema usage\n *\n * @throws An error when an undefined field is used or when a field is used in a way that conflicts with its generated definition\n */\nfunction validateImpliedFields(existing, implicitFields) {\n if (implicitFields === undefined) {\n return;\n }\n for (const [k, field] of Object.entries(implicitFields)) {\n if (existing[k] && areConflicting(existing[k], field)) {\n throw new Error(`Implicit field ${k} conflicts with the explicit field definition.`);\n }\n }\n}\n/**\n * Given a list of authorization rules, produces a set of the implied owner and/or\n * group fields, along with the associated graphql `@auth` string directive.\n *\n * This is intended to be called for each model and field to collect the implied\n * fields and directives from that individual \"item's\" auth rules.\n *\n * The computed directives are intended to be appended to the graphql field definition.\n *\n * The computed fields will be used to confirm no conflicts between explicit field definitions\n * and implicit auth fields.\n *\n * @param authorization A list of authorization rules.\n * @returns\n */\nfunction calculateAuth(authorization) {\n const authFields = {};\n const rules = [];\n for (const entry of authorization) {\n const rule = accessData(entry);\n const ruleParts = [];\n if (rule.strategy) {\n ruleParts.push([`allow: ${rule.strategy}`]);\n }\n else {\n return {\n authFields,\n authString: '',\n };\n }\n if (rule.provider) {\n // identityPool maps to iam in the transform\n const provider = rule.provider === 'identityPool' ? 'iam' : rule.provider;\n ruleParts.push(`provider: ${provider}`);\n }\n if (rule.operations) {\n ruleParts.push(`operations: [${rule.operations.join(', ')}]`);\n }\n if (rule.groupOrOwnerField) {\n // directive attribute, depending whether it's owner or group auth\n if (rule.strategy === 'groups') {\n // does this need to be escaped?\n ruleParts.push(`groupsField: \"${rule.groupOrOwnerField}\"`);\n }\n else {\n // does this need to be escaped?\n ruleParts.push(`ownerField: \"${rule.groupOrOwnerField}\"`);\n }\n // model field dep, type of which depends on whether multiple owner/group\n // is required.\n if (rule.multiOwner) {\n addFields(authFields, { [rule.groupOrOwnerField]: string().array() });\n }\n else {\n addFields(authFields, { [rule.groupOrOwnerField]: string() });\n }\n }\n if (rule.groups) {\n // does `group` need to be escaped?\n ruleParts.push(`groups: [${rule.groups.map((group) => `\"${group}\"`).join(', ')}]`);\n }\n // identityClaim\n if (rule.identityClaim) {\n // does this need to be escaped?\n ruleParts.push(`identityClaim: \"${rule.identityClaim}\"`);\n }\n // groupClaim\n if (rule.groupClaim) {\n // does this need to be escaped?\n ruleParts.push(`groupClaim: \"${rule.groupClaim}\"`);\n }\n rules.push(`{${ruleParts.join(', ')}}`);\n }\n const authString = rules.length > 0 ? `@auth(rules: [${rules.join(',\\n ')}])` : '';\n return { authString, authFields };\n}\nfunction validateCustomAuthRule(rule) {\n if (rule.groups && rule.provider === 'oidc') {\n throw new Error('OIDC group auth is not supported with a.handler.custom');\n }\n}\nfunction getCustomAuthProvider(rule) {\n const strategyDict = {\n public: {\n default: '@aws_api_key',\n apiKey: '@aws_api_key',\n iam: '@aws_iam',\n },\n private: {\n default: '@aws_cognito_user_pools',\n userPools: '@aws_cognito_user_pools',\n oidc: '@aws_oidc',\n iam: '@aws_iam',\n },\n groups: {\n default: '@aws_cognito_user_pools',\n userPools: '@aws_cognito_user_pools',\n },\n custom: {\n default: '@aws_lambda',\n function: '@aws_lambda',\n },\n };\n const stratProviders = strategyDict[rule.strategy];\n if (stratProviders === undefined) {\n throw new Error(`Unsupported auth strategy for custom handlers: ${rule.strategy}`);\n }\n const provider = rule.provider || 'default';\n const stratProvider = stratProviders[provider];\n if (stratProvider === undefined) {\n throw new Error(`Unsupported provider for custom handlers: ${rule.provider}`);\n }\n return stratProvider;\n}\nfunction calculateCustomAuth(authorization) {\n const rules = [];\n for (const entry of authorization) {\n const rule = accessData(entry);\n validateCustomAuthRule(rule);\n const provider = getCustomAuthProvider(rule);\n if (rule.groups) {\n // example: (cognito_groups: [\"Bloggers\", \"Readers\"])\n rules.push(`${provider}(cognito_groups: [${rule.groups\n .map((group) => `\"${group}\"`)\n .join(', ')}])`);\n }\n else {\n rules.push(provider);\n }\n }\n const authString = rules.join(' ');\n return { authString };\n}\nfunction capitalize(s) {\n return `${s[0].toUpperCase()}${s.slice(1)}`;\n}\nfunction processFieldLevelAuthRules(fields, authFields) {\n const fieldLevelAuthRules = {};\n for (const [fieldName, fieldDef] of Object.entries(fields)) {\n const fieldAuth = fieldDef?.data?.authorization || [];\n const { authString, authFields: fieldAuthField } = calculateAuth(fieldAuth);\n if (authString)\n fieldLevelAuthRules[fieldName] = authString;\n if (fieldAuthField) {\n addFields(authFields, fieldAuthField);\n }\n }\n return fieldLevelAuthRules;\n}\nfunction processFields(typeName, fields, impliedFields, fieldLevelAuthRules, identifier, partitionKey, secondaryIndexes = {}) {\n const gqlFields = [];\n const models = [];\n validateImpliedFields(fields, impliedFields);\n for (const [fieldName, fieldDef] of Object.entries(fields)) {\n const fieldAuth = fieldLevelAuthRules[fieldName]\n ? ` ${fieldLevelAuthRules[fieldName]}`\n : '';\n if (isModelField(fieldDef)) {\n gqlFields.push(`${fieldName}: ${modelFieldToGql(fieldDef.data)}${fieldAuth}`);\n }\n else if (isScalarField(fieldDef)) {\n if (fieldName === partitionKey) {\n gqlFields.push(`${fieldName}: ${scalarFieldToGql(fieldDef.data, identifier, secondaryIndexes[fieldName])}${fieldAuth}`);\n }\n else if (isRefField(fieldDef)) {\n gqlFields.push(`${fieldName}: ${refFieldToGql(fieldDef.data, secondaryIndexes[fieldName])}${fieldAuth}`);\n }\n else if (isEnumType(fieldDef)) {\n // The inline enum type name should be `<TypeName><FieldName>` to avoid\n // enum type name conflicts\n const enumName = `${capitalize(typeName)}${capitalize(fieldName)}`;\n models.push([enumName, fieldDef]);\n gqlFields.push(`${fieldName}: ${enumFieldToGql(enumName, secondaryIndexes[fieldName])}`);\n }\n else if (isCustomType(fieldDef)) {\n // The inline CustomType name should be `<TypeName><FieldName>` to avoid\n // CustomType name conflicts\n const customTypeName = `${capitalize(typeName)}${capitalize(fieldName)}`;\n models.push([customTypeName, fieldDef]);\n gqlFields.push(`${fieldName}: ${customTypeName}`);\n }\n else {\n gqlFields.push(`${fieldName}: ${scalarFieldToGql(fieldDef.data, undefined, secondaryIndexes[fieldName])}${fieldAuth}`);\n }\n }\n else {\n throw new Error(`Unexpected field definition: ${fieldDef}`);\n }\n }\n return { gqlFields, models };\n}\n/**\n *\n * @param pk - partition key field name\n * @param sk - (optional) array of sort key field names\n * @returns default query field name\n */\nconst secondaryIndexDefaultQueryField = (modelName, pk, sk) => {\n const skName = sk?.length ? 'And' + sk?.map(capitalize).join('And') : '';\n const queryField = `list${capitalize(modelName)}By${capitalize(pk)}${skName}`;\n return queryField;\n};\n/**\n * Given InternalModelIndexType[] returns a map where the key is the model field to be annotated with an @index directive\n * and the value is an array of transformed Amplify @index directives with all supplied attributes\n */\nconst transformedSecondaryIndexesForModel = (modelName, secondaryIndexes, modelFields, getRefType) => {\n const indexDirectiveWithAttributes = (partitionKey, sortKeys, indexName, queryField) => {\n for (const keyName of [partitionKey, ...sortKeys]) {\n const field = modelFields[keyName];\n if (isRefField(field)) {\n const { def } = getRefType(field.data.link, modelName);\n if (!isEnumType(def)) {\n throw new Error(`The ref field \\`${keyName}\\` used in the secondary index of \\`${modelName}\\` should refer to an enum type. \\`${field.data.link}\\` is not a enum type.`);\n }\n }\n }\n if (!sortKeys.length && !indexName && !queryField) {\n return `@index(queryField: \"${secondaryIndexDefaultQueryField(modelName, partitionKey)}\")`;\n }\n const attributes = [];\n if (indexName) {\n attributes.push(`name: \"${indexName}\"`);\n }\n if (sortKeys.length) {\n attributes.push(`sortKeyFields: [${sortKeys.map((sk) => `\"${sk}\"`).join(', ')}]`);\n }\n if (queryField) {\n attributes.push(`queryField: \"${queryField}\"`);\n }\n else {\n attributes.push(`queryField: \"${secondaryIndexDefaultQueryField(modelName, partitionKey, sortKeys)}\"`);\n }\n return `@index(${attributes.join(', ')})`;\n };\n return secondaryIndexes.reduce((acc, { data: { partitionKey, sortKeys, indexName, queryField } }) => {\n acc[partitionKey] = acc[partitionKey] || [];\n acc[partitionKey].push(indexDirectiveWithAttributes(partitionKey, sortKeys, indexName, queryField));\n return acc;\n }, {});\n};\nconst ruleIsResourceAuth = (authRule) => {\n const data = accessSchemaData(authRule);\n return data.strategy === 'resource';\n};\n/**\n * Separates out lambda resource auth rules from remaining schema rules.\n *\n * @param authRules schema auth rules\n */\nconst extractFunctionSchemaAccess = (authRules) => {\n const schemaAuth = [];\n const functionSchemaAccess = [];\n const defaultActions = [\n 'query',\n 'mutate',\n 'listen',\n ];\n for (const rule of authRules) {\n if (ruleIsResourceAuth(rule)) {\n const ruleData = accessSchemaData(rule);\n const fnAccess = {\n resourceProvider: ruleData.resource,\n actions: ruleData.operations || defaultActions,\n };\n functionSchemaAccess.push(fnAccess);\n }\n else {\n schemaAuth.push(rule);\n }\n }\n return { schemaAuth, functionSchemaAccess };\n};\n/**\n * Returns a closure for retrieving reference type and definition from schema\n */\nconst getRefTypeForSchema = (schema) => {\n const getRefType = (source, target) => {\n const typeDef = schema.data.types[source];\n if (typeDef === undefined) {\n throw new Error(`Invalid ref. ${target} is referencing ${source} which is not defined in the schema`);\n }\n if (isInternalModel(typeDef)) {\n return { type: 'Model', def: typeDef };\n }\n if (isCustomOperation(typeDef)) {\n return { type: 'CustomOperation', def: typeDef };\n }\n if (isCustomType(typeDef)) {\n return { type: 'CustomType', def: typeDef };\n }\n if (isEnumType(typeDef)) {\n return { type: 'Enum', def: typeDef };\n }\n throw new Error(`Invalid ref. ${target} is referencing ${source} which is neither a Model, Custom Operation, Custom Type, or Enum`);\n };\n return getRefType;\n};\nconst schemaPreprocessor = (schema) => {\n const gqlModels = [];\n const customQueries = [];\n const customMutations = [];\n const customSubscriptions = [];\n const jsFunctions = [];\n const lambdaFunctions = {};\n const customSqlDataSourceStrategies = [];\n const databaseType = schema.data.configuration.database.engine === 'dynamodb'\n ? 'dynamodb'\n : 'sql';\n const staticSchema = schema.data.configuration.database.engine === 'dynamodb' ? false : true;\n const topLevelTypes = Object.entries(schema.data.types);\n const { schemaAuth, functionSchemaAccess } = extractFunctionSchemaAccess(schema.data.authorization);\n const getRefType = getRefTypeForSchema(schema);\n for (const [typeName, typeDef] of topLevelTypes) {\n const mostRelevantAuthRules = typeDef.data?.authorization?.length > 0\n ? typeDef.data.authorization\n : schemaAuth;\n if (!isInternalModel(typeDef)) {\n if (isEnumType(typeDef)) {\n if (typeDef.values.some((value) => /\\s/.test(value))) {\n throw new Error(`Values of the enum type ${typeName} should not contain any whitespace.`);\n }\n const enumType = `enum ${typeName} {\\n ${typeDef.values.join('\\n ')}\\n}`;\n gqlModels.push(enumType);\n }\n else if (isCustomType(typeDef)) {\n const fields = typeDef.data.fields;\n const fieldAuthApplicableFields = Object.fromEntries(Object.entries(fields).filter((pair) => isModelField(pair[1])));\n const authString = '';\n const authFields = {};\n const fieldLevelAuthRules = processFieldLevelAuthRules(fieldAuthApplicableFields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n const model = `type ${typeName} ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n else if (isCustomOperation(typeDef)) {\n const { typeName: opType } = typeDef.data;\n const { gqlField, models, jsFunctionForField, lambdaFunctionDefinition, customSqlDataSourceStrategy, } = transformCustomOperations(typeDef, typeName, mostRelevantAuthRules, databaseType, getRefType);\n Object.assign(lambdaFunctions, lambdaFunctionDefinition);\n topLevelTypes.push(...models);\n if (jsFunctionForField) {\n jsFunctions.push(jsFunctionForField);\n }\n if (customSqlDataSourceStrategy) {\n customSqlDataSourceStrategies.push(customSqlDataSourceStrategy);\n }\n switch (opType) {\n case 'Query':\n customQueries.push(gqlField);\n break;\n case 'Mutation':\n customMutations.push(gqlField);\n break;\n case 'Subscription':\n customSubscriptions.push(gqlField);\n break;\n default:\n break;\n }\n }\n }\n else if (staticSchema) {\n const fields = { ...typeDef.data.fields };\n const identifier = typeDef.data.identifier;\n const [partitionKey] = identifier;\n const { authString, authFields } = calculateAuth(mostRelevantAuthRules);\n if (authString == '') {\n throw new Error(`Model \\`${typeName}\\` is missing authorization rules. Add global rules to the schema or ensure every model has its own rules.`);\n }\n const fieldLevelAuthRules = processFieldLevelAuthRules(fields, authFields);\n validateStaticFields(fields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules, identifier, partitionKey);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n // TODO: update @model(timestamps: null) once a longer term solution gets\n // determined.\n //\n // Context: SQL schema should not be automatically inserted with timestamp fields,\n // passing (timestamps: null) to @model to suppress this behavior as a short\n // term solution.\n const model = `type ${typeName} @model(timestamps: null) ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n else {\n const fields = typeDef.data.fields;\n const identifier = typeDef.data.identifier;\n const [partitionKey] = identifier;\n const transformedSecondaryIndexes = transformedSecondaryIndexesForModel(typeName, typeDef.data.secondaryIndexes, fields, getRefType);\n const { authString, authFields } = calculateAuth(mostRelevantAuthRules);\n if (authString == '') {\n throw new Error(`Model \\`${typeName}\\` is missing authorization rules. Add global rules to the schema or ensure every model has its own rules.`);\n }\n const fieldLevelAuthRules = processFieldLevelAuthRules(fields, authFields);\n const { gqlFields, models } = processFields(typeName, fields, authFields, fieldLevelAuthRules, identifier, partitionKey, transformedSecondaryIndexes);\n topLevelTypes.push(...models);\n const joined = gqlFields.join('\\n ');\n const model = `type ${typeName} @model ${authString}\\n{\\n ${joined}\\n}`;\n gqlModels.push(model);\n }\n }\n const customOperations = {\n queries: customQueries,\n mutations: customMutations,\n subscriptions: customSubscriptions,\n };\n gqlModels.push(...generateCustomOperationTypes(customOperations));\n const processedSchema = gqlModels.join('\\n\\n');\n return {\n schema: processedSchema,\n jsFunctions,\n functionSchemaAccess,\n lambdaFunctions,\n customSqlDataSourceStrategies,\n };\n};\nfunction validateCustomOperations(typeDef, typeName, authRules, getRefType) {\n const { functionRef, handlers, typeName: opType, subscriptionSource, } = typeDef.data;\n // TODO: remove `functionRef` after deprecating\n const handlerConfigured = functionRef !== null || handlers?.length;\n const authConfigured = authRules.length > 0;\n if ((authConfigured && !handlerConfigured) ||\n (handlerConfigured && !authConfigured)) {\n // Deploying a custom operation with auth and no handler reference OR\n // with a handler reference but no auth\n // causes the CFN stack to reach an unrecoverable state. Ideally, this should be fixed\n // in the CDK construct, but we're catching it early here as a stopgap\n throw new Error(`Custom operation ${typeName} requires both an authorization rule and a handler reference`);\n }\n // Handlers must all be of the same type\n if (handlers?.length) {\n const configuredHandlers = new Set();\n for (const handler of handlers) {\n configuredHandlers.add(getBrand(handler));\n }\n if (configuredHandlers.size > 1) {\n const configuredHandlersStr = JSON.stringify(Array.from(configuredHandlers));\n throw new Error(`Field handlers must be of the same type. ${typeName} has been configured with ${configuredHandlersStr}`);\n }\n }\n if (opType !== 'Subscription' && subscriptionSource.length > 0) {\n throw new Error(`The .for() modifier function can only be used with a custom subscription. ${typeName} is not a custom subscription.`);\n }\n if (opType === 'Subscription') {\n if (subscriptionSource.length < 1) {\n throw new Error(`${typeName} is missing a mutation source. Custom subscriptions must reference a mutation source via subscription().for(a.ref('ModelOrOperationName')) `);\n }\n let expectedReturnType;\n for (const source of subscriptionSource) {\n const sourceName = source.data.link;\n const { type, def } = getRefType(sourceName, typeName);\n if (type !== 'Model' && source.data.mutationOperations.length > 0) {\n throw new Error(`Invalid subscription definition. .mutations() modifier can only be used with a Model ref. ${typeName} is referencing ${type}`);\n }\n let resolvedReturnType;\n if (type === 'Model') {\n if (source.data.mutationOperations.length === 0) {\n throw new Error(`Invalid subscription definition. .mutations() modifier must be used with a Model ref subscription source. ${typeName} is referencing ${sourceName} without specifying a mutation`);\n }\n else {\n resolvedReturnType = def;\n }\n }\n if (type === 'CustomOperation') {\n if (def.data.typeName !== 'Mutation') {\n throw new Error(`Invalid subscription definition. .for() can only reference a mutation. ${typeName} is referencing ${sourceName} which is a ${def.data.typeName}`);\n }\n else {\n const returnType = def.data.returnType;\n if (isRefField(returnType)) {\n ({ def: resolvedReturnType } = getRefType(returnType.data.link, typeName));\n }\n else {\n resolvedReturnType = returnType;\n }\n }\n }\n expectedReturnType = expectedReturnType ?? resolvedReturnType;\n // As the return types are resolved from the root `schema` object and they should\n // not be mutated, we compare by references here.\n if (expectedReturnType !== resolvedReturnType) {\n throw new Error(`Invalid subscription definition. .for() can only reference resources that have the same return type. ${typeName} is referencing resources that have different return types.`);\n }\n }\n }\n}\nconst isSqlReferenceHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'sqlReference';\n};\nconst isCustomHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'customHandler';\n};\nconst isFunctionHandler = (handler) => {\n return Array.isArray(handler) && getBrand(handler[0]) === 'functionHandler';\n};\nconst normalizeDataSourceName = (dataSource) => {\n // default data source\n const noneDataSourceName = 'NONE_DS';\n if (dataSource === undefined) {\n return noneDataSourceName;\n }\n if (dataSourceIsRef(dataSource)) {\n return `${dataSource.data.link}Table`;\n }\n return dataSource;\n};\nconst sanitizeStackTrace = (stackTrace) => {\n // normalize EOL to \\n so that parsing is consistent across platforms\n const normalizedStackTrace = stackTrace.replace(new RegExp(os.EOL), '\\n');\n return (normalizedStackTrace\n .split('\\n')\n .map((line) => line.trim())\n // filters out noise not relevant to the stack trace. All stack trace lines begin with 'at'\n .filter((line) => line.startsWith('at')) || []);\n};\n// copied from the defineFunction path resolution impl:\n// https://github.com/aws-amplify/amplify-backend/blob/main/packages/backend-function/src/get_caller_directory.ts\nconst resolveEntryPath = (data, errorMessage) => {\n if (path.isAbsolute(data.entry)) {\n return data.entry;\n }\n if (!data.stack) {\n throw new Error(errorMessage);\n }\n const stackTraceLines = sanitizeStackTrace(data.stack);\n if (stackTraceLines.length < 2) {\n throw new Error(errorMessage);\n }\n const stackTraceImportLine = stackTraceLines[1]; // the first entry is the file where the error was initialized (our code). The second entry is where the customer called our code which is what we are interested in\n // if entry is relative, compute with respect to the caller directory\n return { relativePath: data.entry, importLine: stackTraceImportLine };\n};\nconst handleCustom = (handlers, opType, typeName) => {\n const transformedHandlers = handlers.map((handler) => {\n const handlerData = getHandlerData(handler);\n return {\n dataSource: normalizeDataSourceName(handlerData.dataSource),\n entry: resolveEntryPath(handlerData, 'Could not determine import path to construct absolute code path for custom handler. Consider using an absolute path instead.'),\n };\n });\n const jsFn = {\n typeName: opType,\n fieldName: typeName,\n handlers: transformedHandlers,\n };\n return jsFn;\n};\nfunction transformCustomOperations(typeDef, typeName, authRules, databaseType, getRefType) {\n const { typeName: opType, handlers } = typeDef.data;\n let jsFunctionForField = undefined;\n validateCustomOperations(typeDef, typeName, authRules, getRefType);\n if (isCustomHandler(handlers)) {\n jsFunctionForField = handleCustom(handlers, opType, typeName);\n }\n const isCustom = Boolean(jsFunctionForField);\n const { gqlField, models, lambdaFunctionDefinition, customSqlDataSourceStrategy, } = customOperationToGql(typeName, typeDef, authRules, isCustom, databaseType, getRefType);\n return {\n gqlField,\n models,\n jsFunctionForField,\n lambdaFunctionDefinition,\n customSqlDataSourceStrategy,\n };\n}\nfunction generateCustomOperationTypes({ queries, mutations, subscriptions, }) {\n const types = [];\n if (mutations.length > 0) {\n types.push(`type Mutation {\\n ${mutations.join('\\n ')}\\n}`);\n }\n if (queries.length > 0) {\n types.push(`type Query {\\n ${queries.join('\\n ')}\\n}`);\n }\n if (subscriptions.length > 0) {\n types.push(`type Subscription {\\n ${subscriptions.join('\\n ')}\\n}`);\n }\n return types;\n}\n/**\n * Returns API definition from ModelSchema or string schema\n * @param arg - { schema }\n * @returns DerivedApiDefinition that conforms to IAmplifyGraphqlDefinition\n */\nexport function processSchema(arg) {\n const { schema, jsFunctions, functionSchemaAccess, lambdaFunctions, customSqlDataSourceStrategies, } = schemaPreprocessor(arg.schema);\n return {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