feed-common 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +16 -0
- package/dist/constants/google.constants.d.ts +11 -0
- package/dist/constants/google.constants.js +2 -2
- package/dist/constants/google.constants.js.map +1 -1
- package/dist/constants/product.constants.d.ts +4 -0
- package/dist/constants/profile.constants.d.ts +69 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types/company.types.d.ts +11 -0
- package/dist/types/company.types.js +2 -0
- package/dist/types/company.types.js.map +1 -0
- package/dist/types/product.types.d.ts +86 -0
- package/dist/types/profile.types.d.ts +68 -0
- package/dist/utils/company.d.ts +3 -0
- package/dist/utils/company.js +7 -0
- package/dist/utils/company.js.map +1 -0
- package/dist/utils/gmc.d.ts +16 -0
- package/dist/utils/profile.d.ts +28 -0
- package/dist/utils/utils.d.ts +1 -0
- package/package.json +3 -2
- package/src/constants/google.constants.ts +12 -0
- package/src/constants/product.constants.ts +4 -0
- package/src/constants/profile.constants.ts +369 -0
- package/src/index.ts +12 -0
- package/src/types/company.types.ts +8 -0
- package/src/types/product.types.ts +97 -0
- package/src/types/profile.types.ts +73 -0
- package/src/utils/company.ts +9 -0
- package/src/utils/gmc.ts +69 -0
- package/src/utils/profile.ts +348 -0
- package/src/utils/utils.ts +3 -0
- package/.github/workflows/release.yml +0 -38
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## [1.0.2](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.1...v1.0.2) (2024-02-02)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* some changes ([e984a10](https://github.com/advertikon/package-maxify-feed-common/commit/e984a10d9816044b53ea894c881526a7af59ca40))
|
7
|
+
|
8
|
+
## [1.0.1](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.0...v1.0.1) (2024-01-30)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add company types ([cd62d4d](https://github.com/advertikon/package-maxify-feed-common/commit/cd62d4d762b6afd72279426f42fab34eefce1bc0))
|
14
|
+
* add type definitions ([8f5d33f](https://github.com/advertikon/package-maxify-feed-common/commit/8f5d33f69a5f65772fdc0f1ba7bb543ff0f88afe))
|
15
|
+
* fix ci ([6444435](https://github.com/advertikon/package-maxify-feed-common/commit/6444435746003edbebe340a258f9c9c5b1639289))
|
16
|
+
|
1
17
|
# 1.0.0 (2024-01-28)
|
2
18
|
|
3
19
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export declare enum GmcProductSyncStatus {
|
2
|
+
REJECTED = "rejected",
|
3
|
+
APPROVED = "approved",
|
4
|
+
WARNING = "warning",
|
5
|
+
SYNC_SCHEDULED = "sync_scheduled"
|
6
|
+
}
|
7
|
+
export declare enum GoogleAccountStatus {
|
8
|
+
ENABLED = "ENABLED",
|
9
|
+
REMOVED = "REMOVED",
|
10
|
+
REJECTED = "REJECTED"
|
11
|
+
}
|
@@ -2,8 +2,8 @@ export var GmcProductSyncStatus;
|
|
2
2
|
(function (GmcProductSyncStatus) {
|
3
3
|
GmcProductSyncStatus["REJECTED"] = "rejected";
|
4
4
|
GmcProductSyncStatus["APPROVED"] = "approved";
|
5
|
-
GmcProductSyncStatus["
|
6
|
-
GmcProductSyncStatus["
|
5
|
+
GmcProductSyncStatus["WARNING"] = "warning";
|
6
|
+
GmcProductSyncStatus["SYNC_SCHEDULED"] = "sync_scheduled";
|
7
7
|
})(GmcProductSyncStatus || (GmcProductSyncStatus = {}));
|
8
8
|
export var GoogleAccountStatus;
|
9
9
|
(function (GoogleAccountStatus) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"google.constants.js","sourceRoot":"","sources":["../../src/constants/google.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,
|
1
|
+
{"version":3,"file":"google.constants.js","sourceRoot":"","sources":["../../src/constants/google.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,yDAAiC,CAAA;AACnC,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AAED,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B"}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { ProductUploadMapSource } from '../types/profile.types.js';
|
2
|
+
import { ProductUploadRuleFilterType } from '../types/profile.types.js';
|
3
|
+
export declare const SOURCE_VENDORS = "source.vendor";
|
4
|
+
export declare const SOURCE_TAGS = "source.tag";
|
5
|
+
export declare const SOURCE_PORODUCT_TYPE = "source.product_type";
|
6
|
+
export declare const SOURCE_COLLECTIONS = "source.collection";
|
7
|
+
export declare const SOURCE_LANGUAGE = "source.language";
|
8
|
+
export declare const SOURCE_GOOGLE_CATEGORY = "source.google_category";
|
9
|
+
export declare const SOURCE_COUNTRY = "source.country";
|
10
|
+
export declare const SOURCE_SHOPIFY_VENDORS = "shopify.vendor";
|
11
|
+
export declare const SOURCE_SHOPIFY_BARCODE = "shopify.barcode";
|
12
|
+
export declare const SOURCE_SHOPIFY_SKU = "shopify.sku";
|
13
|
+
export declare const SOURCE_CUSTOM = "custom_input";
|
14
|
+
export declare const RuleOperators: {
|
15
|
+
contains: {
|
16
|
+
label: string;
|
17
|
+
value: string;
|
18
|
+
};
|
19
|
+
notContains: {
|
20
|
+
label: string;
|
21
|
+
value: string;
|
22
|
+
};
|
23
|
+
equals: {
|
24
|
+
label: string;
|
25
|
+
value: string;
|
26
|
+
};
|
27
|
+
notEquals: {
|
28
|
+
label: string;
|
29
|
+
value: string;
|
30
|
+
};
|
31
|
+
startsWith: {
|
32
|
+
label: string;
|
33
|
+
value: string;
|
34
|
+
};
|
35
|
+
notStartsWith: {
|
36
|
+
label: string;
|
37
|
+
value: string;
|
38
|
+
};
|
39
|
+
endsWith: {
|
40
|
+
label: string;
|
41
|
+
value: string;
|
42
|
+
};
|
43
|
+
notEndsWith: {
|
44
|
+
label: string;
|
45
|
+
value: string;
|
46
|
+
};
|
47
|
+
in: {
|
48
|
+
label: string;
|
49
|
+
value: string;
|
50
|
+
};
|
51
|
+
notIn: {
|
52
|
+
label: string;
|
53
|
+
value: string;
|
54
|
+
};
|
55
|
+
};
|
56
|
+
export declare const PruoductUploadRulesOperators: {
|
57
|
+
string: {
|
58
|
+
label: string;
|
59
|
+
value: string;
|
60
|
+
}[];
|
61
|
+
list: {
|
62
|
+
label: string;
|
63
|
+
value: string;
|
64
|
+
}[];
|
65
|
+
};
|
66
|
+
export declare const ProductUploadRuleFilters: ProductUploadRuleFilterType[];
|
67
|
+
export declare const ProductUploadMappings: ProductUploadMapSource[];
|
68
|
+
export declare const CHANNEL = "online";
|
69
|
+
export declare const GMC_PRODUCT_ID_TEMPLATE = "{PRODUCT_ID}_{VARIANT_ID}";
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
export * from './constants/google.constants.js';
|
2
|
+
export * from './constants/product.constants.js';
|
3
|
+
export * from './constants/profile.constants.js';
|
4
|
+
export * from './types/product.types.js';
|
5
|
+
export * from './types/profile.types.js';
|
6
|
+
export * from './types/company.types.js';
|
7
|
+
export * from './utils/gmc.js';
|
8
|
+
export * from './utils/profile.js';
|
9
|
+
export * from './utils/utils.js';
|
10
|
+
export * from './utils/company.js';
|
package/dist/index.js
CHANGED
@@ -3,7 +3,9 @@ export * from './constants/product.constants.js';
|
|
3
3
|
export * from './constants/profile.constants.js';
|
4
4
|
export * from './types/product.types.js';
|
5
5
|
export * from './types/profile.types.js';
|
6
|
+
export * from './types/company.types.js';
|
6
7
|
export * from './utils/gmc.js';
|
7
8
|
export * from './utils/profile.js';
|
8
9
|
export * from './utils/utils.js';
|
10
|
+
export * from './utils/company.js';
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export type ServerSideEvent = {
|
2
|
+
shop: string;
|
3
|
+
threadId: string;
|
4
|
+
type: 'progress' | 'schedule';
|
5
|
+
name: string;
|
6
|
+
};
|
7
|
+
export type ServerSideProgressEvent = ServerSideEvent & {
|
8
|
+
progress: number;
|
9
|
+
totalCount: number;
|
10
|
+
};
|
11
|
+
export type ServerSideScheduleEvent = ServerSideEvent;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"company.types.js","sourceRoot":"","sources":["../../src/types/company.types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { GmcProductSyncStatus } from '../constants/google.constants.js';
|
2
|
+
import { ProductSyncStatus } from '../constants/product.constants.js';
|
3
|
+
export type AppProductStatus = 'active' | 'draft' | 'archived';
|
4
|
+
export type AppProductVariant = {
|
5
|
+
id: number;
|
6
|
+
title: string;
|
7
|
+
price: string;
|
8
|
+
sku: string | null;
|
9
|
+
image_id: number | null;
|
10
|
+
};
|
11
|
+
export type GmcProductId = {
|
12
|
+
id: string;
|
13
|
+
profileId: string;
|
14
|
+
gmcAccount: string;
|
15
|
+
uploaded_at: string;
|
16
|
+
status?: GmcProductSyncStatus;
|
17
|
+
};
|
18
|
+
export type GoogleProductIssue = {
|
19
|
+
servability?: 'demoted' | 'disapproved' | 'unaffected' | string;
|
20
|
+
description?: string;
|
21
|
+
documentation?: string;
|
22
|
+
};
|
23
|
+
export type gmcIssue = {
|
24
|
+
gmcProductId: string;
|
25
|
+
gmcAccount: string;
|
26
|
+
updated_at: string;
|
27
|
+
issue: GoogleProductIssue[];
|
28
|
+
};
|
29
|
+
export type ShopifyCollection = {
|
30
|
+
id: number;
|
31
|
+
handle: string;
|
32
|
+
title: string;
|
33
|
+
};
|
34
|
+
export type AppProduct = {
|
35
|
+
status: AppProductStatus;
|
36
|
+
handle: string;
|
37
|
+
title: string;
|
38
|
+
category?: string;
|
39
|
+
id: number;
|
40
|
+
googleCategory?: number;
|
41
|
+
image?: string;
|
42
|
+
_id: string;
|
43
|
+
gmcIssues?: gmcIssue[];
|
44
|
+
gmcProductId?: GmcProductId[];
|
45
|
+
updated_at: string;
|
46
|
+
variants: AppProductVariant[];
|
47
|
+
images: {
|
48
|
+
src: string;
|
49
|
+
id: string;
|
50
|
+
}[];
|
51
|
+
collections: ShopifyCollection[];
|
52
|
+
tags: string[];
|
53
|
+
vendor: string;
|
54
|
+
product_type: string;
|
55
|
+
syncStatus: ProductSyncStatus;
|
56
|
+
};
|
57
|
+
export type GetProductsQuery = {
|
58
|
+
before?: string;
|
59
|
+
after?: string;
|
60
|
+
limit?: number;
|
61
|
+
handle?: string;
|
62
|
+
title?: string;
|
63
|
+
id?: number[];
|
64
|
+
sortField?: 'title' | 'id';
|
65
|
+
sort?: 'asc' | 'desc';
|
66
|
+
fields?: string[];
|
67
|
+
gmcProductId?: string[] | boolean;
|
68
|
+
};
|
69
|
+
export type GetProductsResponse = {
|
70
|
+
products: AppProduct[];
|
71
|
+
pagination: {
|
72
|
+
firstId: string;
|
73
|
+
lastId: string;
|
74
|
+
hasMore: boolean;
|
75
|
+
hasLess: boolean;
|
76
|
+
};
|
77
|
+
};
|
78
|
+
export type ProductsList = {
|
79
|
+
ids: string[];
|
80
|
+
};
|
81
|
+
export type UploadProductBulkPayload = {
|
82
|
+
collections: string[];
|
83
|
+
vendors: string[];
|
84
|
+
types: string[];
|
85
|
+
tags: string[];
|
86
|
+
};
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { ProductUploadRuleFilters, ProductUploadMappings } from '../constants/profile.constants.js';
|
2
|
+
import { RuleOperators } from '../constants/profile.constants.js';
|
3
|
+
export type ProductUploadRuleOpratorType = {
|
4
|
+
label: string;
|
5
|
+
value: string;
|
6
|
+
};
|
7
|
+
export type ProductUploadRuleFilterType = {
|
8
|
+
label: string;
|
9
|
+
operators: ProductUploadRuleOpratorType[];
|
10
|
+
value: string;
|
11
|
+
disabled?: boolean;
|
12
|
+
};
|
13
|
+
export type RuleOperatorsType = typeof RuleOperators;
|
14
|
+
export type ValueType = string | string[] | number[] | number | boolean;
|
15
|
+
export type OptionTypeItem = {
|
16
|
+
label: string;
|
17
|
+
value: ValueType;
|
18
|
+
};
|
19
|
+
export type OptionTypeGroup = {
|
20
|
+
title: string;
|
21
|
+
options: OptionTypeItem[];
|
22
|
+
};
|
23
|
+
export type OptionType = OptionTypeItem | OptionTypeGroup | string;
|
24
|
+
export type ProductUploadMapSource = {
|
25
|
+
required: boolean;
|
26
|
+
label: string;
|
27
|
+
attribute: string;
|
28
|
+
type: 'select' | 'multiselect' | 'text' | 'number';
|
29
|
+
choises?: OptionType[];
|
30
|
+
rules: ProductUploadRuleFilterType['value'][];
|
31
|
+
description?: string;
|
32
|
+
defaultValue?: ValueType;
|
33
|
+
};
|
34
|
+
export type ProductUploadMapping = {
|
35
|
+
attribute: MappingFields;
|
36
|
+
value: ValueType;
|
37
|
+
rules: {
|
38
|
+
sections: {
|
39
|
+
ruleItems: {
|
40
|
+
attribute: (typeof ProductUploadRuleFilters)[number]['value'];
|
41
|
+
operator: ProductUploadRuleOpratorType['value'];
|
42
|
+
value: string | string[] | number[] | number | boolean;
|
43
|
+
id: string;
|
44
|
+
}[];
|
45
|
+
}[];
|
46
|
+
};
|
47
|
+
};
|
48
|
+
type MappingFields = (typeof ProductUploadMappings)[number]['attribute'];
|
49
|
+
export type ProductUploadProfile = {
|
50
|
+
id: string;
|
51
|
+
name: string;
|
52
|
+
active?: boolean;
|
53
|
+
rules: ProductUploadRules;
|
54
|
+
mappings: ProductUploadMapping[];
|
55
|
+
};
|
56
|
+
export type ProductUploadRules = {
|
57
|
+
sections: ProductUploadRuleSection[];
|
58
|
+
};
|
59
|
+
export type ProductUploadRuleSection = {
|
60
|
+
ruleItems: ProductUploadRuleItem[];
|
61
|
+
};
|
62
|
+
export type ProductUploadRuleItem = {
|
63
|
+
id: string;
|
64
|
+
attribute: string;
|
65
|
+
operator: string;
|
66
|
+
value: string | number | string[] | number[] | boolean;
|
67
|
+
};
|
68
|
+
export {};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { ServerSideEvent, ServerSideProgressEvent, ServerSideScheduleEvent } from '../types/company.types.js';
|
2
|
+
export declare function isServerSideProgressEvent(event: ServerSideEvent): event is ServerSideProgressEvent;
|
3
|
+
export declare function isServerSideScheduleEvent(event: ServerSideEvent): event is ServerSideScheduleEvent;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"company.js","sourceRoot":"","sources":["../../src/utils/company.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,yBAAyB,CAAE,KAAsB;IAC7D,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAE,KAAsB;IAC7D,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACrC,CAAC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export declare function isGmcProductId(productId: string): boolean;
|
2
|
+
export declare function GMCProductIdToShopify(productId: string): number;
|
3
|
+
export declare function GmcIdParts(gmcProductId: string): {
|
4
|
+
channel: string;
|
5
|
+
locale: string;
|
6
|
+
country: string;
|
7
|
+
idPart: string;
|
8
|
+
shopifyId: number;
|
9
|
+
shopifyVariantId: number;
|
10
|
+
};
|
11
|
+
export declare function makeGmcIdPart(productId: number | null, variantId: number | null): string;
|
12
|
+
export declare function getShopifyIdsFromGmcIdPart(gmcId: string): {
|
13
|
+
shopifyId: number;
|
14
|
+
shopifyVariantId: number;
|
15
|
+
};
|
16
|
+
export declare function getProductIdFromGmcId(gmcId: string): number;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { OptionType, OptionTypeItem, OptionTypeGroup, ProductUploadProfile } from '../types/profile.types.js';
|
2
|
+
import { ProductUploadMapping } from '../types/profile.types.js';
|
3
|
+
import { ProductUploadRuleFilterType } from '../types/profile.types.js';
|
4
|
+
import { ProductUploadRuleItem, ProductUploadRuleSection, ProductUploadRules } from '../types/profile.types.js';
|
5
|
+
export declare function checkRuleDuplication(rules: ProductUploadRuleItem[]): string[];
|
6
|
+
export declare function checkRuleAlwaysness(rules: ProductUploadRuleItem[]): string[];
|
7
|
+
export declare function checkRuleDeadlocks(sections: ProductUploadRuleSection[]): string[];
|
8
|
+
export declare function getEmptyRuleItem(attribute?: ProductUploadRuleFilterType['value']): ProductUploadRuleItem;
|
9
|
+
export declare function sortMappings(a: ProductUploadMapping, b: ProductUploadMapping): number;
|
10
|
+
export declare function hasRules(rules: ProductUploadRules): boolean;
|
11
|
+
/**
|
12
|
+
* Checks if two rules are the same
|
13
|
+
* @param a
|
14
|
+
* @param b
|
15
|
+
* @returns
|
16
|
+
*/
|
17
|
+
export declare function compareRules(a?: ProductUploadRules, b?: ProductUploadRules): boolean;
|
18
|
+
export declare function compareMappings(a: ProductUploadMapping[], b: ProductUploadMapping[]): boolean;
|
19
|
+
export declare function optionIsString(option: OptionType): option is string;
|
20
|
+
export declare function optionIsItem(option: OptionType): option is OptionTypeItem;
|
21
|
+
export declare function optionIsGroup(option: OptionType): option is OptionTypeGroup;
|
22
|
+
export declare function detectProfileChange(a: ProductUploadProfile, b: ProductUploadProfile): {
|
23
|
+
name: boolean;
|
24
|
+
rules: boolean;
|
25
|
+
mappings: boolean;
|
26
|
+
id: boolean;
|
27
|
+
};
|
28
|
+
export declare function sanitizeUploadProfile(profile: ProductUploadProfile): ProductUploadProfile;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function code(): string;
|
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "feed-common",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "Maxify feed common library",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"type": "module",
|
7
7
|
"scripts": {
|
8
|
-
"build": "tsc"
|
8
|
+
"build": "tsc",
|
9
|
+
"install-local": "scripts/install.sh"
|
9
10
|
},
|
10
11
|
"devDependencies": {
|
11
12
|
"@semantic-release/changelog": "^6.0.1",
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export enum GmcProductSyncStatus {
|
2
|
+
REJECTED = 'rejected',
|
3
|
+
APPROVED = 'approved',
|
4
|
+
WARNING = 'warning',
|
5
|
+
SYNC_SCHEDULED = 'sync_scheduled',
|
6
|
+
}
|
7
|
+
|
8
|
+
export enum GoogleAccountStatus {
|
9
|
+
ENABLED = 'ENABLED',
|
10
|
+
REMOVED = 'REMOVED',
|
11
|
+
REJECTED = 'REJECTED',
|
12
|
+
}
|