@roadmanjs/couchset 0.0.2 → 0.0.6
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/shared/common.model.d.ts +35 -0
- package/dist/shared/common.model.js +88 -0
- package/dist/shared/common.model.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +14 -0
- package/dist/shared/index.js.map +1 -0
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./database"), exports);
|
|
14
14
|
__exportStar(require("./couchbase"), exports);
|
|
15
|
+
__exportStar(require("./shared"), exports);
|
|
15
16
|
//# 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,6CAA2B;AAC3B,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,2CAAyB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Model } from 'couchset';
|
|
2
|
+
export interface GeoLocationType {
|
|
3
|
+
lat: number;
|
|
4
|
+
lon: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class CommonType {
|
|
7
|
+
id?: string;
|
|
8
|
+
env?: string;
|
|
9
|
+
owner?: string;
|
|
10
|
+
createdAt?: Date;
|
|
11
|
+
updatedAt?: Date;
|
|
12
|
+
deleted?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const CommonSchema: {
|
|
15
|
+
id: StringConstructor;
|
|
16
|
+
env: StringConstructor;
|
|
17
|
+
owner: StringConstructor;
|
|
18
|
+
createdAt: DateConstructor;
|
|
19
|
+
updatedAt: DateConstructor;
|
|
20
|
+
deleted: BooleanConstructor;
|
|
21
|
+
};
|
|
22
|
+
interface CreateUpdate {
|
|
23
|
+
model: Model;
|
|
24
|
+
id?: string;
|
|
25
|
+
owner?: string;
|
|
26
|
+
data: any;
|
|
27
|
+
}
|
|
28
|
+
export declare const createUpdate: <T>(args: CreateUpdate) => Promise<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a [className]Pagination ObjectType
|
|
31
|
+
* @param c class
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare const getPagination: <T>(c: T) => any;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
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.getPagination = exports.createUpdate = exports.CommonSchema = exports.CommonType = void 0;
|
|
13
|
+
const type_graphql_1 = require("type-graphql");
|
|
14
|
+
const graphql_type_json_1 = __importDefault(require("graphql-type-json"));
|
|
15
|
+
let CommonType = class CommonType {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
19
|
+
], CommonType.prototype, "id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
22
|
+
], CommonType.prototype, "env", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, type_graphql_1.Field)(() => String, { nullable: true })
|
|
25
|
+
], CommonType.prototype, "owner", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, type_graphql_1.Field)(() => Date, { nullable: true })
|
|
28
|
+
], CommonType.prototype, "createdAt", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, type_graphql_1.Field)(() => Date, { nullable: true })
|
|
31
|
+
], CommonType.prototype, "updatedAt", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, type_graphql_1.Field)(() => Boolean, { nullable: true })
|
|
34
|
+
], CommonType.prototype, "deleted", void 0);
|
|
35
|
+
CommonType = __decorate([
|
|
36
|
+
(0, type_graphql_1.ObjectType)()
|
|
37
|
+
], CommonType);
|
|
38
|
+
exports.CommonType = CommonType;
|
|
39
|
+
exports.CommonSchema = {
|
|
40
|
+
id: String,
|
|
41
|
+
env: String,
|
|
42
|
+
owner: String,
|
|
43
|
+
createdAt: Date,
|
|
44
|
+
updatedAt: Date,
|
|
45
|
+
deleted: Boolean,
|
|
46
|
+
};
|
|
47
|
+
const createUpdate = async (args) => {
|
|
48
|
+
const { model, id, data } = args;
|
|
49
|
+
try {
|
|
50
|
+
if (id) {
|
|
51
|
+
// update
|
|
52
|
+
await model.updateById(id, data);
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
// create
|
|
56
|
+
const createdItem = await model.create(data);
|
|
57
|
+
return createdItem;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(`error creating for ${model.collectionName}`, error);
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.createUpdate = createUpdate;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a [className]Pagination ObjectType
|
|
67
|
+
* @param c class
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
const getPagination = (c) => {
|
|
71
|
+
let Pagination = class Pagination {
|
|
72
|
+
};
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, type_graphql_1.Field)(() => [c], { nullable: true })
|
|
75
|
+
], Pagination.prototype, "items", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, type_graphql_1.Field)({ nullable: true })
|
|
78
|
+
], Pagination.prototype, "hasNext", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, type_graphql_1.Field)(() => graphql_type_json_1.default, { nullable: true })
|
|
81
|
+
], Pagination.prototype, "params", void 0);
|
|
82
|
+
Pagination = __decorate([
|
|
83
|
+
(0, type_graphql_1.ObjectType)(`${c.name}Pagination`)
|
|
84
|
+
], Pagination);
|
|
85
|
+
return Pagination;
|
|
86
|
+
};
|
|
87
|
+
exports.getPagination = getPagination;
|
|
88
|
+
//# sourceMappingURL=common.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.model.js","sourceRoot":"","sources":["../../src/shared/common.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+C;AAE/C,0EAA4C;AAS5C,IAAa,UAAU,GAAvB,MAAa,UAAU;CAkBtB,CAAA;AAhBG;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;sCAC1B;AAGZ;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;uCACzB;AAGb;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;yCACvB;AAGf;IADC,IAAA,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ADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;6CACjB;IAGlB;QADC,IAAA,oBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;+CACN;IAGlB;QADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,2BAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CAC9B;IARX,UAAU;QADf,IAAA,yBAAU,EAAC,GAAI,CAAS,CAAC,IAAI,YAAY,CAAC;OACrC,UAAU,CASf;IACD,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAbW,QAAA,aAAa,iBAaxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common.model';
|
|
@@ -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("./common.model"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA+B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roadmanjs/couchset",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A Couchbase roadman using CouchSet",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@typescript-eslint/eslint-plugin": "^3.4.0",
|
|
56
56
|
"@typescript-eslint/parser": "^3.4.0",
|
|
57
57
|
"chai": "^4.2.0",
|
|
58
|
-
"eslint": "
|
|
58
|
+
"eslint": "7.32.0",
|
|
59
59
|
"eslint-config-prettier": "^6.11.0",
|
|
60
60
|
"eslint-loader": "^4.0.2",
|
|
61
61
|
"eslint-plugin-import": "^2.20.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"eslint-plugin-typescript": "^0.14.0",
|
|
66
66
|
"husky": "^4.2.5",
|
|
67
67
|
"lint-staged": "^10.1.7",
|
|
68
|
-
"mocha": "^
|
|
68
|
+
"mocha": "^9.2.0",
|
|
69
69
|
"prettier": "^2.0.5",
|
|
70
70
|
"rimraf": "^2.5.4",
|
|
71
71
|
"ts-node": "^9.1.1",
|
|
@@ -78,8 +78,9 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@roadmanjs/core": "^0.0.3",
|
|
81
|
+
"@stoqey/client-graphql": "^1.1.12",
|
|
81
82
|
"chalk": "^4.1.0",
|
|
82
|
-
"couchset": "^0.0.
|
|
83
|
+
"couchset": "^0.0.14",
|
|
83
84
|
"debug": "^4.3.1",
|
|
84
85
|
"dotenv": "^8.2.0",
|
|
85
86
|
"lodash": "^4.17.20"
|