@aws-amplify/data-schema 0.15.0 → 0.16.0
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/{lib-esm/src → dist/cjs}/Authorization.js +149 -31
- package/dist/cjs/Authorization.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ClientSchema.js +3 -1
- package/dist/cjs/ClientSchema.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/CombineSchema.js +3 -2
- package/dist/cjs/CombineSchema.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/CustomOperation.js +7 -3
- package/dist/cjs/CustomOperation.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/CustomType.js +3 -1
- package/dist/cjs/CustomType.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/EnumType.js +3 -1
- package/dist/cjs/EnumType.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/Handler.js +3 -1
- package/dist/cjs/Handler.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/MappedTypes/CustomOperations.js +3 -1
- package/dist/cjs/MappedTypes/CustomOperations.js.map +1 -0
- package/dist/cjs/MappedTypes/ExtractNonModelTypes.js +4 -0
- package/dist/cjs/MappedTypes/ExtractNonModelTypes.js.map +1 -0
- package/dist/cjs/MappedTypes/ImplicitFieldInjector.js +4 -0
- package/dist/cjs/MappedTypes/ImplicitFieldInjector.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/MappedTypes/MapSecondaryIndexes.js +3 -1
- package/dist/cjs/MappedTypes/MapSecondaryIndexes.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/MappedTypes/ModelMetadata.js +3 -1
- package/dist/cjs/MappedTypes/ModelMetadata.js.map +1 -0
- package/dist/cjs/MappedTypes/ResolveFieldProperties.js +4 -0
- package/dist/cjs/MappedTypes/ResolveFieldProperties.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/MappedTypes/ResolveSchema.js +3 -1
- package/dist/cjs/MappedTypes/ResolveSchema.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ModelField.js +8 -3
- package/dist/cjs/ModelField.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ModelIndex.js +3 -1
- package/dist/cjs/ModelIndex.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ModelRelationalField.js +7 -10
- package/dist/cjs/ModelRelationalField.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ModelSchema.js +10 -5
- package/dist/cjs/ModelSchema.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/ModelType.js +8 -3
- package/dist/cjs/ModelType.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/RefType.js +8 -5
- package/dist/cjs/RefType.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/SchemaProcessor.js +15 -61
- package/dist/cjs/SchemaProcessor.js.map +1 -0
- package/{lib-esm/src/index.js → dist/cjs/a.js} +4 -4
- package/dist/cjs/a.js.map +1 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/index.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/internals/index.js +3 -1
- package/dist/cjs/internals/index.js.map +1 -0
- package/dist/cjs/runtime/addSchemaToClient.js +17 -0
- package/dist/cjs/runtime/addSchemaToClient.js.map +1 -0
- package/dist/cjs/runtime/addSchemaToClientWithInstance.js +22 -0
- package/dist/cjs/runtime/addSchemaToClientWithInstance.js.map +1 -0
- package/dist/cjs/runtime/bridge-types.js +15 -0
- package/dist/cjs/runtime/bridge-types.js.map +1 -0
- package/dist/cjs/runtime/client/index.js +17 -0
- package/dist/cjs/runtime/client/index.js.map +1 -0
- package/dist/cjs/runtime/client/index.v3.js +7 -0
- package/dist/cjs/runtime/client/index.v3.js.map +1 -0
- package/dist/cjs/runtime/index.js +13 -0
- package/dist/cjs/runtime/index.js.map +1 -0
- package/dist/cjs/runtime/index.v3.js +13 -0
- package/dist/cjs/runtime/index.v3.js.map +1 -0
- package/dist/cjs/runtime/internals/APIClient.js +740 -0
- package/dist/cjs/runtime/internals/APIClient.js.map +1 -0
- package/dist/cjs/runtime/internals/clientUtils.js +29 -0
- package/dist/cjs/runtime/internals/clientUtils.js.map +1 -0
- package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js +49 -0
- package/dist/cjs/runtime/internals/generateCustomOperationsProperty.js.map +1 -0
- package/dist/cjs/runtime/internals/index.js +21 -0
- package/dist/cjs/runtime/internals/index.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/custom.js +356 -0
- package/dist/cjs/runtime/internals/operations/custom.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/get.js +62 -0
- package/dist/cjs/runtime/internals/operations/get.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/indexQuery.js +75 -0
- package/dist/cjs/runtime/internals/operations/indexQuery.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/list.js +74 -0
- package/dist/cjs/runtime/internals/operations/list.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/observeQuery.js +121 -0
- package/dist/cjs/runtime/internals/operations/observeQuery.js.map +1 -0
- package/dist/cjs/runtime/internals/operations/subscription.js +31 -0
- package/dist/cjs/runtime/internals/operations/subscription.js.map +1 -0
- package/dist/cjs/runtime/internals/server/generateModelsProperty.js +53 -0
- package/dist/cjs/runtime/internals/server/generateModelsProperty.js.map +1 -0
- package/dist/cjs/runtime/internals/server/index.js +8 -0
- package/dist/cjs/runtime/internals/server/index.js.map +1 -0
- package/dist/cjs/runtime/internals/utils/clientProperties/generateEnumsProperty.js +21 -0
- package/dist/cjs/runtime/internals/utils/clientProperties/generateEnumsProperty.js.map +1 -0
- package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js +45 -0
- package/dist/cjs/runtime/internals/utils/clientProperties/generateModelsProperty.js.map +1 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js +11 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.js.map +1 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js +11 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map +1 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js +15 -0
- package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.js.map +1 -0
- package/dist/cjs/runtime/utils/findIndexByFields.js +25 -0
- package/dist/cjs/runtime/utils/findIndexByFields.js.map +1 -0
- package/dist/cjs/runtime/utils/index.js +11 -0
- package/dist/cjs/runtime/utils/index.js.map +1 -0
- package/dist/cjs/runtime/utils/resolveOwnerFields.js +48 -0
- package/dist/cjs/runtime/utils/resolveOwnerFields.js.map +1 -0
- package/dist/cjs/runtime/utils/resolvePKFields.js +17 -0
- package/dist/cjs/runtime/utils/resolvePKFields.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/util/Brand.js +3 -1
- package/dist/cjs/util/Brand.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/util/IndexLimit.js +3 -1
- package/dist/cjs/util/IndexLimit.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/util/SpreadTuple.js +3 -1
- package/dist/cjs/util/SpreadTuple.js.map +1 -0
- package/{lib-esm/src → dist/cjs}/util/index.js +3 -1
- package/dist/cjs/util/index.js.map +1 -0
- package/{lib-esm/src → dist/esm}/Authorization.d.ts +105 -31
- package/dist/esm/Authorization.mjs +446 -0
- package/dist/esm/Authorization.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ClientSchema.d.ts +1 -2
- package/dist/esm/ClientSchema.mjs +2 -0
- package/dist/esm/ClientSchema.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/CombineSchema.d.ts +0 -1
- package/dist/esm/CombineSchema.mjs +39 -0
- package/dist/esm/CombineSchema.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/CustomOperation.d.ts +2 -3
- package/dist/esm/CustomOperation.mjs +67 -0
- package/dist/esm/CustomOperation.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/CustomType.d.ts +0 -1
- package/dist/esm/CustomType.mjs +13 -0
- package/dist/esm/CustomType.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/EnumType.d.ts +0 -1
- package/dist/esm/EnumType.mjs +16 -0
- package/dist/esm/EnumType.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/Handler.d.ts +0 -1
- package/dist/esm/Handler.mjs +48 -0
- package/dist/esm/Handler.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/CustomOperations.d.ts +0 -1
- package/dist/esm/MappedTypes/CustomOperations.mjs +2 -0
- package/dist/esm/MappedTypes/CustomOperations.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/ExtractNonModelTypes.d.ts +0 -1
- package/dist/esm/MappedTypes/ExtractNonModelTypes.mjs +2 -0
- package/dist/esm/MappedTypes/ExtractNonModelTypes.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/ImplicitFieldInjector.d.ts +0 -1
- package/dist/esm/MappedTypes/ImplicitFieldInjector.mjs +2 -0
- package/dist/esm/MappedTypes/ImplicitFieldInjector.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/MapSecondaryIndexes.d.ts +0 -1
- package/dist/esm/MappedTypes/MapSecondaryIndexes.mjs +2 -0
- package/dist/esm/MappedTypes/MapSecondaryIndexes.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/ModelMetadata.d.ts +0 -1
- package/dist/esm/MappedTypes/ModelMetadata.mjs +2 -0
- package/dist/esm/MappedTypes/ModelMetadata.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/ResolveFieldProperties.d.ts +0 -1
- package/dist/esm/MappedTypes/ResolveFieldProperties.mjs +2 -0
- package/dist/esm/MappedTypes/ResolveFieldProperties.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/MappedTypes/ResolveSchema.d.ts +0 -1
- package/dist/esm/MappedTypes/ResolveSchema.mjs +2 -0
- package/dist/esm/MappedTypes/ResolveSchema.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ModelField.d.ts +2 -3
- package/dist/esm/ModelField.mjs +199 -0
- package/dist/esm/ModelField.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ModelIndex.d.ts +0 -1
- package/dist/esm/ModelIndex.mjs +33 -0
- package/dist/esm/ModelIndex.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ModelRelationalField.d.ts +3 -4
- package/dist/esm/ModelRelationalField.mjs +88 -0
- package/dist/esm/ModelRelationalField.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ModelSchema.d.ts +3 -4
- package/dist/esm/ModelSchema.mjs +163 -0
- package/dist/esm/ModelSchema.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/ModelType.d.ts +2 -3
- package/dist/esm/ModelType.mjs +66 -0
- package/dist/esm/ModelType.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/RefType.d.ts +2 -3
- package/dist/esm/RefType.mjs +48 -0
- package/dist/esm/RefType.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/SchemaProcessor.d.ts +0 -1
- package/dist/esm/SchemaProcessor.mjs +926 -0
- package/dist/esm/SchemaProcessor.mjs.map +1 -0
- package/{lib-esm/src/index.d.ts → dist/esm/a.d.ts} +1 -3
- package/dist/esm/a.mjs +11 -0
- package/dist/esm/a.mjs.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/internals/index.d.ts +2 -0
- package/dist/esm/internals/index.mjs +2 -0
- package/dist/esm/internals/index.mjs.map +1 -0
- package/dist/esm/runtime/addSchemaToClient.d.ts +3 -0
- package/dist/esm/runtime/addSchemaToClient.mjs +17 -0
- package/dist/esm/runtime/addSchemaToClient.mjs.map +1 -0
- package/dist/esm/runtime/addSchemaToClientWithInstance.d.ts +3 -0
- package/dist/esm/runtime/addSchemaToClientWithInstance.mjs +22 -0
- package/dist/esm/runtime/addSchemaToClientWithInstance.mjs.map +1 -0
- package/dist/esm/runtime/bridge-types.d.ts +281 -0
- package/dist/esm/runtime/bridge-types.mjs +13 -0
- package/dist/esm/runtime/bridge-types.mjs.map +1 -0
- package/dist/esm/runtime/client/index.d.ts +571 -0
- package/dist/esm/runtime/client/index.mjs +2 -0
- package/dist/esm/runtime/client/index.mjs.map +1 -0
- package/dist/esm/runtime/client/index.v3.d.ts +15 -0
- package/dist/esm/runtime/client/index.v3.mjs +2 -0
- package/dist/esm/runtime/client/index.v3.mjs.map +1 -0
- package/dist/esm/runtime/index.d.ts +4 -0
- package/dist/esm/runtime/index.mjs +4 -0
- package/dist/esm/runtime/index.mjs.map +1 -0
- package/dist/esm/runtime/index.v3.d.ts +4 -0
- package/dist/esm/runtime/index.v3.mjs +4 -0
- package/dist/esm/runtime/index.v3.mjs.map +1 -0
- package/dist/esm/runtime/internals/APIClient.d.ts +125 -0
- package/dist/esm/runtime/internals/APIClient.mjs +728 -0
- package/dist/esm/runtime/internals/APIClient.mjs.map +1 -0
- package/dist/esm/runtime/internals/clientUtils.d.ts +6 -0
- package/dist/esm/runtime/internals/clientUtils.mjs +26 -0
- package/dist/esm/runtime/internals/clientUtils.mjs.map +1 -0
- package/dist/esm/runtime/internals/generateCustomOperationsProperty.d.ts +8 -0
- package/dist/esm/runtime/internals/generateCustomOperationsProperty.mjs +44 -0
- package/dist/esm/runtime/internals/generateCustomOperationsProperty.mjs.map +1 -0
- package/dist/esm/runtime/internals/index.d.ts +6 -0
- package/dist/esm/runtime/internals/index.mjs +7 -0
- package/dist/esm/runtime/internals/index.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/custom.d.ts +61 -0
- package/dist/esm/runtime/internals/operations/custom.mjs +354 -0
- package/dist/esm/runtime/internals/operations/custom.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/get.d.ts +3 -0
- package/dist/esm/runtime/internals/operations/get.mjs +60 -0
- package/dist/esm/runtime/internals/operations/get.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/indexQuery.d.ts +7 -0
- package/dist/esm/runtime/internals/operations/indexQuery.mjs +73 -0
- package/dist/esm/runtime/internals/operations/indexQuery.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/list.d.ts +2 -0
- package/dist/esm/runtime/internals/operations/list.mjs +72 -0
- package/dist/esm/runtime/internals/operations/list.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/observeQuery.d.ts +3 -0
- package/dist/esm/runtime/internals/operations/observeQuery.mjs +120 -0
- package/dist/esm/runtime/internals/operations/observeQuery.mjs.map +1 -0
- package/dist/esm/runtime/internals/operations/subscription.d.ts +3 -0
- package/dist/esm/runtime/internals/operations/subscription.mjs +29 -0
- package/dist/esm/runtime/internals/operations/subscription.mjs.map +1 -0
- package/dist/esm/runtime/internals/server/generateModelsProperty.d.ts +3 -0
- package/dist/esm/runtime/internals/server/generateModelsProperty.mjs +51 -0
- package/dist/esm/runtime/internals/server/generateModelsProperty.mjs.map +1 -0
- package/dist/esm/runtime/internals/server/index.d.ts +1 -0
- package/dist/esm/runtime/internals/server/index.mjs +2 -0
- package/dist/esm/runtime/internals/server/index.mjs.map +1 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.d.ts +3 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.mjs +18 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.mjs.map +1 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.d.ts +3 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.mjs +43 -0
- package/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.mjs.map +1 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.d.ts +2 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs +8 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs.map +1 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.d.ts +8 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs +8 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs.map +1 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.d.ts +2 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs +12 -0
- package/dist/esm/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs.map +1 -0
- package/dist/esm/runtime/utils/findIndexByFields.d.ts +9 -0
- package/dist/esm/runtime/utils/findIndexByFields.mjs +22 -0
- package/dist/esm/runtime/utils/findIndexByFields.mjs.map +1 -0
- package/dist/esm/runtime/utils/index.d.ts +2 -0
- package/dist/esm/runtime/utils/index.mjs +3 -0
- package/dist/esm/runtime/utils/index.mjs.map +1 -0
- package/dist/esm/runtime/utils/resolveOwnerFields.d.ts +12 -0
- package/dist/esm/runtime/utils/resolveOwnerFields.mjs +45 -0
- package/dist/esm/runtime/utils/resolveOwnerFields.mjs.map +1 -0
- package/dist/esm/runtime/utils/resolvePKFields.d.ts +13 -0
- package/dist/esm/runtime/utils/resolvePKFields.mjs +14 -0
- package/dist/esm/runtime/utils/resolvePKFields.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/util/Brand.d.ts +0 -1
- package/dist/esm/util/Brand.mjs +30 -0
- package/dist/esm/util/Brand.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/util/IndexLimit.d.ts +0 -1
- package/dist/esm/util/IndexLimit.mjs +2 -0
- package/dist/esm/util/IndexLimit.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/util/SpreadTuple.d.ts +0 -1
- package/dist/esm/util/SpreadTuple.mjs +2 -0
- package/dist/esm/util/SpreadTuple.mjs.map +1 -0
- package/{lib-esm/src → dist/esm}/util/index.d.ts +0 -1
- package/dist/esm/util/index.mjs +2 -0
- package/dist/esm/util/index.mjs.map +1 -0
- package/dist/meta/cjs.tsbuildinfo +1 -0
- package/internals/package.json +7 -5
- package/package.json +31 -14
- package/runtime/package.json +8 -0
- package/src/Authorization.ts +684 -0
- package/src/ClientSchema.ts +118 -0
- package/src/CombineSchema.ts +58 -0
- package/src/CustomOperation.ts +286 -0
- package/src/CustomType.ts +67 -0
- package/src/EnumType.ts +36 -0
- package/src/Handler.ts +127 -0
- package/src/MappedTypes/CustomOperations.ts +256 -0
- package/src/MappedTypes/ExtractNonModelTypes.ts +154 -0
- package/src/MappedTypes/ImplicitFieldInjector.ts +69 -0
- package/src/MappedTypes/MapSecondaryIndexes.ts +100 -0
- package/src/MappedTypes/ModelMetadata.ts +87 -0
- package/src/MappedTypes/ResolveFieldProperties.ts +254 -0
- package/src/MappedTypes/ResolveSchema.ts +148 -0
- package/src/ModelField.ts +304 -0
- package/src/ModelIndex.ts +91 -0
- package/src/ModelRelationalField.ts +263 -0
- package/src/ModelSchema.ts +437 -0
- package/src/ModelType.ts +345 -0
- package/src/RefType.ts +139 -0
- package/src/SchemaProcessor.ts +1516 -0
- package/src/a.ts +58 -0
- package/src/index.ts +6 -0
- package/src/internals/index.ts +2 -0
- package/src/runtime/addSchemaToClient.ts +45 -0
- package/src/runtime/addSchemaToClientWithInstance.ts +46 -0
- package/src/runtime/bridge-types.ts +382 -0
- package/src/runtime/client/index.ts +923 -0
- package/src/runtime/client/index.v3.ts +52 -0
- package/src/runtime/index.ts +7 -0
- package/src/runtime/index.v3.ts +7 -0
- package/src/runtime/internals/APIClient.ts +1082 -0
- package/src/runtime/internals/clientUtils.ts +37 -0
- package/src/runtime/internals/generateCustomOperationsProperty.ts +116 -0
- package/src/runtime/internals/index.ts +12 -0
- package/src/runtime/internals/operations/custom.ts +497 -0
- package/src/runtime/internals/operations/get.ts +150 -0
- package/src/runtime/internals/operations/indexQuery.ts +178 -0
- package/src/runtime/internals/operations/list.ts +143 -0
- package/src/runtime/internals/operations/observeQuery.ts +146 -0
- package/src/runtime/internals/operations/subscription.ts +78 -0
- package/src/runtime/internals/server/generateModelsProperty.ts +94 -0
- package/src/runtime/internals/server/index.ts +4 -0
- package/src/runtime/internals/utils/clientProperties/generateEnumsProperty.ts +34 -0
- package/src/runtime/internals/utils/clientProperties/generateModelsProperty.ts +88 -0
- package/src/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.ts +10 -0
- package/src/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.ts +13 -0
- package/src/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts +15 -0
- package/src/runtime/utils/findIndexByFields.ts +31 -0
- package/src/runtime/utils/index.ts +5 -0
- package/src/runtime/utils/resolveOwnerFields.ts +77 -0
- package/src/runtime/utils/resolvePKFields.ts +23 -0
- package/src/util/Brand.ts +45 -0
- package/src/util/IndexLimit.ts +12 -0
- package/src/util/SpreadTuple.ts +10 -0
- package/src/util/index.ts +3 -0
- package/lib-esm/index.d.ts +0 -5
- package/lib-esm/index.d.ts.map +0 -1
- package/lib-esm/index.js +0 -28
- package/lib-esm/src/Authorization.d.ts.map +0 -1
- package/lib-esm/src/ClientSchema.d.ts.map +0 -1
- package/lib-esm/src/CombineSchema.d.ts.map +0 -1
- package/lib-esm/src/CustomOperation.d.ts.map +0 -1
- package/lib-esm/src/CustomType.d.ts.map +0 -1
- package/lib-esm/src/EnumType.d.ts.map +0 -1
- package/lib-esm/src/Handler.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/CustomOperations.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ExtractNonModelTypes.js +0 -2
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ImplicitFieldInjector.js +0 -2
- package/lib-esm/src/MappedTypes/MapSecondaryIndexes.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ModelMetadata.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.d.ts.map +0 -1
- package/lib-esm/src/MappedTypes/ResolveFieldProperties.js +0 -2
- package/lib-esm/src/MappedTypes/ResolveSchema.d.ts.map +0 -1
- package/lib-esm/src/ModelField.d.ts.map +0 -1
- package/lib-esm/src/ModelIndex.d.ts.map +0 -1
- package/lib-esm/src/ModelRelationalField.d.ts.map +0 -1
- package/lib-esm/src/ModelSchema.d.ts.map +0 -1
- package/lib-esm/src/ModelType.d.ts.map +0 -1
- package/lib-esm/src/RefType.d.ts.map +0 -1
- package/lib-esm/src/SchemaProcessor.d.ts.map +0 -1
- package/lib-esm/src/index.d.ts.map +0 -1
- package/lib-esm/src/internals/index.d.ts +0 -2
- package/lib-esm/src/internals/index.d.ts.map +0 -1
- package/lib-esm/src/util/Brand.d.ts.map +0 -1
- package/lib-esm/src/util/IndexLimit.d.ts.map +0 -1
- package/lib-esm/src/util/SpreadTuple.d.ts.map +0 -1
- package/lib-esm/src/util/index.d.ts.map +0 -1
- package/lib-esm/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.generateModelsProperty = void 0;
|
|
5
|
+
const APIClient_1 = require("../../APIClient");
|
|
6
|
+
const list_1 = require("../../operations/list");
|
|
7
|
+
const indexQuery_1 = require("../../operations/indexQuery");
|
|
8
|
+
const get_1 = require("../../operations/get");
|
|
9
|
+
const subscription_1 = require("../../operations/subscription");
|
|
10
|
+
const observeQuery_1 = require("../../operations/observeQuery");
|
|
11
|
+
const clientUtils_1 = require("../../clientUtils");
|
|
12
|
+
function generateModelsProperty(client, apiGraphQLConfig, getInternals) {
|
|
13
|
+
const models = {};
|
|
14
|
+
const modelIntrospection = apiGraphQLConfig.modelIntrospection;
|
|
15
|
+
if (!modelIntrospection) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
const SUBSCRIPTION_OPS = ['ONCREATE', 'ONUPDATE', 'ONDELETE'];
|
|
19
|
+
for (const model of Object.values(modelIntrospection.models)) {
|
|
20
|
+
const { name } = model;
|
|
21
|
+
models[name] = {};
|
|
22
|
+
Object.entries(APIClient_1.graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {
|
|
23
|
+
const operation = key;
|
|
24
|
+
if (operation === 'LIST') {
|
|
25
|
+
models[name][operationPrefix] = (0, list_1.listFactory)(client, modelIntrospection, model, getInternals);
|
|
26
|
+
}
|
|
27
|
+
else if (SUBSCRIPTION_OPS.includes(operation)) {
|
|
28
|
+
models[name][operationPrefix] = (0, subscription_1.subscriptionFactory)(client, modelIntrospection, model, operation, getInternals);
|
|
29
|
+
}
|
|
30
|
+
else if (operation === 'OBSERVE_QUERY') {
|
|
31
|
+
models[name][operationPrefix] = (0, observeQuery_1.observeQueryFactory)(models, model);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
models[name][operationPrefix] = (0, get_1.getFactory)(client, modelIntrospection, model, operation, getInternals);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const secondaryIdxs = (0, clientUtils_1.getSecondaryIndexesFromSchemaModel)(model);
|
|
38
|
+
for (const idx of secondaryIdxs) {
|
|
39
|
+
models[name][idx.queryField] = (0, indexQuery_1.indexQueryFactory)(client, modelIntrospection, model, idx, getInternals);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return models;
|
|
43
|
+
}
|
|
44
|
+
exports.generateModelsProperty = generateModelsProperty;
|
|
45
|
+
//# sourceMappingURL=generateModelsProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateModelsProperty.js","sources":["../../../../../../src/runtime/internals/utils/clientProperties/generateModelsProperty.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateModelsProperty = void 0;\nconst APIClient_1 = require(\"../../APIClient\");\nconst list_1 = require(\"../../operations/list\");\nconst indexQuery_1 = require(\"../../operations/indexQuery\");\nconst get_1 = require(\"../../operations/get\");\nconst subscription_1 = require(\"../../operations/subscription\");\nconst observeQuery_1 = require(\"../../operations/observeQuery\");\nconst clientUtils_1 = require(\"../../clientUtils\");\nfunction generateModelsProperty(client, apiGraphQLConfig, getInternals) {\n const models = {};\n const modelIntrospection = apiGraphQLConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SUBSCRIPTION_OPS = ['ONCREATE', 'ONUPDATE', 'ONDELETE'];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n Object.entries(APIClient_1.graphQLOperationsInfo).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n if (operation === 'LIST') {\n models[name][operationPrefix] = (0, list_1.listFactory)(client, modelIntrospection, model, getInternals);\n }\n else if (SUBSCRIPTION_OPS.includes(operation)) {\n models[name][operationPrefix] = (0, subscription_1.subscriptionFactory)(client, modelIntrospection, model, operation, getInternals);\n }\n else if (operation === 'OBSERVE_QUERY') {\n models[name][operationPrefix] = (0, observeQuery_1.observeQueryFactory)(models, model);\n }\n else {\n models[name][operationPrefix] = (0, get_1.getFactory)(client, modelIntrospection, model, operation, getInternals);\n }\n });\n const secondaryIdxs = (0, clientUtils_1.getSecondaryIndexesFromSchemaModel)(model);\n for (const idx of secondaryIdxs) {\n models[name][idx.queryField] = (0, indexQuery_1.indexQueryFactory)(client, modelIntrospection, model, idx, getInternals);\n }\n }\n return models;\n}\nexports.generateModelsProperty = generateModelsProperty;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,sBAAsB,GAAG,KAAK,CAAC,CAAC;AACxC,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAChD,MAAM,YAAY,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAC9C,MAAM,cAAc,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAChE,MAAM,cAAc,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAChE,MAAM,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACnD,SAAS,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE;AACxE,IAAI,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,IAAI,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC;AACnE,IAAI,IAAI,CAAC,kBAAkB,EAAE;AAC7B,QAAQ,OAAO,EAAE,CAAC;AAClB,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAClE,IAAI,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;AAClE,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC/B,QAAQ,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAC1B,QAAQ,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,eAAe,EAAE,CAAC,KAAK;AAClG,YAAY,MAAM,SAAS,GAAG,GAAG,CAAC;AAClC,YAAY,IAAI,SAAS,KAAK,MAAM,EAAE;AACtC,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;AACzH,aAAa;AACb,iBAAiB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AAC3D,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AACpJ,aAAa;AACb,iBAAiB,IAAI,SAAS,KAAK,eAAe,EAAE;AACpD,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACvG,aAAa;AACb,iBAAiB;AACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,GAAG,IAAI,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;AAClI,aAAa;AACb,SAAS,CAAC,CAAC;AACX,QAAQ,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;AAC3F,QAAQ,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE;AACzC,YAAY,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,IAAI,YAAY,CAAC,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;AACrI,SAAS;AACT,KAAK;AACL,IAAI,OAAO,MAAM,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isApiGraphQLConfig = void 0;
|
|
7
|
+
function isApiGraphQLConfig(apiGraphQLConfig) {
|
|
8
|
+
return apiGraphQLConfig !== undefined;
|
|
9
|
+
}
|
|
10
|
+
exports.isApiGraphQLConfig = isApiGraphQLConfig;
|
|
11
|
+
//# sourceMappingURL=isApiGraphQLProviderConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isApiGraphQLProviderConfig.js","sources":["../../../../../../src/runtime/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isApiGraphQLConfig = void 0;\nfunction isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\nexports.isApiGraphQLConfig = isApiGraphQLConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,SAAS,kBAAkB,CAAC,gBAAgB,EAAE;AAC9C,IAAI,OAAO,gBAAgB,KAAK,SAAS,CAAC;AAC1C,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
|
package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isConfigureEventWithResourceConfig = void 0;
|
|
7
|
+
function isConfigureEventWithResourceConfig(payload) {
|
|
8
|
+
return payload.event === 'configure';
|
|
9
|
+
}
|
|
10
|
+
exports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;
|
|
11
|
+
//# sourceMappingURL=isConfigureEventWithResourceConfig.js.map
|
package/dist/cjs/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConfigureEventWithResourceConfig.js","sources":["../../../../../../src/runtime/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isConfigureEventWithResourceConfig = void 0;\nfunction isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\nexports.isConfigureEventWithResourceConfig = isConfigureEventWithResourceConfig;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kCAAkC,GAAG,KAAK,CAAC,CAAC;AACpD,SAAS,kCAAkC,CAAC,OAAO,EAAE;AACrD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,CAAC;AACzC,CAAC;AACD,OAAO,CAAC,kCAAkC,GAAG,kCAAkC;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isGraphQLResponseWithErrors = void 0;
|
|
7
|
+
function isGraphQLResponseWithErrors(response) {
|
|
8
|
+
if (!response) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
const r = response;
|
|
12
|
+
return Array.isArray(r.errors) && r.errors.length > 0;
|
|
13
|
+
}
|
|
14
|
+
exports.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;
|
|
15
|
+
//# sourceMappingURL=isGraphQLResponseWithErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isGraphQLResponseWithErrors.js","sources":["../../../../../../src/runtime/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isGraphQLResponseWithErrors = void 0;\nfunction isGraphQLResponseWithErrors(response) {\n if (!response) {\n return false;\n }\n const r = response;\n return Array.isArray(r.errors) && r.errors.length > 0;\n}\nexports.isGraphQLResponseWithErrors = isGraphQLResponseWithErrors;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAC7C,SAAS,2BAA2B,CAAC,QAAQ,EAAE;AAC/C,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC;AACvB,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1D,CAAC;AACD,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.findIndexByFields = void 0;
|
|
5
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
/**
|
|
8
|
+
* Iterates through a collection to find a matching item and returns the index.
|
|
9
|
+
*
|
|
10
|
+
* @param needle The item to search for
|
|
11
|
+
* @param haystack The collection to search
|
|
12
|
+
* @param keyFields The fields used to indicate a match
|
|
13
|
+
* @returns Index of `needle` in `haystack`, otherwise -1 if not found.
|
|
14
|
+
*/
|
|
15
|
+
function findIndexByFields(needle, haystack, keyFields) {
|
|
16
|
+
const searchObject = Object.fromEntries(keyFields.map((fieldName) => [fieldName, needle[fieldName]]));
|
|
17
|
+
for (let i = 0; i < haystack.length; i++) {
|
|
18
|
+
if (Object.keys(searchObject).every((k) => searchObject[k] === haystack[i][k])) {
|
|
19
|
+
return i;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return -1;
|
|
23
|
+
}
|
|
24
|
+
exports.findIndexByFields = findIndexByFields;
|
|
25
|
+
//# sourceMappingURL=findIndexByFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findIndexByFields.js","sources":["../../../../src/runtime/utils/findIndexByFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.findIndexByFields = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Iterates through a collection to find a matching item and returns the index.\n *\n * @param needle The item to search for\n * @param haystack The collection to search\n * @param keyFields The fields used to indicate a match\n * @returns Index of `needle` in `haystack`, otherwise -1 if not found.\n */\nfunction findIndexByFields(needle, haystack, keyFields) {\n const searchObject = Object.fromEntries(keyFields.map((fieldName) => [fieldName, needle[fieldName]]));\n for (let i = 0; i < haystack.length; i++) {\n if (Object.keys(searchObject).every((k) => searchObject[k] === haystack[i][k])) {\n return i;\n }\n }\n return -1;\n}\nexports.findIndexByFields = findIndexByFields;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE;AACxD,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1G,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC9C,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;AACxF,YAAY,OAAO,CAAC,CAAC;AACrB,SAAS;AACT,KAAK;AACL,IAAI,OAAO,CAAC,CAAC,CAAC;AACd,CAAC;AACD,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findIndexByFields = exports.resolvePKFields = void 0;
|
|
7
|
+
var resolvePKFields_1 = require("./resolvePKFields");
|
|
8
|
+
Object.defineProperty(exports, "resolvePKFields", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });
|
|
9
|
+
var findIndexByFields_1 = require("./findIndexByFields");
|
|
10
|
+
Object.defineProperty(exports, "findIndexByFields", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/runtime/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.findIndexByFields = exports.resolvePKFields = void 0;\nvar resolvePKFields_1 = require(\"./resolvePKFields\");\nObject.defineProperty(exports, \"resolvePKFields\", { enumerable: true, get: function () { return resolvePKFields_1.resolvePKFields; } });\nvar findIndexByFields_1 = require(\"./findIndexByFields\");\nObject.defineProperty(exports, \"findIndexByFields\", { enumerable: true, get: function () { return findIndexByFields_1.findIndexByFields; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AAC7D,IAAI,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,iBAAiB,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC;AACxI,IAAI,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACzD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resolveOwnerFields = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Given an introspection schema model, returns all owner fields.
|
|
7
|
+
*
|
|
8
|
+
* @param model Model from an introspection schema
|
|
9
|
+
* @returns List of owner field names
|
|
10
|
+
*/
|
|
11
|
+
function resolveOwnerFields(model) {
|
|
12
|
+
const ownerFields = new Set();
|
|
13
|
+
for (const attr of model.attributes || []) {
|
|
14
|
+
if (isAuthAttribute(attr)) {
|
|
15
|
+
for (const rule of attr.properties.rules) {
|
|
16
|
+
if (rule.allow === 'owner') {
|
|
17
|
+
ownerFields.add(rule.ownerField || 'owner');
|
|
18
|
+
}
|
|
19
|
+
else if (rule.allow === 'groups' && rule.groupsField !== undefined) {
|
|
20
|
+
// only valid for dynamic group(s)
|
|
21
|
+
// static group auth will have an array of predefined groups in the attribute, groups: string[]
|
|
22
|
+
// but `groupsField` will be undefined
|
|
23
|
+
ownerFields.add(rule.groupsField);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return Array.from(ownerFields);
|
|
29
|
+
}
|
|
30
|
+
exports.resolveOwnerFields = resolveOwnerFields;
|
|
31
|
+
/**
|
|
32
|
+
* Type guard that identifies an auth attribute with an attached rules list that
|
|
33
|
+
* specifies an `allow` attribute at a minimum.
|
|
34
|
+
*
|
|
35
|
+
* @param attribute Any object. Ideally a model introspection schema model attribute
|
|
36
|
+
* @returns True if given object is an auth attribute
|
|
37
|
+
*/
|
|
38
|
+
function isAuthAttribute(attribute) {
|
|
39
|
+
if (attribute?.type === 'auth') {
|
|
40
|
+
if (typeof attribute?.properties === 'object') {
|
|
41
|
+
if (Array.isArray(attribute?.properties?.rules)) {
|
|
42
|
+
return (attribute?.properties?.rules).every((rule) => !!rule.allow);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=resolveOwnerFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOwnerFields.js","sources":["../../../../src/runtime/utils/resolveOwnerFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveOwnerFields = void 0;\n/**\n * Given an introspection schema model, returns all owner fields.\n *\n * @param model Model from an introspection schema\n * @returns List of owner field names\n */\nfunction resolveOwnerFields(model) {\n const ownerFields = new Set();\n for (const attr of model.attributes || []) {\n if (isAuthAttribute(attr)) {\n for (const rule of attr.properties.rules) {\n if (rule.allow === 'owner') {\n ownerFields.add(rule.ownerField || 'owner');\n }\n else if (rule.allow === 'groups' && rule.groupsField !== undefined) {\n // only valid for dynamic group(s)\n // static group auth will have an array of predefined groups in the attribute, groups: string[]\n // but `groupsField` will be undefined\n ownerFields.add(rule.groupsField);\n }\n }\n }\n }\n return Array.from(ownerFields);\n}\nexports.resolveOwnerFields = resolveOwnerFields;\n/**\n * Type guard that identifies an auth attribute with an attached rules list that\n * specifies an `allow` attribute at a minimum.\n *\n * @param attribute Any object. Ideally a model introspection schema model attribute\n * @returns True if given object is an auth attribute\n */\nfunction isAuthAttribute(attribute) {\n if (attribute?.type === 'auth') {\n if (typeof attribute?.properties === 'object') {\n if (Array.isArray(attribute?.properties?.rules)) {\n return (attribute?.properties?.rules).every((rule) => !!rule.allow);\n }\n }\n }\n return false;\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,MAAM,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;AAClC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE;AAC/C,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;AACnC,YAAY,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AACtD,gBAAgB,IAAI,IAAI,CAAC,KAAK,KAAK,OAAO,EAAE;AAC5C,oBAAoB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC;AAChE,iBAAiB;AACjB,qBAAqB,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE;AACpF;AACA;AACA;AACA,oBAAoB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACtD,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,SAAS,EAAE;AACpC,IAAI,IAAI,SAAS,EAAE,IAAI,KAAK,MAAM,EAAE;AACpC,QAAQ,IAAI,OAAO,SAAS,EAAE,UAAU,KAAK,QAAQ,EAAE;AACvD,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;AAC7D,gBAAgB,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpF,aAAa;AACb,SAAS;AACT,KAAK;AACL,IAAI,OAAO,KAAK,CAAC;AACjB;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resolvePKFields = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key
|
|
7
|
+
* as an array of field names.
|
|
8
|
+
*
|
|
9
|
+
* @param model The model object
|
|
10
|
+
* @returns Array of field names
|
|
11
|
+
*/
|
|
12
|
+
function resolvePKFields(model) {
|
|
13
|
+
const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;
|
|
14
|
+
return [primaryKeyFieldName, ...sortKeyFieldNames];
|
|
15
|
+
}
|
|
16
|
+
exports.resolvePKFields = resolvePKFields;
|
|
17
|
+
//# sourceMappingURL=resolvePKFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePKFields.js","sources":["../../../../src/runtime/utils/resolvePKFields.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolvePKFields = void 0;\n/**\n * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key\n * as an array of field names.\n *\n * @param model The model object\n * @returns Array of field names\n */\nfunction resolvePKFields(model) {\n const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;\n return [primaryKeyFieldName, ...sortKeyFieldNames];\n}\nexports.resolvePKFields = resolvePKFields;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,eAAe,CAAC,KAAK,EAAE;AAChC,IAAI,MAAM,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC;AAC5E,IAAI,OAAO,CAAC,mBAAmB,EAAE,GAAG,iBAAiB,CAAC,CAAC;AACvD,CAAC;AACD,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.getBrand = exports.brand = void 0;
|
|
4
5
|
const brandSymbol = Symbol('brand');
|
|
@@ -30,3 +31,4 @@ function getBrand(branded) {
|
|
|
30
31
|
return branded[brandSymbol];
|
|
31
32
|
}
|
|
32
33
|
exports.getBrand = getBrand;
|
|
34
|
+
//# sourceMappingURL=Brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Brand.js","sources":["../../../src/util/Brand.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getBrand = exports.brand = void 0;\nconst brandSymbol = Symbol('brand');\n/**\n * Create an object of a specific type Brand\n * string branded type.\n *\n * @param brand: The string to Brand onto a simple object\n * @returns A branded empty object\n *\n * @example\n * brand('example') => {[brandSymbol]: 'example'}\n *\n * Which I might use like this:\n * const myType = {content: \"default content\", ...brand<'example'>}\n */\nfunction brand(brand) {\n return {\n [brandSymbol]: brand,\n };\n}\nexports.brand = brand;\n/**\n *\n * @param branded: Branded object\n * @returns The string brand value\n */\nfunction getBrand(branded) {\n return branded[brandSymbol];\n}\nexports.getBrand = getBrand;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAC1C,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,KAAK,CAAC,KAAK,EAAE;AACtB,IAAI,OAAO;AACX,QAAQ,CAAC,WAAW,GAAG,KAAK;AAC5B,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AACtB;AACA;AACA;AACA;AACA;AACA,SAAS,QAAQ,CAAC,OAAO,EAAE;AAC3B,IAAI,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC;AACD,OAAO,CAAC,QAAQ,GAAG,QAAQ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexLimit.js","sources":["../../../src/util/IndexLimit.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpreadTuple.js","sources":["../../../src/util/SpreadTuple.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.getBrand = exports.brand = void 0;
|
|
4
5
|
var Brand_1 = require("./Brand");
|
|
5
6
|
Object.defineProperty(exports, "brand", { enumerable: true, get: function () { return Brand_1.brand; } });
|
|
6
7
|
Object.defineProperty(exports, "getBrand", { enumerable: true, get: function () { return Brand_1.getBrand; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/util/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getBrand = exports.brand = void 0;\nvar Brand_1 = require(\"./Brand\");\nObject.defineProperty(exports, \"brand\", { enumerable: true, get: function () { return Brand_1.brand; } });\nObject.defineProperty(exports, \"getBrand\", { enumerable: true, get: function () { return Brand_1.getBrand; } });\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAC1C,IAAI,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACjC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1G,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -71,11 +71,7 @@ export type Authorization<AuthStrategy extends Strategy, AuthField extends strin
|
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
export type OwnerField = object;
|
|
74
|
-
type BuilderMethods<T extends object> = {
|
|
75
|
-
[K in keyof T as T[K] extends (...args: any) => any ? K : never]: T[K];
|
|
76
|
-
};
|
|
77
74
|
declare function to<SELF extends Authorization<any, any, any>>(this: SELF, operations: Operation[]): Omit<SELF, "to">;
|
|
78
|
-
declare function inField<SELF extends Authorization<any, any, any>, Field extends string>(this: SELF, field: Field): BuilderMethods<Omit<SELF, "inField">> & Authorization<SELF[typeof __data]["strategy"], Field, SELF[typeof __data]["multiOwner"]>;
|
|
79
75
|
/**
|
|
80
76
|
* Specifies a property of the identity JWT to use in place of `sub::username`
|
|
81
77
|
* as the value to match against the owner field for authorization.
|
|
@@ -93,28 +89,33 @@ declare function withClaimIn<SELF extends Authorization<any, any, any>>(this: SE
|
|
|
93
89
|
*/
|
|
94
90
|
export declare const allow: {
|
|
95
91
|
/**
|
|
96
|
-
* Authorize unauthenticated users
|
|
97
|
-
* use `.public('iam')` to use IAM based authorization for unauthenticated users.
|
|
98
|
-
* @param provider the authentication provider - supports "apiKey" or "iam" as valid providers
|
|
92
|
+
* Authorize unauthenticated users by using API key based authorization.
|
|
99
93
|
* @returns an authorization rule for unauthenticated users
|
|
100
94
|
*/
|
|
101
|
-
readonly
|
|
95
|
+
readonly publicApiKey: () => Authorization<"public", undefined, false> & {
|
|
96
|
+
to: typeof to;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Authorize unauthenticated users by using IAM based authorization.
|
|
100
|
+
* @returns an authorization rule for unauthenticated users
|
|
101
|
+
*/
|
|
102
|
+
readonly guest: () => Authorization<"public", undefined, false> & {
|
|
102
103
|
to: typeof to;
|
|
103
104
|
};
|
|
104
105
|
/**
|
|
105
106
|
* Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
106
|
-
* use `.
|
|
107
|
+
* use `.authenticated("iam")` or `.authenticated("oidc")` to use IAM or OIDC based authorization for authenticated users.
|
|
107
108
|
* @param provider the authentication provider - supports "userPools", "iam", or "oidc"
|
|
108
109
|
* @returns an authorization rule for authenticated users
|
|
109
110
|
*/
|
|
110
|
-
readonly
|
|
111
|
+
readonly authenticated: (provider?: PrivateProvider) => Authorization<"private", undefined, false> & {
|
|
111
112
|
to: typeof to;
|
|
112
113
|
};
|
|
113
114
|
/**
|
|
114
115
|
* Authorize access on a per-user (owner) basis. By setting owner-based authorization, a new `owner: a.string()`
|
|
115
116
|
* field will be added to the model to store which user "owns" the item. Upon item creation, the "owner field" is
|
|
116
|
-
* auto-populated with the authenticated user's information.
|
|
117
|
-
*
|
|
117
|
+
* auto-populated with the authenticated user's information. If you want to specify which field should be used as
|
|
118
|
+
* the owner field, you can use the `ownerDefinedIn` builder function instead.
|
|
118
119
|
*
|
|
119
120
|
* By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
120
121
|
* use `.owner("oidc")` to use OIDC based authentication to designate the owner.
|
|
@@ -127,34 +128,51 @@ export declare const allow: {
|
|
|
127
128
|
*/
|
|
128
129
|
readonly owner: (provider?: OwnerProviders) => Authorization<"owner", "owner", false> & {
|
|
129
130
|
to: typeof to;
|
|
130
|
-
|
|
131
|
+
identityClaim: typeof identityClaim;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Authorize access on a per-user (owner) basis with specifying which field should be used as the owner field.
|
|
135
|
+
*
|
|
136
|
+
* By default, `.owner()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
137
|
+
* use `.ownerDefinedIn("owner", "oidc")` to use OIDC based authentication to designate the owner.
|
|
138
|
+
*
|
|
139
|
+
* To change the specific claim that should be used as the user identifier within the owner field, chain the
|
|
140
|
+
* `.identityClaim(...)` method.
|
|
141
|
+
*
|
|
142
|
+
* @param ownerField the field that contains the owner information
|
|
143
|
+
* @param provider the authentication provider - supports "userPools", "iam", or "oidc"
|
|
144
|
+
* @returns an authorization rule for authenticated users
|
|
145
|
+
*/
|
|
146
|
+
readonly ownerDefinedIn: <T extends string>(ownerField: T, provider?: OwnerProviders) => Authorization<"owner", T, false> & {
|
|
147
|
+
to: typeof to;
|
|
131
148
|
identityClaim: typeof identityClaim;
|
|
132
149
|
};
|
|
133
150
|
/**
|
|
134
151
|
* Authorize access for multi-user / multi-owner access. By setting multi-owner-based authorization, a new `owners: a.string().array()`
|
|
135
152
|
* field will be added to the model to store which users "own" the item. Upon item creation, the "owners field" is
|
|
136
153
|
* auto-populated with the authenticated user's information. To grant other users access to the item, append their user identifier into the `owners` array.
|
|
137
|
-
* You can which field should be used as the owners field by chaining the * `.inField(...)` method.
|
|
138
154
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
155
|
+
* You can specify which field should be used as the owners field by passing the `ownersField` parameter.
|
|
156
|
+
*
|
|
157
|
+
* By default, `.ownersDefinedIn()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
158
|
+
* use `.ownersDefinedIn("owners", "oidc")` to use OIDC based authentication to designate the owner.
|
|
141
159
|
*
|
|
142
160
|
* To change the specific claim that should be used as the user identifier within the owners field, chain the
|
|
143
161
|
* `.identityClaim(...)` method.
|
|
144
162
|
*
|
|
163
|
+
* @param ownersField the field that contains the owners information
|
|
145
164
|
* @param provider the authentication provider - supports "userPools", "iam", or "oidc"
|
|
146
165
|
* @returns an authorization rule for authenticated users
|
|
147
166
|
*/
|
|
148
|
-
readonly
|
|
167
|
+
readonly ownersDefinedIn: <T_1 extends string>(ownersField: T_1, provider?: OwnerProviders) => Authorization<"owner", T_1, true> & {
|
|
149
168
|
to: typeof to;
|
|
150
|
-
inField: typeof inField;
|
|
151
169
|
identityClaim: typeof identityClaim;
|
|
152
170
|
};
|
|
153
171
|
/**
|
|
154
172
|
* Authorize a specific user group. Provide the name of the specific user group to have access.
|
|
155
173
|
*
|
|
156
|
-
* By default, `.
|
|
157
|
-
* use `.
|
|
174
|
+
* By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
175
|
+
* use `.group("group-name", "oidc")` to use OIDC based authentication to designate the user group.
|
|
158
176
|
*
|
|
159
177
|
* To change the specific claim that should be used as the user group identifier, chain the
|
|
160
178
|
* `.withClaimIn(...)` method.
|
|
@@ -162,15 +180,15 @@ export declare const allow: {
|
|
|
162
180
|
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
163
181
|
* @returns an authorization rule to grant access by a specific group
|
|
164
182
|
*/
|
|
165
|
-
readonly
|
|
183
|
+
readonly group: (group: string, provider?: GroupProvider) => Authorization<"groups", undefined, false> & {
|
|
166
184
|
to: typeof to;
|
|
167
185
|
withClaimIn: typeof withClaimIn;
|
|
168
186
|
};
|
|
169
187
|
/**
|
|
170
188
|
* Authorize multiple specific user groups. Provide the names of the specific user groups to have access.
|
|
171
189
|
*
|
|
172
|
-
* By default, `.
|
|
173
|
-
* use `.
|
|
190
|
+
* By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
191
|
+
* use `.groups(["group-a", "group-b"], "oidc")` to use OIDC based authentication to designate the user group.
|
|
174
192
|
*
|
|
175
193
|
* To change the specific claim that should be used as the user group identifier, chain the
|
|
176
194
|
* `.withClaimIn(...)` method.
|
|
@@ -178,7 +196,7 @@ export declare const allow: {
|
|
|
178
196
|
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
179
197
|
* @returns an authorization rule to grant access by a specific group
|
|
180
198
|
*/
|
|
181
|
-
readonly
|
|
199
|
+
readonly groups: (groups: string[], provider?: GroupProvider) => Authorization<"groups", undefined, false> & {
|
|
182
200
|
to: typeof to;
|
|
183
201
|
withClaimIn: typeof withClaimIn;
|
|
184
202
|
};
|
|
@@ -194,7 +212,7 @@ export declare const allow: {
|
|
|
194
212
|
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
195
213
|
* @returns an authorization rule to grant access by a specific group
|
|
196
214
|
*/
|
|
197
|
-
readonly groupDefinedIn: <
|
|
215
|
+
readonly groupDefinedIn: <T_2 extends string>(groupsField: T_2, provider?: GroupProvider) => Authorization<"groups", T_2, false> & {
|
|
198
216
|
to: typeof to;
|
|
199
217
|
withClaimIn: typeof withClaimIn;
|
|
200
218
|
};
|
|
@@ -210,7 +228,7 @@ export declare const allow: {
|
|
|
210
228
|
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
211
229
|
* @returns an authorization rule to grant access by a specific group
|
|
212
230
|
*/
|
|
213
|
-
readonly groupsDefinedIn: <
|
|
231
|
+
readonly groupsDefinedIn: <T_3 extends string>(groupsField: T_3, provider?: GroupProvider) => Authorization<"groups", T_3, true> & {
|
|
214
232
|
to: typeof to;
|
|
215
233
|
withClaimIn: typeof withClaimIn;
|
|
216
234
|
};
|
|
@@ -221,6 +239,61 @@ export declare const allow: {
|
|
|
221
239
|
to: typeof resourceTo;
|
|
222
240
|
};
|
|
223
241
|
};
|
|
242
|
+
/**
|
|
243
|
+
* This is a copy of the {@link allow} defined above, with modifications for custom operations.
|
|
244
|
+
*
|
|
245
|
+
* Removed builder methods:
|
|
246
|
+
*
|
|
247
|
+
* * `owner`
|
|
248
|
+
* * `ownerDefinedIn`
|
|
249
|
+
* * `ownersDefinedIn`
|
|
250
|
+
* * `groupDefinedIn`
|
|
251
|
+
* * `groupsDefinedIn`
|
|
252
|
+
* * `resource`
|
|
253
|
+
* * `.to()` builder method from each available rule builder
|
|
254
|
+
*/
|
|
255
|
+
export declare const allowForCustomOperations: {
|
|
256
|
+
/**
|
|
257
|
+
* Authorize unauthenticated users by using API key based authorization.
|
|
258
|
+
* @returns an authorization rule for unauthenticated users
|
|
259
|
+
*/
|
|
260
|
+
readonly publicApiKey: () => Authorization<"public", undefined, false>;
|
|
261
|
+
/**
|
|
262
|
+
* Authorize unauthenticated users by using IAM based authorization.
|
|
263
|
+
* @returns an authorization rule for unauthenticated users
|
|
264
|
+
*/
|
|
265
|
+
readonly guest: () => Authorization<"public", undefined, false>;
|
|
266
|
+
/**
|
|
267
|
+
* Authorize authenticated users. By default, `.private()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
268
|
+
* use `.authenticated("iam")` or `.authenticated("oidc")` to use IAM or OIDC based authorization for authenticated users.
|
|
269
|
+
* @param provider the authentication provider - supports "userPools", "iam", or "oidc"
|
|
270
|
+
* @returns an authorization rule for authenticated users
|
|
271
|
+
*/
|
|
272
|
+
readonly authenticated: (provider?: PrivateProvider) => Authorization<"private", undefined, false>;
|
|
273
|
+
/**
|
|
274
|
+
* Authorize a specific user group. Provide the name of the specific user group to have access.
|
|
275
|
+
*
|
|
276
|
+
* By default, `.group()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
277
|
+
* use `.group("group-name", "oidc")` to use OIDC based authentication to designate the user group.
|
|
278
|
+
*
|
|
279
|
+
* @param group the name of the group to authorize
|
|
280
|
+
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
281
|
+
* @returns an authorization rule to grant access by a specific group
|
|
282
|
+
*/
|
|
283
|
+
readonly group: (group: string, provider?: GroupProvider) => Authorization<"groups", undefined, false>;
|
|
284
|
+
/**
|
|
285
|
+
* Authorize multiple specific user groups. Provide the names of the specific user groups to have access.
|
|
286
|
+
*
|
|
287
|
+
* By default, `.groups()` uses an Amazon Cognito user pool based authorization. You can additionally
|
|
288
|
+
* use `.groups(["group-a", "group-b"], "oidc")` to use OIDC based authentication to designate the user group.
|
|
289
|
+
*
|
|
290
|
+
* @param groups the names of the group to authorize defined as an array
|
|
291
|
+
* @param provider the authentication provider - supports "userPools" or "oidc"
|
|
292
|
+
* @returns an authorization rule to grant access by a specific group
|
|
293
|
+
*/
|
|
294
|
+
readonly groups: (groups: string[], provider?: GroupProvider) => Authorization<"groups", undefined, false>;
|
|
295
|
+
readonly custom: (provider?: CustomProvider) => Authorization<"custom", undefined, false>;
|
|
296
|
+
};
|
|
224
297
|
declare function resourceTo<SELF extends ResourceAuthorization>(this: SELF, operations: ResourceOperation[]): Omit<SELF, "to">;
|
|
225
298
|
/**
|
|
226
299
|
* Turns the type from a list of `Authorization` rules like this:
|
|
@@ -228,8 +301,8 @@ declare function resourceTo<SELF extends ResourceAuthorization>(this: SELF, oper
|
|
|
228
301
|
* ```typescript
|
|
229
302
|
* [
|
|
230
303
|
* allow.public(),
|
|
231
|
-
* allow.
|
|
232
|
-
* allow.
|
|
304
|
+
* allow.ownerDefinedIn('otherfield'),
|
|
305
|
+
* allow.ownersDefinedIn('editors')
|
|
233
306
|
* ]
|
|
234
307
|
* ```
|
|
235
308
|
*
|
|
@@ -256,8 +329,8 @@ export type ImpliedAuthField<T extends Authorization<any, any, any>> = T extends
|
|
|
256
329
|
* ```typescript
|
|
257
330
|
* [
|
|
258
331
|
* allow.public(),
|
|
259
|
-
* allow.
|
|
260
|
-
* allow.
|
|
332
|
+
* allow.ownerDefinedIn('otherfield'),
|
|
333
|
+
* allow.ownersDefinedIn('editors')
|
|
261
334
|
* ]
|
|
262
335
|
* ```
|
|
263
336
|
*
|
|
@@ -283,5 +356,6 @@ export declare const accessData: <T extends Authorization<any, any, any>>(author
|
|
|
283
356
|
groupClaim?: string | undefined;
|
|
284
357
|
};
|
|
285
358
|
export declare const accessSchemaData: <T extends SchemaAuthorization<any, any, any>>(authorization: T) => T[typeof __data];
|
|
359
|
+
export type AllowModifier = typeof allow;
|
|
360
|
+
export type AllowModifierForCustomOperation = typeof allowForCustomOperations;
|
|
286
361
|
export {};
|
|
287
|
-
//# sourceMappingURL=Authorization.d.ts.map
|