aws-amplify
Version:
AWS Amplify is a JavaScript library for Frontend and mobile developers building cloud-enabled applications.
1 lines • 1.8 kB
Source Map (JSON)
{"version":3,"file":"runWithAmplifyServerContext.mjs","sources":["../../../src/adapterCore/runWithAmplifyServerContext.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createAmplifyServerContext, destroyAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\n/**\n * The low level function that supports framework specific helpers.\n * It creates an Amplify server context based on the input and runs the operation\n * with injecting the context, and finally returns the result of the operation.\n *\n * @param amplifyConfig The Amplify resource config.\n * @param libraryOptions The Amplify library options.\n * @param operation The operation to run with the server context created from\n * `amplifyConfig` and `libraryOptions`.\n * @returns The result returned by the `operation`.\n */\nexport const runWithAmplifyServerContext = async (amplifyConfig, libraryOptions, operation) => {\n const contextSpec = createAmplifyServerContext(amplifyConfig, libraryOptions);\n // run the operation with injecting the context\n try {\n const result = await operation(contextSpec);\n return result;\n }\n finally {\n // ensures destroy the context regardless whether the operation succeeded or failed\n destroyAmplifyServerContext(contextSpec);\n }\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,2BAA2B,GAAG,OAAO,aAAa,EAAE,cAAc,EAAE,SAAS,KAAK;AAC/F,IAAI,MAAM,WAAW,GAAG,0BAA0B,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAClF;AACA,IAAI,IAAI;AACR,QAAQ,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,CAAC;AACpD,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK;AACL,YAAY;AACZ;AACA,QAAQ,2BAA2B,CAAC,WAAW,CAAC,CAAC;AACjD,KAAK;AACL;;;;"}