{"version":3,"file":"assertCtxArg.mjs","sources":["../../../src/context/assertCtxArg.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { InvalidAmplifyContextError } from '../errors/InvalidAmplifyContextError';\nimport { isAmplifyContext } from './contextBrand';\n/**\n * Assertion guard for category class constructors (and other call sites) that\n * accept an **optional** leading {@link AmplifyContext} argument.\n *\n * - `undefined` is allowed (the caller will fall back to the global context\n *   lazily — constructors MUST NOT capture `getGlobalContext()` eagerly).\n * - A branded {@link AmplifyContext} is allowed.\n * - Any other defined value (a plain options object, an `AmplifyClass`\n *   instance, etc.) is rejected with a typed {@link InvalidAmplifyContextError},\n *   so an unbranded value passed in the context position fails loudly instead\n *   of being silently treated as a valid context.\n *\n * This complements {@link resolveCtxArgs}, which handles the function-argument\n * (tuple) pattern, by covering the constructor / single-slot pattern.\n *\n * @throws {@link InvalidAmplifyContextError} when `ctx` is defined but is not a\n *   branded {@link AmplifyContext}.\n *\n * @internal\n */\nexport function assertOptionalCtxArg(ctx) {\n    if (ctx !== undefined && !isAmplifyContext(ctx)) {\n        throw new InvalidAmplifyContextError();\n    }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,GAAG,EAAE;AAC1C,IAAI,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;AACrD,QAAQ,MAAM,IAAI,0BAA0B,EAAE;AAC9C,IAAI;AACJ;;;;"}