@roadmanjs/chat 0.0.3
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/README.md +41 -0
- package/dist/chat/index.d.ts +3 -0
- package/dist/chat/index.js +16 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/methods/ChatConvo.methods.d.ts +4 -0
- package/dist/chat/methods/ChatConvo.methods.js +118 -0
- package/dist/chat/methods/ChatConvo.methods.js.map +1 -0
- package/dist/chat/methods/ChatConvo.test.d.ts +1 -0
- package/dist/chat/methods/ChatConvo.test.js +24 -0
- package/dist/chat/methods/ChatConvo.test.js.map +1 -0
- package/dist/chat/methods/index.d.ts +1 -0
- package/dist/chat/methods/index.js +14 -0
- package/dist/chat/methods/index.js.map +1 -0
- package/dist/chat/models/ChatAttachment.model.d.ts +18 -0
- package/dist/chat/models/ChatAttachment.model.js +51 -0
- package/dist/chat/models/ChatAttachment.model.js.map +1 -0
- package/dist/chat/models/ChatConvo.model.d.ts +36 -0
- package/dist/chat/models/ChatConvo.model.js +111 -0
- package/dist/chat/models/ChatConvo.model.js.map +1 -0
- package/dist/chat/models/ChatMessage.model.d.ts +30 -0
- package/dist/chat/models/ChatMessage.model.js +90 -0
- package/dist/chat/models/ChatMessage.model.js.map +1 -0
- package/dist/chat/models/index.d.ts +3 -0
- package/dist/chat/models/index.js +16 -0
- package/dist/chat/models/index.js.map +1 -0
- package/dist/chat/resolvers/ChatConvo.resolver.d.ts +17 -0
- package/dist/chat/resolvers/ChatConvo.resolver.js +233 -0
- package/dist/chat/resolvers/ChatConvo.resolver.js.map +1 -0
- package/dist/chat/resolvers/ChatMessage.resolver.d.ts +11 -0
- package/dist/chat/resolvers/ChatMessage.resolver.js +142 -0
- package/dist/chat/resolvers/ChatMessage.resolver.js.map +1 -0
- package/dist/chat/resolvers/index.d.ts +2 -0
- package/dist/chat/resolvers/index.js +15 -0
- package/dist/chat/resolvers/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/middlewares/firebaseToken.d.ts +2 -0
- package/dist/middlewares/firebaseToken.js +67 -0
- package/dist/middlewares/firebaseToken.js.map +1 -0
- package/dist/middlewares/index.d.ts +2 -0
- package/dist/middlewares/index.js +15 -0
- package/dist/middlewares/index.js.map +1 -0
- package/dist/middlewares/isAuth.d.ts +2 -0
- package/dist/middlewares/isAuth.js +32 -0
- package/dist/middlewares/isAuth.js.map +1 -0
- package/dist/roadman.d.ts +10 -0
- package/dist/roadman.js +19 -0
- package/dist/roadman.js.map +1 -0
- package/dist/shared/ContextType.d.ts +19 -0
- package/dist/shared/ContextType.js +7 -0
- package/dist/shared/ContextType.js.map +1 -0
- package/dist/shared/pubsub.utils.d.ts +9 -0
- package/dist/shared/pubsub.utils.js +19 -0
- package/dist/shared/pubsub.utils.js.map +1 -0
- package/dist/user/User.methods.d.ts +12 -0
- package/dist/user/User.methods.js +101 -0
- package/dist/user/User.methods.js.map +1 -0
- package/dist/user/User.model.d.ts +43 -0
- package/dist/user/User.model.js +143 -0
- package/dist/user/User.model.js.map +1 -0
- package/dist/user/User.resolver.auth.d.ts +6 -0
- package/dist/user/User.resolver.auth.js +82 -0
- package/dist/user/User.resolver.auth.js.map +1 -0
- package/dist/user/User.resolver.d.ts +9 -0
- package/dist/user/User.resolver.js +103 -0
- package/dist/user/User.resolver.js.map +1 -0
- package/dist/user/User.resolver.public.d.ts +5 -0
- package/dist/user/User.resolver.public.js +50 -0
- package/dist/user/User.resolver.public.js.map +1 -0
- package/dist/user/auth.d.ts +5 -0
- package/dist/user/auth.js +24 -0
- package/dist/user/auth.js.map +1 -0
- package/dist/user/index.d.ts +6 -0
- package/dist/user/index.js +19 -0
- package/dist/user/index.js.map +1 -0
- package/package.json +81 -0
- package/register/index.js +1 -0
- package/register/transpile-only.js +3 -0
- package/register/type-check.js +3 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
<p align="center">
|
|
3
|
+
<h1 align="center"> Roadman - for chat and groups </h1>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## A Roadman for chat and groups, using UserType from 'auth'
|
|
8
|
+
|
|
9
|
+
### How to use
|
|
10
|
+
```
|
|
11
|
+
yarn add @roadmanjs/auth @roadmanjs/chat
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
app.ts
|
|
15
|
+
```ts
|
|
16
|
+
import roadman from 'roadman';
|
|
17
|
+
import {getAuthResolvers} from '@roadmanjs/auth';
|
|
18
|
+
import {getChatResolvers} from '@roadmanjs/chat';
|
|
19
|
+
|
|
20
|
+
await roadman({
|
|
21
|
+
resolvers: [...getAuthResolvers(), ...getChatResolvers(), ...MyOtherResolvers]
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Env required
|
|
26
|
+
```sh
|
|
27
|
+
DEBUG=roadman*
|
|
28
|
+
|
|
29
|
+
# Firebase service account json string
|
|
30
|
+
FIREBASE_SA={"firebase admin service account": ""}
|
|
31
|
+
|
|
32
|
+
# Couchbase envs
|
|
33
|
+
COUCHBASE_URL=
|
|
34
|
+
COUCHBASE_BUCKET=
|
|
35
|
+
COUCHBASE_USERNAME=
|
|
36
|
+
COUCHBASE_PASSWORD=
|
|
37
|
+
|
|
38
|
+
# Any random ass access token generator secrets
|
|
39
|
+
ACCESS_TOKEN_SECRET=xxxxx
|
|
40
|
+
REFRESH_TOKEN_SECRET=xxxx
|
|
41
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
__exportStar(require("./resolvers"), exports);
|
|
15
|
+
__exportStar(require("./methods"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChatConvo, ChatConvoType } from '../models/ChatConvo.model';
|
|
2
|
+
export declare const createAConvoAndReturnIt: (newConvo: ChatConvoType) => Promise<ChatConvoType>;
|
|
3
|
+
export declare const createChatConvoType: (props: Partial<ChatConvoType>) => Promise<ChatConvoType[]>;
|
|
4
|
+
export declare const getChatConvoById: (id: string) => Promise<ChatConvo | null>;
|
|
@@ -0,0 +1,118 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getChatConvoById = exports.createChatConvoType = exports.createAConvoAndReturnIt = void 0;
|
|
37
|
+
const ChatConvo_model_1 = __importStar(require("../models/ChatConvo.model"));
|
|
38
|
+
const couchset_1 = require("@roadmanjs/couchset");
|
|
39
|
+
const client_graphql_1 = require("@stoqey/client-graphql");
|
|
40
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
41
|
+
const logs_1 = require("@roadmanjs/logs");
|
|
42
|
+
const createAConvoAndReturnIt = async (newConvo) => {
|
|
43
|
+
const { members = [], group = false, owner } = newConvo, others = __rest(newConvo, ["members", "group", "owner"]);
|
|
44
|
+
const [errorCreatingConvo, createdChatConvo = []] = await (0, client_graphql_1.awaitTo)((0, exports.createChatConvoType)(Object.assign(Object.assign({}, others), { members,
|
|
45
|
+
group,
|
|
46
|
+
owner })));
|
|
47
|
+
if (errorCreatingConvo) {
|
|
48
|
+
throw errorCreatingConvo;
|
|
49
|
+
}
|
|
50
|
+
let convo = createdChatConvo[0];
|
|
51
|
+
if (owner) {
|
|
52
|
+
const selected = createdChatConvo.find((chat) => chat.owner === owner);
|
|
53
|
+
if (selected) {
|
|
54
|
+
convo = selected;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return convo;
|
|
58
|
+
};
|
|
59
|
+
exports.createAConvoAndReturnIt = createAConvoAndReturnIt;
|
|
60
|
+
const createChatConvoType = async (props) => {
|
|
61
|
+
const { members = [], group = false } = props, others = __rest(props, ["members", "group"]);
|
|
62
|
+
if ((0, isEmpty_1.default)(members)) {
|
|
63
|
+
throw new Error('members have to be more than one');
|
|
64
|
+
}
|
|
65
|
+
const defaultConvo = Object.assign(Object.assign({}, others), { members,
|
|
66
|
+
group, owner: 'system' });
|
|
67
|
+
const [errorSystemConvo, createdSystemConvo] = await (0, client_graphql_1.awaitTo)((0, couchset_1.createUpdate)(Object.assign({ model: ChatConvo_model_1.default, data: defaultConvo }, defaultConvo)));
|
|
68
|
+
if (errorSystemConvo) {
|
|
69
|
+
throw errorSystemConvo;
|
|
70
|
+
}
|
|
71
|
+
const [errorConvos, convos] = await (0, client_graphql_1.awaitTo)(Promise.all(members.map((member) => (0, couchset_1.createUpdate)(Object.assign(Object.assign({ model: ChatConvo_model_1.default, data: Object.assign(Object.assign({}, defaultConvo), { owner: member, convoId: createdSystemConvo === null || createdSystemConvo === void 0 ? void 0 : createdSystemConvo.id }) }, defaultConvo), { owner: member })))));
|
|
72
|
+
if (errorConvos) {
|
|
73
|
+
throw errorConvos;
|
|
74
|
+
}
|
|
75
|
+
return convos;
|
|
76
|
+
};
|
|
77
|
+
exports.createChatConvoType = createChatConvoType;
|
|
78
|
+
const getChatConvoById = async (id) => {
|
|
79
|
+
try {
|
|
80
|
+
const bucket = couchset_1.connectionOptions.bucketName;
|
|
81
|
+
const query = `
|
|
82
|
+
SELECT *
|
|
83
|
+
FROM \`${bucket}\` convo
|
|
84
|
+
JOIN \`${bucket}\` owner
|
|
85
|
+
ON KEYS convo.owner
|
|
86
|
+
NEST \`${bucket}\` members
|
|
87
|
+
ON KEYS convo.members
|
|
88
|
+
LEFT JOIN \`${bucket}\` lastMessage
|
|
89
|
+
ON KEYS convo.lastMessage
|
|
90
|
+
|
|
91
|
+
WHERE convo._type = "${ChatConvo_model_1.ChatConvoModelName}"
|
|
92
|
+
AND convo.id = "${id}"
|
|
93
|
+
LIMIT 1;
|
|
94
|
+
`;
|
|
95
|
+
const [errorFetching, data = []] = await (0, client_graphql_1.awaitTo)(ChatConvo_model_1.default.customQuery({
|
|
96
|
+
limit: 1,
|
|
97
|
+
query,
|
|
98
|
+
params: { limit: 1, id },
|
|
99
|
+
}));
|
|
100
|
+
if (errorFetching) {
|
|
101
|
+
throw errorFetching;
|
|
102
|
+
}
|
|
103
|
+
const [rows = []] = data;
|
|
104
|
+
const dataToSend = rows.map((d) => {
|
|
105
|
+
const { convo, lastMessage, members, owner } = d;
|
|
106
|
+
return ChatConvo_model_1.default.parse(Object.assign(Object.assign({}, convo), { members,
|
|
107
|
+
lastMessage,
|
|
108
|
+
owner }));
|
|
109
|
+
});
|
|
110
|
+
return dataToSend[0];
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
(0, logs_1.log)('error getting chat messages', error);
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
exports.getChatConvoById = getChatConvoById;
|
|
118
|
+
//# sourceMappingURL=ChatConvo.methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatConvo.methods.js","sourceRoot":"","sources":["../../../src/chat/methods/ChatConvo.methods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6EAImC;AACnC,kDAA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I,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;QAEzB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9B,MAAM,EAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAC,GAAG,CAAC,CAAC;YAC/C,OAAO,yBAAc,CAAC,KAAK,iCACpB,KAAK,KACR,OAAO;gBACP,WAAW;gBACX,KAAK,IACP,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;KACxB;IAAC,OAAO,KAAK,EAAE;QACZ,IAAA,UAAG,EAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;KACf;AACL,CAAC,CAAC;AAhDW,QAAA,gBAAgB,oBAgD3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "mocha";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("mocha");
|
|
4
|
+
const ChatConvo_methods_1 = require("./ChatConvo.methods");
|
|
5
|
+
const chai_1 = require("chai");
|
|
6
|
+
const couchset_1 = require("@roadmanjs/couchset");
|
|
7
|
+
before((done) => {
|
|
8
|
+
(0, couchset_1.startCouchbase)().then(done);
|
|
9
|
+
});
|
|
10
|
+
describe("ChatConvo", () => {
|
|
11
|
+
it("Create convo", async () => {
|
|
12
|
+
const owner = "1c01d85f-b811-44b1-8a4f-bef8030bf265";
|
|
13
|
+
const otherUser = "99bc43ba-02ab-4394-b48b-49a39a95443c";
|
|
14
|
+
const members = [owner, otherUser];
|
|
15
|
+
const chatConvo = {
|
|
16
|
+
members,
|
|
17
|
+
group: false,
|
|
18
|
+
};
|
|
19
|
+
const createdConvo = await (0, ChatConvo_methods_1.createChatConvoType)(chatConvo);
|
|
20
|
+
console.log("Created", createdConvo);
|
|
21
|
+
(0, chai_1.expect)(createdConvo).to.not.be.empty;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=ChatConvo.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatConvo.test.js","sourceRoot":"","sources":["../../../src/chat/methods/ChatConvo.test.ts"],"names":[],"mappings":";;AAAA,iBAAe;AAEf,2DAA0D;AAC1D,+BAA8B;AAC9B,kDAAqD;AAErD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;IACd,IAAA,yBAAc,GAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QAC5B,MAAM,KAAK,GAAG,sCAAsC,CAAC;QACrD,MAAM,SAAS,GAAG,sCAAsC,CAAC;QACzD,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAEnC,MAAM,SAAS,GAAG;YACd,OAAO;YACP,KAAK,EAAE,KAAK;SAEf,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,IAAA,uCAAmB,EAAC,SAAS,CAAC,CAAC;QAE1D,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACrC,IAAA,aAAM,EAAC,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChatConvo.methods';
|
|
@@ -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("./ChatConvo.methods"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chat/methods/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Model } from 'couchset';
|
|
2
|
+
export declare const ChatAttachmentModelName = "ChatAttachment";
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL Types start
|
|
5
|
+
*/
|
|
6
|
+
export declare class ChatAttachmentType {
|
|
7
|
+
id: string;
|
|
8
|
+
messageId?: string;
|
|
9
|
+
owner: string;
|
|
10
|
+
createdAt?: Date;
|
|
11
|
+
updatedAt?: Date;
|
|
12
|
+
filename?: string;
|
|
13
|
+
mimetype?: string;
|
|
14
|
+
encoding?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChatAttachmentModel: Model;
|
|
18
|
+
export default ChatAttachmentModel;
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ChatAttachmentModel = exports.ChatAttachmentType = exports.ChatAttachmentModelName = void 0;
|
|
10
|
+
const couchset_1 = require("couchset");
|
|
11
|
+
exports.ChatAttachmentModelName = 'ChatAttachment';
|
|
12
|
+
/**
|
|
13
|
+
* GraphQL Types start
|
|
14
|
+
*/
|
|
15
|
+
let ChatAttachmentType = class ChatAttachmentType {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
19
|
+
], ChatAttachmentType.prototype, "id", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
22
|
+
], ChatAttachmentType.prototype, "messageId", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
25
|
+
], ChatAttachmentType.prototype, "owner", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
28
|
+
], ChatAttachmentType.prototype, "createdAt", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
31
|
+
], ChatAttachmentType.prototype, "updatedAt", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
34
|
+
], ChatAttachmentType.prototype, "filename", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
37
|
+
], ChatAttachmentType.prototype, "mimetype", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
40
|
+
], ChatAttachmentType.prototype, "encoding", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
43
|
+
], ChatAttachmentType.prototype, "url", void 0);
|
|
44
|
+
ChatAttachmentType = __decorate([
|
|
45
|
+
(0, couchset_1.InputType)('ChatAttachmentInput'),
|
|
46
|
+
(0, couchset_1.ObjectType)()
|
|
47
|
+
], ChatAttachmentType);
|
|
48
|
+
exports.ChatAttachmentType = ChatAttachmentType;
|
|
49
|
+
exports.ChatAttachmentModel = new couchset_1.Model(exports.ChatAttachmentModelName);
|
|
50
|
+
exports.default = exports.ChatAttachmentModel;
|
|
51
|
+
//# sourceMappingURL=ChatAttachment.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatAttachment.model.js","sourceRoot":"","sources":["../../../src/chat/models/ChatAttachment.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA6D;AAEhD,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAExD;;GAEG;AAGH,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;CA8B9B,CAAA;AA3BG;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CAC3B;AAGX;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;qDACnB;AAGnB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;iDACxB;AAGd;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;qDACnB;AAGjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;qDACnB;AAKjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;oDACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;oDACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;oDACpB;AAGlB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;+CACzB;AA7BJ,kBAAkB;IAF9B,IAAA,oBAAS,EAAC,qBAAqB,CAAC;IAChC,IAAA,qBAAU,GAAE;GACA,kBAAkB,CA8B9B;AA9BY,gDAAkB;AAgClB,QAAA,mBAAmB,GAAU,IAAI,gBAAK,CAAC,+BAAuB,CAAC,CAAC;AAC7E,kBAAe,2BAAmB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Model } from 'couchset';
|
|
2
|
+
import { ChatMessageType } from './ChatMessage.model';
|
|
3
|
+
import { UserType } from '../../user';
|
|
4
|
+
export declare const ChatConvoModelName = "ChatConvo";
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL Types start
|
|
7
|
+
*/
|
|
8
|
+
export declare class ChatConvoType {
|
|
9
|
+
id?: string;
|
|
10
|
+
convoId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
avatar?: string;
|
|
13
|
+
owner: string;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
group?: boolean;
|
|
17
|
+
unread?: number;
|
|
18
|
+
lastMessage?: string;
|
|
19
|
+
members?: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare class ChatConvo {
|
|
22
|
+
id?: string;
|
|
23
|
+
convoId?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
avatar?: string;
|
|
26
|
+
owner: UserType;
|
|
27
|
+
createdAt?: Date;
|
|
28
|
+
updatedAt?: Date;
|
|
29
|
+
group?: boolean;
|
|
30
|
+
unread?: number;
|
|
31
|
+
lastMessage?: ChatMessageType;
|
|
32
|
+
members?: UserType[];
|
|
33
|
+
}
|
|
34
|
+
export declare const chatConvoSelectors: string[];
|
|
35
|
+
export declare const ChatConvoModel: Model;
|
|
36
|
+
export default ChatConvoModel;
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ChatConvoModel = exports.chatConvoSelectors = exports.ChatConvo = exports.ChatConvoType = exports.ChatConvoModelName = void 0;
|
|
10
|
+
const couchset_1 = require("couchset");
|
|
11
|
+
const ChatMessage_model_1 = require("./ChatMessage.model");
|
|
12
|
+
const user_1 = require("../../user");
|
|
13
|
+
exports.ChatConvoModelName = 'ChatConvo';
|
|
14
|
+
/**
|
|
15
|
+
* GraphQL Types start
|
|
16
|
+
*/
|
|
17
|
+
let ChatConvoType = class ChatConvoType {
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
21
|
+
], ChatConvoType.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
24
|
+
], ChatConvoType.prototype, "convoId", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
27
|
+
], ChatConvoType.prototype, "name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
30
|
+
], ChatConvoType.prototype, "avatar", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
33
|
+
], ChatConvoType.prototype, "owner", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
36
|
+
], ChatConvoType.prototype, "createdAt", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
39
|
+
], ChatConvoType.prototype, "updatedAt", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
42
|
+
], ChatConvoType.prototype, "group", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
45
|
+
], ChatConvoType.prototype, "unread", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
48
|
+
], ChatConvoType.prototype, "lastMessage", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, couchset_1.Field)(() => [String], { nullable: true })
|
|
51
|
+
], ChatConvoType.prototype, "members", void 0);
|
|
52
|
+
ChatConvoType = __decorate([
|
|
53
|
+
(0, couchset_1.InputType)('ChatConvoInput'),
|
|
54
|
+
(0, couchset_1.ObjectType)()
|
|
55
|
+
], ChatConvoType);
|
|
56
|
+
exports.ChatConvoType = ChatConvoType;
|
|
57
|
+
let ChatConvo = class ChatConvo {
|
|
58
|
+
};
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
61
|
+
], ChatConvo.prototype, "id", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
64
|
+
], ChatConvo.prototype, "convoId", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
67
|
+
], ChatConvo.prototype, "name", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
70
|
+
], ChatConvo.prototype, "avatar", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, couchset_1.Field)(() => user_1.UserType, { nullable: true })
|
|
73
|
+
], ChatConvo.prototype, "owner", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
76
|
+
], ChatConvo.prototype, "createdAt", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
79
|
+
], ChatConvo.prototype, "updatedAt", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
82
|
+
], ChatConvo.prototype, "group", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
85
|
+
], ChatConvo.prototype, "unread", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, couchset_1.Field)(() => ChatMessage_model_1.ChatMessageType, { nullable: true })
|
|
88
|
+
], ChatConvo.prototype, "lastMessage", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, couchset_1.Field)(() => [user_1.UserType], { nullable: true })
|
|
91
|
+
], ChatConvo.prototype, "members", void 0);
|
|
92
|
+
ChatConvo = __decorate([
|
|
93
|
+
(0, couchset_1.ObjectType)()
|
|
94
|
+
], ChatConvo);
|
|
95
|
+
exports.ChatConvo = ChatConvo;
|
|
96
|
+
exports.chatConvoSelectors = [
|
|
97
|
+
'id',
|
|
98
|
+
'name',
|
|
99
|
+
'avatar',
|
|
100
|
+
'convoId',
|
|
101
|
+
'owner',
|
|
102
|
+
'createdAt',
|
|
103
|
+
'updatedAt',
|
|
104
|
+
'group',
|
|
105
|
+
'unread',
|
|
106
|
+
'lastMessage',
|
|
107
|
+
'members',
|
|
108
|
+
];
|
|
109
|
+
exports.ChatConvoModel = new couchset_1.Model(exports.ChatConvoModelName);
|
|
110
|
+
exports.default = exports.ChatConvoModel;
|
|
111
|
+
//# sourceMappingURL=ChatConvo.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatConvo.model.js","sourceRoot":"","sources":["../../../src/chat/models/ChatConvo.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA6D;AAE7D,2DAAoD;AACpD,qCAAoC;AAEvB,QAAA,kBAAkB,GAAG,WAAW,CAAC;AAE9C;;GAEG;AAGH,IAAa,aAAa,GAA1B,MAAa,aAAa;CAkCzB,CAAA;AA/BG;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;yCAC1B;AAGZ;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CACrB;AAGjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;2CACxB;AAGd;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;6CACtB;AAGhB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACxB;AAGd;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;gDACnB;AAGjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE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C;4CACnB;AAGjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACnB;AAGjB;IADC,IAAA,gBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;wCACR;AAGhB;IADC,IAAA,gBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;yCACR;AAGhB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,mCAAe,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CACjB;AAG9B;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,CAAC,eAAQ,CAAC,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;0CACrB;AAjCZ,SAAS;IADrB,IAAA,qBAAU,GAAE;GACA,SAAS,CAkCrB;AAlCY,8BAAS;AAoCT,QAAA,kBAAkB,GAAG;IAC9B,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,WAAW;IACX,OAAO;IACP,QAAQ;IACR,aAAa;IACb,SAAS;CACZ,CAAC;AAEW,QAAA,cAAc,GAAU,IAAI,gBAAK,CAAC,0BAAkB,CAAC,CAAC;AACnE,kBAAe,sBAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Model } from 'couchset';
|
|
2
|
+
import { ChatAttachmentType } from './ChatAttachment.model';
|
|
3
|
+
import { UserType } from '../../user';
|
|
4
|
+
export declare const ChatMessageModelName = "ChatMessage";
|
|
5
|
+
/**
|
|
6
|
+
* GraphQL Types start
|
|
7
|
+
*/
|
|
8
|
+
export declare class ChatMessageType {
|
|
9
|
+
id: string;
|
|
10
|
+
owner: string;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
system?: boolean;
|
|
14
|
+
convoId?: string;
|
|
15
|
+
attachments?: string[];
|
|
16
|
+
message?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class ChatMessage {
|
|
19
|
+
id: string;
|
|
20
|
+
owner: UserType;
|
|
21
|
+
createdAt?: Date;
|
|
22
|
+
updatedAt?: Date;
|
|
23
|
+
system?: boolean;
|
|
24
|
+
convoId?: string;
|
|
25
|
+
attachments?: ChatAttachmentType[];
|
|
26
|
+
message?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const chatMessageSelectors: string[];
|
|
29
|
+
export declare const ChatMessageModel: Model;
|
|
30
|
+
export default ChatMessageModel;
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ChatMessageModel = exports.chatMessageSelectors = exports.ChatMessage = exports.ChatMessageType = exports.ChatMessageModelName = void 0;
|
|
10
|
+
const couchset_1 = require("couchset");
|
|
11
|
+
const ChatAttachment_model_1 = require("./ChatAttachment.model");
|
|
12
|
+
const user_1 = require("../../user");
|
|
13
|
+
exports.ChatMessageModelName = 'ChatMessage';
|
|
14
|
+
/**
|
|
15
|
+
* GraphQL Types start
|
|
16
|
+
*/
|
|
17
|
+
let ChatMessageType = class ChatMessageType {
|
|
18
|
+
};
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
21
|
+
], ChatMessageType.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
24
|
+
], ChatMessageType.prototype, "owner", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
27
|
+
], ChatMessageType.prototype, "createdAt", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
30
|
+
], ChatMessageType.prototype, "updatedAt", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
33
|
+
], ChatMessageType.prototype, "system", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
36
|
+
], ChatMessageType.prototype, "convoId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
39
|
+
], ChatMessageType.prototype, "attachments", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
42
|
+
], ChatMessageType.prototype, "message", void 0);
|
|
43
|
+
ChatMessageType = __decorate([
|
|
44
|
+
(0, couchset_1.InputType)('ChatMessageInput'),
|
|
45
|
+
(0, couchset_1.ObjectType)()
|
|
46
|
+
], ChatMessageType);
|
|
47
|
+
exports.ChatMessageType = ChatMessageType;
|
|
48
|
+
let ChatMessage = class ChatMessage {
|
|
49
|
+
};
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, couchset_1.Field)(() => String, { nullable: true })
|
|
52
|
+
], ChatMessage.prototype, "id", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, couchset_1.Field)(() => user_1.UserType, { nullable: true })
|
|
55
|
+
], ChatMessage.prototype, "owner", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
58
|
+
], ChatMessage.prototype, "createdAt", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, couchset_1.Field)(() => Date, { nullable: true })
|
|
61
|
+
], ChatMessage.prototype, "updatedAt", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
64
|
+
], ChatMessage.prototype, "system", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
67
|
+
], ChatMessage.prototype, "convoId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, couchset_1.Field)(() => [ChatAttachment_model_1.ChatAttachmentType], { nullable: true })
|
|
70
|
+
], ChatMessage.prototype, "attachments", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, couchset_1.Field)({ nullable: true })
|
|
73
|
+
], ChatMessage.prototype, "message", void 0);
|
|
74
|
+
ChatMessage = __decorate([
|
|
75
|
+
(0, couchset_1.ObjectType)()
|
|
76
|
+
], ChatMessage);
|
|
77
|
+
exports.ChatMessage = ChatMessage;
|
|
78
|
+
exports.chatMessageSelectors = [
|
|
79
|
+
'id',
|
|
80
|
+
'owner',
|
|
81
|
+
'owner',
|
|
82
|
+
'createdAt',
|
|
83
|
+
'updatedAt',
|
|
84
|
+
'convoId',
|
|
85
|
+
'attachments',
|
|
86
|
+
'message',
|
|
87
|
+
];
|
|
88
|
+
exports.ChatMessageModel = new couchset_1.Model(exports.ChatMessageModelName);
|
|
89
|
+
exports.default = exports.ChatMessageModel;
|
|
90
|
+
//# sourceMappingURL=ChatMessage.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessage.model.js","sourceRoot":"","sources":["../../../src/chat/models/ChatMessage.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAA6D;AAE7D,iEAA0D;AAC1D,qCAAoC;AAEvB,QAAA,oBAAoB,GAAG,aAAa,CAAC;AAElD;;GAEG;AAGH,IAAa,eAAe,GAA5B,MAAa,eAAe;CA0B3B,CAAA;AAvBG;IADC,IAAA,gBAAK,E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AAK,EAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;8CACnB;AAGjB;IADC,IAAA,gBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;2CACP;AAGjB;IADC,IAAA,gBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACP;AAGjB;IADC,IAAA,gBAAK,EAAC,GAAG,EAAE,CAAC,CAAC,yCAAkB,CAAC,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;gDACjB;AAGnC;IADC,IAAA,gBAAK,EAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;4CACP;AAxBR,WAAW;IADvB,IAAA,qBAAU,GAAE;GACA,WAAW,CAyBvB;AAzBY,kCAAW;AA2BX,QAAA,oBAAoB,GAAG;IAChC,IAAI;IACJ,OAAO;IACP,OAAO;IACP,WAAW;IACX,WAAW;IACX,SAAS;IACT,aAAa;IACb,SAAS;CACZ,CAAC;AAEW,QAAA,gBAAgB,GAAU,IAAI,gBAAK,CAAC,4BAAoB,CAAC,CAAC;AACvE,kBAAe,wBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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("./ChatAttachment.model"), exports);
|
|
14
|
+
__exportStar(require("./ChatConvo.model"), exports);
|
|
15
|
+
__exportStar(require("./ChatMessage.model"), exports);
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/chat/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,oDAAkC;AAClC,sDAAoC"}
|