@23blocks/block-conversations 1.0.2 → 1.0.4
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.esm.js +695 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/conversations.block.d.ts +16 -0
- package/dist/src/lib/conversations.block.d.ts.map +1 -0
- package/dist/src/lib/mappers/draft-message.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/draft-message.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/group.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/group.mapper.d.ts.map +1 -0
- package/dist/{lib/mappers/index.js → src/lib/mappers/index.d.ts} +1 -2
- package/dist/src/lib/mappers/index.d.ts.map +1 -0
- package/dist/src/lib/mappers/message.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/message.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/notification.mapper.d.ts +4 -0
- package/dist/src/lib/mappers/notification.mapper.d.ts.map +1 -0
- package/dist/src/lib/mappers/utils.d.ts +29 -0
- package/dist/src/lib/mappers/utils.d.ts.map +1 -0
- package/dist/src/lib/services/conversations.service.d.ts +11 -0
- package/dist/src/lib/services/conversations.service.d.ts.map +1 -0
- package/dist/src/lib/services/draft-messages.service.d.ts +15 -0
- package/dist/src/lib/services/draft-messages.service.d.ts.map +1 -0
- package/dist/src/lib/services/groups.service.d.ts +18 -0
- package/dist/src/lib/services/groups.service.d.ts.map +1 -0
- package/dist/{lib/services/index.js → src/lib/services/index.d.ts} +1 -2
- package/dist/src/lib/services/index.d.ts.map +1 -0
- package/dist/src/lib/services/messages.service.d.ts +17 -0
- package/dist/src/lib/services/messages.service.d.ts.map +1 -0
- package/dist/src/lib/services/notifications.service.d.ts +17 -0
- package/dist/src/lib/services/notifications.service.d.ts.map +1 -0
- package/dist/src/lib/types/conversation.d.ts +29 -0
- package/dist/src/lib/types/conversation.d.ts.map +1 -0
- package/dist/src/lib/types/draft-message.d.ts +77 -0
- package/dist/src/lib/types/draft-message.d.ts.map +1 -0
- package/dist/src/lib/types/group.d.ts +50 -0
- package/dist/src/lib/types/group.d.ts.map +1 -0
- package/dist/{lib/types/index.js → src/lib/types/index.d.ts} +1 -2
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/message.d.ts +81 -0
- package/dist/src/lib/types/message.d.ts.map +1 -0
- package/dist/src/lib/types/notification.d.ts +56 -0
- package/dist/src/lib/types/notification.d.ts.map +1 -0
- package/package.json +10 -8
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/lib/conversations.block.js +0 -24
- package/dist/lib/conversations.block.js.map +0 -1
- package/dist/lib/mappers/draft-message.mapper.js +0 -50
- package/dist/lib/mappers/draft-message.mapper.js.map +0 -1
- package/dist/lib/mappers/group.mapper.js +0 -29
- package/dist/lib/mappers/group.mapper.js.map +0 -1
- package/dist/lib/mappers/index.js.map +0 -1
- package/dist/lib/mappers/message.mapper.js +0 -53
- package/dist/lib/mappers/message.mapper.js.map +0 -1
- package/dist/lib/mappers/notification.mapper.js +0 -39
- package/dist/lib/mappers/notification.mapper.js.map +0 -1
- package/dist/lib/mappers/utils.js +0 -75
- package/dist/lib/mappers/utils.js.map +0 -1
- package/dist/lib/services/conversations.service.js +0 -38
- package/dist/lib/services/conversations.service.js.map +0 -1
- package/dist/lib/services/draft-messages.service.js +0 -94
- package/dist/lib/services/draft-messages.service.js.map +0 -1
- package/dist/lib/services/groups.service.js +0 -109
- package/dist/lib/services/groups.service.js.map +0 -1
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/messages.service.js +0 -116
- package/dist/lib/services/messages.service.js.map +0 -1
- package/dist/lib/services/notifications.service.js +0 -100
- package/dist/lib/services/notifications.service.js.map +0 -1
- package/dist/lib/types/conversation.js +0 -4
- package/dist/lib/types/conversation.js.map +0 -1
- package/dist/lib/types/draft-message.js +0 -3
- package/dist/lib/types/draft-message.js.map +0 -1
- package/dist/lib/types/group.js +0 -3
- package/dist/lib/types/group.js.map +0 -1
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/message.js +0 -3
- package/dist/lib/types/message.js.map +0 -1
- package/dist/lib/types/notification.js +0 -3
- package/dist/lib/types/notification.js.map +0 -1
package/dist/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Block factory and metadata
|
|
2
|
-
export { createConversationsBlock, conversationsBlockMetadata } from './lib/conversations.block';
|
|
3
|
-
export { createMessagesService, createDraftMessagesService, createGroupsService, createNotificationsService, createConversationsService } from './lib/services';
|
|
4
|
-
// Mappers (for advanced use cases)
|
|
5
|
-
export { messageMapper, draftMessageMapper, groupMapper, notificationMapper } from './lib/mappers';
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Block factory and metadata\nexport { createConversationsBlock, conversationsBlockMetadata } from './lib/conversations.block';\nexport type { ConversationsBlock, ConversationsBlockConfig } from './lib/conversations.block';\n\n// Types\nexport type {\n // Message types\n Message,\n CreateMessageRequest,\n UpdateMessageRequest,\n ListMessagesParams,\n // Draft Message types\n DraftMessage,\n CreateDraftMessageRequest,\n UpdateDraftMessageRequest,\n ListDraftMessagesParams,\n // Group types\n Group,\n CreateGroupRequest,\n UpdateGroupRequest,\n ListGroupsParams,\n // Notification types\n Notification,\n CreateNotificationRequest,\n UpdateNotificationRequest,\n ListNotificationsParams,\n // Conversation types\n Conversation,\n ConversationFile,\n ConversationMeta,\n GetConversationParams,\n} from './lib/types';\n\n// Services\nexport type {\n MessagesService,\n DraftMessagesService,\n GroupsService,\n NotificationsService,\n ConversationsService,\n} from './lib/services';\n\nexport {\n createMessagesService,\n createDraftMessagesService,\n createGroupsService,\n createNotificationsService,\n createConversationsService,\n} from './lib/services';\n\n// Mappers (for advanced use cases)\nexport {\n messageMapper,\n draftMessageMapper,\n groupMapper,\n notificationMapper,\n} from './lib/mappers';\n"],"names":["createConversationsBlock","conversationsBlockMetadata","createMessagesService","createDraftMessagesService","createGroupsService","createNotificationsService","createConversationsService","messageMapper","draftMessageMapper","groupMapper","notificationMapper"],"rangeMappings":";;;;","mappings":"AAAA,6BAA6B;AAC7B,SAASA,wBAAwB,EAAEC,0BAA0B,QAAQ,4BAA4B;AAyCjG,SACEC,qBAAqB,EACrBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,0BAA0B,EAC1BC,0BAA0B,QACrB,iBAAiB;AAExB,mCAAmC;AACnC,SACEC,aAAa,EACbC,kBAAkB,EAClBC,WAAW,EACXC,kBAAkB,QACb,gBAAgB"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createMessagesService, createDraftMessagesService, createGroupsService, createNotificationsService, createConversationsService } from './services';
|
|
2
|
-
export function createConversationsBlock(transport, config) {
|
|
3
|
-
return {
|
|
4
|
-
messages: createMessagesService(transport, config),
|
|
5
|
-
draftMessages: createDraftMessagesService(transport, config),
|
|
6
|
-
groups: createGroupsService(transport, config),
|
|
7
|
-
notifications: createNotificationsService(transport, config),
|
|
8
|
-
conversations: createConversationsService(transport, config)
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const conversationsBlockMetadata = {
|
|
12
|
-
name: 'conversations',
|
|
13
|
-
version: '0.1.0',
|
|
14
|
-
description: 'Messaging, conversations, groups, and notifications management',
|
|
15
|
-
resourceTypes: [
|
|
16
|
-
'Message',
|
|
17
|
-
'DraftMessage',
|
|
18
|
-
'Group',
|
|
19
|
-
'Notification',
|
|
20
|
-
'Conversation'
|
|
21
|
-
]
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=conversations.block.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/conversations.block.ts"],"sourcesContent":["import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';\nimport {\n createMessagesService,\n createDraftMessagesService,\n createGroupsService,\n createNotificationsService,\n createConversationsService,\n type MessagesService,\n type DraftMessagesService,\n type GroupsService,\n type NotificationsService,\n type ConversationsService,\n} from './services';\n\nexport interface ConversationsBlockConfig extends BlockConfig {\n appId: string;\n tenantId?: string;\n}\n\nexport interface ConversationsBlock {\n messages: MessagesService;\n draftMessages: DraftMessagesService;\n groups: GroupsService;\n notifications: NotificationsService;\n conversations: ConversationsService;\n}\n\nexport function createConversationsBlock(\n transport: Transport,\n config: ConversationsBlockConfig\n): ConversationsBlock {\n return {\n messages: createMessagesService(transport, config),\n draftMessages: createDraftMessagesService(transport, config),\n groups: createGroupsService(transport, config),\n notifications: createNotificationsService(transport, config),\n conversations: createConversationsService(transport, config),\n };\n}\n\nexport const conversationsBlockMetadata: BlockMetadata = {\n name: 'conversations',\n version: '0.1.0',\n description: 'Messaging, conversations, groups, and notifications management',\n resourceTypes: [\n 'Message',\n 'DraftMessage',\n 'Group',\n 'Notification',\n 'Conversation',\n ],\n};\n"],"names":["createMessagesService","createDraftMessagesService","createGroupsService","createNotificationsService","createConversationsService","createConversationsBlock","transport","config","messages","draftMessages","groups","notifications","conversations","conversationsBlockMetadata","name","version","description","resourceTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SACEA,qBAAqB,EACrBC,0BAA0B,EAC1BC,mBAAmB,EACnBC,0BAA0B,EAC1BC,0BAA0B,QAMrB,aAAa;AAepB,OAAO,SAASC,yBACdC,SAAoB,EACpBC,MAAgC;IAEhC,OAAO;QACLC,UAAUR,sBAAsBM,WAAWC;QAC3CE,eAAeR,2BAA2BK,WAAWC;QACrDG,QAAQR,oBAAoBI,WAAWC;QACvCI,eAAeR,2BAA2BG,WAAWC;QACrDK,eAAeR,2BAA2BE,WAAWC;IACvD;AACF;AAEA,OAAO,MAAMM,6BAA4C;IACvDC,MAAM;IACNC,SAAS;IACTC,aAAa;IACbC,eAAe;QACb;QACA;QACA;QACA;QACA;KACD;AACH,EAAE"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';
|
|
2
|
-
export const draftMessageMapper = {
|
|
3
|
-
type: 'DraftMessage',
|
|
4
|
-
map: (resource)=>({
|
|
5
|
-
id: resource.id,
|
|
6
|
-
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
7
|
-
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
8
|
-
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
9
|
-
contextId: parseString(resource.attributes['context_id']),
|
|
10
|
-
parentId: parseString(resource.attributes['parent_id']),
|
|
11
|
-
content: parseString(resource.attributes['content']) || '',
|
|
12
|
-
// Source (sender)
|
|
13
|
-
source: parseString(resource.attributes['source']),
|
|
14
|
-
sourceId: parseString(resource.attributes['source_id']),
|
|
15
|
-
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
16
|
-
sourceEmail: parseString(resource.attributes['source_email']),
|
|
17
|
-
sourcePhone: parseString(resource.attributes['source_phone']),
|
|
18
|
-
sourceType: parseString(resource.attributes['source_type']),
|
|
19
|
-
// Target (recipient)
|
|
20
|
-
target: parseString(resource.attributes['target']),
|
|
21
|
-
targetId: parseString(resource.attributes['target_id']),
|
|
22
|
-
targetAlias: parseString(resource.attributes['target_alias']),
|
|
23
|
-
targetEmail: parseString(resource.attributes['target_email']),
|
|
24
|
-
targetPhone: parseString(resource.attributes['target_phone']),
|
|
25
|
-
targetType: parseString(resource.attributes['target_type']),
|
|
26
|
-
targetDeviceId: parseString(resource.attributes['target_device_id']),
|
|
27
|
-
// Value and data source
|
|
28
|
-
value: parseOptionalNumber(resource.attributes['value']),
|
|
29
|
-
dataSource: parseString(resource.attributes['data_source']),
|
|
30
|
-
dataSourceId: parseString(resource.attributes['data_source_id']),
|
|
31
|
-
dataSourceType: parseString(resource.attributes['data_source_type']),
|
|
32
|
-
dataSourceAlias: parseString(resource.attributes['data_source_alias']),
|
|
33
|
-
// Status
|
|
34
|
-
status: parseStatus(resource.attributes['status']),
|
|
35
|
-
enabled: parseBoolean(resource.attributes['enabled']),
|
|
36
|
-
// Extra data
|
|
37
|
-
payload: resource.attributes['payload'],
|
|
38
|
-
// Notification
|
|
39
|
-
notificationContent: parseString(resource.attributes['notification_content']),
|
|
40
|
-
notificationUrl: parseString(resource.attributes['notification_url']),
|
|
41
|
-
// Expiration
|
|
42
|
-
expiresAt: parseDate(resource.attributes['expires_at']),
|
|
43
|
-
// RAG sources
|
|
44
|
-
ragSources: parseStringArray(resource.attributes['rag_sources']),
|
|
45
|
-
// Idempotency
|
|
46
|
-
idempotencyKey: parseString(resource.attributes['idempotency_key'])
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=draft-message.mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/draft-message.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { DraftMessage } from '../types/draft-message';\nimport { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';\n\nexport const draftMessageMapper: ResourceMapper<DraftMessage> = {\n type: 'DraftMessage',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n contextId: parseString(resource.attributes['context_id']),\n parentId: parseString(resource.attributes['parent_id']),\n content: parseString(resource.attributes['content']) || '',\n\n // Source (sender)\n source: parseString(resource.attributes['source']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceEmail: parseString(resource.attributes['source_email']),\n sourcePhone: parseString(resource.attributes['source_phone']),\n sourceType: parseString(resource.attributes['source_type']),\n\n // Target (recipient)\n target: parseString(resource.attributes['target']),\n targetId: parseString(resource.attributes['target_id']),\n targetAlias: parseString(resource.attributes['target_alias']),\n targetEmail: parseString(resource.attributes['target_email']),\n targetPhone: parseString(resource.attributes['target_phone']),\n targetType: parseString(resource.attributes['target_type']),\n targetDeviceId: parseString(resource.attributes['target_device_id']),\n\n // Value and data source\n value: parseOptionalNumber(resource.attributes['value']),\n dataSource: parseString(resource.attributes['data_source']),\n dataSourceId: parseString(resource.attributes['data_source_id']),\n dataSourceType: parseString(resource.attributes['data_source_type']),\n dataSourceAlias: parseString(resource.attributes['data_source_alias']),\n\n // Status\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n\n // Extra data\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n\n // Notification\n notificationContent: parseString(resource.attributes['notification_content']),\n notificationUrl: parseString(resource.attributes['notification_url']),\n\n // Expiration\n expiresAt: parseDate(resource.attributes['expires_at']),\n\n // RAG sources\n ragSources: parseStringArray(resource.attributes['rag_sources']),\n\n // Idempotency\n idempotencyKey: parseString(resource.attributes['idempotency_key']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseOptionalNumber","parseStatus","parseStringArray","draftMessageMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","contextId","parentId","content","source","sourceId","sourceAlias","sourceEmail","sourcePhone","sourceType","target","targetId","targetAlias","targetEmail","targetPhone","targetType","targetDeviceId","value","dataSource","dataSourceId","dataSourceType","dataSourceAlias","status","enabled","payload","notificationContent","notificationUrl","expiresAt","ragSources","idempotencyKey"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,mBAAmB,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AAEnH,OAAO,MAAMC,qBAAmD;IAC9DC,MAAM;IACNC,KAAK,CAACC,WAAc,C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BAAmB;YACnEwB,iBAAiBpC,YAAYS,SAASG,UAAU,CAAC,oBAAoB;YAErE,SAAS;YACTyB,QAAQjC,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjD0B,SAASpC,aAAaO,SAASG,UAAU,CAAC,UAAU;YAEpD,aAAa;YACb2B,SAAS9B,SAASG,UAAU,CAAC,UAAU;YAEvC,eAAe;YACf4B,qBAAqBxC,YAAYS,SAASG,UAAU,CAAC,uBAAuB;YAC5E6B,iBAAiBzC,YAAYS,SAASG,UAAU,CAAC,mBAAmB;YAEpE,aAAa;YACb8B,WAAWzC,UAAUQ,SAASG,UAAU,CAAC,aAAa;YAEtD,cAAc;YACd+B,YAAYtC,iBAAiBI,SAASG,UAAU,CAAC,cAAc;YAE/D,cAAc;YACdgC,gBAAgB5C,YAAYS,SAASG,UAAU,CAAC,kBAAkB;QACpE,CAAA;AACF,EAAE"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';
|
|
2
|
-
export const groupMapper = {
|
|
3
|
-
type: 'Group',
|
|
4
|
-
map: (resource)=>({
|
|
5
|
-
id: resource.id,
|
|
6
|
-
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
7
|
-
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
8
|
-
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
9
|
-
name: parseString(resource.attributes['name']) || '',
|
|
10
|
-
code: parseString(resource.attributes['code']),
|
|
11
|
-
uniqueCode: parseString(resource.attributes['unique_code']),
|
|
12
|
-
qcode: parseString(resource.attributes['qcode']),
|
|
13
|
-
groupType: parseString(resource.attributes['group_type']),
|
|
14
|
-
// Members
|
|
15
|
-
members: parseStringArray(resource.attributes['members']),
|
|
16
|
-
// Status
|
|
17
|
-
status: parseStatus(resource.attributes['status']),
|
|
18
|
-
enabled: parseBoolean(resource.attributes['enabled']),
|
|
19
|
-
// Source
|
|
20
|
-
source: parseString(resource.attributes['source']),
|
|
21
|
-
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
22
|
-
sourceId: parseString(resource.attributes['source_id']),
|
|
23
|
-
sourceType: parseString(resource.attributes['source_type']),
|
|
24
|
-
// Extra data
|
|
25
|
-
payload: resource.attributes['payload']
|
|
26
|
-
})
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=group.mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/group.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Group } from '../types/group';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';\n\nexport const groupMapper: ResourceMapper<Group> = {\n type: 'Group',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n name: parseString(resource.attributes['name']) || '',\n code: parseString(resource.attributes['code']),\n uniqueCode: parseString(resource.attributes['unique_code']),\n qcode: parseString(resource.attributes['qcode']),\n groupType: parseString(resource.attributes['group_type']),\n\n // Members\n members: parseStringArray(resource.attributes['members']),\n\n // Status\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n\n // Source\n source: parseString(resource.attributes['source']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceType: parseString(resource.attributes['source_type']),\n\n // Extra data\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseStringArray","groupMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","name","code","uniqueCode","qcode","groupType","members","status","enabled","source","sourceAlias","sourceId","sourceType","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AAE9F,OAAO,MAAMC,cAAqC;IAChDC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUV,YAAYQ,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWX,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWb,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,MAAMf,YAAYQ,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDK,MAAMhB,YAAYQ,SAASG,UAAU,CAAC,OAAO;YAC7CM,YAAYjB,YAAYQ,SAASG,UAAU,CAAC,cAAc;YAC1DO,OAAOlB,YAAYQ,SAASG,UAAU,CAAC,QAAQ;YAC/CQ,WAAWnB,YAAYQ,SAASG,UAAU,CAAC,aAAa;YAExD,UAAU;YACVS,SAAShB,iBAAiBI,SAASG,UAAU,CAAC,UAAU;YAExD,SAAS;YACTU,QAAQlB,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjDW,SAASpB,aAAaM,SAASG,UAAU,CAAC,UAAU;YAEpD,SAAS;YACTY,QAAQvB,YAAYQ,SAASG,UAAU,CAAC,SAAS;YACjDa,aAAaxB,YAAYQ,SAASG,UAAU,CAAC,eAAe;YAC5Dc,UAAUzB,YAAYQ,SAASG,UAAU,CAAC,YAAY;YACtDe,YAAY1B,YAAYQ,SAASG,UAAU,CAAC,cAAc;YAE1D,aAAa;YACbgB,SAASnB,SAASG,UAAU,CAAC,UAAU;QACzC,CAAA;AACF,EAAE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/index.ts"],"sourcesContent":["export * from './message.mapper';\nexport * from './draft-message.mapper';\nexport * from './group.mapper';\nexport * from './notification.mapper';\nexport * from './utils';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,UAAU"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';
|
|
2
|
-
export const messageMapper = {
|
|
3
|
-
type: 'Message',
|
|
4
|
-
map: (resource)=>({
|
|
5
|
-
id: resource.id,
|
|
6
|
-
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
7
|
-
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
8
|
-
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
9
|
-
contextId: parseString(resource.attributes['context_id']),
|
|
10
|
-
parentId: parseString(resource.attributes['parent_id']),
|
|
11
|
-
content: parseString(resource.attributes['content']) || '',
|
|
12
|
-
// Source (sender)
|
|
13
|
-
source: parseString(resource.attributes['source']),
|
|
14
|
-
sourceId: parseString(resource.attributes['source_id']),
|
|
15
|
-
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
16
|
-
sourceEmail: parseString(resource.attributes['source_email']),
|
|
17
|
-
sourcePhone: parseString(resource.attributes['source_phone']),
|
|
18
|
-
sourceType: parseString(resource.attributes['source_type']),
|
|
19
|
-
// Target (recipient)
|
|
20
|
-
target: parseString(resource.attributes['target']),
|
|
21
|
-
targetId: parseString(resource.attributes['target_id']),
|
|
22
|
-
targetAlias: parseString(resource.attributes['target_alias']),
|
|
23
|
-
targetEmail: parseString(resource.attributes['target_email']),
|
|
24
|
-
targetPhone: parseString(resource.attributes['target_phone']),
|
|
25
|
-
targetType: parseString(resource.attributes['target_type']),
|
|
26
|
-
targetDeviceId: parseString(resource.attributes['target_device_id']),
|
|
27
|
-
// Value and data source
|
|
28
|
-
value: parseOptionalNumber(resource.attributes['value']),
|
|
29
|
-
dataSource: parseString(resource.attributes['data_source']),
|
|
30
|
-
dataSourceId: parseString(resource.attributes['data_source_id']),
|
|
31
|
-
dataSourceType: parseString(resource.attributes['data_source_type']),
|
|
32
|
-
dataSourceAlias: parseString(resource.attributes['data_source_alias']),
|
|
33
|
-
// Status
|
|
34
|
-
status: parseStatus(resource.attributes['status']),
|
|
35
|
-
enabled: parseBoolean(resource.attributes['enabled']),
|
|
36
|
-
// Extra data
|
|
37
|
-
payload: resource.attributes['payload'],
|
|
38
|
-
// Notification
|
|
39
|
-
notificationContent: parseString(resource.attributes['notification_content']),
|
|
40
|
-
notificationUrl: parseString(resource.attributes['notification_url']),
|
|
41
|
-
// Expiration
|
|
42
|
-
expiresAt: parseDate(resource.attributes['expires_at']),
|
|
43
|
-
// RAG sources
|
|
44
|
-
ragSources: parseStringArray(resource.attributes['rag_sources']),
|
|
45
|
-
// Idempotency
|
|
46
|
-
idempotencyKey: parseString(resource.attributes['idempotency_key']),
|
|
47
|
-
// Tracking
|
|
48
|
-
createdBy: parseString(resource.attributes['created_by']),
|
|
49
|
-
updatedBy: parseString(resource.attributes['updated_by'])
|
|
50
|
-
})
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=message.mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/message.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Message } from '../types/message';\nimport { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';\n\nexport const messageMapper: ResourceMapper<Message> = {\n type: 'Message',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n contextId: parseString(resource.attributes['context_id']),\n parentId: parseString(resource.attributes['parent_id']),\n content: parseString(resource.attributes['content']) || '',\n\n // Source (sender)\n source: parseString(resource.attributes['source']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceEmail: parseString(resource.attributes['source_email']),\n sourcePhone: parseString(resource.attributes['source_phone']),\n sourceType: parseString(resource.attributes['source_type']),\n\n // Target (recipient)\n target: parseString(resource.attributes['target']),\n targetId: parseString(resource.attributes['target_id']),\n targetAlias: parseString(resource.attributes['target_alias']),\n targetEmail: parseString(resource.attributes['target_email']),\n targetPhone: parseString(resource.attributes['target_phone']),\n targetType: parseString(resource.attributes['target_type']),\n targetDeviceId: parseString(resource.attributes['target_device_id']),\n\n // Value and data source\n value: parseOptionalNumber(resource.attributes['value']),\n dataSource: parseString(resource.attributes['data_source']),\n dataSourceId: parseString(resource.attributes['data_source_id']),\n dataSourceType: parseString(resource.attributes['data_source_type']),\n dataSourceAlias: parseString(resource.attributes['data_source_alias']),\n\n // Status\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n\n // Extra data\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n\n // Notification\n notificationContent: parseString(resource.attributes['notification_content']),\n notificationUrl: parseString(resource.attributes['notification_url']),\n\n // Expiration\n expiresAt: parseDate(resource.attributes['expires_at']),\n\n // RAG sources\n ragSources: parseStringArray(resource.attributes['rag_sources']),\n\n // Idempotency\n idempotencyKey: parseString(resource.attributes['idempotency_key']),\n\n // Tracking\n createdBy: parseString(resource.attributes['created_by']),\n updatedBy: parseString(resource.attributes['updated_by']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseOptionalNumber","parseStatus","parseStringArray","messageMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","contextId","parentId","content","source","sourceId","sourceAlias","sourceEmail","sourcePhone","sourceType","target","targetId","targetAlias","targetEmail","targetPhone","targetType","targetDeviceId","value","dataSource","dataSourceId","dataSourceType","dataSourceAlias","status","enabled","payload","notificationContent","notificationUrl","expiresAt","ragSources","idempotencyKey","createdBy","updatedBy"],"rangeMappings":";;;;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AAU,CAAC,mBAAmB;YAEnE,wBAAwB;YACxBoB,OAAO7B,oBAAoBM,SAASG,UAAU,CAAC,QAAQ;YACvDqB,YAAYjC,YAAYS,SAASG,UAAU,CAAC,cAAc;YAC1DsB,cAAclC,YAAYS,SAASG,UAAU,CAAC,iBAAiB;YAC/DuB,gBAAgBnC,YAAYS,SAASG,UAAU,CAAC,mBAAmB;YACnEwB,iBAAiBpC,YAAYS,SAASG,UAAU,CAAC,oBAAoB;YAErE,SAAS;YACTyB,QAAQjC,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjD0B,SAASpC,aAAaO,SAASG,UAAU,CAAC,UAAU;YAEpD,aAAa;YACb2B,SAAS9B,SAASG,UAAU,CAAC,UAAU;YAEvC,eAAe;YACf4B,qBAAqBxC,YAAYS,SAASG,UAAU,CAAC,uBAAuB;YAC5E6B,iBAAiBzC,YAAYS,SAASG,UAAU,CAAC,mBAAmB;YAEpE,aAAa;YACb8B,WAAWzC,UAAUQ,SAASG,UAAU,CAAC,aAAa;YAEtD,cAAc;YACd+B,YAAYtC,iBAAiBI,SAASG,UAAU,CAAC,cAAc;YAE/D,cAAc;YACdgC,gBAAgB5C,YAAYS,SAASG,UAAU,CAAC,kBAAkB;YAElE,WAAW;YACXiC,WAAW7C,YAAYS,SAASG,UAAU,CAAC,aAAa;YACxDkC,WAAW9C,YAAYS,SAASG,UAAU,CAAC,aAAa;QAC1D,CAAA;AACF,EAAE"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { parseString, parseDate, parseBoolean, parseStatus } from './utils';
|
|
2
|
-
export const notificationMapper = {
|
|
3
|
-
type: 'Notification',
|
|
4
|
-
map: (resource)=>({
|
|
5
|
-
id: resource.id,
|
|
6
|
-
uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
|
|
7
|
-
createdAt: parseDate(resource.attributes['created_at']) || new Date(),
|
|
8
|
-
updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
|
|
9
|
-
content: parseString(resource.attributes['content']) || '',
|
|
10
|
-
// Source
|
|
11
|
-
source: parseString(resource.attributes['source']),
|
|
12
|
-
sourceAlias: parseString(resource.attributes['source_alias']),
|
|
13
|
-
sourceId: parseString(resource.attributes['source_id']),
|
|
14
|
-
sourceType: parseString(resource.attributes['source_type']),
|
|
15
|
-
// URL
|
|
16
|
-
url: parseString(resource.attributes['url']),
|
|
17
|
-
// Status
|
|
18
|
-
status: parseStatus(resource.attributes['status']),
|
|
19
|
-
// Target
|
|
20
|
-
target: parseString(resource.attributes['target']),
|
|
21
|
-
targetId: parseString(resource.attributes['target_id']),
|
|
22
|
-
targetAlias: parseString(resource.attributes['target_alias']),
|
|
23
|
-
targetType: parseString(resource.attributes['target_type']),
|
|
24
|
-
targetEmail: parseString(resource.attributes['target_email']),
|
|
25
|
-
targetPhone: parseString(resource.attributes['target_phone']),
|
|
26
|
-
targetDeviceId: parseString(resource.attributes['target_device_id']),
|
|
27
|
-
// Multichannel
|
|
28
|
-
multichannel: parseBoolean(resource.attributes['multichannel']),
|
|
29
|
-
// Extra data
|
|
30
|
-
payload: resource.attributes['payload'],
|
|
31
|
-
// Expiration
|
|
32
|
-
expiresAt: parseDate(resource.attributes['expires_at']),
|
|
33
|
-
// Tracking
|
|
34
|
-
createdBy: parseString(resource.attributes['created_by']),
|
|
35
|
-
updatedBy: parseString(resource.attributes['updated_by'])
|
|
36
|
-
})
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=notification.mapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/notification.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Notification } from '../types/notification';\nimport { parseString, parseDate, parseBoolean, parseStatus } from './utils';\n\nexport const notificationMapper: ResourceMapper<Notification> = {\n type: 'Notification',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n content: parseString(resource.attributes['content']) || '',\n\n // Source\n source: parseString(resource.attributes['source']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceType: parseString(resource.attributes['source_type']),\n\n // URL\n url: parseString(resource.attributes['url']),\n\n // Status\n status: parseStatus(resource.attributes['status']),\n\n // Target\n target: parseString(resource.attributes['target']),\n targetId: parseString(resource.attributes['target_id']),\n targetAlias: parseString(resource.attributes['target_alias']),\n targetType: parseString(resource.attributes['target_type']),\n targetEmail: parseString(resource.attributes['target_email']),\n targetPhone: parseString(resource.attributes['target_phone']),\n targetDeviceId: parseString(resource.attributes['target_device_id']),\n\n // Multichannel\n multichannel: parseBoolean(resource.attributes['multichannel']),\n\n // Extra data\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n\n // Expiration\n expiresAt: parseDate(resource.attributes['expires_at']),\n\n // Tracking\n createdBy: parseString(resource.attributes['created_by']),\n updatedBy: parseString(resource.attributes['updated_by']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","notificationMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","content","source","sourceAlias","sourceId","sourceType","url","status","target","targetId","targetAlias","targetType","targetEmail","targetPhone","targetDeviceId","multichannel","payload","expiresAt","createdBy","updatedBy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,QAAQ,UAAU;AAE5E,OAAO,MAAMC,qBAAmD;IAC9DC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUT,YAAYO,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWV,UAAUM,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWZ,UAAUM,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,SAASd,YAAYO,SAASG,UAAU,CAAC,UAAU,KAAK;YAExD,SAAS;YACTK,QAAQf,YAAYO,SAASG,UAAU,CAAC,SAAS;YACjDM,aAAahB,YAAYO,SAASG,UAAU,CAAC,eAAe;YAC5DO,UAAUjB,YAAYO,SAASG,UAAU,CAAC,YAAY;YACtDQ,YAAYlB,YAAYO,SAASG,UAAU,CAAC,cAAc;YAE1D,MAAM;YACNS,KAAKnB,YAAYO,SAASG,UAAU,CAAC,MAAM;YAE3C,SAAS;YACTU,QAAQjB,YAAYI,SAASG,UAAU,CAAC,SAAS;YAEjD,SAAS;YACTW,QAAQrB,YAAYO,SAASG,UAAU,CAAC,SAAS;YACjDY,UAAUtB,YAAYO,SAASG,UAAU,CAAC,YAAY;YACtDa,aAAavB,YAAYO,SAASG,UAAU,CAAC,eAAe;YAC5Dc,YAAYxB,YAAYO,SAASG,UAAU,CAAC,cAAc;YAC1De,aAAazB,YAAYO,SAASG,UAAU,CAAC,eAAe;YAC5DgB,aAAa1B,YAAYO,SAASG,UAAU,CAAC,eAAe;YAC5DiB,gBAAgB3B,YAAYO,SAASG,UAAU,CAAC,mBAAmB;YAEnE,eAAe;YACfkB,cAAc1B,aAAaK,SAASG,UAAU,CAAC,eAAe;YAE9D,aAAa;YACbmB,SAAStB,SAASG,UAAU,CAAC,UAAU;YAEvC,aAAa;YACboB,WAAW7B,UAAUM,SAASG,UAAU,CAAC,aAAa;YAEtD,WAAW;YACXqB,WAAW/B,YAAYO,SAASG,UAAU,CAAC,aAAa;YACxDsB,WAAWhC,YAAYO,SAASG,UAAU,CAAC,aAAa;QAC1D,CAAA;AACF,EAAE"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a string value, returning undefined for empty/undefined
|
|
3
|
-
*/ export function parseString(value) {
|
|
4
|
-
if (value === null || value === undefined) {
|
|
5
|
-
return undefined;
|
|
6
|
-
}
|
|
7
|
-
const str = String(value);
|
|
8
|
-
return str.length > 0 ? str : undefined;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Parse a date value
|
|
12
|
-
*/ export function parseDate(value) {
|
|
13
|
-
if (value === null || value === undefined) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
if (value instanceof Date) {
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
20
|
-
const date = new Date(value);
|
|
21
|
-
return isNaN(date.getTime()) ? undefined : date;
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Parse a boolean value
|
|
27
|
-
*/ export function parseBoolean(value) {
|
|
28
|
-
if (typeof value === 'boolean') {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
if (value === 'true' || value === '1' || value === 1) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Parse an array of strings
|
|
38
|
-
*/ export function parseStringArray(value) {
|
|
39
|
-
if (value === null || value === undefined) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
if (Array.isArray(value)) {
|
|
43
|
-
return value.map(String);
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Parse a number value
|
|
49
|
-
*/ export function parseNumber(value) {
|
|
50
|
-
if (value === null || value === undefined) {
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
const num = Number(value);
|
|
54
|
-
return isNaN(num) ? 0 : num;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Parse an optional number value
|
|
58
|
-
*/ export function parseOptionalNumber(value) {
|
|
59
|
-
if (value === null || value === undefined) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
const num = Number(value);
|
|
63
|
-
return isNaN(num) ? undefined : num;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Parse entity status
|
|
67
|
-
*/ export function parseStatus(value) {
|
|
68
|
-
const status = parseString(value);
|
|
69
|
-
if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {
|
|
70
|
-
return status;
|
|
71
|
-
}
|
|
72
|
-
return 'active';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/mappers/utils.ts"],"sourcesContent":["/**\n * Parse a string value, returning undefined for empty/undefined\n */\nexport function parseString(value: unknown): string | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const str = String(value);\n return str.length > 0 ? str : undefined;\n}\n\n/**\n * Parse a date value\n */\nexport function parseDate(value: unknown): Date | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (value instanceof Date) {\n return value;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n const date = new Date(value);\n return isNaN(date.getTime()) ? undefined : date;\n }\n\n return undefined;\n}\n\n/**\n * Parse a boolean value\n */\nexport function parseBoolean(value: unknown): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n if (value === 'true' || value === '1' || value === 1) {\n return true;\n }\n return false;\n}\n\n/**\n * Parse an array of strings\n */\nexport function parseStringArray(value: unknown): string[] | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value.map(String);\n }\n return undefined;\n}\n\n/**\n * Parse a number value\n */\nexport function parseNumber(value: unknown): number {\n if (value === null || value === undefined) {\n return 0;\n }\n const num = Number(value);\n return isNaN(num) ? 0 : num;\n}\n\n/**\n * Parse an optional number value\n */\nexport function parseOptionalNumber(value: unknown): number | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const num = Number(value);\n return isNaN(num) ? undefined : num;\n}\n\n/**\n * Parse entity status\n */\nexport function parseStatus(value: unknown): 'active' | 'inactive' | 'pending' | 'archived' | 'deleted' {\n const status = parseString(value);\n if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {\n return status;\n }\n return 'active';\n}\n"],"names":["parseString","value","undefined","str","String","length","parseDate","Date","date","isNaN","getTime","parseBoolean","parseStringArray","Array","isArray","map","parseNumber","num","Number","parseOptionalNumber","parseStatus","status"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,YAAYC,KAAc;IACxC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,MAAMC,MAAMC,OAAOH;IACnB,OAAOE,IAAIE,MAAM,GAAG,IAAIF,MAAMD;AAChC;AAEA;;CAEC,GACD,OAAO,SAASI,UAAUL,KAAc;IACtC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IAEA,IAAID,iBAAiBM,MAAM;QACzB,OAAON;IACT;IAEA,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,UAAU;QAC1D,MAAMO,OAAO,IAAID,KAAKN;QACtB,OAAOQ,MAAMD,KAAKE,OAAO,MAAMR,YAAYM;IAC7C;IAEA,OAAON;AACT;AAEA;;CAEC,GACD,OAAO,SAASS,aAAaV,KAAc;IACzC,IAAI,OAAOA,UAAU,WAAW;QAC9B,OAAOA;IACT;IACA,IAAIA,UAAU,UAAUA,UAAU,OAAOA,UAAU,GAAG;QACpD,OAAO;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASW,iBAAiBX,KAAc;IAC7C,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,IAAIW,MAAMC,OAAO,CAACb,QAAQ;QACxB,OAAOA,MAAMc,GAAG,CAACX;IACnB;IACA,OAAOF;AACT;AAEA;;CAEC,GACD,OAAO,SAASc,YAAYf,KAAc;IACxC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAO;IACT;IACA,MAAMe,MAAMC,OAAOjB;IACnB,OAAOQ,MAAMQ,OAAO,IAAIA;AAC1B;AAEA;;CAEC,GACD,OAAO,SAASE,oBAAoBlB,KAAc;IAChD,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,MAAMe,MAAMC,OAAOjB;IACnB,OAAOQ,MAAMQ,OAAOf,YAAYe;AAClC;AAEA;;CAEC,GACD,OAAO,SAASG,YAAYnB,KAAc;IACxC,MAAMoB,SAASrB,YAAYC;IAC3B,IAAIoB,WAAW,YAAYA,WAAW,cAAcA,WAAW,aAAaA,WAAW,cAAcA,WAAW,WAAW;QACzH,OAAOA;IACT;IACA,OAAO;AACT"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { decodeMany } from '@23blocks/jsonapi-codec';
|
|
2
|
-
import { messageMapper } from '../mappers/message.mapper';
|
|
3
|
-
export function createConversationsService(transport, _config) {
|
|
4
|
-
return {
|
|
5
|
-
async get (params) {
|
|
6
|
-
const queryParams = {};
|
|
7
|
-
if (params.page) queryParams['page'] = String(params.page);
|
|
8
|
-
if (params.perPage) queryParams['records'] = String(params.perPage);
|
|
9
|
-
if (params.includeFiles) queryParams['with'] = 'files';
|
|
10
|
-
const response = await transport.get(`/conversations/${params.context}`, {
|
|
11
|
-
params: queryParams
|
|
12
|
-
});
|
|
13
|
-
// Decode messages
|
|
14
|
-
const messages = decodeMany(response, messageMapper);
|
|
15
|
-
// Extract files and meta from response if available
|
|
16
|
-
const rawResponse = response;
|
|
17
|
-
const files = rawResponse.files || [];
|
|
18
|
-
const meta = rawResponse.meta || {};
|
|
19
|
-
return {
|
|
20
|
-
id: params.context,
|
|
21
|
-
context: params.context,
|
|
22
|
-
messages,
|
|
23
|
-
files,
|
|
24
|
-
meta
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
async listContexts () {
|
|
28
|
-
var _response_data;
|
|
29
|
-
const response = await transport.get('/conversations/contexts');
|
|
30
|
-
return ((_response_data = response.data) == null ? void 0 : _response_data.contexts) || [];
|
|
31
|
-
},
|
|
32
|
-
async deleteContext (context) {
|
|
33
|
-
await transport.delete(`/conversations/${context}`);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=conversations.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/services/conversations.service.ts"],"sourcesContent":["import type { Transport } from '@23blocks/contracts';\nimport { decodeMany } from '@23blocks/jsonapi-codec';\nimport type {\n Conversation,\n GetConversationParams,\n} from '../types/conversation';\nimport { messageMapper } from '../mappers/message.mapper';\n\nexport interface ConversationsService {\n get(params: GetConversationParams): Promise<Conversation>;\n listContexts(): Promise<string[]>;\n deleteContext(context: string): Promise<void>;\n}\n\nexport function createConversationsService(transport: Transport, _config: { appId: string }): ConversationsService {\n return {\n async get(params: GetConversationParams): Promise<Conversation> {\n const queryParams: Record<string, string> = {};\n if (params.page) queryParams['page'] = String(params.page);\n if (params.perPage) queryParams['records'] = String(params.perPage);\n if (params.includeFiles) queryParams['with'] = 'files';\n\n const response = await transport.get<unknown>(`/conversations/${params.context}`, { params: queryParams });\n\n // Decode messages\n const messages = decodeMany(response, messageMapper);\n\n // Extract files and meta from response if available\n const rawResponse = response as any;\n const files = rawResponse.files || [];\n const meta = rawResponse.meta || {};\n\n return {\n id: params.context,\n context: params.context,\n messages,\n files,\n meta,\n };\n },\n\n async listContexts(): Promise<string[]> {\n const response = await transport.get<any>('/conversations/contexts');\n return response.data?.contexts || [];\n },\n\n async deleteContext(context: string): Promise<void> {\n await transport.delete(`/conversations/${context}`);\n },\n };\n}\n"],"names":["decodeMany","messageMapper","createConversationsService","transport","_config","get","params","queryParams","page","String","perPage","includeFiles","response","context","messages","rawResponse","files","meta","id","listContexts","data","contexts","deleteContext","delete"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,UAAU,QAAQ,0BAA0B;AAKrD,SAASC,aAAa,QAAQ,4BAA4B;AAQ1D,OAAO,SAASC,2BAA2BC,SAAoB,EAAEC,OAA0B;IACzF,OAAO;QACL,MAAMC,KAAIC,MAA6B;YACrC,MAAMC,cAAsC,CAAC;YAC7C,IAAID,OAAOE,IAAI,EAAED,WAAW,CAAC,OAAO,GAAGE,OAAOH,OAAOE,IAAI;YACzD,IAAIF,OAAOI,OAAO,EAAEH,WAAW,CAAC,UAAU,GAAGE,OAAOH,OAAOI,OAAO;YAClE,IAAIJ,OAAOK,YAAY,EAAEJ,WAAW,CAAC,OAAO,GAAG;YAE/C,MAAMK,WAAW,MAAMT,UAAUE,GAAG,CAAU,CAAC,eAAe,EAAEC,OAAOO,OAAO,CAAC,CAAC,EAAE;gBAAEP,QAAQC;YAAY;YAExG,kBAAkB;YAClB,MAAMO,WAAWd,WAAWY,UAAUX;YAEtC,oDAAoD;YACpD,MAAMc,cAAcH;YACpB,MAAMI,QAAQD,YAAYC,KAAK,IAAI,EAAE;YACrC,MAAMC,OAAOF,YAAYE,IAAI,IAAI,CAAC;YAElC,OAAO;gBACLC,IAAIZ,OAAOO,OAAO;gBAClBA,SAASP,OAAOO,OAAO;gBACvBC;gBACAE;gBACAC;YACF;QACF;QAEA,MAAME;gBAEGP;YADP,MAAMA,WAAW,MAAMT,UAAUE,GAAG,CAAM;YAC1C,OAAOO,EAAAA,iBAAAA,SAASQ,IAAI,qBAAbR,eAAeS,QAAQ,KAAI,EAAE;QACtC;QAEA,MAAMC,eAAcT,OAAe;YACjC,MAAMV,UAAUoB,MAAM,CAAC,CAAC,eAAe,EAAEV,QAAQ,CAAC;QACpD;IACF;AACF"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { decodeOne, decodePageResult } from '@23blocks/jsonapi-codec';
|
|
2
|
-
import { draftMessageMapper } from '../mappers/draft-message.mapper';
|
|
3
|
-
export function createDraftMessagesService(transport, _config) {
|
|
4
|
-
return {
|
|
5
|
-
async list (params) {
|
|
6
|
-
const queryParams = {};
|
|
7
|
-
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
8
|
-
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
9
|
-
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
10
|
-
if (params == null ? void 0 : params.contextId) queryParams['context_id'] = params.contextId;
|
|
11
|
-
if (params == null ? void 0 : params.sourceId) queryParams['source_id'] = params.sourceId;
|
|
12
|
-
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
13
|
-
const response = await transport.get('/draft_messages', {
|
|
14
|
-
params: queryParams
|
|
15
|
-
});
|
|
16
|
-
return decodePageResult(response, draftMessageMapper);
|
|
17
|
-
},
|
|
18
|
-
async get (uniqueId) {
|
|
19
|
-
const response = await transport.get(`/draft_messages/${uniqueId}`);
|
|
20
|
-
return decodeOne(response, draftMessageMapper);
|
|
21
|
-
},
|
|
22
|
-
async create (data) {
|
|
23
|
-
const response = await transport.post('/draft_messages', {
|
|
24
|
-
data: {
|
|
25
|
-
type: 'DraftMessage',
|
|
26
|
-
attributes: {
|
|
27
|
-
context_id: data.contextId,
|
|
28
|
-
parent_id: data.parentId,
|
|
29
|
-
content: data.content,
|
|
30
|
-
source: data.source,
|
|
31
|
-
source_id: data.sourceId,
|
|
32
|
-
source_alias: data.sourceAlias,
|
|
33
|
-
source_email: data.sourceEmail,
|
|
34
|
-
source_phone: data.sourcePhone,
|
|
35
|
-
source_type: data.sourceType,
|
|
36
|
-
target: data.target,
|
|
37
|
-
target_id: data.targetId,
|
|
38
|
-
target_alias: data.targetAlias,
|
|
39
|
-
target_email: data.targetEmail,
|
|
40
|
-
target_phone: data.targetPhone,
|
|
41
|
-
target_type: data.targetType,
|
|
42
|
-
target_device_id: data.targetDeviceId,
|
|
43
|
-
value: data.value,
|
|
44
|
-
data_source: data.dataSource,
|
|
45
|
-
data_source_id: data.dataSourceId,
|
|
46
|
-
data_source_type: data.dataSourceType,
|
|
47
|
-
data_source_alias: data.dataSourceAlias,
|
|
48
|
-
notification_content: data.notificationContent,
|
|
49
|
-
notification_url: data.notificationUrl,
|
|
50
|
-
expires_at: data.expiresAt,
|
|
51
|
-
rag_sources: data.ragSources,
|
|
52
|
-
idempotency_key: data.idempotencyKey,
|
|
53
|
-
payload: data.payload
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return decodeOne(response, draftMessageMapper);
|
|
58
|
-
},
|
|
59
|
-
async update (uniqueId, data) {
|
|
60
|
-
const response = await transport.put(`/draft_messages/${uniqueId}`, {
|
|
61
|
-
data: {
|
|
62
|
-
type: 'DraftMessage',
|
|
63
|
-
attributes: {
|
|
64
|
-
content: data.content,
|
|
65
|
-
status: data.status,
|
|
66
|
-
enabled: data.enabled,
|
|
67
|
-
payload: data.payload
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
return decodeOne(response, draftMessageMapper);
|
|
72
|
-
},
|
|
73
|
-
async delete (uniqueId) {
|
|
74
|
-
await transport.delete(`/draft_messages/${uniqueId}`);
|
|
75
|
-
},
|
|
76
|
-
async listByContext (contextId, params) {
|
|
77
|
-
const queryParams = {};
|
|
78
|
-
if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
|
|
79
|
-
if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
|
|
80
|
-
if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
|
|
81
|
-
if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
|
|
82
|
-
const response = await transport.get(`/draft_messages/context/${contextId}`, {
|
|
83
|
-
params: queryParams
|
|
84
|
-
});
|
|
85
|
-
return decodePageResult(response, draftMessageMapper);
|
|
86
|
-
},
|
|
87
|
-
async publish (uniqueId) {
|
|
88
|
-
const response = await transport.put(`/draft_messages/${uniqueId}/publish`, {});
|
|
89
|
-
return decodeOne(response, draftMessageMapper);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
//# sourceMappingURL=draft-messages.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/services/draft-messages.service.ts"],"sourcesContent":["import type { Transport, PageResult } from '@23blocks/contracts';\nimport { decodeOne, decodeMany, decodePageResult } from '@23blocks/jsonapi-codec';\nimport type {\n DraftMessage,\n CreateDraftMessageRequest,\n UpdateDraftMessageRequest,\n ListDraftMessagesParams,\n} from '../types/draft-message';\nimport { draftMessageMapper } from '../mappers/draft-message.mapper';\n\nexport interface DraftMessagesService {\n list(params?: ListDraftMessagesParams): Promise<PageResult<DraftMessage>>;\n get(uniqueId: string): Promise<DraftMessage>;\n create(data: CreateDraftMessageRequest): Promise<DraftMessage>;\n update(uniqueId: string, data: UpdateDraftMessageRequest): Promise<DraftMessage>;\n delete(uniqueId: string): Promise<void>;\n listByContext(contextId: string, params?: ListDraftMessagesParams): Promise<PageResult<DraftMessage>>;\n publish(uniqueId: string): Promise<DraftMessage>;\n}\n\nexport function createDraftMessagesService(transport: Transport, _config: { appId: string }): DraftMessagesService {\n return {\n async list(params?: ListDraftMessagesParams): Promise<PageResult<DraftMessage>> {\n const queryParams: Record<string, string> = {};\n if (params?.page) queryParams['page'] = String(params.page);\n if (params?.perPage) queryParams['records'] = String(params.perPage);\n if (params?.status) queryParams['status'] = params.status;\n if (params?.contextId) queryParams['context_id'] = params.contextId;\n if (params?.sourceId) queryParams['source_id'] = params.sourceId;\n if (params?.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;\n\n const response = await transport.get<unknown>('/draft_messages', { params: queryParams });\n return decodePageResult(response, draftMessageMapper);\n },\n\n async get(uniqueId: string): Promise<DraftMessage> {\n const response = await transport.get<unknown>(`/draft_messages/${uniqueId}`);\n return decodeOne(response, draftMessageMapper);\n },\n\n async create(data: CreateDraftMessageRequest): Promise<DraftMessage> {\n const response = await transport.post<unknown>('/draft_messages', {\n data: {\n type: 'DraftMessage',\n attributes: {\n context_id: data.contextId,\n parent_id: data.parentId,\n content: data.content,\n source: data.source,\n source_id: data.sourceId,\n source_alias: data.sourceAlias,\n source_email: data.sourceEmail,\n source_phone: data.sourcePhone,\n source_type: data.sourceType,\n target: data.target,\n target_id: data.targetId,\n target_alias: data.targetAlias,\n target_email: data.targetEmail,\n target_phone: data.targetPhone,\n target_type: data.targetType,\n target_device_id: data.targetDeviceId,\n value: data.value,\n data_source: data.dataSource,\n data_source_id: data.dataSourceId,\n data_source_type: data.dataSourceType,\n data_source_alias: data.dataSourceAlias,\n notification_content: data.notificationContent,\n notification_url: data.notificationUrl,\n expires_at: data.expiresAt,\n rag_sources: data.ragSources,\n idempotency_key: data.idempotencyKey,\n payload: data.payload,\n },\n },\n });\n return decodeOne(response, draftMessageMapper);\n },\n\n async update(uniqueId: string, data: UpdateDraftMessageRequest): Promise<DraftMessage> {\n const response = await transport.put<unknown>(`/draft_messages/${uniqueId}`, {\n data: {\n type: 'DraftMessage',\n attributes: {\n content: data.content,\n status: data.status,\n enabled: data.enabled,\n payload: data.payload,\n },\n },\n });\n return decodeOne(response, draftMessageMapper);\n },\n\n async delete(uniqueId: string): Promise<void> {\n await transport.delete(`/draft_messages/${uniqueId}`);\n },\n\n async listByContext(contextId: string, params?: ListDraftMessagesParams): Promise<PageResult<DraftMessage>> {\n const queryParams: Record<string, string> = {};\n if (params?.page) queryParams['page'] = String(params.page);\n if (params?.perPage) queryParams['records'] = String(params.perPage);\n if (params?.status) queryParams['status'] = params.status;\n if (params?.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;\n\n const response = await transport.get<unknown>(`/draft_messages/context/${contextId}`, { params: queryParams });\n return decodePageResult(response, draftMessageMapper);\n },\n\n async publish(uniqueId: string): Promise<DraftMessage> {\n const response = await transport.put<unknown>(`/draft_messages/${uniqueId}/publish`, {});\n return decodeOne(response, draftMessageMapper);\n },\n };\n}\n"],"names":["decodeOne","decodePageResult","draftMessageMapper","createDraftMessagesService","transport","_config","list","params","queryParams","page","String","perPage","status","contextId","sourceId","sortBy","sortOrder","response","get","uniqueId","create","data","post","type","attributes","context_id","parent_id","parentId","content","source","source_id","source_alias","sourceAlias","source_email","sourceEmail","source_phone","sourcePhone","source_type","sourceType","target","target_id","targetId","target_alias","targetAlias","target_email","targetEmail","target_phone","targetPhone","target_type","targetType","target_device_id","targetDeviceId","value","data_source","dataSource","data_source_id","dataSourceId","data_source_type","dataSourceType","data_source_alias","dataSourceAlias","notification_content","notificationContent","notification_url","notificationUrl","expires_at","expiresAt","rag_sources","ragSources","idempotency_key","idempotencyKey","payload","update","put","enabled","delete","listByContext","publish"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,SAAS,EAAcC,gBAAgB,QAAQ,0BAA0B;AAOlF,SAASC,kBAAkB,QAAQ,kCAAkC;AAYrE,OAAO,SAASC,2BAA2BC,SAAoB,EAAEC,OAA0B;IACzF,OAAO;QACL,MAAMC,MAAKC,MAAgC;YACzC,MAAMC,cAAsC,CAAC;YAC7C,IAAID,0BAAAA,OAAQE,IAAI,EAAED,WAAW,CAAC,OAAO,GAAGE,OAAOH,OAAOE,IAAI;YAC1D,IAAIF,0BAAAA,OAAQI,OAAO,EAAEH,WAAW,CAAC,UAAU,GAAGE,OAAOH,OAAOI,OAAO;YACnE,IAAIJ,0BAAAA,OAAQK,MAAM,EAAEJ,WAAW,CAAC,SAAS,GAAGD,OAAOK,MAAM;YACzD,IAAIL,0BAAAA,OAAQM,SAAS,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