Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release #121

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/facade/src/modules/master_data/gql/types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { protoMetadata as metaPackageIoRestorecommerceAddress } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/address.js';
import { protoMetadata as metaPackageIoRestorecommerceCountry } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/country.js';
import { protoMetadata as metaPackageIoRestorecommerceTimezone } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/timezone.js';
import { protoMetadata as metaPackageIoRestorecommerceContact_point_type } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/contact_point_type.js';
import { protoMetadata as metaPackageIoRestorecommerceContactPointType } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/contact_point_type.js';
import { protoMetadata as metaPackageIoRestorecommerceCustomer } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/customer.js';
import { protoMetadata as metaPackageIoRestorecommerceContact_point } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/contact_point.js';
import { protoMetadata as metaPackageIoRestorecommerceContactPoint } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/contact_point.js';
import { protoMetadata as metaPackageIoRestorecommerceCredential } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/credential.js';
import { protoMetadata as metaPackageIoRestorecommerceLocale } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/locale.js';
import { protoMetadata as metaPackageIoRestorecommerceLocation } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/location.js';
import { protoMetadata as metaPackageIoRestorecommerceOrganization } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/organization.js';
import { protoMetadata as metaPackageIoRestorecommerceShop } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/shop.js';
import { protoMetadata as metaPackageIoRestorecommerceTax } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/tax.js';
import { protoMetadata as metaPackageIoRestorecommerceTax_type } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/tax_type.js';
import { protoMetadata as metaPackageIoRestorecommerceTaxType } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/tax_type.js';
import { protoMetadata as metaPackageIoRestorecommerceUnitCode } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/unit_code.js';
import { protoMetadata as metaPackageIoRestorecommerceTemplate } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/template.js';
import { protoMetadata as metaPackageIoRestorecommerceSetting } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/setting.js';
import { protoMetadata as metaPackageIoRestorecommerceCommand } from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/command.js';
import { type ProtoMetadata, registerPackagesRecursive } from '../../../gql/protos/index.js';
import { registerProtoMeta } from '@restorecommerce/kafka-client';
Expand All @@ -21,18 +22,19 @@ export const subServices: ProtoMetadata[] = [
metaPackageIoRestorecommerceAddress,
metaPackageIoRestorecommerceCountry,
metaPackageIoRestorecommerceTimezone,
metaPackageIoRestorecommerceContact_point_type,
metaPackageIoRestorecommerceContactPointType,
metaPackageIoRestorecommerceCustomer,
metaPackageIoRestorecommerceContact_point,
metaPackageIoRestorecommerceContactPoint,
metaPackageIoRestorecommerceCredential,
metaPackageIoRestorecommerceLocale,
metaPackageIoRestorecommerceLocation,
metaPackageIoRestorecommerceOrganization,
metaPackageIoRestorecommerceShop,
metaPackageIoRestorecommerceTax_type,
metaPackageIoRestorecommerceTaxType,
metaPackageIoRestorecommerceTax,
metaPackageIoRestorecommerceUnitCode,
metaPackageIoRestorecommerceTemplate,
metaPackageIoRestorecommerceSetting,
metaPackageIoRestorecommerceCommand,
];

Expand Down
7 changes: 6 additions & 1 deletion packages/facade/src/modules/master_data/grpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ import {
type CredentialServiceClient,
CredentialServiceDefinition
} from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/credential.js';
import {
type SettingServiceClient,
SettingServiceDefinition
} from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/setting.js';
import {
CommandServiceDefinition
} from '@restorecommerce/rc-grpc-clients/dist/generated/io/restorecommerce/command.js';
import { type GrpcClientConfig } from '@restorecommerce/grpc-client';

export class ResourceSrvGrpcClient extends RestoreCommerceGrpcClient {

readonly address: AddressServiceClient;
readonly country: CountryServiceClient;
readonly timezone: TimezoneServiceClient;
Expand All @@ -81,6 +84,7 @@ export class ResourceSrvGrpcClient extends RestoreCommerceGrpcClient {
readonly tax_type: TaxTypeServiceClient;
readonly unit_code: UnitCodeServiceClient;
readonly template: TemplateServiceClient;
readonly setting: SettingServiceClient;
readonly command: any = undefined;

constructor(address: string, cfg: GrpcClientConfig) {
Expand All @@ -101,6 +105,7 @@ export class ResourceSrvGrpcClient extends RestoreCommerceGrpcClient {
this.unit_code = this.createClient(cfg, UnitCodeServiceDefinition, this.channel);
this.template = this.createClient(cfg, TemplateServiceDefinition, this.channel);
this.credential = this.createClient(cfg, CredentialServiceDefinition, this.channel);
this.setting = this.createClient(cfg, SettingServiceDefinition, this.channel);
this.command = this.createClient(cfg, CommandServiceDefinition, this.channel);
}

Expand Down
1 change: 0 additions & 1 deletion packages/facade/src/modules/ostorage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const ostorageModule = createFacadeModuleFactory<OstorageConfig, Ostorage
if (authToken && authToken.startsWith('Bearer ')) {
token = authToken.split(' ')[1];
ctx.subject = { token };
ctx.subject = { token };
}
const bucket = ctx.params[0];
const key = ctx.params[1];
Expand Down
29 changes: 28 additions & 1 deletion packages/protos/io/restorecommerce/customer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "io/restorecommerce/meta.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/setting.proto";
import "io/restorecommerce/options.proto";

// Used by resolvers
Expand Down Expand Up @@ -58,7 +59,15 @@ message Customer {
Commercial commercial = 4;
PublicSector public_sector = 5;
};
repeated io.restorecommerce.attribute.Attribute settings = 6;
string setting_id = 6 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.setting.Setting",
target_service: "master_data",
target_sub_service: "setting",
target_method: "Read",
field_name: "setting",
}
];
}

