From 2d47bc9c3798779970e841cbb8dbd48d7eb322fd Mon Sep 17 00:00:00 2001 From: akumar Date: Fri, 28 Jul 2023 16:55:16 +0200 Subject: [PATCH] fix: up data for proto changes and added object importer --- demo-shop/.config.json | 15 +- demo-shop/.gitignore | 3 + demo-shop/README.md | 21 +- demo-shop/data/seed_data/addresses.yaml | 21 +- demo-shop/data/seed_data/commands.yaml | 28 +- .../data/seed_data/contact_point_types.yaml | 21 +- demo-shop/data/seed_data/contact_points.yaml | 60 +-- demo-shop/data/seed_data/countries.yaml | 28 +- .../data/seed_data/fulfillment_couriers.yaml | 14 +- demo-shop/data/seed_data/locales.yaml | 14 +- demo-shop/data/seed_data/organizations.yaml | 33 +- demo-shop/data/seed_data/policies.yaml | 222 +++++----- demo-shop/data/seed_data/policy_sets.yaml | 9 +- demo-shop/data/seed_data/roles.yaml | 31 +- demo-shop/data/seed_data/rules.yaml | 402 ++++++++++++------ demo-shop/data/seed_data/tax_types.yaml | 56 ++- demo-shop/data/seed_data/taxes.yaml | 65 +-- demo-shop/data/seed_data/timezones.yaml | 14 +- demo-shop/data/seed_data/users.yaml | 117 ++--- demo-shop/generator/catalog/transform.js | 131 +++--- demo-shop/jobs/job_catalog.json | 10 +- .../templates/change_password_email_body.hbs | 15 + .../change_password_email_subject.hbs | 5 + .../templates/invitation_body.hbs | 12 + .../templates/invitation_subject.hbs | 1 + .../identity-srv/templates/layout.hbs | 5 + .../templates/registration_body.hbs | 12 + .../templates/registration_subject.hbs | 1 + .../identity-srv/templates/resources.json | 4 + demo-shop/objects/object_importer.ts | 128 ++++++ demo-shop/package-lock.json | 230 +++++++++- demo-shop/package.json | 7 +- demo-shop/tsconfig.objects.json | 33 ++ 33 files changed, 1204 insertions(+), 564 deletions(-) create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/change_password_email_body.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/change_password_email_subject.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/invitation_body.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/invitation_subject.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/layout.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/registration_body.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/registration_subject.hbs create mode 100644 demo-shop/objects/content/internal/identity-srv/templates/resources.json create mode 100644 demo-shop/objects/object_importer.ts create mode 100644 demo-shop/tsconfig.objects.json diff --git a/demo-shop/.config.json b/demo-shop/.config.json index 123df45..784c0aa 100644 --- a/demo-shop/.config.json +++ b/demo-shop/.config.json @@ -4,5 +4,18 @@ "endpoint": "/graphql", "job_prefix": "job_", "data_directory": "data", - "job_directory": "jobs" + "job_directory": "jobs", + "objectImport": { + "endpoint": { + "local": "http://127.0.0.1:5000/graphql/", + "production": "https://api.restorecommerce.io/graphql" + }, + "baseDir": "objects/content", + "content": [ + { + "dir": "internal", + "bucketName": "internal" + } + ] + } } diff --git a/demo-shop/.gitignore b/demo-shop/.gitignore index 067bb8f..315d11a 100644 --- a/demo-shop/.gitignore +++ b/demo-shop/.gitignore @@ -1,3 +1,6 @@ node_modules/ .env data/catalog/ +objects/*.js +objects/*.js.map +objects/*.d.ts \ No newline at end of file diff --git a/demo-shop/README.md b/demo-shop/README.md index 8249666..c987077 100644 --- a/demo-shop/README.md +++ b/demo-shop/README.md @@ -56,7 +56,26 @@ to import the data locally or into the production environment. All flags are optional, and they can be listed by typing `node import.js -h`. The API key can be obtained from the [`facade-srv`](https://github.com/restorecommerce/facade-srv/blob/master/cfg/config.json#L21) configuration. -The API key should be: `dbcccf4037d64a6194db7dd3237ce6d3`. +The API key is generated during system startup from the `facade-srv` (Check the log message of facade-srv `Bootstrap API Key is`). By default, the GraphQL importer uses the configuration file `config.json` to read data regarding endpoints for retrieving the API key and executing mutations/ queries. + +## Object Importer + +To import the files, following settings needs to be configured in [config.json](cfg/config.json): +* The base directory for import, +* GraphQL endpoint +* Bucket name for the storage-server + +Prerequisite: object importer should be build using `npm run build` command before importing objects. + +```sh +# Run import in production-mode: +npm run import-objects -- --apiKey= -- --NODE_ENV=local + +# Run import in production-mode: +npm run import-objects -- --apiKey= -- --NODE_ENV=production +# or: +npm run import-objects -- --apiKey= # default is development +``` \ No newline at end of file diff --git a/demo-shop/data/seed_data/addresses.yaml b/demo-shop/data/seed_data/addresses.yaml index 5b34be7..6eb574e 100644 --- a/demo-shop/data/seed_data/addresses.yaml +++ b/demo-shop/data/seed_data/addresses.yaml @@ -14,14 +14,13 @@ longitude: 48.8 latitude: 9.2 meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: 3275fcd9c84f4831aeba986e328b43ce + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 3275fcd9c84f4831aeba986e328b43ce --- id: 210eff6fc2f044dea7701e24a6b4ce0d postcode: '23456' @@ -38,14 +37,13 @@ longitude: 48.8 latitude: 9.2 meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-1 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-1 --- id: 310eff6fc2f044dea7701e24a6b4ce0d postcode: '34567' @@ -62,11 +60,10 @@ longitude: 48.8 latitude: 9.2 meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-2 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-2 diff --git a/demo-shop/data/seed_data/commands.yaml b/demo-shop/data/seed_data/commands.yaml index 4380307..5d36baa 100644 --- a/demo-shop/data/seed_data/commands.yaml +++ b/demo-shop/data/seed_data/commands.yaml @@ -8,14 +8,13 @@ type: string_value properties: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: restore name: restore @@ -36,39 +35,36 @@ # description: List of topic offsets to be ignored while processing Kafka message # type: array_value meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: reset name: reset description: Reset system data and state (no parameters) parameters: [] meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: version name: version description: "Returns the NPM package and Node.js version of the implementing service" parameters: [] meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/contact_point_types.yaml b/demo-shop/data/seed_data/contact_point_types.yaml index 7361bd5..e8497b6 100644 --- a/demo-shop/data/seed_data/contact_point_types.yaml +++ b/demo-shop/data/seed_data/contact_point_types.yaml @@ -2,35 +2,32 @@ id: billing type: billing meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: shipping type: shipping meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: legal-address type: legal-address meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/contact_points.yaml b/demo-shop/data/seed_data/contact_points.yaml index 43d2d15..e5ca617 100644 --- a/demo-shop/data/seed_data/contact_points.yaml +++ b/demo-shop/data/seed_data/contact_points.yaml @@ -6,16 +6,16 @@ telephone: "+4971146051909" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: billing + contactPointTypeIds: + - billing meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: c0cd56ffc29f4a1189720a6db6f5abb0 physicalAddressId: eb228fb0d80d4f4fa51e1a10d8668c1c @@ -24,16 +24,16 @@ telephone: "+491630000005" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: shipping + contactPointTypeIds: + - shipping meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 30db337d800f4b009c043e2d70d8f6f4 physicalAddressId: 210eff6fc2f044dea7701e24a6b4ce0d @@ -42,16 +42,16 @@ telephone: "+491630000002" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: billing + contactPointTypeIds: + - billing meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-1 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-1 --- id: 40db337d800f4b009c043e2d70d8f6f4 physicalAddressId: 210eff6fc2f044dea7701e24a6b4ce0d @@ -60,16 +60,16 @@ telephone: "+491630000005" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: shipping + contactPointTypeIds: + - shipping meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-1 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-1 --- id: 50db337d800f4b009c043e2d70d8f6f4 physicalAddressId: 310eff6fc2f044dea7701e24a6b4ce0d @@ -78,16 +78,16 @@ telephone: "+491630000002" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: billing + contactPointTypeIds: + - billing meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-2 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-2 --- id: 60db337d800f4b009c043e2d70d8f6f4 physicalAddressId: 310eff6fc2f044dea7701e24a6b4ce0d @@ -96,13 +96,13 @@ telephone: "+491630000005" localeId: de-de timezoneId: europe-berlin - contactPointTypeId: shipping + contactPointTypeIds: + - shipping meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-2 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-2 diff --git a/demo-shop/data/seed_data/countries.yaml b/demo-shop/data/seed_data/countries.yaml index a4c76ef..2113c3e 100644 --- a/demo-shop/data/seed_data/countries.yaml +++ b/demo-shop/data/seed_data/countries.yaml @@ -6,14 +6,13 @@ economicAreas: - EEA meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: switzerland name: Switzerland @@ -21,14 +20,13 @@ geographicalName: Switzerland economicAreas: [] meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: belgium name: Belgium @@ -37,14 +35,13 @@ economicAreas: - EEA meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: france name: France @@ -53,11 +50,10 @@ economicAreas: - EEA meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/fulfillment_couriers.yaml b/demo-shop/data/seed_data/fulfillment_couriers.yaml index 555784d..c54cefc 100644 --- a/demo-shop/data/seed_data/fulfillment_couriers.yaml +++ b/demo-shop/data/seed_data/fulfillment_couriers.yaml @@ -3,24 +3,22 @@ name: DHL description: DHL service used for shipments meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: ups name: UPS description: UPS service used for shipments meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/locales.yaml b/demo-shop/data/seed_data/locales.yaml index 9065197..f34e10f 100644 --- a/demo-shop/data/seed_data/locales.yaml +++ b/demo-shop/data/seed_data/locales.yaml @@ -3,24 +3,22 @@ value: en_US description: English (US) meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: de-de value: de_DE description: Deutsch (Deutschland) meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/organizations.yaml b/demo-shop/data/seed_data/organizations.yaml index 1c3a4db..be9ab46 100644 --- a/demo-shop/data/seed_data/organizations.yaml +++ b/demo-shop/data/seed_data/organizations.yaml @@ -1,7 +1,6 @@ --- id: r-ug name: R UG - addressId: eb228fb0d80d4f4fa51e1a10d8668c1c contactPointIds: - 2a3f8a09e07b4abeab909faeb63c6158 - c0cd56ffc29f4a1189720a6db6f5abb0 @@ -10,66 +9,64 @@ vatId: DE312349168 isicV4: J registration: "760574" - logo: http://console:80/templates/logos/PNG/X_Logo.png + logo: + url: http://console:80/templates/logos/PNG/X_Logo.png registrationCourt: Amtsgericht Stuttgart (Registergericht) paymentMethodIds: [] parentId: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: test-organization-1 name: Test Organization 1 contactPointIds: - 30db337d800f4b009c043e2d70d8f6f4 - 40db337d800f4b009c043e2d70d8f6f4 - addressId: 210eff6fc2f044dea7701e24a6b4ce0d website: https://org1.io email: info@org1.test vatId: "7891011" isicV4: J registration: "99999999" - logo: "" + logo: + url: "" registrationCourt: Amtsgericht Stuttgart (Registergericht) paymentMethodIds: [ ] parentId: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-1 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-1 --- id: test-organization-2 name: Test Organization 2 contactPointIds: - 50db337d800f4b009c043e2d70d8f6f4 - 60db337d800f4b009c043e2d70d8f6f4 - addressId: 310eff6fc2f044dea7701e24a6b4ce0d website: https://org2.io email: info@org2.test vatId: "7891011" isicV4: J registration: "99999999" - logo: "" + logo: + url: "" registrationCourt: Amtsgericht Stuttgart (Registergericht) paymentMethodIds: [ ] parentId: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: test-organization-2 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: test-organization-2 diff --git a/demo-shop/data/seed_data/policies.yaml b/demo-shop/data/seed_data/policies.yaml index f4dfd26..949fcf8 100644 --- a/demo-shop/data/seed_data/policies.yaml +++ b/demo-shop/data/seed_data/policies.yaml @@ -21,14 +21,13 @@ - fbff989edf064ae680ccd9df7c946f3f # Deny - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides --- id: 21fa3c8b4fc742488396aea901a608f0 @@ -49,14 +48,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 70b2edc30a9a4a62b4d4f648605c66f3 name: Addresses policy @@ -75,14 +73,13 @@ - fbff989edf064ae680ccd9df7c946f3f # Deny - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides --- id: 9820ca010d0240908cafbd02dcd925ac @@ -103,14 +100,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: a9a2530ce0fb46bd86215398ee7014ec name: ContactPointType policy @@ -129,14 +125,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 64c0e2881cb94219a4fd066be81bb7e9 name: Taxes policy @@ -155,14 +150,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 1be990cb7de14e32ac6079ebe54168b9 name: TaxType policy @@ -181,14 +175,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: ebc7029ac7d6401f9f280948f54d9ec2 name: Countries policy @@ -207,14 +200,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 28a5482e84ba426dafd648a01e4918a5 name: Roles policy @@ -233,14 +225,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: ceb1e8c3c5b94865ba742a0d904c43f6 name: Locales policy @@ -259,14 +250,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: bc094dabf358485d859a01dcd0fc52fe name: Timezones policy @@ -285,14 +275,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 4f7596a4ea75406ba010ace4a9d4471a name: Execute-Action Policy @@ -307,14 +296,13 @@ resources: [ ] combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug rules: - aa78cbecdbac4b53a914f5836b744c2d # DeleteOrgData - 2769c1a7e09f4971ad04fcca39094c2fx # ExecuteCommand @@ -336,14 +324,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: d710bc27cbbf48cd93c899509e7aff5c name: Jobs Policy @@ -361,14 +348,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 9420abd50e7648479ad9126f93404a8b name: PolicySets Policy @@ -386,14 +372,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 0a7803e4d79f4b2abdd9868dd4b00ebe name: Policy-Resource Policy @@ -411,14 +396,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 4447e1f02840420797876c17f6451d68 name: Rule Policy @@ -436,14 +420,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 45624a6ccab6472a8e7d5314cba011c7 name: Orders Policy @@ -463,14 +446,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # Permit: SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug ## Customers policy and 5 Products policy --- id: 478ec535a3664016a28991bf757eeeec @@ -491,14 +473,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # Permit: SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: abc7029ac7d6401f9f280948f54d9ec2 name: Products policy @@ -517,14 +498,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: c6f5aacece6e4ae4be306f8377548736 name: Manufacturer's policy @@ -543,14 +523,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 5fa4af8f43dd43b58194d7575e29245b name: ProductPrototype policy @@ -569,14 +548,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 383fb654e8b846b5b812a9b110194f74 name: ProductCategory policy @@ -595,14 +573,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 8a99bd194f5546cbbbf3ff8e6fe033ff name: PriceGroup policy @@ -621,14 +598,13 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug #ostorage policy -> Xingular --- id: 2b8faa02dd4140aeb14ca94f23b4f058 @@ -648,11 +624,57 @@ - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 80d27d0a1123456dbc228dc69ccd651d + name: Token Policy + description: Targets `Token` resource + target: + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides + evaluationCacheable: true + rules: + - 98f58e364c984b5f9945d993b64dd405 # user-r-id create rule + - 99f58e364c984b5f9945d993b64dd405 # user-r-id modify rule + - 10g58e364c984b5f9945d993b64dd405 # user-r-id delete rule + - 11g58e364c984b5f9945d993b64dd405 # user-r-id read rule + - 98f1994dcfb24471ab29b38b527da7a4 # admin CRMD rule + - fbff989edf064ae680ccd9df7c946f3f # fallback Deny rule + - ff7da3d8aaca4b2cb66d324d4ff6f71d # superAdmin rule + meta: + modifiedBy: "" + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 2e8faa02dd4140aeb14ca94f23b4f058 + name: Ostorage policy for internal bucket + description: Targets access to the ostorage resource for internal bucket + target: + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:internal.Internal + rules: + - 81f58e364c984b5f9945d993b64dd405 # normal user + - fbff989edf064ae680ccd9df7c946f3f # Deny + - ff7da3d8aaca4b2cb66d324d4ff6f71d # SuperAdmin + combiningAlgorithm: urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides + meta: + modifiedBy: "" + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/policy_sets.yaml b/demo-shop/data/seed_data/policy_sets.yaml index 1423066..bee965b 100644 --- a/demo-shop/data/seed_data/policy_sets.yaml +++ b/demo-shop/data/seed_data/policy_sets.yaml @@ -34,12 +34,13 @@ - 383fb654e8b846b5b812a9b110194f74 - 8a99bd194f5546cbbbf3ff8e6fe033ff - 2b8faa02dd4140aeb14ca94f23b4f058 + - 80d27d0a1123456dbc228dc69ccd651d + - 2e8faa02dd4140aeb14ca94f23b4f058 meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/roles.yaml b/demo-shop/data/seed_data/roles.yaml index 7d3aabf..3aaff05 100644 --- a/demo-shop/data/seed_data/roles.yaml +++ b/demo-shop/data/seed_data/roles.yaml @@ -1,47 +1,44 @@ --- - id: superadmininistrator-r-id - name: Superadmininistrator + id: superadministrator-r-id + name: Superadministrator description: can read and write across all organization scopes assignableByRoles: - - superadmininistrator-r-id + - superadministrator-r-id meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: user-r-id name: user description: can read and write with in his organization scope assignableByRoles: - - superadmininistrator-r-id + - superadministrator-r-id - administrator-r-id meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: administrator-r-id name: Administrator description: can read and write with in his organization scope assignableByRoles: - - superadmininistrator-r-id + - superadministrator-r-id - administrator-r-id meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/rules.yaml b/demo-shop/data/seed_data/rules.yaml index 34e6573..368dc9f 100644 --- a/demo-shop/data/seed_data/rules.yaml +++ b/demo-shop/data/seed_data/rules.yaml @@ -6,7 +6,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: [] resources: [] condition: "" @@ -15,8 +15,6 @@ filters: [] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -30,7 +28,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization actions: @@ -46,8 +44,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -61,7 +57,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization actions: @@ -77,8 +73,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -92,7 +86,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization actions: @@ -108,8 +102,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -123,7 +115,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization actions: @@ -139,8 +131,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -154,7 +144,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -168,8 +158,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -183,7 +171,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -197,8 +185,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -212,7 +198,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -226,8 +212,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -241,9 +225,9 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:role - value: dfcfe667eb614cc1864b3c723297240a # Admin + value: administrator-r-id # Admin actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -257,8 +241,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -272,7 +254,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -280,7 +262,7 @@ - id: urn:restorecommerce:acs:names:model:entity value: urn:restorecommerce:acs:model:role.Role - id: urn:oasis:names:tc:xacml:1.0:resource:resource-id - value: 78c2571c1bf8483285ca61633a24a451 + value: superadministrator-r-id effect: DENY condition: "" evaluationCacheable: false @@ -288,8 +270,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -303,7 +283,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -317,8 +297,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -332,7 +310,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -346,8 +324,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -361,7 +337,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -375,8 +351,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -404,8 +378,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -437,8 +409,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -470,8 +440,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -503,8 +471,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -518,7 +484,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # Normal User + value: user-r-id # Normal User - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -551,8 +517,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -566,7 +530,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: dfcfe667eb614cc1864b3c723297240a # Admin + value: administrator-r-id # Admin - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -580,8 +544,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -595,7 +557,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: dfcfe667eb614cc1864b3c723297240a # Admin + value: administrator-r-id # Admin - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -609,8 +571,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -624,7 +584,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: dfcfe667eb614cc1864b3c723297240a # Admin + value: administrator-r-id # Admin - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -638,8 +598,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -653,7 +611,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: dfcfe667eb614cc1864b3c723297240a # Admin + value: administrator-r-id # Admin - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -667,8 +625,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -689,7 +645,7 @@ value: urn:restorecommerce:acs:names:action:execute subjects: - id: urn:restorecommerce:acs:names:role - value: 78c2571c1bf8483285ca61633a24a451 # SuperAdmin + value: superadministrator-r-id # SuperAdmin effect: PERMIT condition: "" evaluationCacheable: false @@ -697,8 +653,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -718,7 +672,7 @@ value: urn:restorecommerce:acs:names:action:execute subjects: - id: urn:restorecommerce:acs:names:role - value: 78c2571c1bf8483285ca61633a24a451 # SuperAdmin + value: superadministrator-r-id # SuperAdmin effect: PERMIT condition: "" evaluationCacheable: false @@ -726,8 +680,7 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 + modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -741,7 +694,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 78c2571c1bf8483285ca61633a24a451 # SuperAdmin + value: superadministrator-r-id # SuperAdmin actions: [ ] resources: [] effect: PERMIT @@ -751,8 +704,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -766,7 +717,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -780,8 +731,6 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity @@ -795,7 +744,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:user.User resources: @@ -809,14 +758,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 033ac24c43664c5c92fd32b21b92dba9 name: Customer read rule for Organizational Scope @@ -824,7 +772,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization actions: @@ -840,14 +788,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: f22c7ec8c97b4dd385364219559b07e1 name: Customer read rule for Independent User Scope @@ -855,7 +802,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:user.User actions: @@ -871,14 +818,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug ## Product, Manufacturer, ProductPrototype, ProductCategory, PriceGroup - Master Data --- id: 5b78e4a1cc034ddb8d71d46dfd9a53f7 @@ -887,7 +833,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -901,14 +847,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: f58d4fc3da244023a191c015b2b82786 name: Manufacturer read rule @@ -916,7 +861,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -930,14 +875,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 4840a726a1d44ee78d207fa5cc85c024 name: ProductPrototype read rule @@ -945,7 +889,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -959,14 +903,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: cafb58f0676c460f9034a697cd74b9df name: ProductCategory read rule @@ -974,7 +917,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -988,14 +931,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 5eb184be7cc145c9b4b0e230d74f1937 name: PriceGroup read rule @@ -1003,7 +945,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # NormalUser + value: user-r-id # NormalUser actions: - id: urn:oasis:names:tc:xacml:1.0:action:action-id value: urn:restorecommerce:acs:names:action:read @@ -1017,15 +959,13 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug -#ostorage rules -> Xingular + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 78f58e364c984b5f9945d993b64dd405 name: Object Storage rule @@ -1033,7 +973,7 @@ target: subjects: - id: urn:restorecommerce:acs:names:role - value: 95a9302f65434061a3f33e9197c7af24 # Normal User + value: user-r-id # Normal User - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization resources: @@ -1047,11 +987,229 @@ filters: [ ] query: "" meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 98f58e364c984b5f9945d993b64dd405 + name: Token create rule + description: Permit create access to the token resource owned by user + target: + subjects: + - id: urn:restorecommerce:acs:names:role + value: user-r-id + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + actions: + - id: urn:oasis:names:tc:xacml:1.0:action:action-id + value: urn:restorecommerce:acs:names:action:create + condition: + " + const resources = context.resources; + let match = false; + let owner; + for (let resource of resources) { + match = false; + if (resource && resource.meta && resource.meta.owner) { + owner = resource.meta.owner; + } + for (let ownerObj of owner) { + if (ownerObj && ownerObj.attributes.length > 0) { + // ownerObj.id == 'urn:restorecommerce:acs:names:ownerInstance' + for (let ownerInst of ownerObj.attributes) { + if (ownerInst.id == 'urn:restorecommerce:acs:names:ownerInstance') { + if (ownerInst.value == context.subject.id) { + match = true; + break; + } + } + } + } + } + } + match; + " + effect: PERMIT + evaluationCacheable: true + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 99f58e364c984b5f9945d993b64dd405 + name: Token modify rule + description: Permit modify access to the token resource owned by user + target: + subjects: + - id: urn:restorecommerce:acs:names:role + value: user-r-id + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + actions: + - id: urn:oasis:names:tc:xacml:1.0:action:action-id + value: urn:restorecommerce:acs:names:action:modify + condition: + " + const resources = context.resources; + let match = false; + let owner; + for (let resource of resources) { + match = false; + if (resource && resource.meta && resource.meta.owner) { + owner = resource.meta.owner; + } + for (let ownerObj of owner) { + if (ownerObj && ownerObj.attributes.length > 0) { + // ownerObj.id == 'urn:restorecommerce:acs:names:ownerInstance' + for (let ownerInst of ownerObj.attributes) { + if (ownerInst.id == 'urn:restorecommerce:acs:names:ownerInstance') { + if (ownerInst.value == context.subject.id) { + match = true; + break; + } + } + } + } + } + } + match; + " + effect: PERMIT + evaluationCacheable: true + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 10g58e364c984b5f9945d993b64dd405 + name: Token delete rule + description: Permit delete access to the token resource owned by user + target: + subjects: + - id: urn:restorecommerce:acs:names:role + value: user-r-id + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + actions: + - id: urn:oasis:names:tc:xacml:1.0:action:action-id + value: urn:restorecommerce:acs:names:action:delete + condition: + " + const resources = context.resources; + let match = false; + let owner; + for (let resource of resources) { + match = false; + if (resource && resource.meta && resource.meta.owner) { + owner = resource.meta.owner; + } + for (let ownerObj of owner) { + if (ownerObj && ownerObj.attributes.length > 0) { + // ownerObj.id == 'urn:restorecommerce:acs:names:ownerInstance' + for (let ownerInst of ownerObj.attributes) { + if (ownerInst.id == 'urn:restorecommerce:acs:names:ownerInstance') { + if (ownerInst.value == context.subject.id) { + match = true; + break; + } + } + } + } + } + } + match; + " + effect: PERMIT + evaluationCacheable: true + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 11g58e364c984b5f9945d993b64dd405 + name: Token read rule + description: Permit read access to the token resource owned by user + target: + subjects: + - id: urn:restorecommerce:acs:names:role + value: user-r-id + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + actions: + - id: urn:oasis:names:tc:xacml:1.0:action:action-id + value: urn:restorecommerce:acs:names:action:read + condition: + " + let filter = context.subject.id; + filter; + " + effect: PERMIT + evaluationCacheable: true + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 98f1994dcfb24471ab29b38b527da7a4 + name: Token Admin rule + description: Permit CRMD to token resource by admin user + target: + subjects: + - id: urn:restorecommerce:acs:names:role + value: administrator-r-id + - id: urn:restorecommerce:acs:names:roleScopingEntity + value: urn:restorecommerce:acs:model:organization.Organization + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:token.Token + effect: PERMIT + evaluationCacheable: true + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug +--- + id: 81f58e364c984b5f9945d993b64dd405 + name: Object Storage rule for the internal bucket + description: Allows unauthenticated-user to read Object storage data from the internal bucket + target: + subjects: + - id: urn:restorecommerce:acs:names:unauthenticated-user + value: "true" + resources: + - id: urn:restorecommerce:acs:names:model:entity + value: urn:restorecommerce:acs:model:internal.Internal + actions: + - id: urn:oasis:names:tc:xacml:1.0:action:action-id + value: urn:restorecommerce:acs:names:action:read + effect: PERMIT + meta: + owners: + - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity + value: urn:restorecommerce:acs:model:organization.Organization + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/tax_types.yaml b/demo-shop/data/seed_data/tax_types.yaml index 10438e6..8bc291b 100644 --- a/demo-shop/data/seed_data/tax_types.yaml +++ b/demo-shop/data/seed_data/tax_types.yaml @@ -4,27 +4,25 @@ description: Value Added Tax is imposed on each stage of the supply chain and ultimately charged in full to the final purchaser. meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: tax-free type: Tax-free description: Not subject to taxation. meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: sales-tax type: Sales Tax @@ -34,80 +32,74 @@ sale to the final consumer, and only the final sale in the supply chain is subject to tax. meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: visitors-tax type: Visitor's Tax description: Tax to be payed for visitors of certain localities, such as health resorts. meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: corporate-tax type: Corporate Tax description: A direct tax imposed by a jurisdiction on the income or capital of corporations or analogous legal entities meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: individual-income-tax type: Individual Income Tax description: 'The individual income tax is levied on the wages, salaries, dividends, interest, and other income a person earns throughout the year. ' meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: real-estate-tax type: Real Estate Tax description: Tax rate applied to a real estate property meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: property-tax type: Property Tax description: An ad valorem tax on the value of a property, usually levied on real estate meta: - created: 0 - modified: 0 modifiedBy: r-ug owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/taxes.yaml b/demo-shop/data/seed_data/taxes.yaml index fb01596..25abc5e 100644 --- a/demo-shop/data/seed_data/taxes.yaml +++ b/demo-shop/data/seed_data/taxes.yaml @@ -7,8 +7,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 2dd5fc11bb61469e838f7f15fb5ad8f4 rate: 0.19 @@ -18,8 +19,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: f761799673964c17a93712b81c0fb1a6 rate: 0.025 @@ -29,8 +31,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 6fa7df6b0f104a9f9d86cfb0e231ee73 rate: 0.038 @@ -40,8 +43,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: cd106fd4648748ee827bff732b89f1b7 rate: 0.08 @@ -51,8 +55,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 1a61b96b2f3f415c8dd0e6e9a1a6001b country_id: belgium @@ -62,8 +67,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: d2de17beae8f4804a0aeef09b1b33cf5 country_id: belgium @@ -73,8 +79,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 260ed207a7404b99a2b5fab4ae0d51ac country_id: belgium @@ -84,8 +91,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 1256b21216f14e5586362fb874d41a9c country_id: belgium @@ -95,8 +103,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 72fd59dfa4d34ebe8b1322fe13908cee country_id: france @@ -106,8 +115,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 7d86fa5542324663aa113529552c8140 country_id: france @@ -117,8 +127,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: f265a78c1e544e94bd75fd5bc0833c54 country_id: france @@ -128,8 +139,9 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: 8bf2622498654aa3941a6afcec35b438 country_id: france @@ -139,5 +151,6 @@ owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/timezones.yaml b/demo-shop/data/seed_data/timezones.yaml index e5e9161..13c8871 100644 --- a/demo-shop/data/seed_data/timezones.yaml +++ b/demo-shop/data/seed_data/timezones.yaml @@ -2,23 +2,21 @@ id: europe-berlin description: Central Europe meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug --- id: europe-london description: Western Europe meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug diff --git a/demo-shop/data/seed_data/users.yaml b/demo-shop/data/seed_data/users.yaml index 8b9817d..900775b 100644 --- a/demo-shop/data/seed_data/users.yaml +++ b/demo-shop/data/seed_data/users.yaml @@ -7,26 +7,26 @@ password: rcsuperpw defaultScope: r-ug roleAssociations: - - role: superadmininistrator-r-id + - role: superadministrator-r-id attributes: [] id: "" localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: 255f94aa15664d58baa4bf7a06a85681 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 255f94aa15664d58baa4bf7a06a85681 newEmail: "" - active: false + active: true activationCode: "" passwordHash: "" unauthenticated: false @@ -61,32 +61,34 @@ attributes: - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:roleScopingInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:roleScopingInstance + value: r-ug - role: administrator-r-id id: "" attributes: - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:roleScopingInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:roleScopingInstance + value: r-ug localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: 355f94aa15664d58baa4bf7a06a85681 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 355f94aa15664d58baa4bf7a06a85681 newEmail: "" - active: false + active: true activationCode: "" passwordHash: "" unauthenticated: false @@ -121,25 +123,26 @@ attributes: - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:roleScopingInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:roleScopingInstance + value: r-ug localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: 455f94aa15664d58baa4bf7a06a85681 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 455f94aa15664d58baa4bf7a06a85681 newEmail: "" - active: false + active: true activationCode: "" passwordHash: "" unauthenticated: false @@ -174,25 +177,26 @@ attributes: - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:roleScopingInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:roleScopingInstance + value: r-ug localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: 555f94aa15664d58baa4bf7a06a85681 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 555f94aa15664d58baa4bf7a06a85681 newEmail: "" - active: false + active: true activationCode: "" passwordHash: "" unauthenticated: false @@ -227,25 +231,26 @@ attributes: - id: urn:restorecommerce:acs:names:roleScopingEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:roleScopingInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:roleScopingInstance + value: r-ug localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: 655f94aa15664d58baa4bf7a06a85681 + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: 655f94aa15664d58baa4bf7a06a85681 newEmail: "" - active: false + active: true activationCode: "" passwordHash: "" unauthenticated: false @@ -275,24 +280,24 @@ password: rcsuperpw defaultScope: "" roleAssociations: - - id: superadmininistrator-r-role-assoc-id - role: superadmininistrator-r-id + - id: superadministrator-r-role-assoc-id + role: superadministrator-r-id attributes: [] localeId: de-de timezoneId: europe-berlin meta: - created: 0 - modified: 0 modifiedBy: "" owners: - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:organization.Organization - - id: urn:restorecommerce:acs:names:ownerInstance - value: r-ug + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: r-ug - id: urn:restorecommerce:acs:names:ownerIndicatoryEntity value: urn:restorecommerce:acs:model:user.User - - id: urn:restorecommerce:acs:names:ownerInstance - value: upsert_user_tokens + attributes: + - id: urn:restorecommerce:acs:names:ownerInstance + value: upsert_user_tokens newEmail: "" active: true activationCode: "" @@ -316,8 +321,8 @@ tokens: - name: upsert_token expiresIn: 0 - token: change.this.token.number + token: 123099ffc93b44f6b4a81b1e5589b642 type: upsert_token scopes: - - superadmininistrator-r-role-assoc-id + - superadministrator-r-role-assoc-id lastAccess: 0 \ No newline at end of file diff --git a/demo-shop/generator/catalog/transform.js b/demo-shop/generator/catalog/transform.js index 424a008..681e48c 100644 --- a/demo-shop/generator/catalog/transform.js +++ b/demo-shop/generator/catalog/transform.js @@ -10,17 +10,18 @@ const priceGroups = { name: 'PG1', description: 'Dummy price group 1', meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] + } ] } @@ -29,17 +30,17 @@ const priceGroups = { name: 'PG2', description: 'Dummy price group 2', meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] } @@ -48,17 +49,17 @@ const priceGroups = { name: 'PG3', description: 'Dummy price group 3', meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] } @@ -112,17 +113,17 @@ function parseInputLine(csvLine) { name: brandEntry, description: 'Dummy description for manufacturer ' + brandEntry, meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] } @@ -173,17 +174,17 @@ function parseInputLine(csvLine) { image: categoryImgData, priceGroupId: priceGroupIdStr.toString(), meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] } @@ -209,17 +210,17 @@ function parseInputLine(csvLine) { categoryId: hash(categoryTree[categoryTree.length - 3]), version: 'test', meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] } @@ -235,27 +236,29 @@ function parseInputLine(csvLine) { products[productHash] = { product: { - id: productHash, + // id: productHash, name: productEntry, description: 'Dummy description for product ' + productEntry, manufacturerId: brandHash, taricCode: uuid.v4(), // no data available - variants: [], - taxId: [makeUUID()], + physical: { + variants: [] + }, + taxIds: [makeUUID()], gtin: makeUUID() }, meta: { - created: 0, - modified: 0, modifiedBy: '', owners: [ { id: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity', - value: 'urn:restorecommerce:acs:model:organization.Organization' - }, - { - id: 'urn:restorecommerce:acs:names:ownerInstance', - value: 'ce79782cbd064389aaf66d280d3a6c06' + value: 'urn:restorecommerce:acs:model:organization.Organization', + attributes: [ + { + id: 'urn:restorecommerce:acs:names:ownerInstance', + value: 'r-ug' + } + ] } ] }, @@ -263,9 +266,9 @@ function parseInputLine(csvLine) { }; if (categoryTree.length > 2) { - products[productHash].product.prototype = { id: prototypeCatHash }; + products[productHash].product.prototypeId = prototypeCatHash; } else { - products[productHash].product.category = { id: hash(categoryTree[0]) }; + products[productHash].product.categoryId = hash(categoryTree[0]); } } // raw attribute list has the form {"product_specification"=>[{"key"=>"a","value"=>"b"}, {"key"=>"c","value"=>"d"}]} @@ -274,9 +277,7 @@ function parseInputLine(csvLine) { .split('}, {') .map((spec) => { // id, value are string - let id, - value, - attribute = []; + let id, value, unitCode = ''; const elems = spec.split('", "'); @@ -286,7 +287,7 @@ function parseInputLine(csvLine) { value = 'm'; } - return { id, value, attribute }; + return { id, value, unitCode }; }); // // values must be of string type, so we replace all numbers with a string @@ -304,17 +305,19 @@ function parseInputLine(csvLine) { // } // } - products[productHash]['product']['variants'].push({ + products[productHash]['product']['physical']['variants'].push({ id: csvLine['uniq_id'], name: categoryTree[categoryTree.length - 1], description: csvLine['description'], stockLevel: Math.floor(Math.random() * 10000), - price: parseFloat(csvLine['retail_price']), - sale: Math.random() < 0.25, - salePrice: parseFloat(csvLine['discounted_price']), + price: { + regularPrice: parseFloat(csvLine['retail_price']), + sale: Math.random() < 0.25, + salePrice: parseFloat(csvLine['discounted_price']) + }, stockKeepingUnit: csvLine['pid'], - image: imagesData, - attributes: variantAttributes + images: imagesData, + properties: variantAttributes }); } } diff --git a/demo-shop/jobs/job_catalog.json b/demo-shop/jobs/job_catalog.json index 8f66ca6..e50f67c 100644 --- a/demo-shop/jobs/job_catalog.json +++ b/demo-shop/jobs/job_catalog.json @@ -8,14 +8,14 @@ "name": "price_groups", "operation": "sync", "src": "./data/", - "filter": "createPriceGroups.yaml", + "filter": "createPriceGroups*.yaml", "mutation": "mutation{ catalog { price_group { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: CREATE } ) { details{items {status {id, code, message}}, operationStatus { code message }} } } }}" }, { "name": "manufacturers", "operation": "sync", "src": "./data/", - "filter": "createManufacturers.yaml", + "filter": "createManufacturers*.yaml", "batchSize": 500, "mutation": "mutation{ catalog { manufacturer { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: CREATE } ) { details{items {status {id, code, message}}, operationStatus { code message }} } } }}" }, @@ -23,7 +23,7 @@ "name": "product_categories", "operation": "sync", "src": "./data/", - "filter": "createProductCategories.yaml", + "filter": "createProductCategories*.yaml", "batchSize": 500, "mutation": "mutation{ catalog { product_category { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: CREATE } ) { details{items {status {id, code, message}}, operationStatus { code message }} } } }}" }, @@ -31,7 +31,7 @@ "name": "product_prototypes", "operation": "sync", "src": "./data/", - "filter": "createProductPrototypes.yaml", + "filter": "createProductPrototypes*.yaml", "batchSize": 500, "mutation": "mutation{ catalog { product_prototype { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: CREATE } ) { details{items {status {id, code, message}}, operationStatus { code message }} } } }}" }, @@ -39,7 +39,7 @@ "name": "products", "operation": "sync", "src": "./data/", - "filter": "createProducts.yaml", + "filter": "createProducts*.yaml", "batchSize": 500, "mutation": "mutation{ catalog { product { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: CREATE } ) { details{items {status {id, code, message}}, operationStatus { code message }} } } }}" } diff --git a/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_body.hbs b/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_body.hbs new file mode 100644 index 0000000..6fd9e17 --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_body.hbs @@ -0,0 +1,15 @@ +{{#extend "layout"}} + {{#content "main"}} +

Dear {{firstName}} {{lastName}},

+ {{#if passwordChange}} +

You requested a password change for your account. If you wish to do so, please click on the following link:

+ {{else}} +

You requested an email address change for your account. If you wish to do so, please click on the following link:

+ {{/if}} +

{{confirmationURL}}

+

If you did not request this, please contact the Restorecommerce support team.

+

The Restorecommerce Team

+
+
+ {{/content}} +{{/extend}} \ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_subject.hbs b/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_subject.hbs new file mode 100644 index 0000000..2f0d5cc --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/change_password_email_subject.hbs @@ -0,0 +1,5 @@ + {{#if passwordChange}} + Restorecommerce Account Password Change +{{else}} + Restorecommerce Account Email Address Change +{{/if}} \ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/invitation_body.hbs b/demo-shop/objects/content/internal/identity-srv/templates/invitation_body.hbs new file mode 100644 index 0000000..f5654ef --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/invitation_body.hbs @@ -0,0 +1,12 @@ + {{#extend "layout"}} + {{#content "main"}} +

Dear {{firstName}} {{lastName}},

+

{{invitedByUserFirstName}} {{invitedByUserLastName}} ({{invitedByUserName}}) invited you to join for Restorecommerce. + To activate your account, please click on the following link: +

+

{{invitationURL}}

+

The Restorecommerce Team

+
+
+ {{/content}} +{{/extend}} diff --git a/demo-shop/objects/content/internal/identity-srv/templates/invitation_subject.hbs b/demo-shop/objects/content/internal/identity-srv/templates/invitation_subject.hbs new file mode 100644 index 0000000..7c5849c --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/invitation_subject.hbs @@ -0,0 +1 @@ +{{invitedByUserFirstName}} {{invitedByUserLastName}} ({{invitedByUserName}}) invited you to join Restorecommerce \ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/layout.hbs b/demo-shop/objects/content/internal/identity-srv/templates/layout.hbs new file mode 100644 index 0000000..5311337 --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/layout.hbs @@ -0,0 +1,5 @@ +
+ {{#block "main"}} + Main Default Content + {{/block}} +
\ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/registration_body.hbs b/demo-shop/objects/content/internal/identity-srv/templates/registration_body.hbs new file mode 100644 index 0000000..8c55bb8 --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/registration_body.hbs @@ -0,0 +1,12 @@ +{{#extend "layout"}} + {{#content "main"}} +

Dear {{firstName}} {{lastName}},

+

Thank you for registering with Restorecommerce. To complete your registration please activate your account by clicking the following + link: +

+

{{activationURL}}

+

The Restorecommerce Team

+
+
+ {{/content}} +{{/extend}} \ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/registration_subject.hbs b/demo-shop/objects/content/internal/identity-srv/templates/registration_subject.hbs new file mode 100644 index 0000000..3dc9d72 --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/registration_subject.hbs @@ -0,0 +1 @@ +Restorecommerce Account Registration \ No newline at end of file diff --git a/demo-shop/objects/content/internal/identity-srv/templates/resources.json b/demo-shop/objects/content/internal/identity-srv/templates/resources.json new file mode 100644 index 0000000..7505d69 --- /dev/null +++ b/demo-shop/objects/content/internal/identity-srv/templates/resources.json @@ -0,0 +1,4 @@ +{ + "styleURL": "", + "images": [] +} \ No newline at end of file diff --git a/demo-shop/objects/object_importer.ts b/demo-shop/objects/object_importer.ts new file mode 100644 index 0000000..4737ada --- /dev/null +++ b/demo-shop/objects/object_importer.ts @@ -0,0 +1,128 @@ + +import { FormData } from 'formdata-node'; +import * as fs from 'fs'; +import * as readline from 'readline'; + +const CONFIG_NAME = process.env.CONFIG_NAME || '.config.json'; +const defaultConfig = JSON.parse(fs.readFileSync(CONFIG_NAME) + .toString()); +const realConfig = { + ...defaultConfig +}; + +const availableEnvironments = [ + 'local', + 'production' +]; + +export const getNodeEnv = (): string => { + let resultEnvironment = 'local'; + if (!!realConfig['NODE_ENV'] && availableEnvironments.indexOf(realConfig['NODE_ENV']) >= 0) { + resultEnvironment = realConfig['NODE_ENV']; + } + return resultEnvironment; +}; + +const baseDir = realConfig?.objectImport?.baseDir; +const NODE_ENV = getNodeEnv(); +const facadeGqlEndpoint = realConfig?.objectImport?.endpoint[NODE_ENV]; + +async function sendRequest(file: string, bucketName: string, keyName: string, orgKey: string, contentType?: string): Promise { + const body = new FormData(); + body.append('operations', JSON.stringify({ + query: `mutation Ostorage($input: IIoRestorecommerceOstorageObject!) + { ostorage { object { Put(input: $input) { details { response { payload { url, bucket } status { code, message } } operationStatus { code, message } } } } } }`, + variables: { "input": { "object": null, "bucket": `${bucketName}`, "key": `${keyName}`, "options": { "contentType": `${contentType}` } } } + })); + body.append('map', JSON.stringify({ fileVar: ['variables.input.object'] })); + body.append('fileVar', { + [Symbol.toStringTag]: 'File', + stream: () => { + return fs.createReadStream(file); + } + }); + + // add authorization header with apiKey + const apiKey = realConfig?.apiKey; + let headers: any = { + Authorization: 'Bearer ' + `${apiKey}`, + 'Content-Type': 'multipart/form-data', + 'Apollo-Require-Preflight': true + }; + + return fetch(facadeGqlEndpoint, { method: 'POST', body, headers }); +} + +function getFiles(path, files) { + fs.readdirSync(path).forEach(function (file) { + let subpath = path + '/' + file; + if (fs.lstatSync(subpath).isDirectory()) { + getFiles(subpath, files); + } else { + files.push(path + '/' + file); + } + }); +} + +async function runObjectImporter() { + console.log('Objects-Import started'); + + console.log(`Base directory is: \`${baseDir}\``); + + // prompt for prod import + if (realConfig?.NODE_ENV?.toString()?.toLowerCase() === 'production') { + await new Promise(resolve => { + readline.createInterface({ + input: process.stdin, + output: process.stdout + }).question('\x1b[31mYOU ARE ABOUT TO PERFORM AN IMPORT IN PRODUCTION, DO YOU REALLY WANT TO CONTINUE? [y/n]:\x1b[0m ', (response) => { + if (response !== 'y') { + console.log('Setup aborted'); + process.exit(1); + } + resolve(); + }); + }); + } + + const contentArr = realConfig?.objectImport?.content; + if (!contentArr || !Array.isArray(contentArr)) { + console.log('No sources (`content` parameter) defined for object directory or wrong format. Import is interrupted.'); + return; + } + + for (let sourceDef of contentArr) { + let dir = sourceDef.dir; + let bucketName = sourceDef.bucketName; + if (dir && bucketName) { + let fullPath = baseDir + '/' + dir; + if (!fs.existsSync(fullPath)) { + console.warn(`Directory: \`${fullPath}\` does not exist, skipping this directory.`); + continue; + } + + console.warn(`Data from \`${fullPath}\` is going to be loaded into bucket \`${bucketName}\`.`); + + let files = []; + // recursively read the files from the directory and upload file + getFiles(fullPath, files); + + for (let file of files) { + let contentType; + // To upload removing the base directory name as key + let keyName = file.substring(fullPath.length + 1, file.length + 1); + // since orgKey is mandatory for GQL request + let orgKey = ''; + // set content type for svg - image/svg+xml + if (keyName.endsWith('svg')) { + contentType = 'image/svg+xml'; + } + await sendRequest(file, bucketName, keyName, orgKey, contentType).then((response) => { console.log('Upload Status:', file, response.status) }); + } + } + } + process.exit(); +} + +// proivde apiKey as command line flag +runObjectImporter(); diff --git a/demo-shop/package-lock.json b/demo-shop/package-lock.json index c2b4ea7..d4c8059 100644 --- a/demo-shop/package-lock.json +++ b/demo-shop/package-lock.json @@ -12,6 +12,8 @@ "@restorecommerce/gql-bot": "^1.0.1", "commander": "^9.4.1", "dotenv": "^16.0.3", + "formdata-node": "^4.3.3", + "node-fetch": "^3.2.9", "prompt": "^1.3.0", "typescript": "^4.8.4" }, @@ -794,6 +796,25 @@ "node": ">=8" } }, + "node_modules/@restorecommerce/gql-bot/node_modules/node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/@restorecommerce/gql-bot/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -1236,6 +1257,14 @@ "node": ">=0.4.0" } }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, "node_modules/debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -1972,6 +2001,36 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/fetch-blob/node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "engines": { + "node": ">= 8" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -2034,6 +2093,29 @@ "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, + "node_modules/formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2801,12 +2883,39 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, "engines": { - "node": "4.x || >=6.0.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, "node_modules/object-inspect": { @@ -3541,6 +3650,11 @@ "node": ">=4" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/ts-invariant": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", @@ -3671,6 +3785,28 @@ "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==", "dev": true }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", + "engines": { + "node": ">= 14" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4388,6 +4524,14 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, + "node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -4737,6 +4881,11 @@ "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=" }, + "data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==" + }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -5294,6 +5443,22 @@ "reusify": "^1.0.4" } }, + "fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "requires": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "dependencies": { + "web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" + } + } + }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -5338,6 +5503,23 @@ "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", "dev": true }, + "formdata-node": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", + "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", + "requires": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.3" + } + }, + "formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "requires": { + "fetch-blob": "^3.1.2" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -5899,10 +6081,20 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "requires": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + } }, "object-inspect": { "version": "1.12.2", @@ -6404,6 +6596,11 @@ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "ts-invariant": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.4.4.tgz", @@ -6518,6 +6715,25 @@ "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==", "dev": true }, + "web-streams-polyfill": { + "version": "4.0.0-beta.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", + "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/demo-shop/package.json b/demo-shop/package.json index 0993ae4..b05d58d 100644 --- a/demo-shop/package.json +++ b/demo-shop/package.json @@ -16,6 +16,8 @@ "@restorecommerce/gql-bot": "^1.0.1", "commander": "^9.4.1", "dotenv": "^16.0.3", + "formdata-node": "^4.3.3", + "node-fetch": "^3.2.9", "prompt": "^1.3.0", "typescript": "^4.8.4" }, @@ -28,7 +30,10 @@ "eslint-plugin-import": "^2.26.0", "eslint-plugin-json": "^3.1.0" }, - "scripts": {}, + "scripts": { + "build": "tsc -d -P tsconfig.objects.json", + "import-objects": "node objects/object_importer.js" + }, "engines": { "node": ">= 18.0.0" } diff --git a/demo-shop/tsconfig.objects.json b/demo-shop/tsconfig.objects.json new file mode 100644 index 0000000..d5d64d0 --- /dev/null +++ b/demo-shop/tsconfig.objects.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "outDir": "objects", + "target": "ES6", + "module": "commonjs", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "noUnusedLocals": false, + "skipLibCheck": false, + "strict": false, // temporarily disabled for testing by TH + "typeRoots": [ + "node_modules/@types" + ], + "baseUrl": ".", + "paths": { + "@src/*": ["src/*"] + }, + "sourceMap": true + }, + "exclude": [ + "**/*.test.ts", + "data", + "doc", + "lib", + "node_modules", + "test" + ], + "include": [ + "./objects/**/*.ts" + ] +}