couchset 0.0.0 → 0.0.5

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 (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +231 -0
  3. package/dist/automate/index.d.ts +4 -0
  4. package/dist/automate/index.js +17 -0
  5. package/dist/automate/index.js.map +1 -0
  6. package/dist/automate/middlewares/index.d.ts +1 -0
  7. package/dist/automate/middlewares/index.js +14 -0
  8. package/dist/automate/middlewares/index.js.map +1 -0
  9. package/dist/automate/middlewares/isAuth.d.ts +7 -0
  10. package/dist/automate/middlewares/isAuth.js +28 -0
  11. package/dist/automate/middlewares/isAuth.js.map +1 -0
  12. package/dist/automate/model/client.d.ts +12 -0
  13. package/dist/automate/model/client.js +33 -0
  14. package/dist/automate/model/client.js.map +1 -0
  15. package/dist/automate/model/index.d.ts +44 -0
  16. package/dist/automate/model/index.js +304 -0
  17. package/dist/automate/model/index.js.map +1 -0
  18. package/dist/automate/morpheus/index.d.ts +14 -0
  19. package/dist/automate/morpheus/index.js +171 -0
  20. package/dist/automate/morpheus/index.js.map +1 -0
  21. package/dist/automate/writer/index.d.ts +10 -0
  22. package/dist/automate/writer/index.js +72 -0
  23. package/dist/automate/writer/index.js.map +1 -0
  24. package/dist/config/index.d.ts +3 -0
  25. package/dist/config/index.js +8 -0
  26. package/dist/config/index.js.map +1 -0
  27. package/dist/connection.d.ts +36 -0
  28. package/dist/connection.js +129 -0
  29. package/dist/connection.js.map +1 -0
  30. package/dist/index.d.ts +14 -0
  31. package/dist/index.js +80 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/model/index.d.ts +107 -0
  34. package/dist/model/index.js +329 -0
  35. package/dist/model/index.js.map +1 -0
  36. package/dist/pagination/index.d.ts +1 -0
  37. package/dist/pagination/index.js +14 -0
  38. package/dist/pagination/index.js.map +1 -0
  39. package/dist/pagination/pagination.d.ts +19 -0
  40. package/dist/pagination/pagination.js +97 -0
  41. package/dist/pagination/pagination.js.map +1 -0
  42. package/dist/query/base-query.d.ts +17 -0
  43. package/dist/query/base-query.js +15 -0
  44. package/dist/query/base-query.js.map +1 -0
  45. package/dist/query/exceptions.d.ts +24 -0
  46. package/dist/query/exceptions.js +90 -0
  47. package/dist/query/exceptions.js.map +1 -0
  48. package/dist/query/helpers/builders.d.ts +64 -0
  49. package/dist/query/helpers/builders.js +415 -0
  50. package/dist/query/helpers/builders.js.map +1 -0
  51. package/dist/query/helpers/dictionary.d.ts +45 -0
  52. package/dist/query/helpers/dictionary.js +105 -0
  53. package/dist/query/helpers/dictionary.js.map +1 -0
  54. package/dist/query/helpers/index.d.ts +3 -0
  55. package/dist/query/helpers/index.js +16 -0
  56. package/dist/query/helpers/index.js.map +1 -0
  57. package/dist/query/helpers/reservedWords.d.ts +1 -0
  58. package/dist/query/helpers/reservedWords.js +200 -0
  59. package/dist/query/helpers/reservedWords.js.map +1 -0
  60. package/dist/query/index.d.ts +5 -0
  61. package/dist/query/index.js +27 -0
  62. package/dist/query/index.js.map +1 -0
  63. package/dist/query/interface/query.types.d.ts +236 -0
  64. package/dist/query/interface/query.types.js +3 -0
  65. package/dist/query/interface/query.types.js.map +1 -0
  66. package/dist/query/query.cluster.d.ts +14 -0
  67. package/dist/query/query.cluster.js +80 -0
  68. package/dist/query/query.cluster.js.map +1 -0
  69. package/dist/query/query.d.ts +321 -0
  70. package/dist/query/query.js +457 -0
  71. package/dist/query/query.js.map +1 -0
  72. package/dist/query/utils.d.ts +8 -0
  73. package/dist/query/utils.js +56 -0
  74. package/dist/query/utils.js.map +1 -0
  75. package/dist/search/customQuery.d.ts +17 -0
  76. package/dist/search/customQuery.js +83 -0
  77. package/dist/search/customQuery.js.map +1 -0
  78. package/dist/search/index.d.ts +1 -0
  79. package/dist/search/index.js +14 -0
  80. package/dist/search/index.js.map +1 -0
  81. package/dist/shared/ContextType.d.ts +27 -0
  82. package/dist/shared/ContextType.js +55 -0
  83. package/dist/shared/ContextType.js.map +1 -0
  84. package/dist/shared/common.model.d.ts +37 -0
  85. package/dist/shared/common.model.js +148 -0
  86. package/dist/shared/common.model.js.map +1 -0
  87. package/dist/shared/index.d.ts +2 -0
  88. package/dist/shared/index.js +15 -0
  89. package/dist/shared/index.js.map +1 -0
  90. package/dist/utils/awaitTo.d.ts +17 -0
  91. package/dist/utils/awaitTo.js +31 -0
  92. package/dist/utils/awaitTo.js.map +1 -0
  93. package/dist/utils/date.d.ts +11 -0
  94. package/dist/utils/date.js +21 -0
  95. package/dist/utils/date.js.map +1 -0
  96. package/dist/utils/index.d.ts +5 -0
  97. package/dist/utils/index.js +18 -0
  98. package/dist/utils/index.js.map +1 -0
  99. package/dist/utils/log.d.ts +9 -0
  100. package/dist/utils/log.js +19 -0
  101. package/dist/utils/log.js.map +1 -0
  102. package/dist/utils/text.utils.d.ts +14 -0
  103. package/dist/utils/text.utils.js +45 -0
  104. package/dist/utils/text.utils.js.map +1 -0
  105. package/dist/utils/utils.schema.d.ts +6 -0
  106. package/dist/utils/utils.schema.js +33 -0
  107. package/dist/utils/utils.schema.js.map +1 -0
  108. package/dist/uuid.d.ts +1 -0
  109. package/dist/uuid.js +9 -0
  110. package/dist/uuid.js.map +1 -0
  111. package/docs/couch.png +0 -0
  112. package/docs/couchset.png +0 -0
  113. package/docs/couchset_logo.png +0 -0
  114. package/package.json +108 -30
  115. package/register/index.js +1 -0
  116. package/register/transpile-only.js +3 -0
  117. package/register/type-check.js +3 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.utils.js","sourceRoot":"","sources":["../../src/utils/text.utils.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAqC;AACrC,+DAAyC;AACzC,2DAAqC;AAE9B,IAAM,QAAQ,GAAG,UAAC,IAAS;IAC9B,IAAI,IAAA,iBAAO,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QACxB,OAAO,IAAI,CAAC;KACf;IAED,IAAI;QACA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,KAAK,EAAE;QACZ,sDAAsD;QACtD,OAAO,IAAI,CAAC;KACf;AACL,CAAC,CAAC;AAdW,QAAA,QAAQ,YAcnB;AAEF;;;;GAIG;AACH,SAAgB,OAAO,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,+DAA+D;AACtH,CAAC;AAFD,0BAEC;AAED;;;;GAIG;AACI,IAAM,YAAY,GAAG,UAAC,GAAW;IACpC,OAAO,IAAA,iBAAO,EAAC,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF,kBAAe,gBAAQ,CAAC","sourcesContent":["import isEmpty from 'lodash/isEmpty';\nimport snakeCase from 'lodash/snakeCase';\nimport toUpper from 'lodash/toUpper';\n\nexport const JSONDATA = (data: any): Record<string, any> | string | null => {\n if (isEmpty(data) || !data) {\n return null;\n }\n\n try {\n if (typeof data !== 'object') {\n return JSON.parse(data);\n }\n return data;\n } catch (error) {\n // console.log('error trying to parse response data');\n return data;\n }\n};\n\n/**\n * CapitalizeFirstLetter\n * @param txt\n * @returns\n */\nexport function capText(txt: string): string {\n return txt.charAt(0).toUpperCase() + txt.slice(1); //or if you want lowercase the rest txt.slice(1).toLowerCase();\n}\n\n/**\n * To Snake case and in upper case\n * @param txt\n * @returns\n */\nexport const toSnakeUpper = (txt: string): string => {\n return toUpper(snakeCase(txt));\n};\n\nexport default JSONDATA;\n"]}
@@ -0,0 +1,6 @@
1
+ export declare type SchemaTypes = 'string' | 'number' | 'date' | 'object';
2
+ /**
3
+ * Convert date strings to data objects
4
+ * @param data
5
+ */
6
+ export declare const parseSchema: (schema: any, iItem: any) => any;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseSchema = void 0;
4
+ var parseValue = function (fieldType, value) {
5
+ switch (fieldType) {
6
+ case 'date':
7
+ return new Date(value);
8
+ default:
9
+ return value;
10
+ }
11
+ };
12
+ /**
13
+ * Convert date strings to data objects
14
+ * @param data
15
+ */
16
+ var parseSchema = function (schema, iItem) {
17
+ // Get all schema types and parse with data
18
+ var keys = Object.keys(iItem);
19
+ var finalObject = {};
20
+ keys.forEach(function (xField) {
21
+ // check if xField exists
22
+ var xFieldExistsInSchema = schema[xField];
23
+ if (xFieldExistsInSchema) {
24
+ finalObject[xField] = parseValue(xFieldExistsInSchema, iItem[xField]);
25
+ }
26
+ else {
27
+ finalObject[xField] = iItem[xField];
28
+ }
29
+ });
30
+ return finalObject;
31
+ };
32
+ exports.parseSchema = parseSchema;
33
+ //# sourceMappingURL=utils.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.schema.js","sourceRoot":"","sources":["../../src/utils/utils.schema.ts"],"names":[],"mappings":";;;AAEA,IAAM,UAAU,GAAG,UAAC,SAAsB,EAAE,KAAU;IAClD,QAAQ,SAAS,EAAE;QACf,KAAK,MAAM;YACP,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC,CAAC;AAEF;;;GAGG;AACI,IAAM,WAAW,GAAG,UAAC,MAAW,EAAE,KAAU;IAC/C,2CAA2C;IAC3C,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEhC,IAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,IAAI,CAAC,OAAO,CAAC,UAAC,MAAM;QAChB,yBAAyB;QACzB,IAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAE5C,IAAI,oBAAoB,EAAE;YACtB,WAAW,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;SACzE;aAAM;YACH,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;SACvC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAlBW,QAAA,WAAW,eAkBtB","sourcesContent":["export type SchemaTypes = 'string' | 'number' | 'date' | 'object';\n\nconst parseValue = (fieldType: SchemaTypes, value: any): any => {\n switch (fieldType) {\n case 'date':\n return new Date(value);\n default:\n return value;\n }\n};\n\n/**\n * Convert date strings to data objects\n * @param data\n */\nexport const parseSchema = (schema: any, iItem: any): any => {\n // Get all schema types and parse with data\n const keys = Object.keys(iItem);\n\n const finalObject = {};\n\n keys.forEach((xField) => {\n // check if xField exists\n const xFieldExistsInSchema = schema[xField];\n\n if (xFieldExistsInSchema) {\n finalObject[xField] = parseValue(xFieldExistsInSchema, iItem[xField]);\n } else {\n finalObject[xField] = iItem[xField];\n }\n });\n\n return finalObject;\n};\n"]}
package/dist/uuid.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const generateUUID: () => string;
package/dist/uuid.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateUUID = void 0;
4
+ var uuid_1 = require("uuid");
5
+ var generateUUID = function () {
6
+ return (0, uuid_1.v4)();
7
+ };
8
+ exports.generateUUID = generateUUID;
9
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../src/uuid.ts"],"names":[],"mappings":";;;AAAA,6BAAkC;AAE3B,IAAM,YAAY,GAAG;IACxB,OAAO,IAAA,SAAM,GAAE,CAAC;AACpB,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB","sourcesContent":["import {v4 as uuidv4} from 'uuid';\n\nexport const generateUUID = (): string => {\n return uuidv4();\n};\n"]}
package/docs/couch.png ADDED
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,32 +1,110 @@
1
1
  {
2
- "name": "couchset",
3
- "version": "0.0.0",
4
- "description": "Automatic GraphQL API(Resolver/Queries) for Couchbase",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/couchset/couchset.git"
12
- },
13
- "keywords": [
14
- "Couchbase",
15
- "couchset",
16
- "database",
17
- "nosql",
18
- "sql",
19
- "data",
20
- "migrations",
21
- "mongodb",
22
- "orm",
23
- "mongoose",
24
- "redis"
25
- ],
26
- "author": "Ceddy Muhoza <ceddymuhoza@gmail.com >",
27
- "license": "MIT",
28
- "bugs": {
29
- "url": "https://github.com/couchset/couchset/issues"
30
- },
31
- "homepage": "https://github.com/couchset/couchset#readme"
2
+ "name": "couchset",
3
+ "version": "0.0.5",
4
+ "description": "Couchbase ORM & Automatic GraphQL API(Resolver/Queries)",
5
+ "private": false,
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "docs/",
10
+ "dist/",
11
+ "register/",
12
+ "LICENSE"
13
+ ],
14
+ "scripts": {
15
+ "lint": "tslint \"src/**/*.ts\" --project tsconfig.json",
16
+ "build": "rimraf dist && ./node_modules/.bin/tsc --skipLibCheck",
17
+ "test": "mocha src/*test.ts --exit",
18
+ "prepublishOnly": "npm run build",
19
+ "eslint": "eslint ./src --fix --ext=ts"
20
+ },
21
+ "lint-staged": {
22
+ "*.{ts,tsx}": [
23
+ "npm run eslint"
24
+ ]
25
+ },
26
+ "husky": {
27
+ "hooks": {
28
+ "pre-commit": "lint-staged"
29
+ }
30
+ },
31
+ "engines": {
32
+ "node": ">=4.2.0"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/couchset/couchset.git"
37
+ },
38
+ "keywords": [
39
+ "couchbase",
40
+ "couchset",
41
+ "database",
42
+ "nosql",
43
+ "sql",
44
+ "data",
45
+ "migrations",
46
+ "mongodb",
47
+ "orm",
48
+ "mongoose",
49
+ "redis"
50
+ ],
51
+ "author": {
52
+ "name": "Ceddy Muhoza",
53
+ "email": "ceddymuhoza@gmail.com",
54
+ "url": "https://ceddy.org"
55
+ },
56
+ "license": "MIT",
57
+ "bugs": {
58
+ "url": "https://github.com/couchset/couchset/issues"
59
+ },
60
+ "homepage": "https://github.com/couchset/couchset#readme",
61
+ "devDependencies": {
62
+ "@types/chai": "^4.2.14",
63
+ "@types/couchbase": "^2.4.4",
64
+ "@types/debug": "^4.1.7",
65
+ "@types/express": "^4.17.13",
66
+ "@types/lodash": "^4.14.168",
67
+ "@types/mocha": "^8.2.0",
68
+ "@types/node": "^10.0.3",
69
+ "@types/source-map-support": "^0.4.0",
70
+ "@types/uuid": "^8.3.0",
71
+ "@typescript-eslint/eslint-plugin": "^3.4.0",
72
+ "@typescript-eslint/parser": "^3.4.0",
73
+ "chai": "^4.2.0",
74
+ "eslint": "^6.8.0",
75
+ "eslint-config-prettier": "^6.11.0",
76
+ "eslint-loader": "^4.0.2",
77
+ "eslint-plugin-import": "^2.20.2",
78
+ "eslint-plugin-json": "^2.1.1",
79
+ "eslint-plugin-prettier": "^3.1.4",
80
+ "eslint-plugin-simple-import-sort": "^5.0.2",
81
+ "eslint-plugin-typescript": "^0.14.0",
82
+ "husky": "^4.2.5",
83
+ "lint-staged": "^10.1.7",
84
+ "mocha": "^8.2.1",
85
+ "prettier": "^2.0.5",
86
+ "reflect-metadata": "^0.1.13",
87
+ "rimraf": "^2.5.4",
88
+ "ts-node": "^9.1.1",
89
+ "tslint": "^5.11.0",
90
+ "tslint-config-standard": "^8.0.1",
91
+ "typescript": "^4.4.3"
92
+ },
93
+ "peerDependencies": {
94
+ "typescript": ">=2.0"
95
+ },
96
+ "dependencies": {
97
+ "couchbase": "^3.2.1",
98
+ "debug": "^4.3.1",
99
+ "dotenv": "^10.0.0",
100
+ "graphql": "^15.6.0",
101
+ "graphql-redis-subscriptions": "^2.4.0",
102
+ "graphql-tag": "^2.12.5",
103
+ "graphql-type-json": "^0.3.2",
104
+ "jsonwebtoken": "^8.5.1",
105
+ "lodash": "^4.17.20",
106
+ "ts-morph": "^12.0.0",
107
+ "type-graphql": "^1.1.1",
108
+ "uuid": "^8.3.2"
109
+ }
32
110
  }
@@ -0,0 +1 @@
1
+ require('../').register()
@@ -0,0 +1,3 @@
1
+ require('../').register({
2
+ transpileOnly: true
3
+ })
@@ -0,0 +1,3 @@
1
+ require('../').register({
2
+ typeCheck: true
3
+ })