@nhost/stripe-graphql-js 1.1.1 → 1.3.0-beta.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 (232) hide show
  1. package/dist/dev/server.js +17 -0
  2. package/dist/src/builder.js +8 -0
  3. package/dist/{index.d.ts → src/index.js} +0 -1
  4. package/dist/{schema → src/schema}/address.js +2 -5
  5. package/dist/{schema → src/schema}/billing-portal-session.js +2 -5
  6. package/dist/{schema → src/schema}/charge.js +9 -21
  7. package/dist/{schema → src/schema}/charges.js +2 -5
  8. package/dist/{schema → src/schema}/connectedAccount.js +2 -5
  9. package/dist/{schema → src/schema}/connectedAccounts.js +2 -5
  10. package/dist/{schema → src/schema}/customer-shipping.js +2 -5
  11. package/dist/{schema → src/schema}/customer-tax-location.js +2 -5
  12. package/dist/{schema → src/schema}/customer-tax.js +2 -5
  13. package/dist/{schema → src/schema}/customer.js +20 -32
  14. package/dist/{schema → src/schema}/customers.js +2 -5
  15. package/dist/{schema/index.d.ts → src/schema/index.js} +2 -2
  16. package/dist/{schema → src/schema}/invoice-automatic-tax.js +2 -5
  17. package/dist/{schema → src/schema}/invoice-custom-field.js +2 -5
  18. package/dist/{schema → src/schema}/invoice-customer-shipping.js +2 -5
  19. package/dist/{schema → src/schema}/invoice-customer-tax-id.js +2 -5
  20. package/dist/{schema → src/schema}/invoice-line-item-period.js +2 -5
  21. package/dist/{schema → src/schema}/invoice-line-item-tax-amount.js +2 -5
  22. package/dist/{schema → src/schema}/invoice-line-item.js +2 -5
  23. package/dist/{schema → src/schema}/invoice-line-items.js +2 -5
  24. package/dist/{schema → src/schema}/invoice-rendering-options.js +2 -5
  25. package/dist/{schema → src/schema}/invoice-status-transitions.js +2 -5
  26. package/dist/{schema → src/schema}/invoice.js +12 -24
  27. package/dist/{schema → src/schema}/invoices.js +2 -5
  28. package/dist/{schema → src/schema}/payment-intent.js +6 -18
  29. package/dist/{schema → src/schema}/payment-intents.js +2 -5
  30. package/dist/{schema → src/schema}/payment-method-billing-details.js +2 -5
  31. package/dist/{schema → src/schema}/payment-method-card-checks.js +2 -5
  32. package/dist/{schema → src/schema}/payment-method-card-networks.js +2 -5
  33. package/dist/src/schema/payment-method-card-three-d-secure-usage.js +8 -0
  34. package/dist/{schema → src/schema}/payment-method-card-wallet-masterpass.js +2 -5
  35. package/dist/{schema → src/schema}/payment-method-card-wallet-visa-checkout.js +2 -5
  36. package/dist/{schema → src/schema}/payment-method-card-wallet.js +3 -7
  37. package/dist/{schema → src/schema}/payment-method-card.js +2 -5
  38. package/dist/{schema → src/schema}/payment-method.js +2 -5
  39. package/dist/{schema → src/schema}/payment-methods.js +3 -7
  40. package/dist/{schema → src/schema}/plan-transform-usage.js +2 -5
  41. package/dist/{schema → src/schema}/plan.js +6 -18
  42. package/dist/{schema → src/schema}/price.js +6 -18
  43. package/dist/{schema → src/schema}/product.js +6 -18
  44. package/dist/{schema → src/schema}/stripe.js +30 -42
  45. package/dist/src/schema/subscription-automatic-tax.js +9 -0
  46. package/dist/{schema → src/schema}/subscription-billing-thresholds.js +2 -5
  47. package/dist/src/schema/subscription-item-billing-thresholds.js +10 -0
  48. package/dist/{schema → src/schema}/subscription-item.js +2 -5
  49. package/dist/{schema → src/schema}/subscription-items.js +2 -5
  50. package/dist/{schema → src/schema}/subscription-pause-collection.js +2 -5
  51. package/dist/{schema → src/schema}/subscription.js +12 -24
  52. package/dist/{schema → src/schema}/subscriptions.js +2 -5
  53. package/dist/{schema → src/schema}/tax-rate.js +2 -5
  54. package/dist/{schema → src/schema}/test-clock.js +2 -5
  55. package/dist/{server.js → src/server.js} +15 -16
  56. package/dist/src/types.js +1 -0
  57. package/dist/src/utils.js +26 -0
  58. package/package.json +4 -4
  59. package/dist/builder.d.ts +0 -72
  60. package/dist/builder.d.ts.map +0 -1
  61. package/dist/builder.js +0 -15
  62. package/dist/builder.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/index.js +0 -21
  65. package/dist/index.js.map +0 -1
  66. package/dist/schema/address.d.ts +0 -2
  67. package/dist/schema/address.d.ts.map +0 -1
  68. package/dist/schema/address.js.map +0 -1
  69. package/dist/schema/billing-portal-session.d.ts +0 -2
  70. package/dist/schema/billing-portal-session.d.ts.map +0 -1
  71. package/dist/schema/billing-portal-session.js.map +0 -1
  72. package/dist/schema/charge.d.ts +0 -2
  73. package/dist/schema/charge.d.ts.map +0 -1
  74. package/dist/schema/charge.js.map +0 -1
  75. package/dist/schema/charges.d.ts +0 -2
  76. package/dist/schema/charges.d.ts.map +0 -1
  77. package/dist/schema/charges.js.map +0 -1
  78. package/dist/schema/connectedAccount.d.ts +0 -2
  79. package/dist/schema/connectedAccount.d.ts.map +0 -1
  80. package/dist/schema/connectedAccount.js.map +0 -1
  81. package/dist/schema/connectedAccounts.d.ts +0 -2
  82. package/dist/schema/connectedAccounts.d.ts.map +0 -1
  83. package/dist/schema/connectedAccounts.js.map +0 -1
  84. package/dist/schema/customer-shipping.d.ts +0 -2
  85. package/dist/schema/customer-shipping.d.ts.map +0 -1
  86. package/dist/schema/customer-shipping.js.map +0 -1
  87. package/dist/schema/customer-tax-location.d.ts +0 -2
  88. package/dist/schema/customer-tax-location.d.ts.map +0 -1
  89. package/dist/schema/customer-tax-location.js.map +0 -1
  90. package/dist/schema/customer-tax.d.ts +0 -2
  91. package/dist/schema/customer-tax.d.ts.map +0 -1
  92. package/dist/schema/customer-tax.js.map +0 -1
  93. package/dist/schema/customer.d.ts +0 -2
  94. package/dist/schema/customer.d.ts.map +0 -1
  95. package/dist/schema/customer.js.map +0 -1
  96. package/dist/schema/customers.d.ts +0 -2
  97. package/dist/schema/customers.d.ts.map +0 -1
  98. package/dist/schema/customers.js.map +0 -1
  99. package/dist/schema/index.d.ts.map +0 -1
  100. package/dist/schema/index.js +0 -56
  101. package/dist/schema/index.js.map +0 -1
  102. package/dist/schema/invoice-automatic-tax.d.ts +0 -2
  103. package/dist/schema/invoice-automatic-tax.d.ts.map +0 -1
  104. package/dist/schema/invoice-automatic-tax.js.map +0 -1
  105. package/dist/schema/invoice-custom-field.d.ts +0 -2
  106. package/dist/schema/invoice-custom-field.d.ts.map +0 -1
  107. package/dist/schema/invoice-custom-field.js.map +0 -1
  108. package/dist/schema/invoice-customer-shipping.d.ts +0 -2
  109. package/dist/schema/invoice-customer-shipping.d.ts.map +0 -1
  110. package/dist/schema/invoice-customer-shipping.js.map +0 -1
  111. package/dist/schema/invoice-customer-tax-id.d.ts +0 -2
  112. package/dist/schema/invoice-customer-tax-id.d.ts.map +0 -1
  113. package/dist/schema/invoice-customer-tax-id.js.map +0 -1
  114. package/dist/schema/invoice-line-item-period.d.ts +0 -2
  115. package/dist/schema/invoice-line-item-period.d.ts.map +0 -1
  116. package/dist/schema/invoice-line-item-period.js.map +0 -1
  117. package/dist/schema/invoice-line-item-tax-amount.d.ts +0 -2
  118. package/dist/schema/invoice-line-item-tax-amount.d.ts.map +0 -1
  119. package/dist/schema/invoice-line-item-tax-amount.js.map +0 -1
  120. package/dist/schema/invoice-line-item.d.ts +0 -2
  121. package/dist/schema/invoice-line-item.d.ts.map +0 -1
  122. package/dist/schema/invoice-line-item.js.map +0 -1
  123. package/dist/schema/invoice-line-items.d.ts +0 -2
  124. package/dist/schema/invoice-line-items.d.ts.map +0 -1
  125. package/dist/schema/invoice-line-items.js.map +0 -1
  126. package/dist/schema/invoice-rendering-options.d.ts +0 -2
  127. package/dist/schema/invoice-rendering-options.d.ts.map +0 -1
  128. package/dist/schema/invoice-rendering-options.js.map +0 -1
  129. package/dist/schema/invoice-status-transitions.d.ts +0 -2
  130. package/dist/schema/invoice-status-transitions.d.ts.map +0 -1
  131. package/dist/schema/invoice-status-transitions.js.map +0 -1
  132. package/dist/schema/invoice.d.ts +0 -2
  133. package/dist/schema/invoice.d.ts.map +0 -1
  134. package/dist/schema/invoice.js.map +0 -1
  135. package/dist/schema/invoices.d.ts +0 -2
  136. package/dist/schema/invoices.d.ts.map +0 -1
  137. package/dist/schema/invoices.js.map +0 -1
  138. package/dist/schema/payment-intent.d.ts +0 -2
  139. package/dist/schema/payment-intent.d.ts.map +0 -1
  140. package/dist/schema/payment-intent.js.map +0 -1
  141. package/dist/schema/payment-intents.d.ts +0 -2
  142. package/dist/schema/payment-intents.d.ts.map +0 -1
  143. package/dist/schema/payment-intents.js.map +0 -1
  144. package/dist/schema/payment-method-billing-details.d.ts +0 -2
  145. package/dist/schema/payment-method-billing-details.d.ts.map +0 -1
  146. package/dist/schema/payment-method-billing-details.js.map +0 -1
  147. package/dist/schema/payment-method-card-checks.d.ts +0 -2
  148. package/dist/schema/payment-method-card-checks.d.ts.map +0 -1
  149. package/dist/schema/payment-method-card-checks.js.map +0 -1
  150. package/dist/schema/payment-method-card-networks.d.ts +0 -2
  151. package/dist/schema/payment-method-card-networks.d.ts.map +0 -1
  152. package/dist/schema/payment-method-card-networks.js.map +0 -1
  153. package/dist/schema/payment-method-card-three-d-secure-usage.d.ts +0 -2
  154. package/dist/schema/payment-method-card-three-d-secure-usage.d.ts.map +0 -1
  155. package/dist/schema/payment-method-card-three-d-secure-usage.js +0 -11
  156. package/dist/schema/payment-method-card-three-d-secure-usage.js.map +0 -1
  157. package/dist/schema/payment-method-card-wallet-masterpass.d.ts +0 -2
  158. package/dist/schema/payment-method-card-wallet-masterpass.d.ts.map +0 -1
  159. package/dist/schema/payment-method-card-wallet-masterpass.js.map +0 -1
  160. package/dist/schema/payment-method-card-wallet-visa-checkout.d.ts +0 -2
  161. package/dist/schema/payment-method-card-wallet-visa-checkout.d.ts.map +0 -1
  162. package/dist/schema/payment-method-card-wallet-visa-checkout.js.map +0 -1
  163. package/dist/schema/payment-method-card-wallet.d.ts +0 -2
  164. package/dist/schema/payment-method-card-wallet.d.ts.map +0 -1
  165. package/dist/schema/payment-method-card-wallet.js.map +0 -1
  166. package/dist/schema/payment-method-card.d.ts +0 -2
  167. package/dist/schema/payment-method-card.d.ts.map +0 -1
  168. package/dist/schema/payment-method-card.js.map +0 -1
  169. package/dist/schema/payment-method.d.ts +0 -2
  170. package/dist/schema/payment-method.d.ts.map +0 -1
  171. package/dist/schema/payment-method.js.map +0 -1
  172. package/dist/schema/payment-methods.d.ts +0 -2
  173. package/dist/schema/payment-methods.d.ts.map +0 -1
  174. package/dist/schema/payment-methods.js.map +0 -1
  175. package/dist/schema/plan-transform-usage.d.ts +0 -2
  176. package/dist/schema/plan-transform-usage.d.ts.map +0 -1
  177. package/dist/schema/plan-transform-usage.js.map +0 -1
  178. package/dist/schema/plan.d.ts +0 -2
  179. package/dist/schema/plan.d.ts.map +0 -1
  180. package/dist/schema/plan.js.map +0 -1
  181. package/dist/schema/price.d.ts +0 -2
  182. package/dist/schema/price.d.ts.map +0 -1
  183. package/dist/schema/price.js.map +0 -1
  184. package/dist/schema/product.d.ts +0 -2
  185. package/dist/schema/product.d.ts.map +0 -1
  186. package/dist/schema/product.js.map +0 -1
  187. package/dist/schema/stripe.d.ts +0 -2
  188. package/dist/schema/stripe.d.ts.map +0 -1
  189. package/dist/schema/stripe.js.map +0 -1
  190. package/dist/schema/subscription-automatic-tax.d.ts +0 -2
  191. package/dist/schema/subscription-automatic-tax.d.ts.map +0 -1
  192. package/dist/schema/subscription-automatic-tax.js +0 -12
  193. package/dist/schema/subscription-automatic-tax.js.map +0 -1
  194. package/dist/schema/subscription-billing-thresholds.d.ts +0 -2
  195. package/dist/schema/subscription-billing-thresholds.d.ts.map +0 -1
  196. package/dist/schema/subscription-billing-thresholds.js.map +0 -1
  197. package/dist/schema/subscription-item-billing-thresholds.d.ts +0 -2
  198. package/dist/schema/subscription-item-billing-thresholds.d.ts.map +0 -1
  199. package/dist/schema/subscription-item-billing-thresholds.js +0 -13
  200. package/dist/schema/subscription-item-billing-thresholds.js.map +0 -1
  201. package/dist/schema/subscription-item.d.ts +0 -2
  202. package/dist/schema/subscription-item.d.ts.map +0 -1
  203. package/dist/schema/subscription-item.js.map +0 -1
  204. package/dist/schema/subscription-items.d.ts +0 -2
  205. package/dist/schema/subscription-items.d.ts.map +0 -1
  206. package/dist/schema/subscription-items.js.map +0 -1
  207. package/dist/schema/subscription-pause-collection.d.ts +0 -2
  208. package/dist/schema/subscription-pause-collection.d.ts.map +0 -1
  209. package/dist/schema/subscription-pause-collection.js.map +0 -1
  210. package/dist/schema/subscription.d.ts +0 -2
  211. package/dist/schema/subscription.d.ts.map +0 -1
  212. package/dist/schema/subscription.js.map +0 -1
  213. package/dist/schema/subscriptions.d.ts +0 -2
  214. package/dist/schema/subscriptions.d.ts.map +0 -1
  215. package/dist/schema/subscriptions.js.map +0 -1
  216. package/dist/schema/tax-rate.d.ts +0 -2
  217. package/dist/schema/tax-rate.d.ts.map +0 -1
  218. package/dist/schema/tax-rate.js.map +0 -1
  219. package/dist/schema/test-clock.d.ts +0 -2
  220. package/dist/schema/test-clock.d.ts.map +0 -1
  221. package/dist/schema/test-clock.js.map +0 -1
  222. package/dist/server.d.ts +0 -5
  223. package/dist/server.d.ts.map +0 -1
  224. package/dist/server.js.map +0 -1
  225. package/dist/types.d.ts +0 -57
  226. package/dist/types.d.ts.map +0 -1
  227. package/dist/types.js +0 -3
  228. package/dist/types.js.map +0 -1
  229. package/dist/utils.d.ts +0 -5
  230. package/dist/utils.d.ts.map +0 -1
  231. package/dist/utils.js +0 -34
  232. package/dist/utils.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ import { createServer } from 'http';
