@ikas/api-client 0.0.1-canary.5 → 1.0.1-alpha.1

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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/api/admin/admin-client.d.ts +10 -0
  4. package/dist/api/admin/admin-client.js +35 -0
  5. package/dist/api/admin/admin-client.js.map +1 -0
  6. package/dist/api/admin/common-gql.d.ts +4 -0
  7. package/dist/api/admin/common-gql.js +14 -0
  8. package/dist/api/admin/common-gql.js.map +1 -0
  9. package/dist/api/admin/generated/index.d.ts +3008 -0
  10. package/dist/api/admin/generated/index.js +319 -0
  11. package/dist/api/admin/generated/index.js.map +1 -0
  12. package/{src/api/admin/index.ts → dist/api/admin/index.d.ts} +0 -0
  13. package/dist/api/admin/index.js +17 -0
  14. package/dist/api/admin/index.js.map +1 -0
  15. package/dist/api/admin/mutation-gql.d.ts +6 -0
  16. package/dist/api/admin/mutation-gql.js +40 -0
  17. package/dist/api/admin/mutation-gql.js.map +1 -0
  18. package/dist/api/admin/mutation.d.ts +41 -0
  19. package/dist/api/admin/mutation.js +268 -0
  20. package/dist/api/admin/mutation.js.map +1 -0
  21. package/dist/api/admin/query-gql.d.ts +6 -0
  22. package/dist/api/admin/query-gql.js +39 -0
  23. package/dist/api/admin/query-gql.js.map +1 -0
  24. package/dist/api/admin/query.d.ts +38 -0
  25. package/dist/api/admin/query.js +220 -0
  26. package/dist/api/admin/query.js.map +1 -0
  27. package/dist/api/admin/rest.d.ts +21 -0
  28. package/dist/api/admin/rest.js +75 -0
  29. package/dist/api/admin/rest.js.map +1 -0
  30. package/dist/api/base.d.ts +47 -0
  31. package/dist/api/base.js +182 -0
  32. package/dist/api/base.js.map +1 -0
  33. package/{src/api/index.ts → dist/api/index.d.ts} +0 -0
  34. package/dist/api/index.js +15 -0
  35. package/dist/api/index.js.map +1 -0
  36. package/dist/api/oauth/index.d.ts +12 -0
  37. package/dist/api/oauth/index.js +111 -0
  38. package/dist/api/oauth/index.js.map +1 -0
  39. package/dist/api/oauth/models.d.ts +40 -0
  40. package/dist/api/oauth/models.js +23 -0
  41. package/dist/api/oauth/models.js.map +1 -0
  42. package/dist/globals/constants.d.ts +22 -0
  43. package/dist/globals/constants.js +25 -0
  44. package/dist/globals/constants.js.map +1 -0
  45. package/{src/globals/index.ts → dist/globals/index.d.ts} +0 -0
  46. package/dist/globals/index.js +14 -0
  47. package/dist/globals/index.js.map +1 -0
  48. package/dist/helpers/index.d.ts +1 -0
  49. package/dist/helpers/index.js +14 -0
  50. package/dist/helpers/index.js.map +1 -0
  51. package/dist/helpers/webhook-helpers.d.ts +4 -0
  52. package/dist/helpers/webhook-helpers.js +80 -0
  53. package/dist/helpers/webhook-helpers.js.map +1 -0
  54. package/dist/index.d.ts +21 -0
  55. package/dist/index.js +33 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/models/base.d.ts +7 -0
  58. package/dist/models/base.js +3 -0
  59. package/dist/models/base.js.map +1 -0
  60. package/{src/models/index.ts → dist/models/index.d.ts} +0 -0
  61. package/dist/models/index.js +14 -0
  62. package/dist/models/index.js.map +1 -0
  63. package/{src/models/webhook/index.ts → dist/models/webhook/index.d.ts} +0 -0
  64. package/dist/models/webhook/index.js +14 -0
  65. package/dist/models/webhook/index.js.map +1 -0
  66. package/dist/models/webhook/models.d.ts +69 -0
  67. package/dist/models/webhook/models.js +19 -0
  68. package/dist/models/webhook/models.js.map +1 -0
  69. package/package.json +6 -5
  70. package/Jenkinsfile +0 -92
  71. package/codegen/admin.yml +0 -9
  72. package/src/api/admin/admin-client.ts +0 -15
  73. package/src/api/admin/common-gql.ts +0 -425
  74. package/src/api/admin/generated/index.ts +0 -2706
  75. package/src/api/admin/mutation-gql.ts +0 -255
  76. package/src/api/admin/mutation.ts +0 -195
  77. package/src/api/admin/query-gql.ts +0 -434
  78. package/src/api/admin/query.ts +0 -144
  79. package/src/api/base.ts +0 -134
  80. package/src/api/oauth/index.ts +0 -47
  81. package/src/api/oauth/models.ts +0 -37
  82. package/src/globals/constants.ts +0 -19
  83. package/src/helpers/index.ts +0 -1
  84. package/src/helpers/webhook-validate.ts +0 -17
  85. package/src/index.ts +0 -34
  86. package/src/models/base.ts +0 -7
  87. package/src/models/webhook/models.ts +0 -90
  88. package/tsconfig.json +0 -25
