@things-factory/integration-accounting 9.0.0-beta.24 → 9.0.0-beta.27

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 (191) hide show
  1. package/package.json +13 -13
  2. package/dist-server/controllers/accounting-api/decorators.d.ts +0 -1
  3. package/dist-server/controllers/accounting-api/decorators.js +0 -33
  4. package/dist-server/controllers/accounting-api/decorators.js.map +0 -1
  5. package/dist-server/controllers/accounting-api/index.d.ts +0 -25
  6. package/dist-server/controllers/accounting-api/index.js +0 -124
  7. package/dist-server/controllers/accounting-api/index.js.map +0 -1
  8. package/dist-server/controllers/index.d.ts +0 -2
  9. package/dist-server/controllers/index.js +0 -6
  10. package/dist-server/controllers/index.js.map +0 -1
  11. package/dist-server/controllers/xero/apis/contact/get-contact.d.ts +0 -19
  12. package/dist-server/controllers/xero/apis/contact/get-contact.js +0 -32
  13. package/dist-server/controllers/xero/apis/contact/get-contact.js.map +0 -1
  14. package/dist-server/controllers/xero/apis/contact/get-contacts.d.ts +0 -8
  15. package/dist-server/controllers/xero/apis/contact/get-contacts.js +0 -18
  16. package/dist-server/controllers/xero/apis/contact/get-contacts.js.map +0 -1
  17. package/dist-server/controllers/xero/apis/contact/index.d.ts +0 -2
  18. package/dist-server/controllers/xero/apis/contact/index.js +0 -6
  19. package/dist-server/controllers/xero/apis/contact/index.js.map +0 -1
  20. package/dist-server/controllers/xero/apis/index.d.ts +0 -4
  21. package/dist-server/controllers/xero/apis/index.js +0 -8
  22. package/dist-server/controllers/xero/apis/index.js.map +0 -1
  23. package/dist-server/controllers/xero/apis/invoice/create-invoice.d.ts +0 -6
  24. package/dist-server/controllers/xero/apis/invoice/create-invoice.js +0 -16
  25. package/dist-server/controllers/xero/apis/invoice/create-invoice.js.map +0 -1
  26. package/dist-server/controllers/xero/apis/invoice/get-invoice.d.ts +0 -10
  27. package/dist-server/controllers/xero/apis/invoice/get-invoice.js +0 -18
  28. package/dist-server/controllers/xero/apis/invoice/get-invoice.js.map +0 -1
  29. package/dist-server/controllers/xero/apis/invoice/get-invoices.d.ts +0 -10
  30. package/dist-server/controllers/xero/apis/invoice/get-invoices.js +0 -59
  31. package/dist-server/controllers/xero/apis/invoice/get-invoices.js.map +0 -1
  32. package/dist-server/controllers/xero/apis/invoice/index.d.ts +0 -4
  33. package/dist-server/controllers/xero/apis/invoice/index.js +0 -8
  34. package/dist-server/controllers/xero/apis/invoice/index.js.map +0 -1
  35. package/dist-server/controllers/xero/apis/invoice/update-invoice.d.ts +0 -6
  36. package/dist-server/controllers/xero/apis/invoice/update-invoice.js +0 -16
  37. package/dist-server/controllers/xero/apis/invoice/update-invoice.js.map +0 -1
  38. package/dist-server/controllers/xero/apis/item/create-item.d.ts +0 -16
  39. package/dist-server/controllers/xero/apis/item/create-item.js +0 -32
  40. package/dist-server/controllers/xero/apis/item/create-item.js.map +0 -1
  41. package/dist-server/controllers/xero/apis/item/delete-item.d.ts +0 -11
  42. package/dist-server/controllers/xero/apis/item/delete-item.js +0 -21
  43. package/dist-server/controllers/xero/apis/item/delete-item.js.map +0 -1
  44. package/dist-server/controllers/xero/apis/item/get-item.d.ts +0 -10
  45. package/dist-server/controllers/xero/apis/item/get-item.js +0 -34
  46. package/dist-server/controllers/xero/apis/item/get-item.js.map +0 -1
  47. package/dist-server/controllers/xero/apis/item/get-items.d.ts +0 -8
  48. package/dist-server/controllers/xero/apis/item/get-items.js +0 -32
  49. package/dist-server/controllers/xero/apis/item/get-items.js.map +0 -1
  50. package/dist-server/controllers/xero/apis/item/index.d.ts +0 -6
  51. package/dist-server/controllers/xero/apis/item/index.js +0 -10
  52. package/dist-server/controllers/xero/apis/item/index.js.map +0 -1
  53. package/dist-server/controllers/xero/apis/item/update-item.d.ts +0 -14
  54. package/dist-server/controllers/xero/apis/item/update-item.js +0 -30
  55. package/dist-server/controllers/xero/apis/item/update-item.js.map +0 -1
  56. package/dist-server/controllers/xero/apis/item/update-items.d.ts +0 -10
  57. package/dist-server/controllers/xero/apis/item/update-items.js +0 -36
  58. package/dist-server/controllers/xero/apis/item/update-items.js.map +0 -1
  59. package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.d.ts +0 -8
  60. package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.js +0 -56
  61. package/dist-server/controllers/xero/apis/purchase-order/get-purchase-orders.js.map +0 -1
  62. package/dist-server/controllers/xero/apis/purchase-order/index.d.ts +0 -1
  63. package/dist-server/controllers/xero/apis/purchase-order/index.js +0 -5
  64. package/dist-server/controllers/xero/apis/purchase-order/index.js.map +0 -1
  65. package/dist-server/controllers/xero/index.d.ts +0 -1
  66. package/dist-server/controllers/xero/index.js +0 -9
  67. package/dist-server/controllers/xero/index.js.map +0 -1
  68. package/dist-server/controllers/xero/platform-action.d.ts +0 -6
  69. package/dist-server/controllers/xero/platform-action.js +0 -49
  70. package/dist-server/controllers/xero/platform-action.js.map +0 -1
  71. package/dist-server/controllers/xero/xero.d.ts +0 -18
  72. package/dist-server/controllers/xero/xero.js +0 -155
  73. package/dist-server/controllers/xero/xero.js.map +0 -1
  74. package/dist-server/engine/connector/accounting-connector.d.ts +0 -8
  75. package/dist-server/engine/connector/accounting-connector.js +0 -28
  76. package/dist-server/engine/connector/accounting-connector.js.map +0 -1
  77. package/dist-server/engine/connector/index.d.ts +0 -1
  78. package/dist-server/engine/connector/index.js +0 -4
  79. package/dist-server/engine/connector/index.js.map +0 -1
  80. package/dist-server/engine/index.d.ts +0 -2
  81. package/dist-server/engine/index.js +0 -5
  82. package/dist-server/engine/index.js.map +0 -1
  83. package/dist-server/engine/task/accounting-api.d.ts +0 -1
  84. package/dist-server/engine/task/accounting-api.js +0 -54
  85. package/dist-server/engine/task/accounting-api.js.map +0 -1
  86. package/dist-server/engine/task/index.d.ts +0 -1
  87. package/dist-server/engine/task/index.js +0 -4
  88. package/dist-server/engine/task/index.js.map +0 -1
  89. package/dist-server/entities/account.d.ts +0 -23
  90. package/dist-server/entities/account.js +0 -113
  91. package/dist-server/entities/account.js.map +0 -1
  92. package/dist-server/entities/index.d.ts +0 -3
  93. package/dist-server/entities/index.js +0 -7
  94. package/dist-server/entities/index.js.map +0 -1
  95. package/dist-server/graphql/index.d.ts +0 -6
  96. package/dist-server/graphql/index.js +0 -11
  97. package/dist-server/graphql/index.js.map +0 -1
  98. package/dist-server/graphql/resolvers/accounting/account.d.ts +0 -6
  99. package/dist-server/graphql/resolvers/accounting/account.js +0 -15
  100. package/dist-server/graphql/resolvers/accounting/account.js.map +0 -1
  101. package/dist-server/graphql/resolvers/accounting/accounts.d.ts +0 -8
  102. package/dist-server/graphql/resolvers/accounting/accounts.js +0 -14
  103. package/dist-server/graphql/resolvers/accounting/accounts.js.map +0 -1
  104. package/dist-server/graphql/resolvers/accounting/create-account.d.ts +0 -5
  105. package/dist-server/graphql/resolvers/accounting/create-account.js +0 -13
  106. package/dist-server/graphql/resolvers/accounting/create-account.js.map +0 -1
  107. package/dist-server/graphql/resolvers/accounting/delete-account.d.ts +0 -5
  108. package/dist-server/graphql/resolvers/accounting/delete-account.js +0 -16
  109. package/dist-server/graphql/resolvers/accounting/delete-account.js.map +0 -1
  110. package/dist-server/graphql/resolvers/accounting/delete-accounts.d.ts +0 -5
  111. package/dist-server/graphql/resolvers/accounting/delete-accounts.js +0 -20
  112. package/dist-server/graphql/resolvers/accounting/delete-accounts.js.map +0 -1
  113. package/dist-server/graphql/resolvers/accounting/index.d.ts +0 -25
  114. package/dist-server/graphql/resolvers/accounting/index.js +0 -15
  115. package/dist-server/graphql/resolvers/accounting/index.js.map +0 -1
  116. package/dist-server/graphql/resolvers/accounting/update-account.d.ts +0 -6
  117. package/dist-server/graphql/resolvers/accounting/update-account.js +0 -15
  118. package/dist-server/graphql/resolvers/accounting/update-account.js.map +0 -1
  119. package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.d.ts +0 -5
  120. package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.js +0 -30
  121. package/dist-server/graphql/resolvers/accounting/update-multiple-accounts.js.map +0 -1
  122. package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.d.ts +0 -5
  123. package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.js +0 -51
  124. package/dist-server/graphql/resolvers/accounting/xero/deactivate-xero-account.js.map +0 -1
  125. package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.d.ts +0 -6
  126. package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.js +0 -31
  127. package/dist-server/graphql/resolvers/accounting/xero/get-xero-auth-url.js.map +0 -1
  128. package/dist-server/graphql/resolvers/accounting/xero/index.d.ts +0 -13
  129. package/dist-server/graphql/resolvers/accounting/xero/index.js +0 -9
  130. package/dist-server/graphql/resolvers/accounting/xero/index.js.map +0 -1
  131. package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.d.ts +0 -5
  132. package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.js +0 -51
  133. package/dist-server/graphql/resolvers/accounting/xero/refresh-xero-access-token.js.map +0 -1
  134. package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.d.ts +0 -20
  135. package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.js +0 -32
  136. package/dist-server/graphql/resolvers/accounting-api/accounting-invoice.js.map +0 -1
  137. package/dist-server/graphql/resolvers/accounting-api/accounting-item.d.ts +0 -24
  138. package/dist-server/graphql/resolvers/accounting-api/accounting-item.js +0 -36
  139. package/dist-server/graphql/resolvers/accounting-api/accounting-item.js.map +0 -1
  140. package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.d.ts +0 -6
  141. package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.js +0 -16
  142. package/dist-server/graphql/resolvers/accounting-api/accounting-purchase-order.js.map +0 -1
  143. package/dist-server/graphql/resolvers/accounting-api/index.d.ts +0 -44
  144. package/dist-server/graphql/resolvers/accounting-api/index.js +0 -9
  145. package/dist-server/graphql/resolvers/accounting-api/index.js.map +0 -1
  146. package/dist-server/graphql/resolvers/index.d.ts +0 -25
  147. package/dist-server/graphql/resolvers/index.js +0 -8
  148. package/dist-server/graphql/resolvers/index.js.map +0 -1
  149. package/dist-server/graphql/types/accounting/account-list.d.ts +0 -1
  150. package/dist-server/graphql/types/accounting/account-list.js +0 -12
  151. package/dist-server/graphql/types/accounting/account-list.js.map +0 -1
  152. package/dist-server/graphql/types/accounting/account-patch.d.ts +0 -1
  153. package/dist-server/graphql/types/accounting/account-patch.js +0 -18
  154. package/dist-server/graphql/types/accounting/account-patch.js.map +0 -1
  155. package/dist-server/graphql/types/accounting/account.d.ts +0 -1
  156. package/dist-server/graphql/types/accounting/account.js +0 -29
  157. package/dist-server/graphql/types/accounting/account.js.map +0 -1
  158. package/dist-server/graphql/types/accounting/index.d.ts +0 -3
  159. package/dist-server/graphql/types/accounting/index.js +0 -45
  160. package/dist-server/graphql/types/accounting/index.js.map +0 -1
  161. package/dist-server/graphql/types/accounting/new-account.d.ts +0 -1
  162. package/dist-server/graphql/types/accounting/new-account.js +0 -16
  163. package/dist-server/graphql/types/accounting/new-account.js.map +0 -1
  164. package/dist-server/graphql/types/accounting-api/invoice.d.ts +0 -3
  165. package/dist-server/graphql/types/accounting-api/invoice.js +0 -63
  166. package/dist-server/graphql/types/accounting-api/invoice.js.map +0 -1
  167. package/dist-server/graphql/types/accounting-api/item.d.ts +0 -3
  168. package/dist-server/graphql/types/accounting-api/item.js +0 -63
  169. package/dist-server/graphql/types/accounting-api/item.js.map +0 -1
  170. package/dist-server/graphql/types/accounting-api/purchase-order.d.ts +0 -2
  171. package/dist-server/graphql/types/accounting-api/purchase-order.js +0 -34
  172. package/dist-server/graphql/types/accounting-api/purchase-order.js.map +0 -1
  173. package/dist-server/graphql/types/index.d.ts +0 -3
  174. package/dist-server/graphql/types/index.js +0 -12
  175. package/dist-server/graphql/types/index.js.map +0 -1
  176. package/dist-server/index.d.ts +0 -6
  177. package/dist-server/index.js +0 -11
  178. package/dist-server/index.js.map +0 -1
  179. package/dist-server/migrations/index.d.ts +0 -1
  180. package/dist-server/migrations/index.js +0 -12
  181. package/dist-server/migrations/index.js.map +0 -1
  182. package/dist-server/routers/xero-private-router.d.ts +0 -1
  183. package/dist-server/routers/xero-private-router.js +0 -17
  184. package/dist-server/routers/xero-private-router.js.map +0 -1
  185. package/dist-server/routers/xero-router.d.ts +0 -1
  186. package/dist-server/routers/xero-router.js +0 -109
  187. package/dist-server/routers/xero-router.js.map +0 -1
  188. package/dist-server/routes.d.ts +0 -1
  189. package/dist-server/routes.js +0 -11
  190. package/dist-server/routes.js.map +0 -1
  191. package/dist-server/tsconfig.tsbuildinfo +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-account.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting/delete-account.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,sDAAwD;AACxD,gDAA2C;AAE9B,QAAA,aAAa,GAAG;IAC3B,KAAK,CAAC,aAAa,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAwB;QAC1D,MAAM,YAAY,GAAY,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,OAAO,CAAC;YACjE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACvD,CAAC,CAAA;QAEF,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,IAAI,iCAC5B,YAAY,KACf,MAAM,EAAE,+BAAiB,CAAC,UAAU,EACpC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { ACCOUNTING_STATUS } from '../../../controllers'\nimport { Account } from '../../../entities'\n\nexport const deleteAccount = {\n async deleteAccount(_: any, { id }, context: ResolverContext) {\n const foundAccount: Account = await getRepository(Account).findOne({\n where: { domain: { id: context.state.domain.id }, id }\n })\n\n await getRepository(Account).save({\n ...foundAccount,\n status: ACCOUNTING_STATUS.TERMINATED,\n updater: context.state.user\n })\n\n return true\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare const deleteAccounts: {
2
- deleteAccounts(_: any, { ids }: {
3
- ids: any;
4
- }, context: ResolverContext): Promise<boolean>;
5
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAccounts = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const shell_1 = require("@things-factory/shell");
6
- const controllers_1 = require("../../../controllers");
7
- const entities_1 = require("../../../entities");
8
- exports.deleteAccounts = {
9
- async deleteAccounts(_, { ids }, context) {
10
- let foundAccounts = await (0, shell_1.getRepository)(entities_1.Account).find({
11
- where: { domain: { id: context.state.domain.id }, id: (0, typeorm_1.In)(ids) }
12
- });
13
- const updatedAccount = foundAccounts.map((account) => {
14
- return Object.assign(Object.assign({}, account), { status: controllers_1.ACCOUNTING_STATUS.TERMINATED, updater: context.state.user });
15
- });
16
- await (0, shell_1.getRepository)(entities_1.Account).save(updatedAccount);
17
- return true;
18
- }
19
- };
20
- //# sourceMappingURL=delete-accounts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-accounts.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting/delete-accounts.ts"],"names":[],"mappings":";;;AAAA,qCAA4B;AAE5B,iDAAqD;AAErD,sDAAwD;AACxD,gDAA2C;AAE9B,QAAA,cAAc,GAAG;IAC5B,KAAK,CAAC,cAAc,CAAC,CAAM,EAAE,EAAE,GAAG,EAAE,EAAE,OAAwB;QAC5D,IAAI,aAAa,GAAc,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,IAAI,CAAC;YAC/D,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAA,YAAE,EAAC,GAAG,CAAC,EAAE;SAChE,CAAC,CAAA;QAEF,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,OAAgB,EAAE,EAAE;YAC5D,uCACK,OAAO,KACV,MAAM,EAAE,+BAAiB,CAAC,UAAU,EACpC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC5B;QACH,CAAC,CAAC,CAAA;QAEF,MAAM,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA","sourcesContent":["import { In } from 'typeorm'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { ACCOUNTING_STATUS } from '../../../controllers'\nimport { Account } from '../../../entities'\n\nexport const deleteAccounts = {\n async deleteAccounts(_: any, { ids }, context: ResolverContext) {\n let foundAccounts: Account[] = await getRepository(Account).find({\n where: { domain: { id: context.state.domain.id }, id: In(ids) }\n })\n\n const updatedAccount = foundAccounts.map((account: Account) => {\n return {\n ...account,\n status: ACCOUNTING_STATUS.TERMINATED,\n updater: context.state.user\n }\n })\n\n await getRepository(Account).save(updatedAccount)\n return true\n }\n}\n"]}
@@ -1,25 +0,0 @@
1
- export declare const Query: any;
2
- export declare const Mutation: {
3
- deactivateXeroAccount(_: any, { id }: {
4
- id: any;
5
- }, context: ResolverContext): Promise<any>;
6
- refreshXeroAccessToken(_: any, { id }: {
7
- id: any;
8
- }, context: ResolverContext): Promise<any>;
9
- deleteAccounts(_: any, { ids }: {
10
- ids: any;
11
- }, context: ResolverContext): Promise<boolean>;
12
- deleteAccount(_: any, { id }: {
13
- id: any;
14
- }, context: ResolverContext): Promise<boolean>;
15
- createAccount(_: any, { account }: {
16
- account: any;
17
- }, context: ResolverContext): Promise<any>;
18
- updateMultipleAccount(_: any, { patches }: {
19
- patches: any;
20
- }, context: ResolverContext): Promise<any[]>;
21
- updateAccount(_: any, { name, patch }: {
22
- name: any;
23
- patch: any;
24
- }, context: ResolverContext): Promise<any>;
25
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = exports.Query = void 0;
4
- const tslib_1 = require("tslib");
5
- const account_1 = require("./account");
6
- const accounts_1 = require("./accounts");
7
- const update_multiple_accounts_1 = require("./update-multiple-accounts");
8
- const update_account_1 = require("./update-account");
9
- const create_account_1 = require("./create-account");
10
- const delete_account_1 = require("./delete-account");
11
- const delete_accounts_1 = require("./delete-accounts");
12
- const Xero = tslib_1.__importStar(require("./xero"));
13
- exports.Query = Object.assign(Object.assign(Object.assign({}, accounts_1.accountsResolver), account_1.accountResolver), Xero.Query);
14
- exports.Mutation = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, update_account_1.updateAccount), update_multiple_accounts_1.updateMultipleAccount), create_account_1.createAccount), delete_account_1.deleteAccount), delete_accounts_1.deleteAccounts), Xero.Mutation);
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting/index.ts"],"names":[],"mappings":";;;;AAAA,uCAA2C;AAC3C,yCAA6C;AAE7C,yEAAkE;AAClE,qDAAgD;AAChD,qDAAgD;AAChD,qDAAgD;AAChD,uDAAkD;AAElD,qDAA8B;AAEjB,QAAA,KAAK,GAAG,8CAChB,2BAAgB,GAChB,yBAAe,GACf,IAAI,CAAC,KAAK,CACP,CAAA;AAEK,QAAA,QAAQ,2FAChB,8BAAa,GACb,gDAAqB,GACrB,8BAAa,GACb,8BAAa,GACb,gCAAc,GACd,IAAI,CAAC,QAAQ,EACjB","sourcesContent":["import { accountResolver } from './account'\nimport { accountsResolver } from './accounts'\n\nimport { updateMultipleAccount } from './update-multiple-accounts'\nimport { updateAccount } from './update-account'\nimport { createAccount } from './create-account'\nimport { deleteAccount } from './delete-account'\nimport { deleteAccounts } from './delete-accounts'\n\nimport * as Xero from './xero'\n\nexport const Query = {\n ...accountsResolver,\n ...accountResolver,\n ...Xero.Query\n} as any\n\nexport const Mutation = {\n ...updateAccount,\n ...updateMultipleAccount,\n ...createAccount,\n ...deleteAccount,\n ...deleteAccounts,\n ...Xero.Mutation\n}\n"]}
@@ -1,6 +0,0 @@
1
- export declare const updateAccount: {
2
- updateAccount(_: any, { name, patch }: {
3
- name: any;
4
- patch: any;
5
- }, context: ResolverContext): Promise<any>;
6
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAccount = void 0;
4
- const shell_1 = require("@things-factory/shell");
5
- const entities_1 = require("../../../entities");
6
- exports.updateAccount = {
7
- async updateAccount(_, { name, patch }, context) {
8
- const repository = (0, shell_1.getRepository)(entities_1.Account);
9
- const account = await repository.findOne({
10
- where: { domain: { id: context.state.domain.id }, name }
11
- });
12
- return await repository.save(Object.assign(Object.assign(Object.assign({}, account), patch), { updater: context.state.user }));
13
- }
14
- };
15
- //# sourceMappingURL=update-account.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-account.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting/update-account.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,gDAA2C;AAE9B,QAAA,aAAa,GAAG;IAC3B,KAAK,CAAC,aAAa,CAAC,CAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,OAAwB;QACnE,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAA;QACzC,MAAM,OAAO,GAAQ,MAAM,UAAU,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;SACzD,CAAC,CAAA;QAEF,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,OAAO,GACP,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { Account } from '../../../entities'\n\nexport const updateAccount = {\n async updateAccount(_: any, { name, patch }, context: ResolverContext) {\n const repository = getRepository(Account)\n const account: any = await repository.findOne({\n where: { domain: { id: context.state.domain.id }, name }\n })\n\n return await repository.save({\n ...account,\n ...patch,\n updater: context.state.user\n })\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare const updateMultipleAccount: {
2
- updateMultipleAccount(_: any, { patches }: {
3
- patches: any;
4
- }, context: ResolverContext): Promise<any[]>;
5
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateMultipleAccount = void 0;
4
- const shell_1 = require("@things-factory/shell");
5
- const entities_1 = require("../../../entities");
6
- exports.updateMultipleAccount = {
7
- async updateMultipleAccount(_, { patches }, context) {
8
- let results = [];
9
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
10
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
11
- const accountRepo = (0, shell_1.getRepository)(entities_1.Account);
12
- if (_createRecords.length > 0) {
13
- for (let i = 0; i < _createRecords.length; i++) {
14
- const newRecord = _createRecords[i];
15
- const result = await accountRepo.save(Object.assign(Object.assign({}, newRecord), { domain: context.state.domain, creator: context.state.user, updater: context.state.user }));
16
- results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
17
- }
18
- }
19
- if (_updateRecords.length > 0) {
20
- for (let i = 0; i < _updateRecords.length; i++) {
21
- const newRecord = _updateRecords[i];
22
- const account = await accountRepo.findOneBy({ id: newRecord.id });
23
- const result = await accountRepo.save(Object.assign(Object.assign(Object.assign({}, account), newRecord), { updater: context.state.user }));
24
- results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
25
- }
26
- }
27
- return results;
28
- }
29
- };
30
- //# sourceMappingURL=update-multiple-accounts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-multiple-accounts.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting/update-multiple-accounts.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AAErD,gDAA2C;AAE9B,QAAA,qBAAqB,GAAG;IACnC,KAAK,CAAC,qBAAqB,CAAC,CAAM,EAAE,EAAE,OAAO,EAAE,EAAE,OAAwB;QACvE,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAA;QACzF,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAA;QACzF,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAA;QAE1C,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;gBAEnC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,iCAChC,SAAS,KACZ,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAC5B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAC3B,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;gBAEF,OAAO,CAAC,IAAI,iCAAM,MAAM,KAAE,MAAM,EAAE,GAAG,IAAG,CAAA;YAC1C,CAAC;QACH,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;gBACnC,MAAM,OAAO,GAAY,MAAM,WAAW,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;gBAE1E,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,+CAChC,OAAO,GACP,SAAS,KACZ,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;gBAEF,OAAO,CAAC,IAAI,iCAAM,MAAM,KAAE,MAAM,EAAE,GAAG,IAAG,CAAA;YAC1C,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF,CAAA","sourcesContent":["import { getRepository } from '@things-factory/shell'\n\nimport { Account } from '../../../entities'\n\nexport const updateMultipleAccount = {\n async updateMultipleAccount(_: any, { patches }, context: ResolverContext) {\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const accountRepo = getRepository(Account)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await accountRepo.save({\n ...newRecord,\n domain: context.state.domain,\n creator: context.state.user,\n updater: context.state.user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const account: Account = await accountRepo.findOneBy({ id: newRecord.id })\n\n const result = await accountRepo.save({\n ...account,\n ...newRecord,\n updater: context.state.user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare const deactivateXeroAccount: {
2
- deactivateXeroAccount(_: any, { id }: {
3
- id: any;
4
- }, context: ResolverContext): Promise<any>;
5
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deactivateXeroAccount = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
- const shell_1 = require("@things-factory/shell");
7
- const controllers_1 = require("../../../../controllers");
8
- const entities_1 = require("../../../../entities");
9
- const debug = require('debug')('things-factory:integration-accounting:deactivate-xero-account');
10
- exports.deactivateXeroAccount = {
11
- async deactivateXeroAccount(_, { id }, context) {
12
- const repository = (0, shell_1.getRepository)(entities_1.Account);
13
- const account = await repository.findOne({
14
- where: { domain: { id: context.state.domain.id }, id }
15
- });
16
- try {
17
- const connection = JSON.parse(account.accountInfo);
18
- if (connection) {
19
- /* delete connection request to xero */
20
- const response = await (0, node_fetch_1.default)(`https://api.xero.com/connections/${connection.id}`, {
21
- method: 'delete',
22
- headers: {
23
- Authorization: `Bearer ${account.accessToken}`
24
- }
25
- });
26
- if (!response.ok) {
27
- debug('delete connection failed', response.status, await response.text());
28
- }
29
- }
30
- else {
31
- debug(`connection info from accountInfo is empty`);
32
- }
33
- }
34
- catch (err) {
35
- debug(`get connection info failed from accountInfo`);
36
- }
37
- var patch = {
38
- accountId: '',
39
- accessToken: '',
40
- refreshToken: '',
41
- accessInfo: '',
42
- expiresIn: null,
43
- tokenType: '',
44
- accountInfo: '',
45
- countryCode: '',
46
- status: controllers_1.ACCOUNTING_STATUS.INACTIVE
47
- };
48
- return await repository.save(Object.assign(Object.assign(Object.assign({}, account), patch), { updater: context.state.user }));
49
- }
50
- };
51
- //# sourceMappingURL=deactivate-xero-account.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deactivate-xero-account.js","sourceRoot":"","sources":["../../../../../server/graphql/resolvers/accounting/xero/deactivate-xero-account.ts"],"names":[],"mappings":";;;;AAAA,oEAA8B;AAE9B,iDAAqD;AAErD,yDAA2D;AAC3D,mDAA8C;AAE9C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,+DAA+D,CAAC,CAAA;AAElF,QAAA,qBAAqB,GAAG;IACnC,KAAK,CAAC,qBAAqB,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAwB;QAClE,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAA;QACzC,MAAM,OAAO,GAAQ,MAAM,UAAU,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACvD,CAAC,CAAA;QAEF,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;YAElD,IAAI,UAAU,EAAE,CAAC;gBACf,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,oCAAoC,UAAU,CAAC,EAAE,EAAE,EAAE;oBAChF,MAAM,EAAE,QAAQ;oBAChB,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,OAAO,CAAC,WAAW,EAAE;qBAC/C;iBACF,CAAC,CAAA;gBAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,KAAK,CAAC,0BAA0B,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;gBAC3E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,2CAA2C,CAAC,CAAA;YACpD,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,6CAA6C,CAAC,CAAA;QACtD,CAAC;QAED,IAAI,KAAK,GAAG;YACV,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;YACf,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;YACf,MAAM,EAAE,+BAAiB,CAAC,QAAQ;SACnC,CAAA;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,OAAO,GACP,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import fetch from 'node-fetch'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { ACCOUNTING_STATUS } from '../../../../controllers'\nimport { Account } from '../../../../entities'\n\nconst debug = require('debug')('things-factory:integration-accounting:deactivate-xero-account')\n\nexport const deactivateXeroAccount = {\n async deactivateXeroAccount(_: any, { id }, context: ResolverContext) {\n const repository = getRepository(Account)\n const account: any = await repository.findOne({\n where: { domain: { id: context.state.domain.id }, id }\n })\n\n try {\n const connection = JSON.parse(account.accountInfo)\n\n if (connection) {\n /* delete connection request to xero */\n const response = await fetch(`https://api.xero.com/connections/${connection.id}`, {\n method: 'delete',\n headers: {\n Authorization: `Bearer ${account.accessToken}`\n }\n })\n\n if (!response.ok) {\n debug('delete connection failed', response.status, await response.text())\n }\n } else {\n debug(`connection info from accountInfo is empty`)\n }\n } catch (err) {\n debug(`get connection info failed from accountInfo`)\n }\n\n var patch = {\n accountId: '',\n accessToken: '',\n refreshToken: '',\n accessInfo: '',\n expiresIn: null,\n tokenType: '',\n accountInfo: '',\n countryCode: '',\n status: ACCOUNTING_STATUS.INACTIVE\n }\n\n return await repository.save({\n ...account,\n ...patch,\n updater: context.state.user\n })\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- export declare function makeVerificationTokenForNonce(): string;
2
- export declare const getXeroAuthURL: {
3
- getXeroAuthURL(_: any, { accounting }: {
4
- accounting: any;
5
- }, context: ResolverContext): Promise<string>;
6
- };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getXeroAuthURL = void 0;
4
- exports.makeVerificationTokenForNonce = makeVerificationTokenForNonce;
5
- const tslib_1 = require("tslib");
6
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
7
- const auth_base_1 = require("@things-factory/auth-base");
8
- const env_1 = require("@things-factory/env");
9
- const shell_1 = require("@things-factory/shell");
10
- const xero_1 = require("../../../../controllers/xero");
11
- const xeroConfig = env_1.config.get('accountingIntegrationXero', {});
12
- const { apiKey, apiSecret, callback } = xeroConfig;
13
- function makeVerificationTokenForNonce() {
14
- return crypto_1.default.randomBytes(16).toString('hex');
15
- }
16
- exports.getXeroAuthURL = {
17
- async getXeroAuthURL(_, { accounting }, context) {
18
- const { user } = context.state;
19
- const xero = new xero_1.Xero({ apiKey, apiSecret, callback });
20
- /* generate verification-token as a nonce */
21
- const nonce = makeVerificationTokenForNonce();
22
- await (0, shell_1.getRepository)(auth_base_1.VerificationToken).save({
23
- userId: user.id,
24
- token: nonce,
25
- type: auth_base_1.VerificationTokenType.REQUEST_ACCESS_TOKEN,
26
- suppliment: accounting
27
- });
28
- return xero.buildAuthURL(nonce);
29
- }
30
- };
31
- //# sourceMappingURL=get-xero-auth-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-xero-auth-url.js","sourceRoot":"","sources":["../../../../../server/graphql/resolvers/accounting/xero/get-xero-auth-url.ts"],"names":[],"mappings":";;;AAWA,sEAEC;;AAbD,4DAA2B;AAE3B,yDAAoF;AACpF,6CAA4C;AAC5C,iDAAqD;AAErD,uDAAmD;AAEnD,MAAM,UAAU,GAAG,YAAM,CAAC,GAAG,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAA;AAC9D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAA;AAElD,SAAgB,6BAA6B;IAC3C,OAAO,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC;AAEY,QAAA,cAAc,GAAG;IAC5B,KAAK,CAAC,cAAc,CAAC,CAAM,EAAE,EAAE,UAAU,EAAE,EAAE,OAAwB;QACnE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAC9B,MAAM,IAAI,GAAG,IAAI,WAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAA;QAEtD,4CAA4C;QAC5C,MAAM,KAAK,GAAG,6BAA6B,EAAE,CAAA;QAC7C,MAAM,IAAA,qBAAa,EAAC,6BAAiB,CAAC,CAAC,IAAI,CAAC;YAC1C,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,iCAAqB,CAAC,oBAAoB;YAChD,UAAU,EAAE,UAAU;SACvB,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IACjC,CAAC;CACF,CAAA","sourcesContent":["import crypto from 'crypto'\n\nimport { VerificationToken, VerificationTokenType } from '@things-factory/auth-base'\nimport { config } from '@things-factory/env'\nimport { getRepository } from '@things-factory/shell'\n\nimport { Xero } from '../../../../controllers/xero'\n\nconst xeroConfig = config.get('accountingIntegrationXero', {})\nconst { apiKey, apiSecret, callback } = xeroConfig\n\nexport function makeVerificationTokenForNonce() {\n return crypto.randomBytes(16).toString('hex')\n}\n\nexport const getXeroAuthURL = {\n async getXeroAuthURL(_: any, { accounting }, context: ResolverContext) {\n const { user } = context.state\n const xero = new Xero({ apiKey, apiSecret, callback })\n\n /* generate verification-token as a nonce */\n const nonce = makeVerificationTokenForNonce()\n await getRepository(VerificationToken).save({\n userId: user.id,\n token: nonce,\n type: VerificationTokenType.REQUEST_ACCESS_TOKEN,\n suppliment: accounting\n })\n\n return xero.buildAuthURL(nonce)\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- export declare const Query: {
2
- getXeroAuthURL(_: any, { accounting }: {
3
- accounting: any;
4
- }, context: ResolverContext): Promise<string>;
5
- };
6
- export declare const Mutation: {
7
- deactivateXeroAccount(_: any, { id }: {
8
- id: any;
9
- }, context: ResolverContext): Promise<any>;
10
- refreshXeroAccessToken(_: any, { id }: {
11
- id: any;
12
- }, context: ResolverContext): Promise<any>;
13
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = exports.Query = void 0;
4
- const get_xero_auth_url_1 = require("./get-xero-auth-url");
5
- const deactivate_xero_account_1 = require("./deactivate-xero-account");
6
- const refresh_xero_access_token_1 = require("./refresh-xero-access-token");
7
- exports.Query = Object.assign({}, get_xero_auth_url_1.getXeroAuthURL);
8
- exports.Mutation = Object.assign(Object.assign({}, refresh_xero_access_token_1.refreshXeroAccessToken), deactivate_xero_account_1.deactivateXeroAccount);
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../server/graphql/resolvers/accounting/xero/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoD;AAEpD,uEAAiE;AACjE,2EAAoE;AAEvD,QAAA,KAAK,qBACb,kCAAc,EAClB;AAEY,QAAA,QAAQ,mCAChB,kDAAsB,GACtB,+CAAqB,EACzB","sourcesContent":["import { getXeroAuthURL } from './get-xero-auth-url'\n\nimport { deactivateXeroAccount } from './deactivate-xero-account'\nimport { refreshXeroAccessToken } from './refresh-xero-access-token'\n\nexport const Query = {\n ...getXeroAuthURL\n}\n\nexport const Mutation = {\n ...refreshXeroAccessToken,\n ...deactivateXeroAccount\n}\n"]}
@@ -1,5 +0,0 @@
1
- export declare const refreshXeroAccessToken: {
2
- refreshXeroAccessToken(_: any, { id }: {
3
- id: any;
4
- }, context: ResolverContext): Promise<any>;
5
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.refreshXeroAccessToken = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
- const env_1 = require("@things-factory/env");
7
- const shell_1 = require("@things-factory/shell");
8
- const utils_1 = require("@things-factory/utils");
9
- const entities_1 = require("../../../../entities");
10
- const xeroConfig = env_1.config.get('accountingIntegrationXero', {});
11
- const { apiKey, apiSecret } = xeroConfig;
12
- const debug = require('debug')('things-factory:integration-accounting:refresh-xero-access-token');
13
- exports.refreshXeroAccessToken = {
14
- async refreshXeroAccessToken(_, { id }, context) {
15
- const repository = (0, shell_1.getRepository)(entities_1.Account);
16
- const account = await repository.findOne({
17
- where: { domain: { id: context.state.domain.id }, id }
18
- });
19
- const refreshRequestData = {
20
- grant_type: 'refresh_token',
21
- refresh_token: account.refreshToken
22
- };
23
- const refreshResponse = await (0, node_fetch_1.default)(`https://identity.xero.com/connect/token`, {
24
- method: 'post',
25
- headers: {
26
- Authorization: `Basic ${Buffer.from(apiKey + ':' + apiSecret).toString('base64')}`,
27
- 'Content-Type': 'application/x-www-form-urlencoded'
28
- },
29
- body: Object.entries(refreshRequestData)
30
- .map(([key, value]) => encodeURIComponent(key) + '=' + encodeURIComponent(value))
31
- .join('&')
32
- });
33
- if (!refreshResponse.ok) {
34
- throw new Error(`get account information failed: ${await refreshResponse.text()}`);
35
- }
36
- const body = await refreshResponse.json();
37
- const { access_token /* token used to call the API */, id_token /* token containing user identity details (only returned if OpenID Connect scopes are requested) */, expires_in /* amount of seconds until the access token expires */, token_type: tokenType /* must be Bearer */, refresh_token
38
- /* token used to refresh the access token once it has expired (only returned if the offline_access scope is requested).
39
- */
40
- } = body;
41
- const { exp } = (0, utils_1.parseJwt)(access_token);
42
- var patch = {
43
- accessToken: access_token,
44
- refreshToken: refresh_token,
45
- tokenType,
46
- expiresIn: new Date(exp * 1000)
47
- };
48
- return await repository.save(Object.assign(Object.assign(Object.assign({}, account), patch), { updater: context.state.user }));
49
- }
50
- };
51
- //# sourceMappingURL=refresh-xero-access-token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refresh-xero-access-token.js","sourceRoot":"","sources":["../../../../../server/graphql/resolvers/accounting/xero/refresh-xero-access-token.ts"],"names":[],"mappings":";;;;AAAA,oEAA8B;AAE9B,6CAA4C;AAC5C,iDAAqD;AACrD,iDAAgD;AAEhD,mDAA8C;AAE9C,MAAM,UAAU,GAAG,YAAM,CAAC,GAAG,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAA;AAC9D,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAA;AAExC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,iEAAiE,CAAC,CAAA;AAEpF,QAAA,sBAAsB,GAAG;IACpC,KAAK,CAAC,sBAAsB,CAAC,CAAM,EAAE,EAAE,EAAE,EAAE,EAAE,OAAwB;QACnE,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,kBAAO,CAAC,CAAA;QACzC,MAAM,OAAO,GAAQ,MAAM,UAAU,CAAC,OAAO,CAAC;YAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;SACvD,CAAC,CAAA;QAEF,MAAM,kBAAkB,GAAG;YACzB,UAAU,EAAE,eAAe;YAC3B,aAAa,EAAE,OAAO,CAAC,YAAY;SACpC,CAAA;QAED,MAAM,eAAe,GAAG,MAAM,IAAA,oBAAK,EAAC,yCAAyC,EAAE;YAC7E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBAClF,cAAc,EAAE,mCAAmC;aACpD;YACD,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;iBAChF,IAAI,CAAC,GAAG,CAAC;SACb,CAAC,CAAA;QAEF,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,mCAAmC,MAAM,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACpF,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;QACzC,MAAM,EACJ,YAAY,CAAC,gCAAgC,EAC7C,QAAQ,CAAC,mGAAmG,EAC5G,UAAU,CAAC,sDAAsD,EACjE,UAAU,EAAE,SAAS,CAAC,oBAAoB,EAC1C,aAAa;QACb;WACG;UACJ,GAAG,IAAI,CAAA;QAER,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAC,CAAA;QAEtC,IAAI,KAAK,GAAG;YACV,WAAW,EAAE,YAAY;YACzB,YAAY,EAAE,aAAa;YAC3B,SAAS;YACT,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;SAChC,CAAA;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,+CACvB,OAAO,GACP,KAAK,KACR,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,IAC3B,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import fetch from 'node-fetch'\n\nimport { config } from '@things-factory/env'\nimport { getRepository } from '@things-factory/shell'\nimport { parseJwt } from '@things-factory/utils'\n\nimport { Account } from '../../../../entities'\n\nconst xeroConfig = config.get('accountingIntegrationXero', {})\nconst { apiKey, apiSecret } = xeroConfig\n\nconst debug = require('debug')('things-factory:integration-accounting:refresh-xero-access-token')\n\nexport const refreshXeroAccessToken = {\n async refreshXeroAccessToken(_: any, { id }, context: ResolverContext) {\n const repository = getRepository(Account)\n const account: any = await repository.findOne({\n where: { domain: { id: context.state.domain.id }, id }\n })\n\n const refreshRequestData = {\n grant_type: 'refresh_token',\n refresh_token: account.refreshToken\n }\n\n const refreshResponse = await fetch(`https://identity.xero.com/connect/token`, {\n method: 'post',\n headers: {\n Authorization: `Basic ${Buffer.from(apiKey + ':' + apiSecret).toString('base64')}`,\n 'Content-Type': 'application/x-www-form-urlencoded'\n },\n body: Object.entries(refreshRequestData)\n .map(([key, value]) => encodeURIComponent(key) + '=' + encodeURIComponent(value))\n .join('&')\n })\n\n if (!refreshResponse.ok) {\n throw new Error(`get account information failed: ${await refreshResponse.text()}`)\n }\n\n const body = await refreshResponse.json()\n const {\n access_token /* token used to call the API */,\n id_token /* token containing user identity details (only returned if OpenID Connect scopes are requested) */,\n expires_in /* amount of seconds until the access token expires */,\n token_type: tokenType /* must be Bearer */,\n refresh_token\n /* token used to refresh the access token once it has expired (only returned if the offline_access scope is requested).\n */\n } = body\n\n const { exp } = parseJwt(access_token)\n\n var patch = {\n accessToken: access_token,\n refreshToken: refresh_token,\n tokenType,\n expiresIn: new Date(exp * 1000)\n }\n\n return await repository.save({\n ...account,\n ...patch,\n updater: context.state.user\n })\n }\n}\n"]}
@@ -1,20 +0,0 @@
1
- export declare const queryAccountingInvoice: {
2
- getAccountingInvoices(_: any, { accountingId, params: ListParam }: {
3
- accountingId: any;
4
- params: any;
5
- }, context: ResolverContext): Promise<any>;
6
- getAccountingInvoice(_: any, { accountingId, invoiceNo }: {
7
- accountingId: any;
8
- invoiceNo: any;
9
- }, context: ResolverContext): Promise<any>;
10
- };
11
- export declare const mutateAccountingInvoice: {
12
- createAccountingInvoice(_: any, { accountingId, newInvoice }: {
13
- accountingId: any;
14
- newInvoice: any;
15
- }, context: ResolverContext): Promise<any>;
16
- updateAccountingInvoice(_: any, { accountingId, patch }: {
17
- accountingId: any;
18
- patch: any;
19
- }, context: ResolverContext): Promise<any>;
20
- };
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mutateAccountingInvoice = exports.queryAccountingInvoice = void 0;
4
- const accounting_api_1 = require("../../../controllers/accounting-api");
5
- exports.queryAccountingInvoice = {
6
- async getAccountingInvoices(_, { accountingId, params: ListParam }, context) {
7
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
8
- return await accounting_api_1.AccountingAPI.getInvoices(accounting, {
9
- pagination: {
10
- page: 0,
11
- limit: 100
12
- }
13
- });
14
- },
15
- async getAccountingInvoice(_, { accountingId, invoiceNo }, context) {
16
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
17
- return await accounting_api_1.AccountingAPI.getInvoice(accounting, {
18
- invoiceNo
19
- });
20
- }
21
- };
22
- exports.mutateAccountingInvoice = {
23
- async createAccountingInvoice(_, { accountingId, newInvoice }, context) {
24
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
25
- return await accounting_api_1.AccountingAPI.createInvoice(accounting, newInvoice);
26
- },
27
- async updateAccountingInvoice(_, { accountingId, patch }, context) {
28
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
29
- return await accounting_api_1.AccountingAPI.updateInvoice(accounting, patch);
30
- }
31
- };
32
- //# sourceMappingURL=accounting-invoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accounting-invoice.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting-api/accounting-invoice.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEtD,QAAA,sBAAsB,GAAG;IACpC,KAAK,CAAC,qBAAqB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAwB;QAC/F,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,WAAW,CAAC,UAAU,EAAE;YACjD,UAAU,EAAE;gBACV,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,GAAG;aACX;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,OAAwB;QACtF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,UAAU,CAAC,UAAU,EAAE;YAChD,SAAS;SACV,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAEY,QAAA,uBAAuB,GAAG;IACrC,KAAK,CAAC,uBAAuB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,OAAwB;QAC1F,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAClE,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,OAAwB;QACrF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC7D,CAAC;CACF,CAAA","sourcesContent":["import { AccountingAPI } from '../../../controllers/accounting-api'\n\nexport const queryAccountingInvoice = {\n async getAccountingInvoices(_: any, { accountingId, params: ListParam }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.getInvoices(accounting, {\n pagination: {\n page: 0,\n limit: 100\n }\n })\n },\n\n async getAccountingInvoice(_: any, { accountingId, invoiceNo }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.getInvoice(accounting, {\n invoiceNo\n })\n }\n}\n\nexport const mutateAccountingInvoice = {\n async createAccountingInvoice(_: any, { accountingId, newInvoice }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.createInvoice(accounting, newInvoice)\n },\n\n async updateAccountingInvoice(_: any, { accountingId, patch }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.updateInvoice(accounting, patch)\n }\n}\n"]}
@@ -1,24 +0,0 @@
1
- export declare const queryAccountingItem: {
2
- getAccountingItems(_: any, { accountingId, params: ListParam }: {
3
- accountingId: any;
4
- params: any;
5
- }, context: ResolverContext): Promise<any>;
6
- getAccountingItem(_: any, { accountingId, itemId }: {
7
- accountingId: any;
8
- itemId: any;
9
- }, context: ResolverContext): Promise<any>;
10
- };
11
- export declare const mutateAccountingItem: {
12
- createAccountingItem(_: any, { accountingId, newItem }: {
13
- accountingId: any;
14
- newItem: any;
15
- }, context: ResolverContext): Promise<any>;
16
- updateAccountingItem(_: any, { accountingId, patch }: {
17
- accountingId: any;
18
- patch: any;
19
- }, context: ResolverContext): Promise<any>;
20
- deleteAccountingItem(_: any, { accountingId, itemId }: {
21
- accountingId: any;
22
- itemId: any;
23
- }, context: ResolverContext): Promise<any>;
24
- };
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mutateAccountingItem = exports.queryAccountingItem = void 0;
4
- const accounting_api_1 = require("../../../controllers/accounting-api");
5
- exports.queryAccountingItem = {
6
- async getAccountingItems(_, { accountingId, params: ListParam }, context) {
7
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
8
- return await accounting_api_1.AccountingAPI.getItems(accounting, {
9
- pagination: {
10
- page: 0,
11
- limit: 100
12
- }
13
- });
14
- },
15
- async getAccountingItem(_, { accountingId, itemId }, context) {
16
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
17
- return await accounting_api_1.AccountingAPI.getItem(accounting, {
18
- itemId
19
- });
20
- }
21
- };
22
- exports.mutateAccountingItem = {
23
- async createAccountingItem(_, { accountingId, newItem }, context) {
24
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
25
- return await accounting_api_1.AccountingAPI.createItem(accounting, newItem);
26
- },
27
- async updateAccountingItem(_, { accountingId, patch }, context) {
28
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
29
- return await accounting_api_1.AccountingAPI.updateItem(accounting, patch);
30
- },
31
- async deleteAccountingItem(_, { accountingId, itemId }, context) {
32
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
33
- return await accounting_api_1.AccountingAPI.deleteItem(accounting, itemId);
34
- }
35
- };
36
- //# sourceMappingURL=accounting-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accounting-item.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting-api/accounting-item.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEtD,QAAA,mBAAmB,GAAG;IACjC,KAAK,CAAC,kBAAkB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAwB;QAC5F,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC9C,UAAU,EAAE;gBACV,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,GAAG;aACX;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,OAAwB;QAChF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,OAAO,CAAC,UAAU,EAAE;YAC7C,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAEY,QAAA,oBAAoB,GAAG;IAClC,KAAK,CAAC,oBAAoB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,OAAwB;QACpF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IAC5D,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,OAAwB;QAClF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IAC1D,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,OAAwB;QACnF,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAC3D,CAAC;CACF,CAAA","sourcesContent":["import { AccountingAPI } from '../../../controllers/accounting-api'\n\nexport const queryAccountingItem = {\n async getAccountingItems(_: any, { accountingId, params: ListParam }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.getItems(accounting, {\n pagination: {\n page: 0,\n limit: 100\n }\n })\n },\n\n async getAccountingItem(_: any, { accountingId, itemId }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.getItem(accounting, {\n itemId\n })\n }\n}\n\nexport const mutateAccountingItem = {\n async createAccountingItem(_: any, { accountingId, newItem }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.createItem(accounting, newItem)\n },\n\n async updateAccountingItem(_: any, { accountingId, patch }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.updateItem(accounting, patch)\n },\n\n async deleteAccountingItem(_: any, { accountingId, itemId }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.deleteItem(accounting, itemId)\n }\n}\n"]}
@@ -1,6 +0,0 @@
1
- export declare const queryAccountingPurchaseOrder: {
2
- getAccountingPurchaseOrders(_: any, { accountingId, params: ListParam }: {
3
- accountingId: any;
4
- params: any;
5
- }, context: ResolverContext): Promise<any>;
6
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queryAccountingPurchaseOrder = void 0;
4
- const accounting_api_1 = require("../../../controllers/accounting-api");
5
- exports.queryAccountingPurchaseOrder = {
6
- async getAccountingPurchaseOrders(_, { accountingId, params: ListParam }, context) {
7
- var accounting = await accounting_api_1.AccountingAPI.getAccounting(accountingId);
8
- return await accounting_api_1.AccountingAPI.getPurchaseOrders(accounting, {
9
- pagination: {
10
- page: 0,
11
- limit: 100
12
- }
13
- });
14
- }
15
- };
16
- //# sourceMappingURL=accounting-purchase-order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accounting-purchase-order.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting-api/accounting-purchase-order.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEtD,QAAA,4BAA4B,GAAG;IAC1C,KAAK,CAAC,2BAA2B,CAAC,CAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAwB;QACrG,IAAI,UAAU,GAAG,MAAM,8BAAa,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QAEhE,OAAO,MAAM,8BAAa,CAAC,iBAAiB,CAAC,UAAU,EAAE;YACvD,UAAU,EAAE;gBACV,IAAI,EAAE,CAAC;gBACP,KAAK,EAAE,GAAG;aACX;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { AccountingAPI } from '../../../controllers/accounting-api'\n\nexport const queryAccountingPurchaseOrder = {\n async getAccountingPurchaseOrders(_: any, { accountingId, params: ListParam }, context: ResolverContext) {\n var accounting = await AccountingAPI.getAccounting(accountingId)\n\n return await AccountingAPI.getPurchaseOrders(accounting, {\n pagination: {\n page: 0,\n limit: 100\n }\n })\n }\n}\n"]}
@@ -1,44 +0,0 @@
1
- export declare const Query: {
2
- getAccountingPurchaseOrders(_: any, { accountingId, params: ListParam }: {
3
- accountingId: any;
4
- params: any;
5
- }, context: ResolverContext): Promise<any>;
6
- getAccountingItems(_: any, { accountingId, params: ListParam }: {
7
- accountingId: any;
8
- params: any;
9
- }, context: ResolverContext): Promise<any>;
10
- getAccountingItem(_: any, { accountingId, itemId }: {
11
- accountingId: any;
12
- itemId: any;
13
- }, context: ResolverContext): Promise<any>;
14
- getAccountingInvoices(_: any, { accountingId, params: ListParam }: {
15
- accountingId: any;
16
- params: any;
17
- }, context: ResolverContext): Promise<any>;
18
- getAccountingInvoice(_: any, { accountingId, invoiceNo }: {
19
- accountingId: any;
20
- invoiceNo: any;
21
- }, context: ResolverContext): Promise<any>;
22
- };
23
- export declare const Mutation: {
24
- createAccountingItem(_: any, { accountingId, newItem }: {
25
- accountingId: any;
26
- newItem: any;
27
- }, context: ResolverContext): Promise<any>;
28
- updateAccountingItem(_: any, { accountingId, patch }: {
29
- accountingId: any;
30
- patch: any;
31
- }, context: ResolverContext): Promise<any>;
32
- deleteAccountingItem(_: any, { accountingId, itemId }: {
33
- accountingId: any;
34
- itemId: any;
35
- }, context: ResolverContext): Promise<any>;
36
- createAccountingInvoice(_: any, { accountingId, newInvoice }: {
37
- accountingId: any;
38
- newInvoice: any;
39
- }, context: ResolverContext): Promise<any>;
40
- updateAccountingInvoice(_: any, { accountingId, patch }: {
41
- accountingId: any;
42
- patch: any;
43
- }, context: ResolverContext): Promise<any>;
44
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mutation = exports.Query = void 0;
4
- const accounting_invoice_1 = require("./accounting-invoice");
5
- const accounting_item_1 = require("./accounting-item");
6
- const accounting_purchase_order_1 = require("./accounting-purchase-order");
7
- exports.Query = Object.assign(Object.assign(Object.assign({}, accounting_invoice_1.queryAccountingInvoice), accounting_item_1.queryAccountingItem), accounting_purchase_order_1.queryAccountingPurchaseOrder);
8
- exports.Mutation = Object.assign(Object.assign({}, accounting_invoice_1.mutateAccountingInvoice), accounting_item_1.mutateAccountingItem);
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/accounting-api/index.ts"],"names":[],"mappings":";;;AAAA,6DAAsF;AACtF,uDAA6E;AAC7E,2EAA0E;AAE7D,QAAA,KAAK,iDACb,2CAAsB,GACtB,qCAAmB,GACnB,wDAA4B,EAChC;AAEY,QAAA,QAAQ,mCAChB,4CAAuB,GACvB,sCAAoB,EACxB","sourcesContent":["import { queryAccountingInvoice, mutateAccountingInvoice } from './accounting-invoice'\nimport { queryAccountingItem, mutateAccountingItem } from './accounting-item'\nimport { queryAccountingPurchaseOrder } from './accounting-purchase-order'\n\nexport const Query = {\n ...queryAccountingInvoice,\n ...queryAccountingItem,\n ...queryAccountingPurchaseOrder\n}\n\nexport const Mutation = {\n ...mutateAccountingInvoice,\n ...mutateAccountingItem\n}\n"]}