Skip to content

Commit

Permalink
Merge pull request #14 from Send4BR/dev
Browse files Browse the repository at this point in the history
[ajustes] TKR-3749 Atualizar schema no SDK ecommerce replicator [main]
  • Loading branch information
Abner Persio authored Apr 6, 2022
2 parents 2e3a67a + 576db38 commit 58a2839
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 5 deletions.
7 changes: 7 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ declare module '@aftersale/ecommerce-replication-sdk/lib/__mocks__/ecommerce-moc
primary: boolean;
data: {};
}[];
handling: number;
picking: number;
integration: {
platform: string;
origin_domain: string;
Expand Down Expand Up @@ -43,6 +45,7 @@ declare module '@aftersale/ecommerce-replication-sdk/lib/__mocks__/ecommerce-moc
couriers: {
id: string;
enabled: boolean;
sacMail: string;
customNames: string[];
courierUrl: null;
connectorUrl: string;
Expand Down Expand Up @@ -128,9 +131,12 @@ declare module '@aftersale/ecommerce-replication-sdk/lib/types/ecommerce' {
trackingUrl: string;
logoUrl: string;
email: string;
handling: number;
picking: number;
confirmationType: string;
channels: {
id: string;
primary: boolean;
data: Record<string, unknown>;
}[];
integration: Record<string, unknown>;
Expand All @@ -153,6 +159,7 @@ declare module '@aftersale/ecommerce-replication-sdk/lib/types/ecommerce' {
courierUrl: string | null;
connectorUrl: string | null;
customNames: string[];
sacMail?: string | null;
authFields?: Record<string, unknown>;
}[];
mappedEcommerceStatuses: Record<string, string>;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.esm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// lib/schema.ts
import S from "fluent-json-schema";
var ecommerceMessageSchema = S.object().prop("id", S.number()).prop("isCustomizable", S.boolean()).prop("title", S.string()).prop("customDetail", S.anyOf([S.string(), S.null()])).prop("description", S.anyOf([S.string(), S.null()])).prop("actionIds", S.array().items(S.number())).prop("tags", S.array().items(S.string()));
var schema = S.object().prop("uuid", S.string().required()).prop("enabled", S.boolean().required()).prop("name", S.string().required()).prop("storeUrl", S.string().required()).prop("trackingUrl", S.string().required()).prop("logoUrl", S.string().required()).prop("email", S.string().required()).prop("confirmationType", S.string().required()).prop("integrations", S.object().prop("platform", S.string().required()).prop("store_id", S.string().required()).prop("origin_domain", S.string().required()).prop("connectorUrl", S.string().required()).prop("connectorFields", S.object().required())).prop("channels", S.array().items(S.object().prop("id", S.string()).prop("data", S.object()))).prop("features", S.array().items(S.string())).prop("featureSettings", S.object().prop("loyalty", S.object().prop("enabled", S.boolean().required()))).prop("utm", S.object().required()).prop("createdAt", S.string().required()).prop("updatedAt", S.string().required()).prop("coupons", S.array().items(S.object().prop("isActive", S.boolean().required()).prop("name", S.string().required()).prop("rules", S.string().required()).prop("expirationDate", S.string().required()))).prop("notifications", S.array().items(S.number())).prop("demo", S.boolean()).prop("couriers", S.array().items(S.object().prop("customNames", S.array().items(S.string())).prop("enabled", S.boolean().required()).prop("id", S.string().required()).prop("courierUrl", S.anyOf([S.string(), S.null()])).prop("connectorUrl", S.anyOf([S.string(), S.null()])).prop("authFields", S.object()))).prop("mappedEcommerceStatuses", S.object().required()).prop("messsages", S.object().prop("courier", S.array().items(ecommerceMessageSchema).required()).prop("platform", S.array().items(ecommerceMessageSchema).required()).prop("system", S.array().items(ecommerceMessageSchema).required()));
var schema = S.object().prop("uuid", S.string().required()).prop("enabled", S.boolean().required()).prop("name", S.string().required()).prop("storeUrl", S.string().required()).prop("trackingUrl", S.string().required()).prop("logoUrl", S.string().required()).prop("email", S.string().required()).prop("confirmationType", S.string().required()).prop("integrations", S.object().prop("platform", S.string().required()).prop("store_id", S.string().required()).prop("origin_domain", S.string().required()).prop("connectorUrl", S.string().required()).prop("connectorFields", S.object().required())).prop("channels", S.array().items(S.object().prop("id", S.string()).prop("primary", S.boolean()).prop("data", S.object()))).prop("features", S.array().items(S.string())).prop("featureSettings", S.object().prop("loyalty", S.object().prop("enabled", S.boolean().required()))).prop("utm", S.object().required()).prop("createdAt", S.string().required()).prop("updatedAt", S.string().required()).prop("coupons", S.array().items(S.object().prop("isActive", S.boolean().required()).prop("name", S.string().required()).prop("rules", S.string().required()).prop("expirationDate", S.string().required()))).prop("notifications", S.array().items(S.number())).prop("demo", S.boolean()).prop("picking", S.number()).prop("handling", S.number()).prop("couriers", S.array().items(S.object().prop("customNames", S.array().items(S.string())).prop("sacMail", S.anyOf([S.string(), S.null()])).prop("enabled", S.boolean().required()).prop("id", S.string().required()).prop("courierUrl", S.anyOf([S.string(), S.null()])).prop("connectorUrl", S.anyOf([S.string(), S.null()])).prop("authFields", S.object()))).prop("mappedEcommerceStatuses", S.object().required()).prop("messsages", S.object().prop("courier", S.array().items(ecommerceMessageSchema).required()).prop("platform", S.array().items(ecommerceMessageSchema).required()).prop("system", S.array().items(ecommerceMessageSchema).required()));

// lib/send.ts
async function send({ client, ecommerce }) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ __export(lib_exports, {
// lib/schema.ts
var import_fluent_json_schema = __toESM(require("fluent-json-schema"));
var ecommerceMessageSchema = import_fluent_json_schema.default.object().prop("id", import_fluent_json_schema.default.number()).prop("isCustomizable", import_fluent_json_schema.default.boolean()).prop("title", import_fluent_json_schema.default.string()).prop("customDetail", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("description", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("actionIds", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.number())).prop("tags", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.string()));
var schema = import_fluent_json_schema.default.object().prop("uuid", import_fluent_json_schema.default.string().required()).prop("enabled", import_fluent_json_schema.default.boolean().required()).prop("name", import_fluent_json_schema.default.string().required()).prop("storeUrl", import_fluent_json_schema.default.string().required()).prop("trackingUrl", import_fluent_json_schema.default.string().required()).prop("logoUrl", import_fluent_json_schema.default.string().required()).prop("email", import_fluent_json_schema.default.string().required()).prop("confirmationType", import_fluent_json_schema.default.string().required()).prop("integrations", import_fluent_json_schema.default.object().prop("platform", import_fluent_json_schema.default.string().required()).prop("store_id", import_fluent_json_schema.default.string().required()).prop("origin_domain", import_fluent_json_schema.default.string().required()).prop("connectorUrl", import_fluent_json_schema.default.string().required()).prop("connectorFields", import_fluent_json_schema.default.object().required())).prop("channels", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("id", import_fluent_json_schema.default.string()).prop("data", import_fluent_json_schema.default.object()))).prop("features", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.string())).prop("featureSettings", import_fluent_json_schema.default.object().prop("loyalty", import_fluent_json_schema.default.object().prop("enabled", import_fluent_json_schema.default.boolean().required()))).prop("utm", import_fluent_json_schema.default.object().required()).prop("createdAt", import_fluent_json_schema.default.string().required()).prop("updatedAt", import_fluent_json_schema.default.string().required()).prop("coupons", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("isActive", import_fluent_json_schema.default.boolean().required()).prop("name", import_fluent_json_schema.default.string().required()).prop("rules", import_fluent_json_schema.default.string().required()).prop("expirationDate", import_fluent_json_schema.default.string().required()))).prop("notifications", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.number())).prop("demo", import_fluent_json_schema.default.boolean()).prop("couriers", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("customNames", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.string())).prop("enabled", import_fluent_json_schema.default.boolean().required()).prop("id", import_fluent_json_schema.default.string().required()).prop("courierUrl", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("connectorUrl", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("authFields", import_fluent_json_schema.default.object()))).prop("mappedEcommerceStatuses", import_fluent_json_schema.default.object().required()).prop("messsages", import_fluent_json_schema.default.object().prop("courier", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()).prop("platform", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()).prop("system", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()));
var schema = import_fluent_json_schema.default.object().prop("uuid", import_fluent_json_schema.default.string().required()).prop("enabled", import_fluent_json_schema.default.boolean().required()).prop("name", import_fluent_json_schema.default.string().required()).prop("storeUrl", import_fluent_json_schema.default.string().required()).prop("trackingUrl", import_fluent_json_schema.default.string().required()).prop("logoUrl", import_fluent_json_schema.default.string().required()).prop("email", import_fluent_json_schema.default.string().required()).prop("confirmationType", import_fluent_json_schema.default.string().required()).prop("integrations", import_fluent_json_schema.default.object().prop("platform", import_fluent_json_schema.default.string().required()).prop("store_id", import_fluent_json_schema.default.string().required()).prop("origin_domain", import_fluent_json_schema.default.string().required()).prop("connectorUrl", import_fluent_json_schema.default.string().required()).prop("connectorFields", import_fluent_json_schema.default.object().required())).prop("channels", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("id", import_fluent_json_schema.default.string()).prop("primary", import_fluent_json_schema.default.boolean()).prop("data", import_fluent_json_schema.default.object()))).prop("features", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.string())).prop("featureSettings", import_fluent_json_schema.default.object().prop("loyalty", import_fluent_json_schema.default.object().prop("enabled", import_fluent_json_schema.default.boolean().required()))).prop("utm", import_fluent_json_schema.default.object().required()).prop("createdAt", import_fluent_json_schema.default.string().required()).prop("updatedAt", import_fluent_json_schema.default.string().required()).prop("coupons", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("isActive", import_fluent_json_schema.default.boolean().required()).prop("name", import_fluent_json_schema.default.string().required()).prop("rules", import_fluent_json_schema.default.string().required()).prop("expirationDate", import_fluent_json_schema.default.string().required()))).prop("notifications", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.number())).prop("demo", import_fluent_json_schema.default.boolean()).prop("picking", import_fluent_json_schema.default.number()).prop("handling", import_fluent_json_schema.default.number()).prop("couriers", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.object().prop("customNames", import_fluent_json_schema.default.array().items(import_fluent_json_schema.default.string())).prop("sacMail", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("enabled", import_fluent_json_schema.default.boolean().required()).prop("id", import_fluent_json_schema.default.string().required()).prop("courierUrl", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("connectorUrl", import_fluent_json_schema.default.anyOf([import_fluent_json_schema.default.string(), import_fluent_json_schema.default.null()])).prop("authFields", import_fluent_json_schema.default.object()))).prop("mappedEcommerceStatuses", import_fluent_json_schema.default.object().required()).prop("messsages", import_fluent_json_schema.default.object().prop("courier", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()).prop("platform", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()).prop("system", import_fluent_json_schema.default.array().items(ecommerceMessageSchema).required()));

// lib/send.ts
async function send({ client, ecommerce }) {
Expand Down
2 changes: 1 addition & 1 deletion dist/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/__mocks__/ecommerce-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default {
email: '[email protected]',
confirmationType: 'email',
channels: [{ id: 'sms', primary: true, data: {} }],
handling: 20,
picking: 10,
integration: {
platform: 'vtex',
origin_domain: 'mockecomm.test',
Expand Down Expand Up @@ -37,6 +39,7 @@ export default {
{
id: 'correios',
enabled: true,
sacMail: '[email protected]',
customNames: ['correios'],
courierUrl: null,
connectorUrl: 'http://connector.url',
Expand Down
10 changes: 9 additions & 1 deletion lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export const schema = S.object()
.prop('connectorUrl', S.string().required())
.prop('connectorFields', S.object().required())
)
.prop('channels', S.array().items(S.object().prop('id', S.string()).prop('data', S.object())))
.prop(
'channels',
S.array().items(
S.object().prop('id', S.string()).prop('primary', S.boolean()).prop('data', S.object())
)
)
.prop('features', S.array().items(S.string()))
.prop(
'featureSettings',
Expand All @@ -48,11 +53,14 @@ export const schema = S.object()
)
.prop('notifications', S.array().items(S.number()))
.prop('demo', S.boolean())
.prop('picking', S.number())
.prop('handling', S.number())
.prop(
'couriers',
S.array().items(
S.object()
.prop('customNames', S.array().items(S.string()))
.prop('sacMail', S.anyOf([S.string(), S.null()]))
.prop('enabled', S.boolean().required())
.prop('id', S.string().required())
.prop('courierUrl', S.anyOf([S.string(), S.null()]))
Expand Down
9 changes: 8 additions & 1 deletion lib/types/ecommerce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ export type Ecommerce = {
trackingUrl: string;
logoUrl: string;
email: string;
handling: number;
picking: number;
confirmationType: string;
channels: { id: string; data: Record<string, unknown> }[];
channels: {
id: string;
primary: boolean;
data: Record<string, unknown>;
}[];
integration: Record<string, unknown>;
features: string[];
featureSettings: Record<string, unknown>;
Expand All @@ -28,6 +34,7 @@ export type Ecommerce = {
courierUrl: string | null;
connectorUrl: string | null;
customNames: string[];
sacMail?: string | null;
authFields?: Record<string, unknown>;
}[];
mappedEcommerceStatuses: Record<string, string>;
Expand Down

0 comments on commit 58a2839

Please sign in to comment.