@@ -0,0 +1 @@
1
+ export * from './webhook-helpers';
@@ -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-helpers"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC"}
@@ -0,0 +1,4 @@
1
+ import { IkasWebhook, IWebhookData } from '../models';
2
+ export declare const validateIkasWebhookMiddleware: (clientSecret: string) => (req: any, res: any, next: () => any) => Promise<void>;
3
+ export declare function validateIkasWebhookSignature(data: IkasWebhook, clientSecret: string): boolean;
4
+ export declare function getParsedIkasWebhookData(data: IkasWebhook, clientSecret: string): IWebhookData;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.getParsedIkasWebhookData = exports.validateIkasWebhookSignature = exports.validateIkasWebhookMiddleware = void 0;
43
+ var crypto_1 = __importDefault(require("crypto"));
44
+ var validateIkasWebhookMiddleware = function (clientSecret) { return function (req, res, next) { return __awaiter(void 0, void 0, void 0, function () {
45
+ var data;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0:
49
+ data = req.body;
50
+ if (!validateIkasWebhookSignature(data, clientSecret)) return [3 /*break*/, 2];
51
+ return [4 /*yield*/, next()];
52
+ case 1:
53
+ _a.sent();
54
+ return [3 /*break*/, 3];
55
+ case 2:
56
+ res.status(401).send({ message: 'invalid signature', statusCode: 401 });
57
+ _a.label = 3;
58
+ case 3: return [2 /*return*/];
59
+ }
60
+ });
61
+ }); }; };
62
+ exports.validateIkasWebhookMiddleware = validateIkasWebhookMiddleware;
63
+ function validateIkasWebhookSignature(data, clientSecret) {
64
+ var generatedHash = crypto_1.default
65
+ .createHmac('sha256', clientSecret || '')
66
+ .update(data.data, 'utf8')
67
+ .digest('hex');
68
+ return generatedHash === data.signature;
69
+ }
70
+ exports.validateIkasWebhookSignature = validateIkasWebhookSignature;
71
+ function getParsedIkasWebhookData(data, clientSecret) {
72
+ if (validateIkasWebhookSignature(data, clientSecret)) {
73
+ return JSON.parse(data.data);
74
+ }
75
+ else {
76
+ throw new Error('invalid signature');
77
+ }
78
+ }
79
+ exports.getParsedIkasWebhookData = getParsedIkasWebhookData;
80
+ //# sourceMappingURL=webhook-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-helpers.js","sourceRoot":"","sources":["../../src/helpers/webhook-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAA4B;AAErB,IAAM,6BAA6B,GAAG,UAAC,YAAoB,IAAK,OAAA,UAAO,GAAQ,EAAE,GAAQ,EAAE,IAAe;;;;;gBACzG,IAAI,GAAgB,GAAG,CAAC,IAAI,CAAC;qBAE/B,4BAA4B,CAAC,IAAI,EAAE,YAAY,CAAC,EAAhD,wBAAgD;gBAClD,qBAAM,IAAI,EAAE,EAAA;;gBAAZ,SAAY,CAAC;;;gBAEb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;;;;;KAE3E,EARsE,CAQtE,CAAC;AARW,QAAA,6BAA6B,iCAQxC;AAEF,SAAgB,4BAA4B,CAAC,IAAiB,EAAE,YAAoB;IAClF,IAAM,aAAa,GAAG,gBAAM;SACzB,UAAU,CAAC,QAAQ,EAAE,YAAY,IAAI,EAAE,CAAC;SACxC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;SACzB,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjB,OAAO,aAAa,KAAK,IAAI,CAAC,SAAS,CAAA;AACzC,CAAC;AAPD,oEAOC;AAGD,SAAgB,wBAAwB,CAAC,IAAiB,EAAE,YAAoB;IAE9E,IAAG,4BAA4B,CAAC,IAAI,EAAE,YAAY,CAAC,EAAC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KAC7B;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;KACrC;AACH,CAAC;AAPD,4DAOC"}
@@ -0,0 +1,21 @@
1
+ import { ikasAdminGraphQLAPIClient } from './api';
2
+ import { IkasConfig } from './globals';
3
+ import { OnCheckTokenCallback } from './api/base';
4
+ export * from './api';
5
+ export * from './globals';
6
+ export * from './helpers';
7
+ export * from './models';
8
+ declare type AppProps<TokenData> = {
9
+ clientId: string;
10
+ clientSecret: string;
11
+ accessToken: string;
12
+ apiVersion?: 'v1';
13
+ tokenData?: TokenData;
14
+ onCheckToken?: OnCheckTokenCallback<TokenData>;
15
+ [p: string]: any;
16
+ };
17
+ export declare class ikas<TokenData> {
18
+ adminApi: ikasAdminGraphQLAPIClient<TokenData>;
19
+ config: IkasConfig;
20
+ constructor(props: AppProps<TokenData>);
21
+ }
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,7 @@
1
+ export interface IBaseModelWithIdAndDates {
2
+ id: string;
3
+ createdAt?: Date | null;
4
+ updatedAt?: Date | null;
5
+ merchantId?: string | null;
6
+ deleted?: boolean | null;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/models/base.ts"],"names":[],"mappings":""}
File without changes
@@ -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,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,69 @@
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 declare type IWebhookData = IWebhookOrder | IWebhookCustomer | IWebhookStock | IWebhookStoreAppPaymentData | IWebhookProduct;
69
+ 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"}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@ikas/api-client",
3
- "version": "0.0.1-canary.5",
3
+ "version": "1.0.1-alpha.1",
4
4
  "description": "ikas public node api client for store apps and private apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
7
10
  "author": "ikas",
8
11
  "license": "MIT",
9
12
  "publishConfig": {
@@ -33,13 +36,11 @@
33
36
  "build": "npx tsc",
34
37
  "generate:admin": "graphql-codegen --config codegen/admin.yml",
35
38
  "version:patch": "yarn build && npm --no-git-tag-version version patch && git add .",
36
- "version:canary": "yarn build && npm --no-git-tag-version version prerelease --preid=canary && git add .",
37
- "publish:patch": "yarn version:patch && npm publish --access public --tag latest",
38
- "publish:canary": "npm publish --access restricted --tag canary"
39
+ "version:alpha": "yarn build && npm --no-git-tag-version version prerelease --preid=alpha && git add ."
39
40
  },
40
41
  "husky": {
41
42
  "hooks": {
42
- "pre-commit": "git-branch-is main && yarn version:patch || (git-branch-is development && yarn version:canary)"
43
+ "pre-commit": "yarn build && git-branch-is development && yarn version:alpha || true"
43
44
  }
44
45
  },
45
46
  "prettier": {
package/Jenkinsfile DELETED
@@ -1,92 +0,0 @@
1
- @NonCPS
2
- def getChangeString() {
3
- MAX_MSG_LEN = 100
4
- def changeString = ""
5
- echo "Gathering SCM changes"
6
- def changeLogSets = currentBuild.changeSets
7
- for (int i = 0; i < changeLogSets.size(); i++) {
8
- def entries = changeLogSets[i].items
9
- for (int j = 0; j < entries.length; j++) {
10
- def entry = entries[j]
11
- truncated_msg = entry.msg.take(MAX_MSG_LEN)
12
- changeString += " - ${truncated_msg} [${entry.author}]\n"
13
- }
14
- }
15
- if (!changeString) {
16
- changeString = " - No new changes"
17
- }
18
- return changeString
19
- }
20
-
21
- pipeline {
22
- agent any
23
- stages {
24
- stage("Load Env") {
25
- steps {
26
- script {
27
- switch(env.BRANCH_NAME) {
28
- case 'development':
29
- env.NPM_VARS='--access restricted --tag canary'
30
- break
31
- case "main":
32
- env.NPM_VARS='--access public --tag latest'
33
- break
34
- default:
35
- println("Branch value error: " + env.BRANCH_NAME)
36
- currentBuild.getRawBuild().getExecutor().interrupt(Result.FAILURE)
37
- }
38
- }
39
- sh 'printenv'
40
- }
41
- }
42
-
43
- stage('Startup') {
44
- steps {
45
- buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
46
- slackSend (channel: 'v2-build-notifications',
47
- color: 'good',
48
- message: "The pipeline ${currentBuild.fullDisplayName} is started. Changes:\n " + getChangeString())
49
- script {
50
- sh '''yarn install'''
51
- }
52
- }
53
- }
54
- stage('Build') {
55
- steps {
56
- sh 'yarn build'
57
- }
58
- }
59
-
60
- stage('Publish') {
61
- steps {
62
- withCredentials([string(credentialsId: 'NPM_TOKEN', variable: 'NPM_TOKEN')]) {
63
- sh '''
64
- npm config set //registry.npmjs.org/:_authToken ${env.NPM_TOKEN}
65
- npm publish ${env.NPM_VARS}'''
66
- }
67
- }
68
- }
69
- }
70
-
71
- post {
72
- success {
73
- slackSend (channel: 'v2-build-notifications',
74
- color: 'good',
75
- message: "The pipeline ${currentBuild.fullDisplayName} is success.")
76
- }
77
- failure {
78
- slackSend (channel: 'v2-build-failures',
79
- color: 'danger',
80
- message: "The pipeline ${currentBuild.fullDisplayName} failed.")
81
- }
82
- fixed {
83
- slackSend (channel: 'v2-build-failures',
84
- color: 'good',
85
- message: "The pipeline ${currentBuild.fullDisplayName} back to normal.")
86
- }
87
- }
88
- triggers {
89
- pollSCM('* * * * *')
90
- }
91
- options { disableConcurrentBuilds() }
92
- }
package/codegen/admin.yml DELETED
@@ -1,9 +0,0 @@
1
- overwrite: true
2
- schema: "https://api.myikas.dev/api/v1/admin/graphql"
3
- documents: null
4
- generates:
5
- src/api/admin/generated/index.ts:
6
- plugins:
7
- - "typescript"
8
- config:
9
- namingConvention: keep
@@ -1,15 +0,0 @@
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
- }