@or-sdk/tickets 1.0.1-320.0
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/dist/cjs/Tickets.js +81 -0
- package/dist/cjs/Tickets.js.map +1 -0
- package/dist/cjs/constants.js +5 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/Tickets.js +31 -0
- package/dist/esm/Tickets.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/Tickets.d.ts +6 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types.d.ts +17 -0
- package/package.json +28 -0
- package/src/Tickets.ts +36 -0
- package/src/constants.ts +1 -0
- package/src/index.ts +2 -0
- package/src/types.ts +27 -0
- package/tsconfig.esm.json +9 -0
- package/tsconfig.json +7 -0
- package/tsconfig.types.json +9 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.Tickets = void 0;
|
|
55
|
+
var base_1 = require("@or-sdk/base");
|
|
56
|
+
var constants_1 = require("./constants");
|
|
57
|
+
var Tickets = (function (_super) {
|
|
58
|
+
__extends(Tickets, _super);
|
|
59
|
+
function Tickets(params) {
|
|
60
|
+
var token = params.token, serviceUrl = params.serviceUrl;
|
|
61
|
+
return _super.call(this, {
|
|
62
|
+
token: token,
|
|
63
|
+
serviceUrl: serviceUrl,
|
|
64
|
+
serviceKey: constants_1.SERVICE_KEY,
|
|
65
|
+
}) || this;
|
|
66
|
+
}
|
|
67
|
+
Tickets.prototype.createType = function (data) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
return [2, this.callApi({
|
|
71
|
+
method: 'POST',
|
|
72
|
+
route: '/v2/ticket/types',
|
|
73
|
+
data: data,
|
|
74
|
+
})];
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return Tickets;
|
|
79
|
+
}(base_1.Base));
|
|
80
|
+
exports.Tickets = Tickets;
|
|
81
|
+
//# sourceMappingURL=Tickets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tickets.js","sourceRoot":"","sources":["../../src/Tickets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAEpC,yCAA0C;AAS1C;IAA6B,2BAAI;IAO/B,iBAAY,MAAqB;QACvB,IAAA,KAAK,GAAiB,MAAM,MAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;eAErC,kBAAM;YACJ,KAAK,OAAA;YACL,UAAU,YAAA;YACV,UAAU,EAAE,uBAAW;SACxB,CAAC;IACJ,CAAC;IAEK,4BAAU,GAAhB,UAAiB,IAAuB;;;gBACtC,WAAO,IAAI,CAAC,OAAO,CAAC;wBAClB,MAAM,EAAE,MAAM;wBACd,KAAK,EAAE,kBAAkB;wBACzB,IAAI,MAAA;qBACL,CAAC,EAAC;;;KACJ;IACH,cAAC;AAAD,CAAC,AAxBD,CAA6B,WAAI,GAwBhC;AAxBY,0BAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Tickets = void 0;
|
|
18
|
+
var Tickets_1 = require("./Tickets");
|
|
19
|
+
Object.defineProperty(exports, "Tickets", { enumerable: true, get: function () { return Tickets_1.Tickets; } });
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Base } from '@or-sdk/base';
|
|
11
|
+
import { SERVICE_KEY } from './constants';
|
|
12
|
+
export class Tickets extends Base {
|
|
13
|
+
constructor(params) {
|
|
14
|
+
const { token, serviceUrl } = params;
|
|
15
|
+
super({
|
|
16
|
+
token,
|
|
17
|
+
serviceUrl,
|
|
18
|
+
serviceKey: SERVICE_KEY,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
createType(data) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return this.callApi({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
route: '/v2/ticket/types',
|
|
26
|
+
data,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Tickets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tickets.js","sourceRoot":"","sources":["../../src/Tickets.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAO/B,YAAY,MAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAErC,KAAK,CAAC;YACJ,KAAK;YACL,UAAU;YACV,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;IACL,CAAC;IAEK,UAAU,CAAC,IAAuB;;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,kBAAkB;gBACzB,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVICE_KEY = "tickets-api";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Token } from '@or-sdk/base';
|
|
2
|
+
export declare type TicketsConfig = {
|
|
3
|
+
token: Token;
|
|
4
|
+
serviceUrl?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type CreateLabelOptions = {
|
|
7
|
+
label: string;
|
|
8
|
+
color: string;
|
|
9
|
+
ticketType?: string;
|
|
10
|
+
meta?: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export declare type CreateTypeOptions = {
|
|
13
|
+
label: string;
|
|
14
|
+
settings: Record<string, any>;
|
|
15
|
+
initialData: Record<string, any>;
|
|
16
|
+
systemLabels?: Pick<CreateLabelOptions, 'label' | 'color'>[];
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.1-320.0",
|
|
3
|
+
"name": "@or-sdk/tickets",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"module": "dist/esm/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "npm run clean && concurrently \"npm run build:cjs\" \"npm run build:esm\" \"npm run build:types\"",
|
|
9
|
+
"build:watch": "concurrently -r --hide 1,2 \"npm run build:watch:cjs\" \"npm run build:watch:esm\" \"npm run build:watch:types\"",
|
|
10
|
+
"build:cjs": "tsc --project tsconfig.json",
|
|
11
|
+
"build:watch:cjs": "tsc --project tsconfig.json -w",
|
|
12
|
+
"build:esm": "tsc --project tsconfig.esm.json",
|
|
13
|
+
"build:watch:esm": "tsc --project tsconfig.esm.json -w",
|
|
14
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
15
|
+
"build:watch:types": "tsc --project tsconfig.types.json -w",
|
|
16
|
+
"clean": "rm -rf ./dist"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"concurrently": "^6.4.0",
|
|
20
|
+
"typescript": "^4.4.4"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@or-sdk/base": "^0.23.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/Tickets.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Base } from '@or-sdk/base';
|
|
2
|
+
import { CreateTypeOptions, TicketsConfig } from './types';
|
|
3
|
+
import { SERVICE_KEY } from './constants';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* OneReach Tickets service client
|
|
7
|
+
* ## Installation:
|
|
8
|
+
* ```
|
|
9
|
+
* $ npm i @or-sdk/tickets
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export class Tickets extends Base {
|
|
13
|
+
/**
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { Tickets } from '@or-sdk/tickets'
|
|
16
|
+
* const tickets = new Tickets({token: 'my-account-token-string', serviceUrl: 'http://example.tickets/endpoint'});
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
constructor(params: TicketsConfig) {
|
|
20
|
+
const { token, serviceUrl } = params;
|
|
21
|
+
|
|
22
|
+
super({
|
|
23
|
+
token,
|
|
24
|
+
serviceUrl,
|
|
25
|
+
serviceKey: SERVICE_KEY,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async createType(data: CreateTypeOptions) {
|
|
30
|
+
return this.callApi({
|
|
31
|
+
method: 'POST',
|
|
32
|
+
route: '/v2/ticket/types',
|
|
33
|
+
data,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SERVICE_KEY = 'tickets-api';
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Token } from '@or-sdk/base';
|
|
2
|
+
|
|
3
|
+
export type TicketsConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* token
|
|
6
|
+
*/
|
|
7
|
+
token: Token;
|
|
8
|
+
/**
|
|
9
|
+
* Direct service url, can be used to avoid discovery api call
|
|
10
|
+
*/
|
|
11
|
+
serviceUrl?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export type CreateLabelOptions = {
|
|
16
|
+
label: string;
|
|
17
|
+
color: string;
|
|
18
|
+
ticketType?: string;
|
|
19
|
+
meta?: Record<string, any>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CreateTypeOptions = {
|
|
23
|
+
label: string;
|
|
24
|
+
settings: Record<string, any>;
|
|
25
|
+
initialData: Record<string, any>;
|
|
26
|
+
systemLabels?: Pick<CreateLabelOptions, 'label' | 'color'>[];
|
|
27
|
+
};
|
package/tsconfig.json
ADDED