Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
[SALEOR6451] Expose manifest in an app (#10055)
Tomasz Magulskif0f9440663b8
diff --git a/saleor/app/installation_utils.py b/saleor/app/installation_utils.pyindex 3122d5f3b9..c24a065b5c 100644--- a/saleor/app/installation_utils.py+++ b/saleor/app/installation_utils.py@@ -48,6 +48,7 @@ def install_app(app_installation: AppInstallation, activate: bool = False):configuration_url=manifest_data.get("configurationUrl"),app_url=manifest_data.get("appUrl"),version=manifest_data.get("version"),+ manifest_url=app_installation.manifest_url,type=AppType.THIRDPARTY,)app.permissions.set(app_installation.permissions.all())diff --git a/saleor/app/migrations/0015_app_manifest_url.py b/saleor/app/migrations/0015_app_manifest_url.pynew file mode 100644index 0000000000..60b2b84289--- /dev/null+++ b/saleor/app/migrations/0015_app_manifest_url.py@@ -0,0 +1,18 @@+# Generated by Django 3.2.13 on 2022-06-24 12:44++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [+ ("app", "0014_alter_app_options"),+ ]++ operations = [+ migrations.AddField(+ model_name="app",+ name="manifest_url",+ field=models.URLField(blank=True, null=True),+ ),+ ]diff --git a/saleor/app/models.py b/saleor/app/models.pyindex a70f59b835..58b7230d0d 100644--- a/saleor/app/models.py+++ b/saleor/app/models.py@@ -53,6 +53,7 @@ class App(ModelWithMetadata):support_url = models.URLField(blank=True, null=True)configuration_url = models.URLField(blank=True, null=True)app_url = models.URLField(blank=True, null=True)+ manifest_url = models.URLField(blank=True, null=True)version = models.CharField(max_length=60, blank=True, null=True)objects = models.Manager.from_queryset(AppQueryset)()diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.pyindex 53266dc324..378472b09a 100644--- a/saleor/graphql/app/types.py+++ b/saleor/graphql/app/types.py@@ -13,7 +13,12 @@ from ...core.permissions import ()from ..account.utils import is_owner_or_has_one_of_permsfrom ..core.connection import CountableConnection-from ..core.descriptions import ADDED_IN_31, DEPRECATED_IN_3X_FIELD, PREVIEW_FEATURE+from ..core.descriptions import (+ ADDED_IN_31,+ ADDED_IN_35,+ DEPRECATED_IN_3X_FIELD,+ PREVIEW_FEATURE,+)from ..core.federation import federated_entity, resolve_federation_referencesfrom ..core.types import Job, ModelObjectType, NonNullList, Permissionfrom ..core.utils import from_global_id_or_error@@ -83,7 +88,7 @@ class AppManifestExtension(graphene.ObjectType):@staticmethoddef resolve_url(root, info):- """Return an extension url."""+ """Return an extension URL."""return resolve_app_extension_url(root)@@ -158,7 +163,7 @@ class Manifest(graphene.ObjectType):permissions = NonNullList(Permission)app_url = graphene.String()configuration_url = graphene.String(- description="Url to iframe with the configuration for the app.",+ description="URL to iframe with the configuration for the app.",deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use `appUrl` instead.",)token_target_url = graphene.String()@@ -241,15 +246,18 @@ class App(ModelObjectType):deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use `dataPrivacyUrl` instead.",)data_privacy_url = graphene.String(- description="Url to details about the privacy policy on the app owner page."+ description="URL to details about the privacy policy on the app owner page.")homepage_url = graphene.String(description="Homepage of the app.")support_url = graphene.String(description="Support page for the app.")configuration_url = graphene.String(- description="Url to iframe with the configuration for the app.",+ description="URL to iframe with the configuration for the app.",deprecation_reason=f"{DEPRECATED_IN_3X_FIELD} Use `appUrl` instead.",)- app_url = graphene.String(description="Url to iframe with the app.")+ app_url = graphene.String(description="URL to iframe with the app.")+ manifest_url = graphene.String(+ description="URL to manifest used during app's installation." + ADDED_IN_35+ )version = graphene.String(description="Version number of the app.")access_token = graphene.String(description="JWT token used to authenticate by thridparty app."diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 93478739d8..020f64b7fa 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1968,6 +1968,13 @@ type App implements Node & ObjectWithMetadata {"""Url to iframe with the app."""appUrl: String+ """+ Url to manifest used during app's installation.++ Added in Saleor 3.5.+ """+ manifestUrl: String+"""Version number of the app."""version: String