message Private {
Expand Down Expand Up @@ -92,6 +101,15 @@ message Commercial {
field_name: "organization",
}
];
repeated string template_ids = 2 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
}

message PublicSector {
Expand All @@ -104,4 +122,13 @@ message PublicSector {
field_name: "organization",
}
];
repeated string template_ids = 2 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
}
6 changes: 1 addition & 5 deletions packages/protos/io/restorecommerce/file.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "io/restorecommerce/image.proto";

message File {
optional string id = 1;
optional int64 index = 2;
optional uint32 ordinal = 2;
optional string caption = 3;
optional string filename = 4;
optional string content_type = 5;
Expand All @@ -19,8 +19,4 @@ message File {
message FileList {
repeated File items = 1;
optional uint32 total_count = 2;
}

message Deleted {
optional string id = 1;
}
4 changes: 0 additions & 4 deletions packages/protos/io/restorecommerce/fulfillment.proto
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,6 @@ message FulfillmentIdList {
optional io.restorecommerce.auth.Subject subject = 3;
}

message Deleted {
optional string id = 1;
}

message FulfillmentInvoiceSection {
optional string fulfillment_id = 1;
repeated string selected_parcels = 2; // selects all on empty
Expand Down
7 changes: 2 additions & 5 deletions packages/protos/io/restorecommerce/fulfillment_courier.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ message FulfillmentCourier {
optional string description = 5;
optional string logo = 6;
optional string website = 7;
optional string stub_type = 8;
optional string stub_type = 8; // obsolete, use api
optional string credential_id = 9;
optional google.protobuf.Any configuration = 10;
optional string api = 11;
}

message FulfillmentCourierList {
Expand All @@ -72,7 +73,3 @@ message FulfillmentCourierListResponse {
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message Deleted {
optional string id = 1;
}

19 changes: 7 additions & 12 deletions packages/protos/io/restorecommerce/fulfillment_product.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ service FulfillmentProductService {
}

message Preferences {
optional bool partial_filfillment_allowed = 1;
repeated string couriers = 2; // ID of courier
repeated io.restorecommerce.attribute.Attribute options = 3; // Courier specific options such as C02 neutral delivery etc.
optional bool partial_fulfillment_allowed = 1;
repeated string courier_ids = 2; // Narrows search to certain couriers, leave empty for open search
repeated string fulfillment_product_ids = 3; // Narrows search to certain tariffs, leave empty for open search
repeated io.restorecommerce.attribute.Attribute options = 4; // Courier specific options such as CO2 neutral delivery etc.
}

message FulfillmentSolutionQuery {
Expand Down Expand Up @@ -128,11 +129,9 @@ message FulfillmentProductListResponse {
}

message FulfillmentSolution {
repeated io.restorecommerce.amount.Amount amounts = 1;
optional double compactness = 2;
optional double homogeneity = 3;
optional double score = 4;
repeated io.restorecommerce.fulfillment.Parcel parcels = 5;
repeated string courier_ids = 1;
repeated io.restorecommerce.fulfillment.Parcel parcels = 2;
repeated io.restorecommerce.amount.Amount amounts = 3;
}

message FulfillmentSolutionResponse {
Expand All @@ -146,7 +145,3 @@ message FulfillmentSolutionListResponse {
optional uint32 total_count = 2;
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message Deleted {
optional string id = 1;
}
8 changes: 5 additions & 3 deletions packages/protos/io/restorecommerce/invoice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ message InvoiceResponse {

message InvoiceId {
optional string id = 1;
repeated string channel_ids = 2;
optional google.protobuf.Any options = 3;
optional io.restorecommerce.auth.Subject subject = 4;
repeated string document_ids = 2; // empty takes latest
repeated string notification_channel_ids = 3;
optional google.protobuf.Any options = 4;
optional io.restorecommerce.auth.Subject subject = 5;
}

message InvoiceIdList {
Expand Down Expand Up @@ -162,6 +163,7 @@ message Invoice {
optional google.protobuf.Timestamp to_date = 17; // value performance to date
optional bool sent = 18;
optional bool withdrawn = 19;
optional string customer_order_number = 20;
}

message Section {
Expand Down
3 changes: 3 additions & 0 deletions packages/protos/io/restorecommerce/order.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ service OrderService {
rpc Cancel (OrderIdList) returns (OrderListResponse);
rpc Delete (io.restorecommerce.resourcebase.DeleteRequest) returns (io.restorecommerce.resourcebase.DeleteResponse);

// Requires Fulfillment Service
// Evaluates plausibility of the Fulfillment that would result from given order.
rpc EvaluateFulfillment (OrderList) returns (io.restorecommerce.status.StatusListResponse);
// Requires Fulfillment Service
rpc QueryFulfillmentSolution (FulfillmentRequestList) returns (io.restorecommerce.fulfillment_product.FulfillmentSolutionListResponse);
// Requires Fulfillment Service
Expand Down
45 changes: 45 additions & 0 deletions packages/protos/io/restorecommerce/setting.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
syntax = "proto3";

package io.restorecommerce.setting;

import "io/restorecommerce/meta.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/resource_base.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/options.proto";

service SettingService {
rpc Read (io.restorecommerce.resourcebase.ReadRequest) returns (SettingListResponse) {
option (io.restorecommerce.options.is_query) = true;
};
rpc Create (SettingList) returns (SettingListResponse);
rpc Delete (io.restorecommerce.resourcebase.DeleteRequest) returns (io.restorecommerce.resourcebase.DeleteResponse);
rpc Update (SettingList) returns (SettingListResponse);
rpc Upsert (SettingList) returns (SettingListResponse);
}

message Setting {
optional string id = 1;
optional io.restorecommerce.meta.Meta meta = 2;
optional string name = 3;
optional string description = 4;
repeated io.restorecommerce.attribute.Attribute settings = 5;
}

message SettingList {
repeated Setting items = 1;
optional uint32 total_count = 2;
optional io.restorecommerce.auth.Subject subject = 3;
}

message SettingListResponse {
repeated SettingResponse items = 1;
optional uint32 total_count = 2;
optional io.restorecommerce.status.OperationStatus operation_status = 3;
}

message SettingResponse {
optional Setting payload = 1;
optional io.restorecommerce.status.Status status = 3;
}
20 changes: 19 additions & 1 deletion packages/protos/io/restorecommerce/shop.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import "io/restorecommerce/meta.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/attribute.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/setting.proto";
import "io/restorecommerce/options.proto";

// Used by resolvers
Expand Down Expand Up @@ -60,5 +61,22 @@ message Shop {
field_name: "organization",
}
];
repeated io.restorecommerce.attribute.Attribute settings = 8;
repeated string template_ids = 8 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.template.Template",
target_service: "master_data",
target_sub_service: "template",
target_method: "Read",
field_name: "templates",
}
]; // list of active templates
string setting_id = 9 [
(io.restorecommerce.options.resolver) = {
target_type: ".io.restorecommerce.setting.Setting",
target_service: "master_data",
target_sub_service: "setting",
target_method: "Read",
field_name: "setting",
}
];
}
28 changes: 23 additions & 5 deletions packages/protos/io/restorecommerce/template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "io/restorecommerce/file.proto";
import "io/restorecommerce/meta.proto";
import "io/restorecommerce/auth.proto";
import "io/restorecommerce/status.proto";
import "io/restorecommerce/reference.proto";
import "io/restorecommerce/options.proto";

/*
Expand All @@ -25,6 +24,15 @@ service TemplateService {
rpc Upsert (TemplateList) returns (TemplateListResponse);
}

enum TemplateUseCase {
MISCELLANEOUS = 0;
INVOICE_PDF = 1;
INVOICE_EMAIL = 2;
INVITATION_EMAIL = 3;
REGISTRATION_EMAIL = 4;
CHANGE_PASSWORD_EMAIL = 5;
}

message Deleted {
optional string id = 1;
}
Expand All @@ -46,13 +54,23 @@ message TemplateResponse {
optional io.restorecommerce.status.Status status = 2;
}

message Localization {
repeated string local_codes = 1; // e.g. en, en_US, en_UK, ...
optional io.restorecommerce.file.File l10n = 2; // JSON expected
}

message Template {
optional string id = 1;
optional io.restorecommerce.meta.Meta meta = 2;
optional string name = 3;
optional string description = 4;
optional io.restorecommerce.reference.Reference reference = 5;
repeated io.restorecommerce.file.File files = 6;
repeated io.restorecommerce.image.Image images = 7;
repeated io.restorecommerce.attribute.Attribute attributes = 8;
optional TemplateUseCase use_case = 5;
optional uint32 ordinal = 6; // sort number
optional string section = 7; // e.g. header, body, footer
optional io.restorecommerce.file.File body = 8; // e.g. text/html
optional io.restorecommerce.file.File layout = 9;
repeated io.restorecommerce.file.File styles = 10; // e.g. application/css
repeated io.restorecommerce.image.Image images = 11;
repeated Localization localization = 12;
repeated io.restorecommerce.attribute.Attribute attributes = 14;
}
Loading