@23blocks/block-crm 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/lib/crm.block.js +28 -0
  4. package/dist/lib/crm.block.js.map +1 -0
  5. package/dist/lib/mappers/account.mapper.js +44 -0
  6. package/dist/lib/mappers/account.mapper.js.map +1 -0
  7. package/dist/lib/mappers/contact.mapper.js +54 -0
  8. package/dist/lib/mappers/contact.mapper.js.map +1 -0
  9. package/dist/lib/mappers/index.js +9 -0
  10. package/dist/lib/mappers/index.js.map +1 -0
  11. package/dist/lib/mappers/lead.mapper.js +31 -0
  12. package/dist/lib/mappers/lead.mapper.js.map +1 -0
  13. package/dist/lib/mappers/meeting.mapper.js +34 -0
  14. package/dist/lib/mappers/meeting.mapper.js.map +1 -0
  15. package/dist/lib/mappers/opportunity.mapper.js +30 -0
  16. package/dist/lib/mappers/opportunity.mapper.js.map +1 -0
  17. package/dist/lib/mappers/quote.mapper.js +30 -0
  18. package/dist/lib/mappers/quote.mapper.js.map +1 -0
  19. package/dist/lib/mappers/utils.js +75 -0
  20. package/dist/lib/mappers/utils.js.map +1 -0
  21. package/dist/lib/services/accounts.service.js +88 -0
  22. package/dist/lib/services/accounts.service.js.map +1 -0
  23. package/dist/lib/services/contacts.service.js +95 -0
  24. package/dist/lib/services/contacts.service.js.map +1 -0
  25. package/dist/lib/services/index.js +8 -0
  26. package/dist/lib/services/index.js.map +1 -0
  27. package/dist/lib/services/leads.service.js +109 -0
  28. package/dist/lib/services/leads.service.js.map +1 -0
  29. package/dist/lib/services/meetings.service.js +108 -0
  30. package/dist/lib/services/meetings.service.js.map +1 -0
  31. package/dist/lib/services/opportunities.service.js +105 -0
  32. package/dist/lib/services/opportunities.service.js.map +1 -0
  33. package/dist/lib/services/quotes.service.js +105 -0
  34. package/dist/lib/services/quotes.service.js.map +1 -0
  35. package/dist/lib/types/account.js +3 -0
  36. package/dist/lib/types/account.js.map +1 -0
  37. package/dist/lib/types/contact.js +3 -0
  38. package/dist/lib/types/contact.js.map +1 -0
  39. package/dist/lib/types/index.js +8 -0
  40. package/dist/lib/types/index.js.map +1 -0
  41. package/dist/lib/types/lead.js +3 -0
  42. package/dist/lib/types/lead.js.map +1 -0
  43. package/dist/lib/types/meeting.js +3 -0
  44. package/dist/lib/types/meeting.js.map +1 -0
  45. package/dist/lib/types/opportunity.js +3 -0
  46. package/dist/lib/types/opportunity.js.map +1 -0
  47. package/dist/lib/types/quote.js +3 -0
  48. package/dist/lib/types/quote.js.map +1 -0
  49. package/package.json +24 -1
  50. package/dist/index.d.ts +0 -2
  51. package/dist/index.d.ts.map +0 -1
  52. package/dist/lib/block-crm.d.ts +0 -2
  53. package/dist/lib/block-crm.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
- export * from './lib/block-crm.js';
1
+ // Block factory and metadata
2
+ export { createCrmBlock, crmBlockMetadata } from './lib/crm.block';
3
+ export { createAccountsService, createContactsService, createLeadsService, createOpportunitiesService, createMeetingsService, createQuotesService } from './lib/services';
4
+ // Mappers (for advanced use cases)
5
+ export { accountMapper, accountDetailMapper, contactMapper, contactProfileMapper, leadMapper, opportunityMapper, meetingMapper, quoteMapper } from './lib/mappers';
2
6
 