2
+ import { createStripeGraphQLServer } from '../src/index';
3
+ const isAllowed = (_stripeCustomerId, context) => {
4
+ const { isAdmin } = context;
5
+ if (isAdmin) {
6
+ return true;
7
+ }
8
+ return false;
9
+ };
10
+ const yoga = createStripeGraphQLServer({
11
+ isAllowed,
12
+ graphiql: true
13
+ });
14
+ const server = createServer(yoga);
15
+ server.listen(4000, () => {
16
+ console.info('Stripe GraphQL API server is running on http://localhost:4000');
17
+ });
@@ -0,0 +1,8 @@
1
+ import { GraphQLJSONObject } from 'graphql-scalars';
2
+ import SchemaBuilder from '@pothos/core';
3
+ // TODO: Make sure we either use Type or Types (e.g. StripePaymentMethodTypes or StripePaymentMethodType ) everywhere
4
+ const builder = new SchemaBuilder({});
5
+ builder.queryType();
6
+ builder.mutationType();
7
+ builder.addScalarType('JSON', GraphQLJSONObject, {});
8
+ export { builder };
@@ -2,4 +2,3 @@ export * from './builder';
2
2
  export * from './schema';
3
3
  export * from './server';
4
4
  export * from './types';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeAddress', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeAddress', {
5
3
  fields: (t) => ({
6
4
  line1: t.exposeString('line1', {
7
5
  description: `Block/Building number.`,
@@ -29,4 +27,3 @@ builder_1.builder.objectType('StripeAddress', {
29
27
  })
30
28
  })
31
29
  });
32
- //# sourceMappingURL=address.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeBillingPortalSession', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeBillingPortalSession', {
5
3
  description: '',
6
4
  fields: (t) => ({
7
5
  id: t.exposeString('id', {
@@ -32,4 +30,3 @@ builder_1.builder.objectType('StripeBillingPortalSession', {
32
30
  })
33
31
  })
34
32
  });
35
- //# sourceMappingURL=billing-portal-session.js.map
@@ -1,17 +1,6 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const builder_1 = require("../builder");
13
- const utils_1 = require("../utils");
14
- builder_1.builder.objectType('StripeCharge', {
1
+ import { builder } from '../builder';
2
+ import { stripe } from '../utils';
3
+ builder.objectType('StripeCharge', {
15
4
  description: 'Stripe charge object',
16
5
  fields: (t) => ({
17
6
  id: t.exposeString('id'),
@@ -35,25 +24,25 @@ builder_1.builder.objectType('StripeCharge', {
35
24
  invoice: t.field({
36
25
  type: 'StripeInvoice',
37
26
  nullable: true,
38
- resolve: (charge) => __awaiter(void 0, void 0, void 0, function* () {
27
+ resolve: async (charge) => {
39
28
  const { invoice } = charge;
40
29
  if (!invoice) {
41
30
  return null;
42
31
  }
43
- const invoiceData = yield utils_1.stripe.invoices.retrieve(invoice);
32
+ const invoiceData = await stripe.invoices.retrieve(invoice);
44
33
  return invoiceData;
45
- })
34
+ }
46
35
  }),
47
36
  application: t.field({
48
37
  type: 'StripeConnectedAccount',
49
38
  nullable: true,
50
- resolve: (charge) => __awaiter(void 0, void 0, void 0, function* () {
39
+ resolve: async (charge) => {
51
40
  const { application } = charge;
52
41
  if (!application)
53
42
  return null;
54
- const connectedAccount = yield utils_1.stripe.accounts.retrieve(application);
43
+ const connectedAccount = await stripe.accounts.retrieve(application);
55
44
  return connectedAccount;
56
- })
45
+ }
57
46
  }),
58
47
  livemode: t.exposeBoolean('livemode'),
59
48
  metadata: t.expose('metadata', { nullable: true, type: 'JSON' }),
@@ -82,4 +71,3 @@ builder_1.builder.objectType('StripeCharge', {
82
71
  // source_transfer
83
72
  })
84
73
  });
85
- //# sourceMappingURL=charge.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeCharges', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeCharges', {
5
3
  description: 'List of Stripe charge objects',
6
4
  fields: (t) => ({
7
5
  object: t.exposeString('object'),
@@ -13,4 +11,3 @@ builder_1.builder.objectType('StripeCharges', {
13
11
  })
14
12
  })
15
13
  });
16
- //# sourceMappingURL=charges.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeConnectedAccount', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeConnectedAccount', {
5
3
  description: 'Stripe charge object',
6
4
  fields: (t) => ({
7
5
  id: t.exposeString('id'),
@@ -27,4 +25,3 @@ builder_1.builder.objectType('StripeConnectedAccount', {
27
25
  settings: t.expose('settings', { type: 'JSON' })
28
26
  })
29
27
  });
30
- //# sourceMappingURL=connectedAccount.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeConnectedAccounts', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeConnectedAccounts', {
5
3
  description: 'List of Stripe Connected Account objects',
6
4
  fields: (t) => ({
7
5
  object: t.exposeString('object'),
@@ -13,4 +11,3 @@ builder_1.builder.objectType('StripeConnectedAccounts', {
13
11
  })
14
12
  })
15
13
  });
16
- //# sourceMappingURL=connectedAccounts.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeCustomerShipping', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeCustomerShipping', {
5
3
  fields: (t) => ({
6
4
  address: t.expose('address', {
7
5
  type: 'StripeAddress',
@@ -25,4 +23,3 @@ builder_1.builder.objectType('StripeCustomerShipping', {
25
23
  })
26
24
  })
27
25
  });
28
- //# sourceMappingURL=customer-shipping.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeCustomerTaxLocation', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeCustomerTaxLocation', {
5
3
  fields: (t) => ({
6
4
  country: t.exposeString('country', {
7
5
  description: `The customer's country as identified by Stripe Tax.`
@@ -20,4 +18,3 @@ builder_1.builder.objectType('StripeCustomerTaxLocation', {
20
18
  // namespace Location {
21
19
  // type Source = 'billing_address' | 'ip_address' | 'payment_method' | 'shipping_destination'
22
20
  // }
23
- //# sourceMappingURL=customer-tax-location.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeCustomerTax', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeCustomerTax', {
5
3
  fields: (t) => ({
6
4
  // todo: implement correct enum
7
5
  // automaticTax: t.expose('automatic_tax', {
@@ -20,4 +18,3 @@ builder_1.builder.objectType('StripeCustomerTax', {
20
18
  })
21
19
  });
22
20
  // type AutomaticTax = 'failed' | 'not_collecting' | 'supported' | 'unrecognized_location'
23
- //# sourceMappingURL=customer-tax.js.map
@@ -1,18 +1,7 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const builder_1 = require("../builder");
13
- const utils_1 = require("../utils");
14
- const payment_methods_1 = require("./payment-methods");
15
- builder_1.builder.objectType('StripeCustomer', {
1
+ import { builder } from '../builder';
2
+ import { stripe } from '../utils';
3
+ import { StripePaymentMethodTypes } from './payment-methods';
4
+ builder.objectType('StripeCustomer', {
16
5
  description: 'This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.',
17
6
  fields: (t) => ({
18
7
  id: t.exposeString('id', {
@@ -98,38 +87,38 @@ builder_1.builder.objectType('StripeCustomer', {
98
87
  description: `The customer's current subscriptions, if any.`,
99
88
  type: 'StripeSubscriptions',
100
89
  nullable: false,
101
- resolve: (customer) => __awaiter(void 0, void 0, void 0, function* () {
102
- const subscriptions = yield utils_1.stripe.subscriptions.list({
90
+ resolve: async (customer) => {
91
+ const subscriptions = await stripe.subscriptions.list({
103
92
  customer: customer.id
104
93
  });
105
94
  return subscriptions;
106
- })
95
+ }
107
96
  }),
108
97
  invoices: t.field({
109
98
  type: 'StripeInvoices',
110
99
  nullable: false,
111
- resolve: (customer) => __awaiter(void 0, void 0, void 0, function* () {
112
- const invoices = yield utils_1.stripe.invoices.list({
100
+ resolve: async (customer) => {
101
+ const invoices = await stripe.invoices.list({
113
102
  customer: customer.id
114
103
  });
115
104
  return invoices;
116
- })
105
+ }
117
106
  }),
118
107
  paymentIntents: t.field({
119
108
  type: 'StripePaymentIntents',
120
109
  nullable: false,
121
- resolve: (customer) => __awaiter(void 0, void 0, void 0, function* () {
122
- const paymentIntents = yield utils_1.stripe.paymentIntents.list({
110
+ resolve: async (customer) => {
111
+ const paymentIntents = await stripe.paymentIntents.list({
123
112
  customer: customer.id
124
113
  });
125
114
  return paymentIntents;
126
- })
115
+ }
127
116
  }),
128
117
  paymentMethods: t.field({
129
118
  type: 'StripePaymentMethods',
130
119
  args: {
131
120
  type: t.arg({
132
- type: payment_methods_1.StripePaymentMethodTypes,
121
+ type: StripePaymentMethodTypes,
133
122
  required: true,
134
123
  defaultValue: 'card'
135
124
  }),
@@ -144,26 +133,25 @@ builder_1.builder.objectType('StripeCustomer', {
144
133
  })
145
134
  },
146
135
  nullable: false,
147
- resolve: (customer, { type, startingAfter, endingBefore, limit }) => __awaiter(void 0, void 0, void 0, function* () {
148
- const paymentMethods = yield utils_1.stripe.customers.listPaymentMethods(customer.id, {
136
+ resolve: async (customer, { type, startingAfter, endingBefore, limit }) => {
137
+ const paymentMethods = await stripe.customers.listPaymentMethods(customer.id, {
149
138
  type,
150
139
  starting_after: startingAfter || undefined,
151
140
  ending_before: endingBefore || undefined,
152
141
  limit: limit || undefined
153
142
  });
154
143
  return paymentMethods;
155
- })
144
+ }
156
145
  }),
157
146
  charges: t.field({
158
147
  type: 'StripeCharges',
159
148
  nullable: false,
160
- resolve: (customer) => __awaiter(void 0, void 0, void 0, function* () {
161
- const charges = yield utils_1.stripe.charges.list({
149
+ resolve: async (customer) => {
150
+ const charges = await stripe.charges.list({
162
151
  customer: customer.id
163
152
  });
164
153
  return charges;
165
- })
154
+ }
166
155
  })
167
156
  })
168
157
  });
169
- //# sourceMappingURL=customer.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeCustomers', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeCustomers', {
5
3
  fields: (t) => ({
6
4
  object: t.exposeString('object'),
7
5
  url: t.exposeString('url', {
@@ -16,4 +14,3 @@ builder_1.builder.objectType('StripeCustomers', {
16
14
  })
17
15
  })
18
16
  });
19
- //# sourceMappingURL=customers.js.map
@@ -48,5 +48,5 @@ import './charges';
48
48
  import './charge';
49
49
  import './connectedAccount';
50
50
  import './connectedAccounts';
51
- export declare const schema: import("graphql").GraphQLSchema;
52
- //# sourceMappingURL=index.d.ts.map
51
+ import { builder } from '../builder';
52
+ export const schema = builder.toSchema();
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceAutomaticTax', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceAutomaticTax', {
5
3
  fields: (t) => ({
6
4
  enabled: t.exposeBoolean('enabled', {
7
5
  description: `Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or \`tax_behavior=unspecified\`) cannot be added to automatic tax invoices.`
@@ -12,4 +10,3 @@ builder_1.builder.objectType('StripeInvoiceAutomaticTax', {
12
10
  })
13
11
  })
14
12
  });
15
- //# sourceMappingURL=invoice-automatic-tax.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceCustomField', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceCustomField', {
5
3
  fields: (t) => ({
6
4
  name: t.exposeString('name', {
7
5
  description: `The name of the custom field.`
@@ -11,4 +9,3 @@ builder_1.builder.objectType('StripeInvoiceCustomField', {
11
9
  })
12
10
  })
13
11
  });
14
- //# sourceMappingURL=invoice-custom-field.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceCustomerShipping', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceCustomerShipping', {
5
3
  fields: (t) => ({
6
4
  address: t.expose('address', {
7
5
  type: 'StripeAddress',
@@ -25,4 +23,3 @@ builder_1.builder.objectType('StripeInvoiceCustomerShipping', {
25
23
  })
26
24
  })
27
25
  });
28
- //# sourceMappingURL=invoice-customer-shipping.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceCustomerTaxId', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceCustomerTaxId', {
5
3
  fields: (t) => ({
6
4
  type: t.exposeString('type', {
7
5
  description: `The type of the tax ID, one of \`eu_vat\`, \`br_cnpj\`, \`br_cpf\`, \`eu_oss_vat\`, \`gb_vat\`, \`nz_gst\`, \`au_abn\`, \`au_arn\`, \`in_gst\`, \`no_vat\`, \`za_vat\`, \`ch_vat\`, \`mx_rfc\`, \`sg_uen\`, \`ru_inn\`, \`ru_kpp\`, \`ca_bn\`, \`hk_br\`, \`es_cif\`, \`tw_vat\`, \`th_vat\`, \`jp_cn\`, \`jp_rn\`, \`li_uid\`, \`my_itn\`, \`us_ein\`, \`kr_brn\`, \`ca_qst\`, \`ca_gst_hst\`, \`ca_pst_bc\`, \`ca_pst_mb\`, \`ca_pst_sk\`, \`my_sst\`, \`sg_gst\`, \`ae_trn\`, \`cl_tin\`, \`sa_vat\`, \`id_npwp\`, \`my_frp\`, \`il_vat\`, \`ge_vat\`, \`ua_vat\`, \`is_vat\`, \`bg_uic\`, \`hu_tin\`, \`si_tin\`, or \`unknown\``
@@ -12,4 +10,3 @@ builder_1.builder.objectType('StripeInvoiceCustomerTaxId', {
12
10
  })
13
11
  })
14
12
  });
15
- //# sourceMappingURL=invoice-customer-tax-id.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceLineItemPeriod', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceLineItemPeriod', {
5
3
  fields: (t) => ({
6
4
  start: t.exposeInt('start', {
7
5
  description: `The start of the period.`
@@ -11,4 +9,3 @@ builder_1.builder.objectType('StripeInvoiceLineItemPeriod', {
11
9
  })
12
10
  })
13
11
  });
14
- //# sourceMappingURL=invoice-line-item-period.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceLineItemTaxAmount', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceLineItemTaxAmount', {
5
3
  fields: (t) => ({
6
4
  amount: t.exposeInt('amount', {
7
5
  description: `The amount, in %s, of the tax.`
@@ -16,4 +14,3 @@ builder_1.builder.objectType('StripeInvoiceLineItemTaxAmount', {
16
14
  // })
17
15
  })
18
16
  });
19
- //# sourceMappingURL=invoice-line-item-tax-amount.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceLineItem', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceLineItem', {
5
3
  fields: (t) => ({
6
4
  id: t.exposeString('id', {
7
5
  description: `Unique identifier for the object.`
@@ -81,4 +79,3 @@ builder_1.builder.objectType('StripeInvoiceLineItem', {
81
79
  })
82
80
  })
83
81
  });
84
- //# sourceMappingURL=invoice-line-item.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceLineItems', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceLineItems', {
5
3
  fields: (t) => ({
6
4
  object: t.exposeString('object'),
7
5
  url: t.exposeString('url', {
@@ -16,4 +14,3 @@ builder_1.builder.objectType('StripeInvoiceLineItems', {
16
14
  })
17
15
  })
18
16
  });
19
- //# sourceMappingURL=invoice-line-items.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceRenderingOptions', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceRenderingOptions', {
5
3
  fields: (t) => ({
6
4
  amountTaxDisplay: t.exposeString('amount_tax_display', {
7
5
  description: 'How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.',
@@ -9,4 +7,3 @@ builder_1.builder.objectType('StripeInvoiceRenderingOptions', {
9
7
  })
10
8
  })
11
9
  });
12
- //# sourceMappingURL=invoice-rendering-options.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoiceStatusTransitions', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoiceStatusTransitions', {
5
3
  fields: (t) => ({
6
4
  finalizedAt: t.exposeInt('finalized_at', {
7
5
  description: 'The time that the invoice draft was finalized.',
@@ -21,4 +19,3 @@ builder_1.builder.objectType('StripeInvoiceStatusTransitions', {
21
19
  })
22
20
  })
23
21
  });
24
- //# sourceMappingURL=invoice-status-transitions.js.map
@@ -1,17 +1,6 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const builder_1 = require("../builder");
13
- const utils_1 = require("../utils");
14
- builder_1.builder.objectType('StripeInvoice', {
1
+ import { builder } from '../builder';
2
+ import { stripe } from '../utils';
3
+ builder.objectType('StripeInvoice', {
15
4
  description: '',
16
5
  fields: (t) => ({
17
6
  id: t.exposeString('id', {
@@ -44,13 +33,13 @@ builder_1.builder.objectType('StripeInvoice', {
44
33
  application: t.field({
45
34
  type: 'StripeConnectedAccount',
46
35
  nullable: true,
47
- resolve: (invoice) => __awaiter(void 0, void 0, void 0, function* () {
36
+ resolve: async (invoice) => {
48
37
  const { application } = invoice;
49
38
  if (!application)
50
39
  return null;
51
- const connectedAccount = yield utils_1.stripe.accounts.retrieve(application);
40
+ const connectedAccount = await stripe.accounts.retrieve(application);
52
41
  return connectedAccount;
53
- })
42
+ }
54
43
  }),
55
44
  applicationFeeAmount: t.exposeInt('application_fee_amount', {
56
45
  description: `The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.`,
@@ -127,14 +116,14 @@ builder_1.builder.objectType('StripeInvoice', {
127
116
  description: `ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.`,
128
117
  type: 'StripePaymentMethod',
129
118
  nullable: true,
130
- resolve: (invoice) => __awaiter(void 0, void 0, void 0, function* () {
119
+ resolve: async (invoice) => {
131
120
  const { default_payment_method } = invoice;
132
121
  if (!default_payment_method) {
133
122
  return null;
134
123
  }
135
- const paymentMethod = yield utils_1.stripe.paymentMethods.retrieve(default_payment_method);
124
+ const paymentMethod = await stripe.paymentMethods.retrieve(default_payment_method);
136
125
  return paymentMethod;
137
- })
126
+ }
138
127
  }),
139
128
  // todo: default source
140
129
  // defaultTaxRates: t.exposeString('default_tax_rates', {
@@ -238,14 +227,14 @@ builder_1.builder.objectType('StripeInvoice', {
238
227
  description: `The subscription that this invoice was prepared for, if any.`,
239
228
  type: 'StripeSubscription',
240
229
  nullable: true,
241
- resolve: (invoice) => __awaiter(void 0, void 0, void 0, function* () {
230
+ resolve: async (invoice) => {
242
231
  const { subscription } = invoice;
243
232
  if (!subscription) {
244
233
  return null;
245
234
  }
246
- const subscriptionData = yield utils_1.stripe.subscriptions.retrieve(subscription);
235
+ const subscriptionData = await stripe.subscriptions.retrieve(subscription);
247
236
  return subscriptionData;
248
- })
237
+ }
249
238
  }),
250
239
  subscriptionProrationDate: t.exposeInt('subscription_proration_date', {
251
240
  description: `Only set for upcoming invoices that preview prorations. The time used to calculate prorations.`,
@@ -280,4 +269,3 @@ builder_1.builder.objectType('StripeInvoice', {
280
269
  })
281
270
  })
282
271
  });
283
- //# sourceMappingURL=invoice.js.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const builder_1 = require("../builder");
4
- builder_1.builder.objectType('StripeInvoices', {
1
+ import { builder } from '../builder';
2
+ builder.objectType('StripeInvoices', {
5
3
  fields: (t) => ({
6
4
  object: t.exposeString('object'),
7
5
  url: t.exposeString('url', {
@@ -16,4 +14,3 @@ builder_1.builder.objectType('StripeInvoices', {
16
14
  })
17
15
  })
18
16
  });
19
- //# sourceMappingURL=invoices.js.map