couchset 0.0.18 → 0.2.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.
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +1 -3
- package/dist/config/index.js.map +1 -1
- package/dist/connection.d.ts +1 -1
- package/dist/connection.js +5 -26
- package/dist/connection.js.map +1 -1
- package/dist/couchbase.d.ts +2 -0
- package/dist/couchbase.js +13 -0
- package/dist/couchbase.js.map +1 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/model/index.d.ts +1 -8
- package/dist/model/index.js +1 -10
- package/dist/model/index.js.map +1 -1
- package/dist/query/query.cluster.d.ts +1 -1
- package/dist/query/query.cluster.js.map +1 -1
- package/dist/shared/common.model.d.ts +0 -28
- package/dist/shared/common.model.js +2 -78
- package/dist/shared/common.model.js.map +1 -1
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/index.js +0 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/utils/edge.d.ts +1 -0
- package/dist/utils/edge.js +16 -0
- package/dist/utils/edge.js.map +1 -0
- package/dist/utils/log.js +1 -2
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/text.utils.d.ts +0 -6
- package/dist/utils/text.utils.js +1 -12
- package/dist/utils/text.utils.js.map +1 -1
- package/package.json +8 -17
- package/dist/automate/index.d.ts +0 -4
- package/dist/automate/index.js +0 -21
- package/dist/automate/index.js.map +0 -1
- package/dist/automate/middlewares/blankMiddleware.d.ts +0 -8
- package/dist/automate/middlewares/blankMiddleware.js +0 -16
- package/dist/automate/middlewares/blankMiddleware.js.map +0 -1
- package/dist/automate/middlewares/index.d.ts +0 -2
- package/dist/automate/middlewares/index.js +0 -19
- package/dist/automate/middlewares/index.js.map +0 -1
- package/dist/automate/middlewares/isAuth.d.ts +0 -8
- package/dist/automate/middlewares/isAuth.js +0 -29
- package/dist/automate/middlewares/isAuth.js.map +0 -1
- package/dist/automate/model/client.d.ts +0 -12
- package/dist/automate/model/client.js +0 -33
- package/dist/automate/model/client.js.map +0 -1
- package/dist/automate/model/index.d.ts +0 -47
- package/dist/automate/model/index.js +0 -341
- package/dist/automate/model/index.js.map +0 -1
- package/dist/automate/morpheus/index.d.ts +0 -14
- package/dist/automate/morpheus/index.js +0 -171
- package/dist/automate/morpheus/index.js.map +0 -1
- package/dist/automate/writer/index.d.ts +0 -10
- package/dist/automate/writer/index.js +0 -72
- package/dist/automate/writer/index.js.map +0 -1
- package/dist/shared/ContextType.d.ts +0 -27
- package/dist/shared/ContextType.js +0 -55
- package/dist/shared/ContextType.js.map +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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 __rest = (this && this.__rest) || function (s, e) {
|
|
39
|
-
var t = {};
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
41
|
-
t[p] = s[p];
|
|
42
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
43
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
44
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
45
|
-
t[p[i]] = s[p[i]];
|
|
46
|
-
}
|
|
47
|
-
return t;
|
|
48
|
-
};
|
|
49
|
-
var __values = (this && this.__values) || function(o) {
|
|
50
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
51
|
-
if (m) return m.call(o);
|
|
52
|
-
if (o && typeof o.length === "number") return {
|
|
53
|
-
next: function () {
|
|
54
|
-
if (o && i >= o.length) o = void 0;
|
|
55
|
-
return { value: o && o[i++], done: !o };
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
59
|
-
};
|
|
60
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
61
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
62
|
-
};
|
|
63
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
|
-
exports.writeAllClientSchemas = void 0;
|
|
65
|
-
/**
|
|
66
|
-
* Define all models that should be morphed
|
|
67
|
-
*/
|
|
68
|
-
var ts_morph_1 = require("ts-morph");
|
|
69
|
-
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
70
|
-
var utils_1 = require("../../utils");
|
|
71
|
-
var writer_1 = require("../writer");
|
|
72
|
-
var config_1 = require("../../config");
|
|
73
|
-
/**
|
|
74
|
-
* Morpheus in actions
|
|
75
|
-
*/
|
|
76
|
-
var writeAllClientSchemas = function (_a) {
|
|
77
|
-
var clients = _a.clients, path = _a.path;
|
|
78
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
-
var writeFilesTasks, allFileExports;
|
|
80
|
-
return __generator(this, function (_b) {
|
|
81
|
-
switch (_b.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
if (!config_1.isDev) {
|
|
84
|
-
return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
writeFilesTasks = clients.map(function (clt) {
|
|
87
|
-
var e_1, _a;
|
|
88
|
-
var modelName = clt.name;
|
|
89
|
-
var nameSNAKE_CASE = (0, utils_1.toSnakeUpper)(modelName);
|
|
90
|
-
// write fragments and all queries
|
|
91
|
-
var _b = clt.client, FRAGMENT = _b.FRAGMENT, GET = _b.GET, PAGE = _b.PAGE, DELETE = _b.DELETE, CREATE = _b.CREATE, otherClient = __rest(_b, ["FRAGMENT", "GET", "PAGE", "DELETE", "CREATE"]);
|
|
92
|
-
var constStatements = [
|
|
93
|
-
{
|
|
94
|
-
name: "".concat(nameSNAKE_CASE, "_FRAGMENT"),
|
|
95
|
-
value: FRAGMENT,
|
|
96
|
-
leadingTrivia: "/** ".concat(nameSNAKE_CASE, " Fragment **/"),
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: "".concat(nameSNAKE_CASE, "_CREATE"),
|
|
100
|
-
value: CREATE,
|
|
101
|
-
leadingTrivia: "/** ".concat(nameSNAKE_CASE, " Create Mutation **/"),
|
|
102
|
-
},
|
|
103
|
-
{ name: "".concat(nameSNAKE_CASE, "_DELETE"), value: DELETE },
|
|
104
|
-
{ name: "".concat(nameSNAKE_CASE, "_GET"), value: GET },
|
|
105
|
-
{ name: "".concat(nameSNAKE_CASE, "_PAGE"), value: PAGE },
|
|
106
|
-
];
|
|
107
|
-
try {
|
|
108
|
-
// Add other defined queries
|
|
109
|
-
for (var _c = __values(Object.keys(otherClient)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
110
|
-
var keyQuery = _d.value;
|
|
111
|
-
if (!(0, isEmpty_1.default)(keyQuery)) {
|
|
112
|
-
constStatements.push({
|
|
113
|
-
name: keyQuery,
|
|
114
|
-
value: otherClient["".concat(keyQuery)],
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
120
|
-
finally {
|
|
121
|
-
try {
|
|
122
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
123
|
-
}
|
|
124
|
-
finally { if (e_1) throw e_1.error; }
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
filename: nameSNAKE_CASE,
|
|
128
|
-
task: (0, writer_1.writeTsFile)({
|
|
129
|
-
pathToClient: path,
|
|
130
|
-
filename: nameSNAKE_CASE,
|
|
131
|
-
variables: constStatements.map(function (con) { return ({
|
|
132
|
-
name: con.name,
|
|
133
|
-
initializer: JSON.stringify(con.value),
|
|
134
|
-
leadingTrivia: function (writer) {
|
|
135
|
-
writer.writeLine('\n');
|
|
136
|
-
if (con === null || con === void 0 ? void 0 : con.leadingTrivia) {
|
|
137
|
-
writer.writeLine(con.leadingTrivia);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
trailingTrivia: function (writer) { return writer.writeLine('\n'); },
|
|
141
|
-
}); }),
|
|
142
|
-
}),
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
// write all files
|
|
146
|
-
return [4 /*yield*/, Promise.all(writeFilesTasks.map(function (i) { return i.task; }))];
|
|
147
|
-
case 1:
|
|
148
|
-
// write all files
|
|
149
|
-
_b.sent();
|
|
150
|
-
allFileExports = writeFilesTasks
|
|
151
|
-
.map(function (i) { return i.filename; })
|
|
152
|
-
.map(function (c) { return ({
|
|
153
|
-
kind: ts_morph_1.StructureKind.ExportDeclaration,
|
|
154
|
-
// namespaceExport: "*",
|
|
155
|
-
moduleSpecifier: "./".concat(c),
|
|
156
|
-
}); });
|
|
157
|
-
// write final index file
|
|
158
|
-
return [4 /*yield*/, (0, writer_1.writeTsFile)({
|
|
159
|
-
filename: 'index',
|
|
160
|
-
exports: allFileExports,
|
|
161
|
-
})];
|
|
162
|
-
case 2:
|
|
163
|
-
// write final index file
|
|
164
|
-
_b.sent();
|
|
165
|
-
return [2 /*return*/];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
exports.writeAllClientSchemas = writeAllClientSchemas;
|
|
171
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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,GAAiC,eAAe;yBAC/D,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,QAAQ,EAAV,CAAU,CAAC;yBACtB,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC;wBACT,IAAI,EAAE,wBAAa,CAAC,iBAAiB;wBACrC,0BAA0B;wBAC1B,eAAe,EAAE,YAAK,CAAC,CAAE;qBAC5B,CAAC,EAJU,CAIV,CAAC,CAAC;oBAER,yBAAyB;oBACzB,qBAAM,IAAA,oBAAW,EAAC;4BACd,QAAQ,EAAE,OAAO;4BACjB,OAAO,EAAE,cAAc;yBAC1B,CAAC,EAAA;;oBAJF,yBAAyB;oBACzB,SAGE,CAAC;;;;;CACN,CAAC;AA5EW,QAAA,qBAAqB,yBA4EhC","sourcesContent":["/**\n * Define all models that should be morphed\n */\nimport {ExportDeclarationStructure, StructureKind} from 'ts-morph';\nimport isEmpty from 'lodash/isEmpty';\nimport {DocumentNode} from 'graphql';\n\nimport {toSnakeUpper} from '../../utils';\nimport {writeTsFile} from '../writer';\nimport {isDev} from '../../config';\n\ninterface ClientModels {\n name: string;\n client: Record<string, DocumentNode>;\n}\n\ninterface IWriteClient {\n path: string;\n clients: ClientModels[];\n}\n\n/**\n * Morpheus in actions\n */\nexport const writeAllClientSchemas = async ({clients, path}: IWriteClient): Promise<void> => {\n if (!isDev) {\n return;\n }\n // write each file\n const writeFilesTasks = clients.map((clt) => {\n const modelName = clt.name;\n const nameSNAKE_CASE = toSnakeUpper(modelName);\n\n // write fragments and all queries\n const {FRAGMENT, GET, PAGE, DELETE, CREATE, ...otherClient} = clt.client;\n\n const constStatements = [\n {\n name: `${nameSNAKE_CASE}_FRAGMENT`,\n value: FRAGMENT,\n leadingTrivia: `/** ${nameSNAKE_CASE} Fragment **/`,\n },\n {\n name: `${nameSNAKE_CASE}_CREATE`,\n value: CREATE,\n leadingTrivia: `/** ${nameSNAKE_CASE} Create Mutation **/`,\n },\n {name: `${nameSNAKE_CASE}_DELETE`, value: DELETE},\n {name: `${nameSNAKE_CASE}_GET`, value: GET},\n {name: `${nameSNAKE_CASE}_PAGE`, value: PAGE},\n ];\n\n // Add other defined queries\n for (const keyQuery of Object.keys(otherClient)) {\n if (!isEmpty(keyQuery)) {\n constStatements.push({\n name: keyQuery,\n value: (otherClient as any)[`${keyQuery}`],\n });\n }\n }\n\n return {\n filename: nameSNAKE_CASE,\n task: writeTsFile({\n pathToClient: path,\n filename: nameSNAKE_CASE,\n variables: constStatements.map((con) => ({\n name: con.name,\n initializer: JSON.stringify(con.value),\n leadingTrivia: (writer) => {\n writer.writeLine('\\n');\n\n if (con?.leadingTrivia) {\n writer.writeLine(con.leadingTrivia);\n }\n },\n trailingTrivia: (writer) => writer.writeLine('\\n'),\n })),\n }),\n };\n });\n\n // write all files\n await Promise.all(writeFilesTasks.map((i) => i.task));\n\n // write all exports\n const allFileExports: ExportDeclarationStructure[] = writeFilesTasks\n .map((i) => i.filename)\n .map((c) => ({\n kind: StructureKind.ExportDeclaration,\n // namespaceExport: \"*\",\n moduleSpecifier: `./${c}`,\n }));\n\n // write final index file\n await writeTsFile({\n filename: 'index',\n exports: allFileExports,\n });\n};\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StatementedNodeStructure, VariableDeclarationStructure, OptionalKind, InterfaceDeclarationStructure, ExportDeclarationStructure } from 'ts-morph';
|
|
2
|
-
interface WriteFileProps extends StatementedNodeStructure {
|
|
3
|
-
filename: string;
|
|
4
|
-
variables?: OptionalKind<VariableDeclarationStructure>[];
|
|
5
|
-
interfaces?: OptionalKind<InterfaceDeclarationStructure>[];
|
|
6
|
-
exports?: OptionalKind<ExportDeclarationStructure>[];
|
|
7
|
-
pathToClient?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const writeTsFile: (props: WriteFileProps) => Promise<any>;
|
|
10
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.writeTsFile = void 0;
|
|
40
|
-
var ts_morph_1 = require("ts-morph");
|
|
41
|
-
var defaultPathToTs = __dirname + '/client/';
|
|
42
|
-
var writeTsFile = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
-
var filename, variables, interfaces, exports, _a, pathToClient, project, sourceFile;
|
|
44
|
-
return __generator(this, function (_b) {
|
|
45
|
-
switch (_b.label) {
|
|
46
|
-
case 0:
|
|
47
|
-
filename = props.filename, variables = props.variables, interfaces = props.interfaces, exports = props.exports, _a = props.pathToClient, pathToClient = _a === void 0 ? defaultPathToTs : _a;
|
|
48
|
-
project = new ts_morph_1.Project({
|
|
49
|
-
tsConfigFilePath: "".concat(pathToClient, "/tsconfig.json"),
|
|
50
|
-
skipAddingFilesFromTsConfig: true,
|
|
51
|
-
});
|
|
52
|
-
sourceFile = project.createSourceFile("".concat(pathToClient, "/").concat(filename, ".ts"), {}, { overwrite: true });
|
|
53
|
-
if (variables) {
|
|
54
|
-
sourceFile.addVariableStatement({
|
|
55
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
56
|
-
isExported: true,
|
|
57
|
-
declarations: variables,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (interfaces) {
|
|
61
|
-
sourceFile.addInterfaces(interfaces);
|
|
62
|
-
}
|
|
63
|
-
if (exports) {
|
|
64
|
-
sourceFile.addExportDeclarations(exports);
|
|
65
|
-
}
|
|
66
|
-
return [4 /*yield*/, sourceFile.save()];
|
|
67
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}); };
|
|
71
|
-
exports.writeTsFile = writeTsFile;
|
|
72
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/automate/writer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAQkB;AAElB,IAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAC;AAUxC,IAAM,WAAW,GAAG,UAAO,KAAqB;;;;;gBAC5C,QAAQ,GAAoE,KAAK,SAAzE,EAAE,SAAS,GAAyD,KAAK,UAA9D,EAAE,UAAU,GAA6C,KAAK,WAAlD,EAAE,OAAO,GAAoC,KAAK,QAAzC,EAAE,KAAkC,KAAK,aAAT,EAA9B,YAAY,mBAAG,eAAe,KAAA,CAAU;gBACnF,OAAO,GAAG,IAAI,kBAAO,CAAC;oBACxB,gBAAgB,EAAE,UAAG,YAAY,mBAAgB;oBACjD,2BAA2B,EAAE,IAAI;iBACpC,CAAC,CAAC;gBAEG,UAAU,GAAG,OAAO,CAAC,gBAAgB,CACvC,UAAG,YAAY,cAAI,QAAQ,QAAK,EAChC,EAAE,EACF,EAAC,SAAS,EAAE,IAAI,EAAC,CACpB,CAAC;gBAEF,IAAI,SAAS,EAAE;oBACX,UAAU,CAAC,oBAAoB,CAAC;wBAC5B,eAAe,EAAE,kCAAuB,CAAC,KAAK;wBAC9C,UAAU,EAAE,IAAI;wBAChB,YAAY,EAAE,SAAS;qBAC1B,CAAC,CAAC;iBACN;gBAED,IAAI,UAAU,EAAE;oBACZ,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;iBACxC;gBAED,IAAI,OAAO,EAAE;oBACT,UAAU,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;iBAC7C;gBAEM,qBAAM,UAAU,CAAC,IAAI,EAAE,EAAA;oBAA9B,sBAAO,SAAuB,EAAC;;;KAClC,CAAC;AA9BW,QAAA,WAAW,eA8BtB","sourcesContent":["import {\n Project,\n StatementedNodeStructure,\n VariableDeclarationKind,\n VariableDeclarationStructure,\n OptionalKind,\n InterfaceDeclarationStructure,\n ExportDeclarationStructure,\n} from 'ts-morph';\n\nconst defaultPathToTs = __dirname + '/client/';\n\ninterface WriteFileProps extends StatementedNodeStructure {\n filename: string;\n variables?: OptionalKind<VariableDeclarationStructure>[];\n interfaces?: OptionalKind<InterfaceDeclarationStructure>[];\n exports?: OptionalKind<ExportDeclarationStructure>[];\n pathToClient?: string;\n}\n\nexport const writeTsFile = async (props: WriteFileProps): Promise<any> => {\n const {filename, variables, interfaces, exports, pathToClient = defaultPathToTs} = props;\n const project = new Project({\n tsConfigFilePath: `${pathToClient}/tsconfig.json`,\n skipAddingFilesFromTsConfig: true,\n });\n\n const sourceFile = project.createSourceFile(\n `${pathToClient}/${filename}.ts`,\n {},\n {overwrite: true}\n );\n\n if (variables) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const, // defaults to \"let\"\n isExported: true,\n declarations: variables,\n });\n }\n\n if (interfaces) {\n sourceFile.addInterfaces(interfaces);\n }\n\n if (exports) {\n sourceFile.addExportDeclarations(exports);\n }\n\n return await sourceFile.save();\n};\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Request, Response } from 'express';
|
|
2
|
-
import { RedisPubSub } from 'graphql-redis-subscriptions';
|
|
3
|
-
export interface ContextType {
|
|
4
|
-
req: Request;
|
|
5
|
-
res: Response;
|
|
6
|
-
payload?: any;
|
|
7
|
-
pubsub: RedisPubSub;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* GraphQL Types start
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* ResType
|
|
14
|
-
*/
|
|
15
|
-
export declare class ResType {
|
|
16
|
-
success: boolean;
|
|
17
|
-
message?: string;
|
|
18
|
-
data?: any;
|
|
19
|
-
}
|
|
20
|
-
export declare class GeoType {
|
|
21
|
-
lat: number;
|
|
22
|
-
lon: number;
|
|
23
|
-
}
|
|
24
|
-
export interface GeoLocationType {
|
|
25
|
-
lat: number;
|
|
26
|
-
lon: number;
|
|
27
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GeoType = exports.ResType = void 0;
|
|
13
|
-
var type_graphql_1 = require("type-graphql");
|
|
14
|
-
var graphql_type_json_1 = __importDefault(require("graphql-type-json"));
|
|
15
|
-
/**
|
|
16
|
-
* GraphQL Types start
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* ResType
|
|
20
|
-
*/
|
|
21
|
-
var ResType = /** @class */ (function () {
|
|
22
|
-
function ResType() {
|
|
23
|
-
}
|
|
24
|
-
__decorate([
|
|
25
|
-
(0, type_graphql_1.Field)(function () { return Boolean; })
|
|
26
|
-
], ResType.prototype, "success", void 0);
|
|
27
|
-
__decorate([
|
|
28
|
-
(0, type_graphql_1.Field)(function () { return String; }, { nullable: true })
|
|
29
|
-
], ResType.prototype, "message", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, type_graphql_1.Field)(function (type) { return graphql_type_json_1.default; }, { nullable: true })
|
|
32
|
-
], ResType.prototype, "data", void 0);
|
|
33
|
-
ResType = __decorate([
|
|
34
|
-
(0, type_graphql_1.ObjectType)()
|
|
35
|
-
], ResType);
|
|
36
|
-
return ResType;
|
|
37
|
-
}());
|
|
38
|
-
exports.ResType = ResType;
|
|
39
|
-
var GeoType = /** @class */ (function () {
|
|
40
|
-
function GeoType() {
|
|
41
|
-
}
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, type_graphql_1.Field)(function () { return Number; }, { nullable: true })
|
|
44
|
-
], GeoType.prototype, "lat", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, type_graphql_1.Field)(function () { return Number; }, { nullable: true })
|
|
47
|
-
], GeoType.prototype, "lon", void 0);
|
|
48
|
-
GeoType = __decorate([
|
|
49
|
-
(0, type_graphql_1.InputType)('GeoTypeInput'),
|
|
50
|
-
(0, type_graphql_1.ObjectType)()
|
|
51
|
-
], GeoType);
|
|
52
|
-
return GeoType;
|
|
53
|
-
}());
|
|
54
|
-
exports.GeoType = GeoType;
|
|
55
|
-
//# sourceMappingURL=ContextType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextType.js","sourceRoot":"","sources":["../../src/shared/ContextType.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAA0D;AAC1D,wEAA4C;AAU5C;;GAEG;AAEH;;GAEG;AAEH;IAAA;IAUA,CAAC;IARG;QADC,IAAA,oBAAK,EAAC,cAAM,OAAA,OAAO,EAAP,CAAO,CAAC;4CACJ;IAGjB;QADC,IAAA,oBAAK,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACrB;IAIjB;QADC,IAAA,oBAAK,EAAC,UAAC,IAAI,IAAK,OAAA,2BAAW,EAAX,CAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;yCACpC;IATF,OAAO;QADnB,IAAA,yBAAU,GAAE;OACA,OAAO,CAUnB;IAAD,cAAC;CAAA,AAVD,IAUC;AAVY,0BAAO;AAcpB;IAAA;IAMA,CAAC;IAJG;QADC,IAAA,oBAAK,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;wCAC1B;IAGZ;QADC,IAAA,oBAAK,EAAC,cAAM,OAAA,MAAM,EAAN,CAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;wCAC1B;IALH,OAAO;QAFnB,IAAA,wBAAS,EAAC,cAAc,CAAC;QACzB,IAAA,yBAAU,GAAE;OACA,OAAO,CAMnB;IAAD,cAAC;CAAA,AAND,IAMC;AANY,0BAAO","sourcesContent":["import {Request, Response} from 'express';\nimport {ObjectType, Field, InputType} from 'type-graphql';\nimport GraphQLJSON from 'graphql-type-json';\nimport {RedisPubSub} from 'graphql-redis-subscriptions';\n\nexport interface ContextType {\n req: Request;\n res: Response;\n payload?: any;\n pubsub: RedisPubSub;\n}\n\n/**\n * GraphQL Types start\n */\n\n/**\n * ResType\n */\n@ObjectType()\nexport class ResType {\n @Field(() => Boolean)\n success: boolean;\n\n @Field(() => String, {nullable: true})\n message?: string;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n @Field((type) => GraphQLJSON, {nullable: true})\n data?: any;\n}\n\n@InputType('GeoTypeInput')\n@ObjectType()\nexport class GeoType {\n @Field(() => Number, {nullable: true})\n lat: number;\n\n @Field(() => Number, {nullable: true})\n lon: number;\n}\n\nexport interface GeoLocationType {\n lat: number;\n lon: number;\n}\n"]}
|