3
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './lib/block-crm.js';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,qBAAqB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Block factory and metadata\nexport { createCrmBlock, crmBlockMetadata } from './lib/crm.block';\nexport type { CrmBlock, CrmBlockConfig } from './lib/crm.block';\n\n// Types\nexport type {\n // Account types\n Account,\n AccountDetail,\n CreateAccountRequest,\n UpdateAccountRequest,\n ListAccountsParams,\n // Contact types\n Contact,\n ContactProfile,\n CreateContactRequest,\n UpdateContactRequest,\n ListContactsParams,\n // Lead types\n Lead,\n CreateLeadRequest,\n UpdateLeadRequest,\n ListLeadsParams,\n // Opportunity types\n Opportunity,\n CreateOpportunityRequest,\n UpdateOpportunityRequest,\n ListOpportunitiesParams,\n // Meeting types\n Meeting,\n CreateMeetingRequest,\n UpdateMeetingRequest,\n ListMeetingsParams,\n // Quote types\n Quote,\n CreateQuoteRequest,\n UpdateQuoteRequest,\n ListQuotesParams,\n} from './lib/types';\n\n// Services\nexport type {\n AccountsService,\n ContactsService,\n LeadsService,\n OpportunitiesService,\n MeetingsService,\n QuotesService,\n} from './lib/services';\n\nexport {\n createAccountsService,\n createContactsService,\n createLeadsService,\n createOpportunitiesService,\n createMeetingsService,\n createQuotesService,\n} from './lib/services';\n\n// Mappers (for advanced use cases)\nexport {\n accountMapper,\n accountDetailMapper,\n contactMapper,\n contactProfileMapper,\n leadMapper,\n opportunityMapper,\n meetingMapper,\n quoteMapper,\n} from './lib/mappers';\n"],"names":["createCrmBlock","crmBlockMetadata","createAccountsService","createContactsService","createLeadsService","createOpportunitiesService","createMeetingsService","createQuotesService","accountMapper","accountDetailMapper","contactMapper","contactProfileMapper","leadMapper","opportunityMapper","meetingMapper","quoteMapper"],"rangeMappings":";;;;","mappings":"AAAA,6BAA6B;AAC7B,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,kBAAkB;AAiDnE,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,EAClBC,0BAA0B,EAC1BC,qBAAqB,EACrBC,mBAAmB,QACd,iBAAiB;AAExB,mCAAmC;AACnC,SACEC,aAAa,EACbC,mBAAmB,EACnBC,aAAa,EACbC,oBAAoB,EACpBC,UAAU,EACVC,iBAAiB,EACjBC,aAAa,EACbC,WAAW,QACN,gBAAgB"}
@@ -0,0 +1,28 @@
1
+ import { createAccountsService, createContactsService, createLeadsService, createOpportunitiesService, createMeetingsService, createQuotesService } from './services';
2
+ export function createCrmBlock(transport, config) {
3
+ return {
4
+ accounts: createAccountsService(transport, config),
5
+ contacts: createContactsService(transport, config),
6
+ leads: createLeadsService(transport, config),
7
+ opportunities: createOpportunitiesService(transport, config),
8
+ meetings: createMeetingsService(transport, config),
9
+ quotes: createQuotesService(transport, config)
10
+ };
11
+ }
12
+ export const crmBlockMetadata = {
13
+ name: 'crm',
14
+ version: '0.1.0',
15
+ description: 'CRM block for managing accounts, contacts, leads, opportunities, meetings, and quotes',
16
+ resourceTypes: [
17
+ 'Account',
18
+ 'AccountDetail',
19
+ 'Contact',
20
+ 'ContactProfile',
21
+ 'Lead',
22
+ 'Opportunity',
23
+ 'Meeting',
24
+ 'Quote'
25
+ ]
26
+ };
27
+
28
+ //# sourceMappingURL=crm.block.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/crm.block.ts"],"sourcesContent":["import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';\nimport {\n createAccountsService,\n createContactsService,\n createLeadsService,\n createOpportunitiesService,\n createMeetingsService,\n createQuotesService,\n type AccountsService,\n type ContactsService,\n type LeadsService,\n type OpportunitiesService,\n type MeetingsService,\n type QuotesService,\n} from './services';\n\nexport interface CrmBlockConfig extends BlockConfig {\n appId: string;\n tenantId?: string;\n}\n\nexport interface CrmBlock {\n accounts: AccountsService;\n contacts: ContactsService;\n leads: LeadsService;\n opportunities: OpportunitiesService;\n meetings: MeetingsService;\n quotes: QuotesService;\n}\n\nexport function createCrmBlock(\n transport: Transport,\n config: CrmBlockConfig\n): CrmBlock {\n return {\n accounts: createAccountsService(transport, config),\n contacts: createContactsService(transport, config),\n leads: createLeadsService(transport, config),\n opportunities: createOpportunitiesService(transport, config),\n meetings: createMeetingsService(transport, config),\n quotes: createQuotesService(transport, config),\n };\n}\n\nexport const crmBlockMetadata: BlockMetadata = {\n name: 'crm',\n version: '0.1.0',\n description: 'CRM block for managing accounts, contacts, leads, opportunities, meetings, and quotes',\n resourceTypes: [\n 'Account',\n 'AccountDetail',\n 'Contact',\n 'ContactProfile',\n 'Lead',\n 'Opportunity',\n 'Meeting',\n 'Quote',\n ],\n};\n"],"names":["createAccountsService","createContactsService","createLeadsService","createOpportunitiesService","createMeetingsService","createQuotesService","createCrmBlock","transport","config","accounts","contacts","leads","opportunities","meetings","quotes","crmBlockMetadata","name","version","description","resourceTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SACEA,qBAAqB,EACrBC,qBAAqB,EACrBC,kBAAkB,EAClBC,0BAA0B,EAC1BC,qBAAqB,EACrBC,mBAAmB,QAOd,aAAa;AAgBpB,OAAO,SAASC,eACdC,SAAoB,EACpBC,MAAsB;IAEtB,OAAO;QACLC,UAAUT,sBAAsBO,WAAWC;QAC3CE,UAAUT,sBAAsBM,WAAWC;QAC3CG,OAAOT,mBAAmBK,WAAWC;QACrCI,eAAeT,2BAA2BI,WAAWC;QACrDK,UAAUT,sBAAsBG,WAAWC;QAC3CM,QAAQT,oBAAoBE,WAAWC;IACzC;AACF;AAEA,OAAO,MAAMO,mBAAkC;IAC7CC,MAAM;IACNC,SAAS;IACTC,aAAa;IACbC,eAAe;QACb;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;AACH,EAAE"}
@@ -0,0 +1,44 @@
1
+ import { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';
2
+ export const accountMapper = {
3
+ type: 'Account',
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
+ code: parseString(resource.attributes['code']) || '',
10
+ name: parseString(resource.attributes['name']) || '',
11
+ label: parseString(resource.attributes['label']),
12
+ status: parseStatus(resource.attributes['status']),
13
+ enabled: parseBoolean(resource.attributes['enabled']),
14
+ preferredDomain: parseString(resource.attributes['preferred_domain']),
15
+ preferredLanguage: parseString(resource.attributes['preferred_language']),
16
+ payload: resource.attributes['payload'],
17
+ tags: parseStringArray(resource.attributes['tags']),
18
+ createdBy: parseString(resource.attributes['created_by']),
19
+ updatedBy: parseString(resource.attributes['updated_by'])
20
+ })
21
+ };
22
+ export const accountDetailMapper = {
23
+ type: 'AccountDetail',
24
+ map: (resource)=>({
25
+ id: resource.id,
26
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
27
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
28
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
29
+ accountUniqueId: parseString(resource.attributes['account_unique_id']) || '',
30
+ code: parseString(resource.attributes['code']) || '',
31
+ name: parseString(resource.attributes['name']) || '',
32
+ label: parseString(resource.attributes['label']),
33
+ status: parseStatus(resource.attributes['status']),
34
+ enabled: parseBoolean(resource.attributes['enabled']),
35
+ preferredDomain: parseString(resource.attributes['preferred_domain']),
36
+ preferredLanguage: parseString(resource.attributes['preferred_language']),
37
+ payload: resource.attributes['payload'],
38
+ tags: parseStringArray(resource.attributes['tags']),
39
+ createdBy: parseString(resource.attributes['created_by']),
40
+ updatedBy: parseString(resource.attributes['updated_by'])
41
+ })
42
+ };
43
+
44
+ //# sourceMappingURL=account.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/account.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Account, AccountDetail } from '../types/account';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';\n\nexport const accountMapper: ResourceMapper<Account> = {\n type: 'Account',\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 code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n label: parseString(resource.attributes['label']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n preferredDomain: parseString(resource.attributes['preferred_domain']),\n preferredLanguage: parseString(resource.attributes['preferred_language']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n tags: parseStringArray(resource.attributes['tags']),\n createdBy: parseString(resource.attributes['created_by']),\n updatedBy: parseString(resource.attributes['updated_by']),\n }),\n};\n\nexport const accountDetailMapper: ResourceMapper<AccountDetail> = {\n type: 'AccountDetail',\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 accountUniqueId: parseString(resource.attributes['account_unique_id']) || '',\n code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n label: parseString(resource.attributes['label']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n preferredDomain: parseString(resource.attributes['preferred_domain']),\n preferredLanguage: parseString(resource.attributes['preferred_language']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n tags: parseStringArray(resource.attributes['tags']),\n createdBy: parseString(resource.attributes['created_by']),\n updatedBy: parseString(resource.attributes['updated_by']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseStringArray","accountMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","code","name","label","status","enabled","preferredDomain","preferredLanguage","payload","tags","createdBy","updatedBy","accountDetailMapper","accountUniqueId"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AAE9F,OAAO,MAAMC,gBAAyC;IACpDC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUV,YAAYQ,SAASG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AAQf,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjDQ,SAASjB,aAAaM,SAASG,UAAU,CAAC,UAAU;YACpDS,iBAAiBpB,YAAYQ,SAASG,UAAU,CAAC,mBAAmB;YACpEU,mBAAmBrB,YAAYQ,SAASG,UAAU,CAAC,qBAAqB;YACxEW,SAASd,SAASG,UAAU,CAAC,UAAU;YACvCY,MAAMnB,iBAAiBI,SAASG,UAAU,CAAC,OAAO;YAClDa,WAAWxB,YAAYQ,SAASG,UAAU,CAAC,aAAa;YACxDc,WAAWzB,YAAYQ,SAASG,UAAU,CAAC,aAAa;QAC1D,CAAA;AACF,EAAE"}
@@ -0,0 +1,54 @@
1
+ import { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';
2
+ export const contactMapper = {
3
+ type: 'Contact',
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
+ firstName: parseString(resource.attributes['first_name']) || '',
10
+ lastName: parseString(resource.attributes['last_name']) || '',
11
+ middleName: parseString(resource.attributes['middle_name']),
12
+ primaryEmail: parseString(resource.attributes['primary_email']),
13
+ primaryPhone: parseString(resource.attributes['primary_phone']),
14
+ position: parseString(resource.attributes['position']),
15
+ notes: parseString(resource.attributes['notes']),
16
+ source: parseString(resource.attributes['source']),
17
+ sourceId: parseString(resource.attributes['source_id']),
18
+ sourceAlias: parseString(resource.attributes['source_alias']),
19
+ sourceType: parseString(resource.attributes['source_type']),
20
+ status: parseStatus(resource.attributes['status']),
21
+ contactStatus: parseString(resource.attributes['contact_status']),
22
+ userUniqueId: parseString(resource.attributes['user_unique_id']),
23
+ enabled: parseBoolean(resource.attributes['enabled']),
24
+ tags: parseStringArray(resource.attributes['tags'])
25
+ })
26
+ };
27
+ export const contactProfileMapper = {
28
+ type: 'ContactProfile',
29
+ map: (resource)=>({
30
+ id: resource.id,
31
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
32
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
33
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
34
+ contactUniqueId: parseString(resource.attributes['contact_unique_id']) || '',
35
+ firstName: parseString(resource.attributes['first_name']) || '',
36
+ lastName: parseString(resource.attributes['last_name']) || '',
37
+ middleName: parseString(resource.attributes['middle_name']),
38
+ primaryEmail: parseString(resource.attributes['primary_email']),
39
+ primaryPhone: parseString(resource.attributes['primary_phone']),
40
+ position: parseString(resource.attributes['position']),
41
+ notes: parseString(resource.attributes['notes']),
42
+ source: parseString(resource.attributes['source']),
43
+ sourceId: parseString(resource.attributes['source_id']),
44
+ sourceAlias: parseString(resource.attributes['source_alias']),
45
+ sourceType: parseString(resource.attributes['source_type']),
46
+ status: parseStatus(resource.attributes['status']),
47
+ contactStatus: parseString(resource.attributes['contact_status']),
48
+ userUniqueId: parseString(resource.attributes['user_unique_id']),
49
+ enabled: parseBoolean(resource.attributes['enabled']),
50
+ tags: parseStringArray(resource.attributes['tags'])
51
+ })
52
+ };
53
+
54
+ //# sourceMappingURL=contact.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/contact.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Contact, ContactProfile } from '../types/contact';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';\n\nexport const contactMapper: ResourceMapper<Contact> = {\n type: 'Contact',\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 firstName: parseString(resource.attributes['first_name']) || '',\n lastName: parseString(resource.attributes['last_name']) || '',\n middleName: parseString(resource.attributes['middle_name']),\n primaryEmail: parseString(resource.attributes['primary_email']),\n primaryPhone: parseString(resource.attributes['primary_phone']),\n position: parseString(resource.attributes['position']),\n notes: parseString(resource.attributes['notes']),\n source: parseString(resource.attributes['source']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceType: parseString(resource.attributes['source_type']),\n status: parseStatus(resource.attributes['status']),\n contactStatus: parseString(resource.attributes['contact_status']),\n userUniqueId: parseString(resource.attributes['user_unique_id']),\n enabled: parseBoolean(resource.attributes['enabled']),\n tags: parseStringArray(resource.attributes['tags']),\n }),\n};\n\nexport const contactProfileMapper: ResourceMapper<ContactProfile> = {\n type: 'ContactProfile',\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 contactUniqueId: parseString(resource.attributes['contact_unique_id']) || '',\n firstName: parseString(resource.attributes['first_name']) || '',\n lastName: parseString(resource.attributes['last_name']) || '',\n middleName: parseString(resource.attributes['middle_name']),\n primaryEmail: parseString(resource.attributes['primary_email']),\n primaryPhone: parseString(resource.attributes['primary_phone']),\n position: parseString(resource.attributes['position']),\n notes: parseString(resource.attributes['notes']),\n source: parseString(resource.attributes['source']),\n sourceId: parseString(resource.attributes['source_id']),\n sourceAlias: parseString(resource.attributes['source_alias']),\n sourceType: parseString(resource.attributes['source_type']),\n status: parseStatus(resource.attributes['status']),\n contactStatus: parseString(resource.attributes['contact_status']),\n userUniqueId: parseString(resource.attributes['user_unique_id']),\n enabled: parseBoolean(resource.attributes['enabled']),\n tags: parseStringArray(resource.attributes['tags']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseStringArray","contactMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","firstName","lastName","middleName","primaryEmail","primaryPhone","position","notes","source","sourceId","sourceAlias","sourceType","status","contactStatus","userUniqueId","enabled","tags","contactProfileMapper","contactUniqueId"],"r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9 @@
1
+ export * from './account.mapper';
2
+ export * from './contact.mapper';
3
+ export * from './lead.mapper';
4
+ export * from './opportunity.mapper';
5
+ export * from './meeting.mapper';
6
+ export * from './quote.mapper';
7
+ export * from './utils';
8
+
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/index.ts"],"sourcesContent":["export * from './account.mapper';\nexport * from './contact.mapper';\nexport * from './lead.mapper';\nexport * from './opportunity.mapper';\nexport * from './meeting.mapper';\nexport * from './quote.mapper';\nexport * from './utils';\n"],"names":[],"rangeMappings":";;;;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,uBAAuB;AACrC,cAAc,mBAAmB;AACjC,cAAc,iBAAiB;AAC/B,cAAc,UAAU"}
@@ -0,0 +1,31 @@
1
+ import { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';
2
+ export const leadMapper = {
3
+ type: 'Lead',
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
+ firstName: parseString(resource.attributes['first_name']) || '',
10
+ lastName: parseString(resource.attributes['last_name']) || '',
11
+ middleName: parseString(resource.attributes['middle_name']),
12
+ leadEmail: parseString(resource.attributes['lead_email']),
13
+ phoneNumber: parseString(resource.attributes['phone_number']),
14
+ webSite: parseString(resource.attributes['web_site']),
15
+ twitter: parseString(resource.attributes['twitter']),
16
+ fb: parseString(resource.attributes['fb']),
17
+ instagram: parseString(resource.attributes['instagram']),
18
+ linkedin: parseString(resource.attributes['linkedin']),
19
+ youtube: parseString(resource.attributes['youtube']),
20
+ blog: parseString(resource.attributes['blog']),
21
+ notes: parseString(resource.attributes['notes']),
22
+ source: parseString(resource.attributes['source']),
23
+ status: parseStatus(resource.attributes['status']),
24
+ contactStatus: parseString(resource.attributes['contact_status']),
25
+ enabled: parseBoolean(resource.attributes['enabled']),
26
+ payload: resource.attributes['payload'],
27
+ tags: parseStringArray(resource.attributes['tags'])
28
+ })
29
+ };
30
+
31
+ //# sourceMappingURL=lead.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/lead.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Lead } from '../types/lead';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseStringArray } from './utils';\n\nexport const leadMapper: ResourceMapper<Lead> = {\n type: 'Lead',\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 firstName: parseString(resource.attributes['first_name']) || '',\n lastName: parseString(resource.attributes['last_name']) || '',\n middleName: parseString(resource.attributes['middle_name']),\n leadEmail: parseString(resource.attributes['lead_email']),\n phoneNumber: parseString(resource.attributes['phone_number']),\n webSite: parseString(resource.attributes['web_site']),\n twitter: parseString(resource.attributes['twitter']),\n fb: parseString(resource.attributes['fb']),\n instagram: parseString(resource.attributes['instagram']),\n linkedin: parseString(resource.attributes['linkedin']),\n youtube: parseString(resource.attributes['youtube']),\n blog: parseString(resource.attributes['blog']),\n notes: parseString(resource.attributes['notes']),\n source: parseString(resource.attributes['source']),\n status: parseStatus(resource.attributes['status']),\n contactStatus: parseString(resource.attributes['contact_status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n tags: parseStringArray(resource.attributes['tags']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseStringArray","leadMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","firstName","lastName","middleName","leadEmail","phoneNumber","webSite","twitter","fb","instagram","linkedin","youtube","blog","notes","source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AiB;YAChEoB,SAAS7B,aAAaM,SAASG,UAAU,CAAC,UAAU;YACpDqB,SAASxB,SAASG,UAAU,CAAC,UAAU;YACvCsB,MAAM7B,iBAAiBI,SAASG,UAAU,CAAC,OAAO;QACpD,CAAA;AACF,EAAE"}
@@ -0,0 +1,34 @@
1
+ import { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus } from './utils';
2
+ export const meetingMapper = {
3
+ type: 'Meeting',
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
+ code: parseString(resource.attributes['code']) || '',
10
+ title: parseString(resource.attributes['title']) || '',
11
+ meetingType: parseString(resource.attributes['meeting_type']),
12
+ token: parseString(resource.attributes['token']),
13
+ description: parseString(resource.attributes['description']),
14
+ scheduledAt: parseDate(resource.attributes['scheduled_at']),
15
+ startTime: parseDate(resource.attributes['start_time']),
16
+ endTime: parseDate(resource.attributes['end_time']),
17
+ timeUnit: parseString(resource.attributes['time_unit']),
18
+ timeQuantity: parseOptionalNumber(resource.attributes['time_quantity']),
19
+ allDay: parseBoolean(resource.attributes['all_day']),
20
+ timezone: parseString(resource.attributes['timezone']),
21
+ userUniqueId: parseString(resource.attributes['user_unique_id']),
22
+ userName: parseString(resource.attributes['user_name']),
23
+ userEmail: parseString(resource.attributes['user_email']),
24
+ accountUniqueId: parseString(resource.attributes['account_unique_id']),
25
+ meetingLocation: parseString(resource.attributes['meeting_location']),
26
+ meetingUrl: parseString(resource.attributes['meeting_url']),
27
+ meetingScore: parseOptionalNumber(resource.attributes['meeting_score']),
28
+ payload: resource.attributes['payload'],
29
+ status: parseStatus(resource.attributes['status']),
30
+ enabled: parseBoolean(resource.attributes['enabled'])
31
+ })
32
+ };
33
+
34
+ //# sourceMappingURL=meeting.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/meeting.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Meeting } from '../types/meeting';\nimport { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus } from './utils';\n\nexport const meetingMapper: ResourceMapper<Meeting> = {\n type: 'Meeting',\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 code: parseString(resource.attributes['code']) || '',\n title: parseString(resource.attributes['title']) || '',\n meetingType: parseString(resource.attributes['meeting_type']),\n token: parseString(resource.attributes['token']),\n description: parseString(resource.attributes['description']),\n scheduledAt: parseDate(resource.attributes['scheduled_at']),\n startTime: parseDate(resource.attributes['start_time']),\n endTime: parseDate(resource.attributes['end_time']),\n timeUnit: parseString(resource.attributes['time_unit']),\n timeQuantity: parseOptionalNumber(resource.attributes['time_quantity']),\n allDay: parseBoolean(resource.attributes['all_day']),\n timezone: parseString(resource.attributes['timezone']),\n userUniqueId: parseString(resource.attributes['user_unique_id']),\n userName: parseString(resource.attributes['user_name']),\n userEmail: parseString(resource.attributes['user_email']),\n accountUniqueId: parseString(resource.attributes['account_unique_id']),\n meetingLocation: parseString(resource.attributes['meeting_location']),\n meetingUrl: parseString(resource.attributes['meeting_url']),\n meetingScore: parseOptionalNumber(resource.attributes['meeting_score']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseOptionalNumber","parseStatus","meetingMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","code","title","meetingType","token","description","scheduledAt","startTime","endTime","timeUnit","timeQuantity","allDay","timezone","userUniqueId","userName","userEmail","accountUniqueId","meetingLocation","meetingUrl","meetingScore","payload","status","enabled"],"rangeMappings":";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YQ,SAASG,UAAU,CAAC,mBAAmB;YACpEqB,YAAYhC,YAAYQ,SAASG,UAAU,CAAC,cAAc;YAC1DsB,cAAc9B,oBAAoBK,SAASG,UAAU,CAAC,gBAAgB;YACtEuB,SAAS1B,SAASG,UAAU,CAAC,UAAU;YACvCwB,QAAQ/B,YAAYI,SAASG,UAAU,CAAC,SAAS;YACjDyB,SAASlC,aAAaM,SAASG,UAAU,CAAC,UAAU;QACtD,CAAA;AACF,EAAE"}
@@ -0,0 +1,30 @@
1
+ import { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';
2
+ export const opportunityMapper = {
3
+ type: 'Opportunity',
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
+ accountUniqueId: parseString(resource.attributes['account_unique_id']),
10
+ contactUniqueId: parseString(resource.attributes['contact_unique_id']),
11
+ code: parseString(resource.attributes['code']) || '',
12
+ name: parseString(resource.attributes['name']) || '',
13
+ notes: parseString(resource.attributes['notes']),
14
+ budget: parseOptionalNumber(resource.attributes['budget']),
15
+ total: parseOptionalNumber(resource.attributes['total']),
16
+ duration: parseOptionalNumber(resource.attributes['duration']),
17
+ durationUnit: parseString(resource.attributes['duration_unit']),
18
+ durationDescription: parseString(resource.attributes['duration_description']),
19
+ payload: resource.attributes['payload'],
20
+ nextActionAt: parseDate(resource.attributes['next_action_at']),
21
+ ownerUniqueId: parseString(resource.attributes['owner_unique_id']),
22
+ ownerName: parseString(resource.attributes['owner_name']),
23
+ ownerEmail: parseString(resource.attributes['owner_email']),
24
+ status: parseStatus(resource.attributes['status']),
25
+ enabled: parseBoolean(resource.attributes['enabled']),
26
+ tags: parseStringArray(resource.attributes['tags'])
27
+ })
28
+ };
29
+
30
+ //# sourceMappingURL=opportunity.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/opportunity.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Opportunity } from '../types/opportunity';\nimport { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';\n\nexport const opportunityMapper: ResourceMapper<Opportunity> = {\n type: 'Opportunity',\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 accountUniqueId: parseString(resource.attributes['account_unique_id']),\n contactUniqueId: parseString(resource.attributes['contact_unique_id']),\n code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n notes: parseString(resource.attributes['notes']),\n budget: parseOptionalNumber(resource.attributes['budget']),\n total: parseOptionalNumber(resource.attributes['total']),\n duration: parseOptionalNumber(resource.attributes['duration']),\n durationUnit: parseString(resource.attributes['duration_unit']),\n durationDescription: parseString(resource.attributes['duration_description']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n nextActionAt: parseDate(resource.attributes['next_action_at']),\n ownerUniqueId: parseString(resource.attributes['owner_unique_id']),\n ownerName: parseString(resource.attributes['owner_name']),\n ownerEmail: parseString(resource.attributes['owner_email']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n tags: parseStringArray(resource.attributes['tags']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseOptionalNumber","parseStatus","parseStringArray","opportunityMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","accountUniqueId","contactUniqueId","code","name","notes","budget","total","duration","durationUnit","durationDescription","payload","nextActionAt","ownerUniqueId","ownerName","ownerEmail","status","enabled","tags"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAA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AC,OAAO;QACpD,CAAA;AACF,EAAE"}
@@ -0,0 +1,30 @@
1
+ import { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';
2
+ export const quoteMapper = {
3
+ type: 'Quote',
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
+ accountUniqueId: parseString(resource.attributes['account_unique_id']),
10
+ contactUniqueId: parseString(resource.attributes['contact_unique_id']),
11
+ code: parseString(resource.attributes['code']) || '',
12
+ name: parseString(resource.attributes['name']) || '',
13
+ notes: parseString(resource.attributes['notes']),
14
+ budget: parseOptionalNumber(resource.attributes['budget']),
15
+ total: parseOptionalNumber(resource.attributes['total']),
16
+ duration: parseOptionalNumber(resource.attributes['duration']),
17
+ durationUnit: parseString(resource.attributes['duration_unit']),
18
+ durationDescription: parseString(resource.attributes['duration_description']),
19
+ payload: resource.attributes['payload'],
20
+ nextActionAt: parseDate(resource.attributes['next_action_at']),
21
+ ownerUniqueId: parseString(resource.attributes['owner_unique_id']),
22
+ ownerName: parseString(resource.attributes['owner_name']),
23
+ ownerEmail: parseString(resource.attributes['owner_email']),
24
+ status: parseStatus(resource.attributes['status']),
25
+ enabled: parseBoolean(resource.attributes['enabled']),
26
+ tags: parseStringArray(resource.attributes['tags'])
27
+ })
28
+ };
29
+
30
+ //# sourceMappingURL=quote.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/mappers/quote.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Quote } from '../types/quote';\nimport { parseString, parseDate, parseBoolean, parseOptionalNumber, parseStatus, parseStringArray } from './utils';\n\nexport const quoteMapper: ResourceMapper<Quote> = {\n type: 'Quote',\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 accountUniqueId: parseString(resource.attributes['account_unique_id']),\n contactUniqueId: parseString(resource.attributes['contact_unique_id']),\n code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n notes: parseString(resource.attributes['notes']),\n budget: parseOptionalNumber(resource.attributes['budget']),\n total: parseOptionalNumber(resource.attributes['total']),\n duration: parseOptionalNumber(resource.attributes['duration']),\n durationUnit: parseString(resource.attributes['duration_unit']),\n durationDescription: parseString(resource.attributes['duration_description']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n nextActionAt: parseDate(resource.attributes['next_action_at']),\n ownerUniqueId: parseString(resource.attributes['owner_unique_id']),\n ownerName: parseString(resource.attributes['owner_name']),\n ownerEmail: parseString(resource.attributes['owner_email']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n tags: parseStringArray(resource.attributes['tags']),\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseOptionalNumber","parseStatus","parseStringArray","quoteMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","accountUniqueId","contactUniqueId","code","name","notes","budget","total","duration","durationUnit","durationDescription","payload","nextActionAt","ownerUniqueId","ownerName","ownerEmail","status","enabled","tags"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,mBAAmB,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AAEnH,OAAO,MAAMC,cAAqC;IAChDC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUX,YAAYS,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWZ,UAAUQ,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWd,UAAUQ,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,iBAAiBhB,YAAYS,SAASG,UAAU,CAAC,oBAAoB;YACrEK,iBAAiBjB,YAAYS,SAASG,UAAU,CAAC,oBAAoB;YACrEM,MAAMlB,YAAYS,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDO,MAAMnB,YAAYS,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDQ,OAAOpB,YAAYS,SAASG,UAAU,CAAC,QAAQ;YAC/CS,QAAQlB,oBAAoBM,SAASG,UAAU,CAAC,SAAS;YACzDU,OAAOnB,oBAAoBM,SAASG,UAAU,CAAC,QAAQ;YACvDW,UAAUpB,oBAAoBM,SAASG,UAAU,CAAC,WAAW;YAC7DY,cAAcxB,YAAYS,SAASG,UAAU,CAAC,gBAAgB;YAC9Da,qBAAqBzB,YAAYS,SAASG,UAAU,CAAC,uBAAuB;YAC5Ec,SAASjB,SAASG,UAAU,CAAC,UAAU;YACvCe,cAAc1B,UAAUQ,SAASG,UAAU,CAAC,iBAAiB;YAC7DgB,eAAe5B,YAAYS,SAASG,UAAU,CAAC,kBAAkB;YACjEiB,WAAW7B,YAAYS,SAASG,UAAU,CAAC,aAAa;YACxDkB,YAAY9B,YAAYS,SAASG,UAAU,CAAC,cAAc;YAC1DmB,QAAQ3B,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjDoB,SAAS9B,aAAaO,SAASG,UAAU,CAAC,UAAU;YACpDqB,MAAM5B,iBAAiBI,SAASG,UAAU,CAAC,OAAO;QACpD,CAAA;AACF,EAAE"}
@@ -0,0 +1,75 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,88 @@
1
+ import { decodeOne, decodePageResult } from '@23blocks/jsonapi-codec';
2
+ import { accountMapper } from '../mappers/account.mapper';
3
+ export function createAccountsService(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.search) queryParams['search'] = params.search;
11
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
12
+ const response = await transport.get('/accounts', {
13
+ params: queryParams
14
+ });
15
+ return decodePageResult(response, accountMapper);
16
+ },
17
+ async get (uniqueId) {
18
+ const response = await transport.get(`/accounts/${uniqueId}`);
19
+ return decodeOne(response, accountMapper);
20
+ },
21
+ async create (data) {
22
+ const response = await transport.post('/accounts', {
23
+ data: {
24
+ type: 'Account',
25
+ attributes: {
26
+ code: data.code,
27
+ name: data.name,
28
+ label: data.label,
29
+ preferred_domain: data.preferredDomain,
30
+ preferred_language: data.preferredLanguage,
31
+ payload: data.payload,
32
+ tags: data.tags
33
+ }
34
+ }
35
+ });
36
+ return decodeOne(response, accountMapper);
37
+ },
38
+ async update (uniqueId, data) {
39
+ const response = await transport.put(`/accounts/${uniqueId}`, {
40
+ data: {
41
+ type: 'Account',
42
+ attributes: {
43
+ name: data.name,
44
+ label: data.label,
45
+ preferred_domain: data.preferredDomain,
46
+ preferred_language: data.preferredLanguage,
47
+ enabled: data.enabled,
48
+ status: data.status,
49
+ payload: data.payload,
50
+ tags: data.tags
51
+ }
52
+ }
53
+ });
54
+ return decodeOne(response, accountMapper);
55
+ },
56
+ async delete (uniqueId) {
57
+ await transport.delete(`/accounts/${uniqueId}`);
58
+ },
59
+ async recover (uniqueId) {
60
+ const response = await transport.put(`/accounts/${uniqueId}/recover`, {});
61
+ return decodeOne(response, accountMapper);
62
+ },
63
+ async search (query, params) {
64
+ const queryParams = {
65
+ search: query
66
+ };
67
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
68
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
69
+ const response = await transport.post('/accounts/search', {
70
+ search: query
71
+ }, {
72
+ params: queryParams
73
+ });
74
+ return decodePageResult(response, accountMapper);
75
+ },
76
+ async listDeleted (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
+ const response = await transport.get('/accounts/trash/show', {
81
+ params: queryParams
82
+ });
83
+ return decodePageResult(response, accountMapper);
84
+ }
85
+ };
86
+ }
87
+
88
+ //# sourceMappingURL=accounts.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/services/accounts.service.ts"],"sourcesContent":["import type { Transport, PageResult } from '@23blocks/contracts';\nimport { decodeOne, decodeMany, decodePageResult } from '@23blocks/jsonapi-codec';\nimport type {\n Account,\n CreateAccountRequest,\n UpdateAccountRequest,\n ListAccountsParams,\n} from '../types/account';\nimport { accountMapper } from '../mappers/account.mapper';\n\nexport interface AccountsService {\n list(params?: ListAccountsParams): Promise<PageResult<Account>>;\n get(uniqueId: string): Promise<Account>;\n create(data: CreateAccountRequest): Promise<Account>;\n update(uniqueId: string, data: UpdateAccountRequest): Promise<Account>;\n delete(uniqueId: string): Promise<void>;\n recover(uniqueId: string): Promise<Account>;\n search(query: string, params?: ListAccountsParams): Promise<PageResult<Account>>;\n listDeleted(params?: ListAccountsParams): Promise<PageResult<Account>>;\n}\n\nexport function createAccountsService(transport: Transport, _config: { appId: string }): AccountsService {\n return {\n async list(params?: ListAccountsParams): Promise<PageResult<Account>> {\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?.search) queryParams['search'] = params.search;\n if (params?.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;\n\n const response = await transport.get<unknown>('/accounts', { params: queryParams });\n return decodePageResult(response, accountMapper);\n },\n\n async get(uniqueId: string): Promise<Account> {\n const response = await transport.get<unknown>(`/accounts/${uniqueId}`);\n return decodeOne(response, accountMapper);\n },\n\n async create(data: CreateAccountRequest): Promise<Account> {\n const response = await transport.post<unknown>('/accounts', {\n data: {\n type: 'Account',\n attributes: {\n code: data.code,\n name: data.name,\n label: data.label,\n preferred_domain: data.preferredDomain,\n preferred_language: data.preferredLanguage,\n payload: data.payload,\n tags: data.tags,\n },\n },\n });\n return decodeOne(response, accountMapper);\n },\n\n async update(uniqueId: string, data: UpdateAccountRequest): Promise<Account> {\n const response = await transport.put<unknown>(`/accounts/${uniqueId}`, {\n data: {\n type: 'Account',\n attributes: {\n name: data.name,\n label: data.label,\n preferred_domain: data.preferredDomain,\n preferred_language: data.preferredLanguage,\n enabled: data.enabled,\n status: data.status,\n payload: data.payload,\n tags: data.tags,\n },\n },\n });\n return decodeOne(response, accountMapper);\n },\n\n async delete(uniqueId: string): Promise<void> {\n await transport.delete(`/accounts/${uniqueId}`);\n },\n\n async recover(uniqueId: string): Promise<Account> {\n const response = await transport.put<unknown>(`/accounts/${uniqueId}/recover`, {});\n return decodeOne(response, accountMapper);\n },\n\n async search(query: string, params?: ListAccountsParams): Promise<PageResult<Account>> {\n const queryParams: Record<string, string> = { search: query };\n if (params?.page) queryParams['page'] = String(params.page);\n if (params?.perPage) queryParams['records'] = String(params.perPage);\n\n const response = await transport.post<unknown>('/accounts/search', { search: query }, { params: queryParams });\n return decodePageResult(response, accountMapper);\n },\n\n async listDeleted(params?: ListAccountsParams): Promise<PageResult<Account>> {\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\n const response = await transport.get<unknown>('/accounts/trash/show', { params: queryParams });\n return decodePageResult(response, accountMapper);\n },\n };\n}\n"],"names":["decodeOne","decodePageResult","accountMapper","createAccountsService","transport","_config","list","params","queryParams","page","String","perPage","status","search","sortBy","sortOrder","response","get","uniqueId","create","data","post","type","attributes","code","name","label","preferred_domain","preferredDomain","preferred_language","preferredLanguage","payload","tags","update","put","enabled","delete","recover","query","listDeleted"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,SAAS,EAAcC,gBAAgB,QAAQ,0BAA0B;AAOlF,SAASC,aAAa,QAAQ,4BAA4B;AAa1D,OAAO,SAASC,sBAAsBC,SAAoB,EAAEC,OAA0B;IACpF,OAAO;QACL,MAAMC,MAAKC,MAA2B;YACpC,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,MAAM,EAAEL,WAAW,CAAC,SAAS,GAAGD,OAAOM,MAAM;YACzD,IAAIN,0BAAAA,OAAQO,MAAM,EAAEN,WAAW,CAAC,OAAO,GAAGD,OAAOQ,SAAS,KAAK,SAAS,CAAC,CAAC,EAAER,OAAOO,MAAM,CAAC,CAAC,GAAGP,OAAOO,MAAM;YAE3G,MAAME,WAAW,MAAMZ,UAAUa,GAAG,CAAU,aAAa;gBAAEV,QAAQC;YAAY;YACjF,OAAOP,iBAAiBe,UAAUd;QACpC;QAEA,MAAMe,KAAIC,QAAgB;YACxB,MAAMF,WAAW,MAAMZ,UAAUa,GAAG,CAAU,CAAC,UAAU,EAAEC,SAAS,CAAC;YACrE,OAAOlB,UAAUgB,UAAUd;QAC7B;QAEA,MAAMiB,QAAOC,IAA0B;YACrC,MAAMJ,WA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