@ikas/api-client 0.0.1-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Jenkinsfile +92 -0
- package/README.md +2 -0
- package/codegen/admin.yml +9 -0
- package/dist/api/admin/admin-client.d.ts +8 -0
- package/dist/api/admin/admin-client.js +33 -0
- package/dist/api/admin/admin-client.js.map +1 -0
- package/dist/api/admin/common-gql.d.ts +4 -0
- package/dist/api/admin/common-gql.js +14 -0
- package/dist/api/admin/common-gql.js.map +1 -0
- package/dist/api/admin/generated/index.d.ts +2105 -0
- package/dist/api/admin/generated/index.js +340 -0
- package/dist/api/admin/generated/index.js.map +1 -0
- package/dist/api/admin/index.d.ts +4 -0
- package/dist/api/admin/index.js +17 -0
- package/dist/api/admin/index.js.map +1 -0
- package/dist/api/admin/mutation-gql.d.ts +6 -0
- package/dist/api/admin/mutation-gql.js +40 -0
- package/dist/api/admin/mutation-gql.js.map +1 -0
- package/dist/api/admin/mutation.d.ts +41 -0
- package/dist/api/admin/mutation.js +268 -0
- package/dist/api/admin/mutation.js.map +1 -0
- package/dist/api/admin/query-gql.d.ts +6 -0
- package/dist/api/admin/query-gql.js +34 -0
- package/dist/api/admin/query-gql.js.map +1 -0
- package/dist/api/admin/query.d.ts +33 -0
- package/dist/api/admin/query.js +205 -0
- package/dist/api/admin/query.js.map +1 -0
- package/dist/api/base.d.ts +44 -0
- package/dist/api/base.js +181 -0
- package/dist/api/base.js.map +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.js +15 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/oauth/index.d.ts +11 -0
- package/dist/api/oauth/index.js +100 -0
- package/dist/api/oauth/index.js.map +1 -0
- package/dist/api/oauth/models.d.ts +35 -0
- package/dist/api/oauth/models.js +23 -0
- package/dist/api/oauth/models.js.map +1 -0
- package/dist/globals/constants.d.ts +13 -0
- package/dist/globals/constants.js +15 -0
- package/dist/globals/constants.js.map +1 -0
- package/dist/globals/index.d.ts +1 -0
- package/dist/globals/index.js +14 -0
- package/dist/globals/index.js.map +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.js +14 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/webhook-validate.d.ts +1 -0
- package/dist/helpers/webhook-validate.js +67 -0
- package/dist/helpers/webhook-validate.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/models/base.d.ts +7 -0
- package/dist/models/base.js +3 -0
- package/dist/models/base.js.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +14 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/webhook/index.d.ts +1 -0
- package/dist/models/webhook/index.js +14 -0
- package/dist/models/webhook/index.js.map +1 -0
- package/dist/models/webhook/models.d.ts +68 -0
- package/dist/models/webhook/models.js +19 -0
- package/dist/models/webhook/models.js.map +1 -0
- package/dist/models/webhook/product.d.ts +19 -0
- package/dist/models/webhook/product.js +3 -0
- package/dist/models/webhook/product.js.map +1 -0
- package/package.json +51 -0
- package/src/api/admin/admin-client.ts +15 -0
- package/src/api/admin/common-gql.ts +425 -0
- package/src/api/admin/generated/index.ts +2373 -0
- package/src/api/admin/index.ts +4 -0
- package/src/api/admin/mutation-gql.ts +255 -0
- package/src/api/admin/mutation.ts +195 -0
- package/src/api/admin/query-gql.ts +434 -0
- package/src/api/admin/query.ts +119 -0
- package/src/api/base.ts +133 -0
- package/src/api/index.ts +2 -0
- package/src/api/oauth/index.ts +47 -0
- package/src/api/oauth/models.ts +37 -0
- package/src/globals/constants.ts +19 -0
- package/src/globals/index.ts +1 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/webhook-validate.ts +17 -0
- package/src/index.ts +34 -0
- package/src/models/base.ts +7 -0
- package/src/models/index.ts +1 -0
- package/src/models/webhook/index.ts +1 -0
- package/src/models/webhook/models.ts +90 -0
- package/tsconfig.json +25 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ikas = void 0;
|
|
14
|
+
var api_1 = require("./api");
|
|
15
|
+
var globals_1 = require("./globals");
|
|
16
|
+
__exportStar(require("./api"), exports);
|
|
17
|
+
__exportStar(require("./globals"), exports);
|
|
18
|
+
__exportStar(require("./helpers"), exports);
|
|
19
|
+
__exportStar(require("./models"), exports);
|
|
20
|
+
var ikas = /** @class */ (function () {
|
|
21
|
+
function ikas(props) {
|
|
22
|
+
this.config = new globals_1.IkasConfig(props);
|
|
23
|
+
this.adminApi = new api_1.ikasAdminGraphQLAPIClient({
|
|
24
|
+
accessToken: props.accessToken,
|
|
25
|
+
graphApiUrl: this.config.adminApiUrl,
|
|
26
|
+
tokenData: props.tokenData,
|
|
27
|
+
onCheckToken: props.onCheckToken,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return ikas;
|
|
31
|
+
}());
|
|
32
|
+
exports.ikas = ikas;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6BAAkD;AAClD,qCAAuC;AAGvC,wCAAsB;AACtB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AAYzB;IAIE,cAAY,KAA0B;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,oBAAU,CAAC,KAAK,CAAC,CAAC;QAEpC,IAAI,CAAC,QAAQ,GAAG,IAAI,+BAAyB,CAAC;YAC5C,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;YACpC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;IACL,CAAC;IACH,WAAC;AAAD,CAAC,AAdD,IAcC;AAdY,oBAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/models/base.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './webhook';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./webhook"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './models';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./models"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/webhook/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Category, Customer, MerchantAppPaymentStatusEnum, MerchantAppPaymentTypeEnum, MerchantAppSubscription, MerchantLicenceStatusEnum, Order, Product, ProductAttribute, ProductAttributeOption, ProductAttributeValue, ProductBrand, ProductStockLocation, ProductTag, ProductVariantType, Variant, VariantType } from '../../api';
|
|
2
|
+
export declare enum WebhookScope {
|
|
3
|
+
ORDER_CREATED = "store/order/created",
|
|
4
|
+
ORDER_UPDATED = "store/order/updated",
|
|
5
|
+
PRODUCT_CREATED = "store/product/created",
|
|
6
|
+
PRODUCT_UPDATED = "store/product/updated",
|
|
7
|
+
CUSTOMER_CREATED = "store/customer/created",
|
|
8
|
+
CUSTOMER_UPDATED = "store/customer/updated",
|
|
9
|
+
CUSTOMER_FAVORITE_PRODUCTS_CREATED = "store/customerFavoriteProducts/created",
|
|
10
|
+
CUSTOMER_FAVORITE_PRODUCTS_UPDATED = "store/customerFavoriteProducts/updated",
|
|
11
|
+
STOCK_CREATED = "store/stock/created",
|
|
12
|
+
STOCK_UPDATED = "store/stock/updated",
|
|
13
|
+
APP_DELETED = "store/app/deleted",
|
|
14
|
+
APP_PAYMENT = "store/app/payment"
|
|
15
|
+
}
|
|
16
|
+
export interface IkasWebhook {
|
|
17
|
+
id: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
scope: string;
|
|
20
|
+
merchantId: string;
|
|
21
|
+
data: string;
|
|
22
|
+
signature: string;
|
|
23
|
+
authorizedAppId: string;
|
|
24
|
+
}
|
|
25
|
+
interface IWebhookProductAttributeValue extends ProductAttributeValue {
|
|
26
|
+
productAttribute?: ProductAttribute | null;
|
|
27
|
+
productAttributeOption?: ProductAttributeOption | null;
|
|
28
|
+
}
|
|
29
|
+
interface IWebhookProductVariantType extends ProductVariantType {
|
|
30
|
+
variantType: VariantType;
|
|
31
|
+
}
|
|
32
|
+
interface IWebhookVariant extends Variant {
|
|
33
|
+
attributes?: IWebhookProductAttributeValue[] | null;
|
|
34
|
+
}
|
|
35
|
+
export interface IWebhookProduct extends Product {
|
|
36
|
+
productVariantTypes?: IWebhookProductVariantType[] | null;
|
|
37
|
+
variants: IWebhookVariant[];
|
|
38
|
+
attributes?: IWebhookProductAttributeValue[] | null;
|
|
39
|
+
tags?: ProductTag[] | null;
|
|
40
|
+
brand?: ProductBrand | null;
|
|
41
|
+
categories?: Category[] | null;
|
|
42
|
+
}
|
|
43
|
+
export interface IWebhookOrder extends Order {
|
|
44
|
+
}
|
|
45
|
+
export interface IWebhookCustomer extends Customer {
|
|
46
|
+
}
|
|
47
|
+
export interface IWebhookStock extends ProductStockLocation {
|
|
48
|
+
}
|
|
49
|
+
export declare type IWebhookStoreAppPaymentData = {
|
|
50
|
+
merchantAppPayment: {
|
|
51
|
+
_id: string;
|
|
52
|
+
appPaymentKey: string;
|
|
53
|
+
name: string;
|
|
54
|
+
type: MerchantAppPaymentTypeEnum;
|
|
55
|
+
status: MerchantAppPaymentStatusEnum;
|
|
56
|
+
paymentDate?: Date | null;
|
|
57
|
+
error?: string | null;
|
|
58
|
+
};
|
|
59
|
+
merchantLicence: {
|
|
60
|
+
licenceActivationDate?: Date | null;
|
|
61
|
+
fromDate?: Date | null;
|
|
62
|
+
toDate?: Date | null;
|
|
63
|
+
status: MerchantLicenceStatusEnum;
|
|
64
|
+
statusUpdatedAt: Date | null;
|
|
65
|
+
appSubscription?: MerchantAppSubscription[] | null;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebhookScope = void 0;
|
|
4
|
+
var WebhookScope;
|
|
5
|
+
(function (WebhookScope) {
|
|
6
|
+
WebhookScope["ORDER_CREATED"] = "store/order/created";
|
|
7
|
+
WebhookScope["ORDER_UPDATED"] = "store/order/updated";
|
|
8
|
+
WebhookScope["PRODUCT_CREATED"] = "store/product/created";
|
|
9
|
+
WebhookScope["PRODUCT_UPDATED"] = "store/product/updated";
|
|
10
|
+
WebhookScope["CUSTOMER_CREATED"] = "store/customer/created";
|
|
11
|
+
WebhookScope["CUSTOMER_UPDATED"] = "store/customer/updated";
|
|
12
|
+
WebhookScope["CUSTOMER_FAVORITE_PRODUCTS_CREATED"] = "store/customerFavoriteProducts/created";
|
|
13
|
+
WebhookScope["CUSTOMER_FAVORITE_PRODUCTS_UPDATED"] = "store/customerFavoriteProducts/updated";
|
|
14
|
+
WebhookScope["STOCK_CREATED"] = "store/stock/created";
|
|
15
|
+
WebhookScope["STOCK_UPDATED"] = "store/stock/updated";
|
|
16
|
+
WebhookScope["APP_DELETED"] = "store/app/deleted";
|
|
17
|
+
WebhookScope["APP_PAYMENT"] = "store/app/payment";
|
|
18
|
+
})(WebhookScope = exports.WebhookScope || (exports.WebhookScope = {}));
|
|
19
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/webhook/models.ts"],"names":[],"mappings":";;;AAoBA,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,qDAAqC,CAAA;IACrC,qDAAqC,CAAA;IACrC,yDAAyC,CAAA;IACzC,yDAAyC,CAAA;IACzC,2DAA2C,CAAA;IAC3C,2DAA2C,CAAA;IAC3C,6FAA6E,CAAA;IAC7E,6FAA6E,CAAA;IAC7E,qDAAqC,CAAA;IACrC,qDAAqC,CAAA;IACrC,iDAAiC,CAAA;IACjC,iDAAiC,CAAA;AACnC,CAAC,EAbW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAavB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Category, Product, ProductAttribute, ProductAttributeOption, ProductAttributeValue, ProductBrand, ProductTag, ProductVariantType, Variant, VariantType } from '../../api/admin/generated';
|
|
2
|
+
export interface IWebhookProductAttributeValue extends ProductAttributeValue {
|
|
3
|
+
productAttribute?: ProductAttribute | null;
|
|
4
|
+
productAttributeOption?: ProductAttributeOption | null;
|
|
5
|
+
}
|
|
6
|
+
export interface IWebhookProductVariantType extends ProductVariantType {
|
|
7
|
+
variantType: VariantType;
|
|
8
|
+
}
|
|
9
|
+
export interface IWebhookVariant extends Variant {
|
|
10
|
+
attributes?: IWebhookProductAttributeValue[] | null;
|
|
11
|
+
}
|
|
12
|
+
export interface IWebhookProduct extends Product {
|
|
13
|
+
productVariantTypes?: IWebhookProductVariantType[] | null;
|
|
14
|
+
variants: IWebhookVariant[];
|
|
15
|
+
attributes?: IWebhookProductAttributeValue[] | null;
|
|
16
|
+
tags?: ProductTag[] | null;
|
|
17
|
+
brand?: ProductBrand | null;
|
|
18
|
+
categories?: Category[] | null;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/models/webhook/product.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ikas/api-client",
|
|
3
|
+
"version": "0.0.1-canary.3",
|
|
4
|
+
"description": "ikas public node api client for store apps and private apps",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"author": "ikas",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ikas",
|
|
14
|
+
"graphql",
|
|
15
|
+
"Public API"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"axios": "^0.24.0",
|
|
19
|
+
"graphql": "^16.0.1",
|
|
20
|
+
"graphql-request": "^3.6.1",
|
|
21
|
+
"qs": "^6.10.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@graphql-codegen/cli": "^2.3.0",
|
|
25
|
+
"@graphql-codegen/typescript": "^2.4.1",
|
|
26
|
+
"@types/qs": "^6.9.7",
|
|
27
|
+
"git-branch-is": "^4.0.0",
|
|
28
|
+
"husky": "4.3.8",
|
|
29
|
+
"prettier": "^2.4.1",
|
|
30
|
+
"typescript": "^4.5.2"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "npx tsc",
|
|
34
|
+
"generate:admin": "graphql-codegen --config codegen/admin.yml",
|
|
35
|
+
"version:patch": "npm --no-git-tag-version version patch && git add .",
|
|
36
|
+
"version:canary": "npm --no-git-tag-version version prerelease --preid=canary && git add ."
|
|
37
|
+
},
|
|
38
|
+
"husky": {
|
|
39
|
+
"hooks": {
|
|
40
|
+
"pre-commit": "git-branch-is main && yarn version:patch || (git-branch-is development && yarn version:canary)"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"prettier": {
|
|
44
|
+
"semi": true,
|
|
45
|
+
"trailingComma": "all",
|
|
46
|
+
"singleQuote": true,
|
|
47
|
+
"printWidth": 150,
|
|
48
|
+
"tabWidth": 2,
|
|
49
|
+
"bracketSpacing": true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseGraphQLAPIClient, BaseGraphQLAPIClientOptions } from '../base';
|
|
2
|
+
import { AdminQuery } from './query';
|
|
3
|
+
import { AdminMutation } from './mutation';
|
|
4
|
+
|
|
5
|
+
export class ikasAdminGraphQLAPIClient<TokenData> extends BaseGraphQLAPIClient<TokenData> {
|
|
6
|
+
queries: AdminQuery;
|
|
7
|
+
mutations: AdminMutation;
|
|
8
|
+
|
|
9
|
+
constructor(options: BaseGraphQLAPIClientOptions<TokenData>) {
|
|
10
|
+
super(options);
|
|
11
|
+
|
|
12
|
+
this.queries = new AdminQuery(this);
|
|
13
|
+
this.mutations = new AdminMutation(this);
|
|
14
|
+
}
|
|
15
|
+
}
|