@nhost/stripe-graphql-js 1.3.0-beta.5 → 1.3.0-beta7

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 (127) hide show
  1. package/README.md +37 -10
  2. package/dist/src/builder.d.ts +2 -2
  3. package/dist/src/builder.d.ts.map +1 -1
  4. package/dist/src/builder.js +1 -1
  5. package/dist/src/builder.js.map +1 -1
  6. package/dist/src/index.d.ts.map +1 -1
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/schema/address.js +8 -8
  9. package/dist/src/schema/address.js.map +1 -1
  10. package/dist/src/schema/billing-portal-session.js +9 -9
  11. package/dist/src/schema/billing-portal-session.js.map +1 -1
  12. package/dist/src/schema/charge.js +23 -11
  13. package/dist/src/schema/charge.js.map +1 -1
  14. package/dist/src/schema/charges.js +3 -3
  15. package/dist/src/schema/charges.js.map +1 -1
  16. package/dist/src/schema/connectedAccount.js +2 -2
  17. package/dist/src/schema/connectedAccount.js.map +1 -1
  18. package/dist/src/schema/connectedAccounts.js +3 -3
  19. package/dist/src/schema/connectedAccounts.js.map +1 -1
  20. package/dist/src/schema/customer-shipping.js +7 -7
  21. package/dist/src/schema/customer-shipping.js.map +1 -1
  22. package/dist/src/schema/customer-tax-location.js +4 -4
  23. package/dist/src/schema/customer-tax-location.js.map +1 -1
  24. package/dist/src/schema/customer-tax.js +4 -4
  25. package/dist/src/schema/customer-tax.js.map +1 -1
  26. package/dist/src/schema/customer.js +35 -35
  27. package/dist/src/schema/customer.js.map +1 -1
  28. package/dist/src/schema/customers.js +5 -5
  29. package/dist/src/schema/customers.js.map +1 -1
  30. package/dist/src/schema/index.d.ts.map +1 -1
  31. package/dist/src/schema/index.js.map +1 -1
  32. package/dist/src/schema/invoice-automatic-tax.js +4 -4
  33. package/dist/src/schema/invoice-automatic-tax.js.map +1 -1
  34. package/dist/src/schema/invoice-custom-field.js +4 -4
  35. package/dist/src/schema/invoice-custom-field.js.map +1 -1
  36. package/dist/src/schema/invoice-customer-shipping.js +7 -7
  37. package/dist/src/schema/invoice-customer-shipping.js.map +1 -1
  38. package/dist/src/schema/invoice-customer-tax-id.js +4 -4
  39. package/dist/src/schema/invoice-customer-tax-id.js.map +1 -1
  40. package/dist/src/schema/invoice-line-item-period.js +4 -4
  41. package/dist/src/schema/invoice-line-item-period.js.map +1 -1
  42. package/dist/src/schema/invoice-line-item-tax-amount.js +4 -4
  43. package/dist/src/schema/invoice-line-item-tax-amount.js.map +1 -1
  44. package/dist/src/schema/invoice-line-item.js +21 -21
  45. package/dist/src/schema/invoice-line-item.js.map +1 -1
  46. package/dist/src/schema/invoice-line-items.js +5 -5
  47. package/dist/src/schema/invoice-line-items.js.map +1 -1
  48. package/dist/src/schema/invoice-rendering-options.js +3 -3
  49. package/dist/src/schema/invoice-rendering-options.js.map +1 -1
  50. package/dist/src/schema/invoice-status-transitions.js +6 -6
  51. package/dist/src/schema/invoice-status-transitions.js.map +1 -1
  52. package/dist/src/schema/invoice.js +59 -59
  53. package/dist/src/schema/invoice.js.map +1 -1
  54. package/dist/src/schema/invoices.js +5 -5
  55. package/dist/src/schema/invoices.js.map +1 -1
  56. package/dist/src/schema/payment-intent.js +14 -14
  57. package/dist/src/schema/payment-intent.js.map +1 -1
  58. package/dist/src/schema/payment-intents.js +3 -3
  59. package/dist/src/schema/payment-intents.js.map +1 -1
  60. package/dist/src/schema/payment-method-billing-details.js +6 -6
  61. package/dist/src/schema/payment-method-billing-details.js.map +1 -1
  62. package/dist/src/schema/payment-method-card-checks.js +5 -5
  63. package/dist/src/schema/payment-method-card-checks.js.map +1 -1
  64. package/dist/src/schema/payment-method-card-networks.js +4 -4
  65. package/dist/src/schema/payment-method-card-networks.js.map +1 -1
  66. package/dist/src/schema/payment-method-card-three-d-secure-usage.js +3 -3
  67. package/dist/src/schema/payment-method-card-three-d-secure-usage.js.map +1 -1
  68. package/dist/src/schema/payment-method-card-wallet-masterpass.js +6 -6
  69. package/dist/src/schema/payment-method-card-wallet-masterpass.js.map +1 -1
  70. package/dist/src/schema/payment-method-card-wallet-visa-checkout.js +6 -6
  71. package/dist/src/schema/payment-method-card-wallet-visa-checkout.js.map +1 -1
  72. package/dist/src/schema/payment-method-card-wallet.d.ts.map +1 -1
  73. package/dist/src/schema/payment-method-card-wallet.js +8 -8
  74. package/dist/src/schema/payment-method-card-wallet.js.map +1 -1
  75. package/dist/src/schema/payment-method-card.js +16 -16
  76. package/dist/src/schema/payment-method-card.js.map +1 -1
  77. package/dist/src/schema/payment-method.js +10 -10
  78. package/dist/src/schema/payment-method.js.map +1 -1
  79. package/dist/src/schema/payment-methods.d.ts.map +1 -1
  80. package/dist/src/schema/payment-methods.js +7 -7
  81. package/dist/src/schema/payment-methods.js.map +1 -1
  82. package/dist/src/schema/plan-transform-usage.js +4 -4
  83. package/dist/src/schema/plan-transform-usage.js.map +1 -1
  84. package/dist/src/schema/plan.js +21 -21
  85. package/dist/src/schema/plan.js.map +1 -1
  86. package/dist/src/schema/price.js +17 -17
  87. package/dist/src/schema/price.js.map +1 -1
  88. package/dist/src/schema/product.js +21 -21
  89. package/dist/src/schema/product.js.map +1 -1
  90. package/dist/src/schema/stripe.js +31 -30
  91. package/dist/src/schema/stripe.js.map +1 -1
  92. package/dist/src/schema/subscription-automatic-tax.js +3 -3
  93. package/dist/src/schema/subscription-automatic-tax.js.map +1 -1
  94. package/dist/src/schema/subscription-billing-thresholds.js +4 -4
  95. package/dist/src/schema/subscription-billing-thresholds.js.map +1 -1
  96. package/dist/src/schema/subscription-item-billing-thresholds.js +3 -3
  97. package/dist/src/schema/subscription-item-billing-thresholds.js.map +1 -1
  98. package/dist/src/schema/subscription-item.js +11 -11
  99. package/dist/src/schema/subscription-item.js.map +1 -1
  100. package/dist/src/schema/subscription-items.js +5 -5
  101. package/dist/src/schema/subscription-items.js.map +1 -1
  102. package/dist/src/schema/subscription-pause-collection.js +4 -4
  103. package/dist/src/schema/subscription-pause-collection.js.map +1 -1
  104. package/dist/src/schema/subscription.js +33 -33
  105. package/dist/src/schema/subscription.js.map +1 -1
  106. package/dist/src/schema/subscriptions.js +5 -5
  107. package/dist/src/schema/subscriptions.js.map +1 -1
  108. package/dist/src/schema/tax-rate.js +16 -16
  109. package/dist/src/schema/tax-rate.js.map +1 -1
  110. package/dist/src/schema/test-clock.js +10 -10
  111. package/dist/src/schema/test-clock.js.map +1 -1
  112. package/dist/src/server.d.ts +2 -2
  113. package/dist/src/server.d.ts.map +1 -1
  114. package/dist/src/server.js +3 -3
  115. package/dist/src/server.js.map +1 -1
  116. package/dist/src/types.d.ts +1 -1
  117. package/dist/src/types.d.ts.map +1 -1
  118. package/dist/src/utils.d.ts +1 -1
  119. package/dist/src/utils.d.ts.map +1 -1
  120. package/dist/src/utils.js +3 -2
  121. package/dist/src/utils.js.map +1 -1
  122. package/dist/stripe-graphql-js.cjs +2 -0
  123. package/dist/stripe-graphql-js.cjs.map +1 -0
  124. package/dist/stripe-graphql-js.js +76 -0
  125. package/dist/stripe-graphql-js.js.map +1 -0
  126. package/dist/tsconfig.tsbuildinfo +1 -1
  127. package/package.json +32 -23
@@ -4,59 +4,59 @@ builder.objectType('StripeSubscription', {
4
4
  description: '',
5
5
  fields: (t) => ({
6
6
  id: t.exposeString('id', {
7
- description: `Unique identifier for the object.`
7
+ description: `Unique identifier for the object.`,
8
8
  }),
9
9
  object: t.exposeString('object', {
10
- description: `String representing the object's type. Objects of the same type share the same value.`
10
+ description: `String representing the object's type. Objects of the same type share the same value.`,
11
11
  }),
12
12
  // todo: application
13
13
  applicationFeePercent: t.exposeFloat('application_fee_percent', {
14
14
  description: `A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account.`,
15
- nullable: true
15
+ nullable: true,
16
16
  }),
17
17
  automaticTax: t.expose('automatic_tax', {
18
- type: 'StripeSubscriptionAutomaticTax'
18
+ type: 'StripeSubscriptionAutomaticTax',
19
19
  }),
20
20
  billingCycleAnchor: t.exposeInt('billing_cycle_anchor', {
21
- description: `Determines the date of the first full invoice, and, for plans with \`month\` or \`year\` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format.`
21
+ description: `Determines the date of the first full invoice, and, for plans with \`month\` or \`year\` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format.`,
22
22
  }),
23
23
  billingThresholds: t.expose('billing_thresholds', {
24
24
  description: `Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period`,
25
25
  type: 'StripeSubscriptionBillingThresholds',
26
- nullable: true
26
+ nullable: true,
27
27
  }),
28
28
  cancelAt: t.exposeInt('cancel_at', {
29
29
  description: `A date in the future at which the subscription will automatically get canceled`,
30
- nullable: true
30
+ nullable: true,
31
31
  }),
32
32
  cancelAtPeriodEnd: t.exposeBoolean('cancel_at_period_end', {
33
- description: `If the subscription has been canceled with the \`at_period_end\` flag set to \`true\`, \`cancel_at_period_end\` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.`
33
+ description: `If the subscription has been canceled with the \`at_period_end\` flag set to \`true\`, \`cancel_at_period_end\` on the subscription will be true. You can use this attribute to determine whether a subscription that has a status of active is scheduled to be canceled at the end of the current period.`,
34
34
  }),
35
35
  canceledAt: t.exposeInt('canceled_at', {
36
36
  description: `If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with \`cancel_at_period_end\`, \`canceled_at\` will reflect the time of the most recent update request, not the end of the subscription period when the subscription is automatically moved to a canceled state.`,
37
- nullable: true
37
+ nullable: true,
38
38
  }),
39
39
  collectionMethods: t.exposeString('collection_method', {
40
- description: `Either \`charge_automatically\`, or \`send_invoice\`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as \`active\`.`
40
+ description: `Either \`charge_automatically\`, or \`send_invoice\`. When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as \`active\`.`,
41
41
  }),
42
42
  created: t.exposeInt('created', {
43
- description: `Time at which the object was created. Measured in seconds since the Unix epoch.`
43
+ description: `Time at which the object was created. Measured in seconds since the Unix epoch.`,
44
44
  }),
45
45
  currency: t.exposeString('currency', {
46
- description: `Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).`
46
+ description: `Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).`,
47
47
  }),
48
48
  currentPeriodEnd: t.exposeInt('current_period_end', {
49
- description: `End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.`
49
+ description: `End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created.`,
50
50
  }),
51
51
  currentPeriodStart: t.exposeInt('current_period_start', {
52
- description: `Start of the current period that the subscription has been invoiced for.`
52
+ description: `Start of the current period that the subscription has been invoiced for.`,
53
53
  }),
54
54
  customer: t.exposeString('customer', {
55
- description: `ID of the customer who owns the subscription.`
55
+ description: `ID of the customer who owns the subscription.`,
56
56
  }),
57
57
  daysUntilDue: t.exposeInt('days_until_due', {
58
58
  description: `Number of days a customer has to pay invoices generated by this subscription. This value will be \`null\` for subscriptions where \`collection_method=charge_automatically\`.`,
59
- nullable: true
59
+ nullable: true,
60
60
  }),
61
61
  defaultPaymentMethod: t.field({
62
62
  description: `ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over \`default_source\`. If neither are set, invoices will use the customer's [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) or [default_source](https://stripe.com/docs/api/customers/object#customer_object-default_source).`,
@@ -72,26 +72,26 @@ builder.objectType('StripeSubscription', {
72
72
  return null;
73
73
  }
74
74
  return paymentMethod;
75
- }
75
+ },
76
76
  }),
77
77
  // todo: default source
78
78
  defaultTaxRates: t.expose('default_tax_rates', {
79
79
  description: `The tax rates that will apply to any subscription item that does not have \`tax_rates\` set. Invoices created will have their \`default_tax_rates\` populated from the subscription.`,
80
80
  type: ['StripeTaxRate'],
81
- nullable: true
81
+ nullable: true,
82
82
  }),
83
83
  description: t.exposeString('description', {
84
84
  description: `The subscription's description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces.`,
85
- nullable: true
85
+ nullable: true,
86
86
  }),
87
87
  // TODO: discount
88
88
  endedAt: t.exposeInt('ended_at', {
89
89
  description: `If the subscription has ended, the date the subscription ended.`,
90
- nullable: true
90
+ nullable: true,
91
91
  }),
92
92
  items: t.expose('items', {
93
93
  description: `List of subscription items, each with an attached price.`,
94
- type: 'StripeSubscriptionItems'
94
+ type: 'StripeSubscriptionItems',
95
95
  }),
96
96
  latestInvoice: t.field({
97
97
  description: `The most recent invoice this subscription has generated.`,
@@ -107,23 +107,23 @@ builder.objectType('StripeSubscription', {
107
107
  return null;
108
108
  }
109
109
  return invoice;
110
- }
110
+ },
111
111
  }),
112
112
  livemode: t.exposeBoolean('livemode', {
113
- description: `Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.`
113
+ description: `Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.`,
114
114
  }),
115
115
  metadata: t.expose('metadata', {
116
116
  description: `Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.`,
117
- type: 'JSON'
117
+ type: 'JSON',
118
118
  }),
119
119
  nextPendingInvoiceItemInvoice: t.exposeInt('next_pending_invoice_item_invoice', {
120
120
  description: `Specifies the approximate timestamp on which any pending invoice items will be billed according to the schedule provided at \`pending_invoice_item_interval\`.`,
121
- nullable: true
121
+ nullable: true,
122
122
  }),
123
123
  pauseCollection: t.expose('pause_collection', {
124
124
  description: `If specified, payment collection for this subscription will be paused.`,
125
125
  type: 'StripeSubscriptionPauseCollection',
126
- nullable: true
126
+ nullable: true,
127
127
  }),
128
128
  // todo: payment settings
129
129
  // todo: pending_invoice_item_interval
@@ -131,10 +131,10 @@ builder.objectType('StripeSubscription', {
131
131
  // todo: pending_update
132
132
  // todo: schedule
133
133
  startDate: t.exposeInt('start_date', {
134
- description: `Date when the subscription was first created. The date might differ from the \`created\` date due to backdating.`
134
+ description: `Date when the subscription was first created. The date might differ from the \`created\` date due to backdating.`,
135
135
  }),
136
136
  status: t.exposeString('status', {
137
- description: `Possible values are \`incomplete\`, \`incomplete_expired\`, \`trialing\`, \`active\`, \`past_due\`, \`canceled\`, or \`unpaid\`.\n\nFor \`collection_method=charge_automatically\` a subscription moves into \`incomplete\` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an \`active\` state. If the first invoice is not paid within 23 hours, the subscription transitions to \`incomplete_expired\`. This is a terminal state, the open invoice will be voided and no further invoices will be generated.\n\nA subscription that is currently in a trial period is \`trialing\` and moves to \`active\` when the trial period is over.\n\nIf subscription \`collection_method=charge_automatically\` it becomes \`past_due\` when payment to renew it fails and \`canceled\` or \`unpaid\` (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.\n\nIf subscription \`collection_method=send_invoice\` it becomes \`past_due\` when its invoice is not paid by the due date, and \`canceled\` or \`unpaid\` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of \`unpaid\`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.`
137
+ description: `Possible values are \`incomplete\`, \`incomplete_expired\`, \`trialing\`, \`active\`, \`past_due\`, \`canceled\`, or \`unpaid\`.\n\nFor \`collection_method=charge_automatically\` a subscription moves into \`incomplete\` if the initial payment attempt fails. A subscription in this state can only have metadata and default_source updated. Once the first invoice is paid, the subscription moves into an \`active\` state. If the first invoice is not paid within 23 hours, the subscription transitions to \`incomplete_expired\`. This is a terminal state, the open invoice will be voided and no further invoices will be generated.\n\nA subscription that is currently in a trial period is \`trialing\` and moves to \`active\` when the trial period is over.\n\nIf subscription \`collection_method=charge_automatically\` it becomes \`past_due\` when payment to renew it fails and \`canceled\` or \`unpaid\` (depending on your subscriptions settings) when Stripe has exhausted all payment retry attempts.\n\nIf subscription \`collection_method=send_invoice\` it becomes \`past_due\` when its invoice is not paid by the due date, and \`canceled\` or \`unpaid\` if it is still not paid by an additional deadline after that. Note that when a subscription has a status of \`unpaid\`, no subsequent invoices will be attempted (invoices will be created, but then immediately automatically closed). After receiving updated payment information from a customer, you may choose to reopen and pay their closed invoices.`,
138
138
  }),
139
139
  testClock: t.field({
140
140
  description: `ID of the test clock this subscription belongs to.`,
@@ -150,17 +150,17 @@ builder.objectType('StripeSubscription', {
150
150
  return null;
151
151
  }
152
152
  return testClock;
153
- }
153
+ },
154
154
  }),
155
155
  // todo: transfer data
156
156
  trialEnd: t.exposeInt('trial_end', {
157
157
  description: `If the subscription has a trial, the end of that trial.`,
158
- nullable: true
158
+ nullable: true,
159
159
  }),
160
160
  trialStart: t.exposeInt('trial_start', {
161
161
  description: `If the subscription has a trial, the beginning of that trial.`,
162
- nullable: true
163
- })
164
- })
162
+ nullable: true,
163
+ }),
164
+ }),
165
165
  });
166
166
  //# sourceMappingURL=subscription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/schema/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,CAAC,UAAU,CAAC,oBAAoB,EAAE;IACvC,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE;YACvB,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC/B,WAAW,EAAE,uFAAuF;SACrG,CAAC;QACF,oBAAoB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AAiB;QACjB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE;YACnC,WAAW,EAAE,kHAAkH;SAChI,CAAC;QACF,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC/B,WAAW,EAAE,69CAA69C;SAC3+C,CAAC;QACF,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC;YACjB,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;gBAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,CAAC;gBAEpC,IAAI,CAAC,UAAU,EAAE,CAAC;oBAChB,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAC5D,UAAoB,CACrB,CAAC;gBAEF,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;QACF,sBAAsB;QACtB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;YACjC,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE;YACrC,WAAW,EAAE,+DAA+D;YAC5E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -3,15 +3,15 @@ builder.objectType('StripeSubscriptions', {
3
3
  fields: (t) => ({
4
4
  object: t.exposeString('object'),
5
5
  url: t.exposeString('url', {
6
- description: `The URL where this list can be accessed.`
6
+ description: `The URL where this list can be accessed.`,
7
7
  }),
8
8
  hasMore: t.exposeBoolean('has_more', {
9
- description: `True if this list has another page of items after this one that can be fetched.`
9
+ description: `True if this list has another page of items after this one that can be fetched.`,
10
10
  }),
11
11
  data: t.expose('data', {
12
12
  type: ['StripeSubscription'],
13
- nullable: false
14
- })
15
- })
13
+ nullable: false,
14
+ }),
15
+ }),
16
16
  });
17
17
  //# sourceMappingURL=subscriptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/schema/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE;IACxC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC;QAChC,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE;YACzB,WAAW,EAAE,0CAA0C;SACxD,CAAC;QACF,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE;YACnC,WAAW,EAAE,iFAAiF;SAC/F,CAAC;QACF,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE;YACrB,IAAI,EAAE,CAAC,oBAAoB,CAAC;YAC5B,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAC;CACH,CAAC,CAAA"}
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/schema/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE;IACxC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC;QAChC,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE;YACzB,WAAW,EAAE,0CAA0C;SACxD,CAAC;QACF,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE;YACnC,WAAW,EAAE,iFAAiF;SAC/F,CAAC;QACF,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE;YACrB,IAAI,EAAE,CAAC,oBAAoB,CAAC;YAC5B,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -3,54 +3,54 @@ builder.objectType('StripeTaxRate', {
3
3
  description: 'Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.',
4
4
  fields: (t) => ({
5
5
  id: t.exposeString('id', {
6
- description: 'Unique identifier for the object.'
6
+ description: 'Unique identifier for the object.',
7
7
  }),
8
8
  object: t.exposeString('object', {
9
- description: `String representing the object's type. Objects of the same type share the same value.`
9
+ description: `String representing the object's type. Objects of the same type share the same value.`,
10
10
  }),
11
11
  active: t.exposeBoolean('active', {
12
- description: 'Defaults to `true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.'
12
+ description: 'Defaults to `true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.',
13
13
  }),
14
14
  country: t.exposeString('country', {
15
15
  description: 'Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).',
16
- nullable: true
16
+ nullable: true,
17
17
  }),
18
18
  created: t.exposeInt('created', {
19
- description: 'Time at which the object was created. Measured in seconds since the Unix epoch.'
19
+ description: 'Time at which the object was created. Measured in seconds since the Unix epoch.',
20
20
  }),
21
21
  description: t.exposeString('description', {
22
22
  description: 'An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.',
23
- nullable: true
23
+ nullable: true,
24
24
  }),
25
25
  displayName: t.exposeString('display_name', {
26
- description: 'The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.'
26
+ description: 'The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.',
27
27
  }),
28
28
  inclusive: t.exposeBoolean('inclusive', {
29
- description: 'This specifies if the tax rate is inclusive or exclusive.'
29
+ description: 'This specifies if the tax rate is inclusive or exclusive.',
30
30
  }),
31
31
  jurisdiction: t.exposeString('jurisdiction', {
32
32
  description: 'The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.',
33
- nullable: true
33
+ nullable: true,
34
34
  }),
35
35
  livemode: t.exposeBoolean('livemode', {
36
- description: 'Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.'
36
+ description: 'Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.',
37
37
  }),
38
38
  metadata: t.expose('metadata', {
39
39
  description: 'Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.',
40
40
  type: 'JSON',
41
- nullable: true
41
+ nullable: true,
42
42
  }),
43
43
  percentage: t.exposeFloat('percentage', {
44
- description: 'This represents the tax rate percent out of 100.'
44
+ description: 'This represents the tax rate percent out of 100.',
45
45
  }),
46
46
  state: t.exposeString('state', {
47
47
  description: '[ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States.',
48
- nullable: true
48
+ nullable: true,
49
49
  }),
50
50
  taxType: t.exposeString('tax_type', {
51
51
  description: 'The high-level tax type, such as `vat` or `sales_tax`.',
52
- nullable: true
53
- })
54
- })
52
+ nullable: true,
53
+ }),
54
+ }),
55
55
  });
56
56
  //# sourceMappingURL=tax-rate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tax-rate.js","sourceRoot":"","sources":["../../../src/schema/tax-rate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE;IAClC,WAAW,EACT,qRAAqR;IACvR,MAA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;QACF,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE;YACtC,WAAW,EAAE,2DAA2D;SACzE,CAAC;QACF,YAAY,EAAE,CAAC,CAAC,YAAY,CAAC,cAAc,EAAE;YAC3C,WAAW,EACT,yIAAyI;YAC3I,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE;YACpC,WAAW,EACT,gHAAgH;SACnH,CAAC;QACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE;YAC7B,WAAW,EACT,iMAAiM;YACnM,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,CAAC,CAAC,WAAW,CAAC,YAAY,EAAE;YACtC,WAAW,EAAE,kDAAkD;SAChE,CAAC;QACF,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE;YAC7B,WAAW,EACT,oJAAoJ;YACtJ,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE;YAClC,WAAW,EAAE,wDAAwD;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -3,30 +3,30 @@ builder.objectType('StripeTestClock', {
3
3
  description: '',
4
4
  fields: (t) => ({
5
5
  id: t.exposeString('id', {
6
- description: `Unique identifier for the object.`
6
+ description: `Unique identifier for the object.`,
7
7
  }),
8
8
  object: t.exposeString('object', {
9
- description: `String representing the object's type. Objects of the same type share the same value.`
9
+ description: `String representing the object's type. Objects of the same type share the same value.`,
10
10
  }),
11
11
  created: t.exposeInt('created', {
12
- description: `Time at which the object was created. Measured in seconds since the Unix epoch.`
12
+ description: `Time at which the object was created. Measured in seconds since the Unix epoch.`,
13
13
  }),
14
14
  deletesAfter: t.exposeInt('deletes_after', {
15
- description: `Time at which this clock is scheduled to auto delete.`
15
+ description: `Time at which this clock is scheduled to auto delete.`,
16
16
  }),
17
17
  frozenTime: t.exposeInt('frozen_time', {
18
- description: `Time at which all objects belonging to this clock are frozen.`
18
+ description: `Time at which all objects belonging to this clock are frozen.`,
19
19
  }),
20
20
  livemode: t.exposeBoolean('livemode', {
21
- description: `Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.`
21
+ description: `Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.`,
22
22
  }),
23
23
  name: t.exposeString('name', {
24
24
  description: `The custom name supplied at creation.`,
25
- nullable: true
25
+ nullable: true,
26
26
  }),
27
27
  status: t.exposeString('status', {
28
- description: `The status of the Test Clock.`
29
- })
30
- })
28
+ description: `The status of the Test Clock.`,
29
+ }),
30
+ }),
31
31
  });
32
32
  //# sourceMappingURL=test-clock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-clock.js","sourceRoot":"","sources":["../../../src/schema/test-clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,OAAO,CAAC,UAAU,CAAC,iBAAiB,EAAE;IACpC,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE;YACvB,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC/B,WAAW,EAAE,uFAAuF;SACrG,CAAC;QACF,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE;YAC9B,WAAW,EAAE,iFAAiF;SAC/F,CAAC;QACF,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE;YACzC,WAAW,EAAE,uDAAuD;SACrE,CAAC;QACF,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,EAAE;YACrC,WAAW,EAAE,+DAA+D;SAC7E,CAAC;Q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,IAAI;SACf,CAAC;QACF,MAAM,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE;YAC/B,WAAW,EAAE,+BAA+B;SAC7C,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { schema } from './schema';
2
- import { Context, CreateServerProps } from './types';
3
- declare const createStripeGraphQLServer: ({ cors, isAllowed, graphiql, maskedErrors }?: CreateServerProps) => import("graphql-yoga").YogaServerInstance<{}, Context>;
2
+ import type { Context, CreateServerProps } from './types';
3
+ declare const createStripeGraphQLServer: ({ cors, isAllowed, graphiql, maskedErrors, }?: CreateServerProps) => import("graphql-yoga").YogaServerInstance<{}, Context>;
4
4
  export { createStripeGraphQLServer, schema };
5
5
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGpD,QAAA,MAAM,yBAAyB,GAAI,8CAKhC,iBAAsB,2DA+CxB,CAAA;AAED,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG1D,QAAA,MAAM,yBAAyB,GAAI,+CAKhC,iBAAsB,2DAiDxB,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { createYoga } from 'graphql-yoga';
2
2
  import { schema } from './schema';
3
3
  import { getUserClaims } from './utils';
4
- const createStripeGraphQLServer = ({ cors, isAllowed, graphiql, maskedErrors = true } = {}) => {
4
+ const createStripeGraphQLServer = ({ cors, isAllowed, graphiql, maskedErrors = true, } = {}) => {
5
5
  const context = (context) => {
6
6
  const { request } = context;
7
7
  // user id
@@ -26,7 +26,7 @@ const createStripeGraphQLServer = ({ cors, isAllowed, graphiql, maskedErrors = t
26
26
  ...context,
27
27
  isAllowed: isAllowedFunction,
28
28
  userClaims,
29
- isAdmin
29
+ isAdmin,
30
30
  };
31
31
  };
32
32
  const yoga = createYoga({
@@ -35,7 +35,7 @@ const createStripeGraphQLServer = ({ cors, isAllowed, graphiql, maskedErrors = t
35
35
  context,
36
36
  schema,
37
37
  graphqlEndpoint: '*',
38
- maskedErrors
38
+ maskedErrors,
39
39
  });
40
40
  return yoga;
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAA;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,yBAAyB,GAAG,CAAC,EACjC,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,GAAG,IAAI,KACE,EAAE,EAAE,EAAE;IAC3B,MAAM,OAAO,GAAG,CAAC,OAA2B,EAAW,EAAE;QACvD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;QAE3B,UAAU;QACV,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;QAEzC,wDAAwD;QACxD,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;QAC1E,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;QAErD,sCAAsC;QACtC,MAAM,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA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AAU,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;QAE1C,wDAAwD;QACxD,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAEtD,sCAAsC;QACtC,MAAM,4BAA4B,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CACtD,wBAAwB,CACzB,CAAC;QACF,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAElD,YAAY;QACZ,MAAM,OAAO,GACX,qBAAqB,KAAK,WAAW;YACrC,CAAC,IAAI,KAAK,OAAO,IAAI,4BAA4B,KAAK,kBAAkB,CAAC,CAAC;QAE5E,qEAAqE;QACrE,MAAM,iBAAiB,GACrB,SAAS;YACT,CAAC,CAAC,iBAAyB,EAAE,OAAgB,EAAE,EAAE;gBAC/C,OAAO,OAAO,CAAC,OAAO,CAAC;YACzB,CAAC,CAAC,CAAC;QAEL,SAAS;QACT,OAAO;YACL,GAAG,OAAO;YACV,SAAS,EAAE,iBAAiB;YAC5B,UAAU;YACV,OAAO;SACR,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,UAAU,CAAC;QACtB,IAAI;QACJ,QAAQ;QACR,OAAO;QACP,MAAM;QACN,eAAe,EAAE,GAAG;QACpB,YAAY;KACb,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import type Stripe from 'stripe';
2
1
  import type { CORSOptions, YogaInitialContext } from 'graphql-yoga';
2
+ import type Stripe from 'stripe';
3
3
  export type StripeGraphQLContext = {
4
4
  isAllowed: (stripeCustomerId: string, context: Context) => boolean | Promise<boolean>;
5
5
  userClaims?: UserHasuraClaims;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEnE,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACrF,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,kBAAkB,GAAG,oBAAoB,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtF;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAID,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,GAAG;IACvD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,GAAG;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAA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AAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAIF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,GAAG;IACvD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,GAAG;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,GAAG;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEnD,cAAc,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,GAAG;IACvD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,EAAE,CAAC;CACpC,GAAG;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import Stripe from 'stripe';
2
- import { UserHasuraClaims } from './types';
2
+ import type { UserHasuraClaims } from './types';
3
3
  export declare const stripe: Stripe;
4
4
  export declare const getUserClaims: (req: Request) => UserHasuraClaims | undefined;
5
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM1C,eAAO,MAAM,MAAM,QAEjB,CAAA;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,OAAO,KAAG,gBAAgB,GAAG,SAqB/D,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAMhD,eAAO,MAAM,MAAM,QAEjB,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,KAAK,OAAO,KAAG,gBAAgB,GAAG,SAsB/D,CAAC"}
package/dist/src/utils.js CHANGED
@@ -4,7 +4,7 @@ if (!process.env['STRIPE_SECRET_KEY']) {
4
4
  throw new Error('STRIPE_SECRET_KEY env var is not set');
5
5
  }
6
6
  export const stripe = new Stripe(process.env['STRIPE_SECRET_KEY'], {
7
- apiVersion: '2022-11-15'
7
+ apiVersion: '2022-11-15',
8
8
  });
9
9
  export const getUserClaims = (req) => {
10
10
  try {
@@ -17,10 +17,11 @@ export const getUserClaims = (req) => {
17
17
  throw new Error('NHOST_JWT_SECRET env var is not set');
18
18
  }
19
19
  const jwtSecret = JSON.parse(process.env['NHOST_JWT_SECRET']);
20
+ // biome-ignore lint/suspicious/noExplicitAny: JWT decode returns unknown structure
20
21
  const decodedToken = jwt.verify(accessToken, jwtSecret.key);
21
22
  return decodedToken['https://hasura.io/jwt/claims'];
22
23
  }
23
- catch (error) {
24
+ catch (_error) {
24
25
  return undefined;
25
26
  }
26
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cA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AQ,CAAC;AAI5B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;IACtC,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE;IACjE,UAAU,EAAE,YAAY;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAY,EAAgC,EAAE;IAC1E,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAE7D,MAAM,WAAW,GAAG,mBAAmB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvD,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAE9D,mFAAmF;QACnF,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,CAAQ,CAAC;QACnE,OAAO,YAAY,CAAC,8BAA8B,CAAqB,CAAC;IAC1E,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@pothos/core"),r=require("graphql-scalars"),s=require("graphql-yoga"),t=require("jsonwebtoken"),o=require("stripe"),a=new e({});if(a.queryType(),a.mutationType(),a.addScalarType("JSON",r.GraphQLJSONObject,{}),!process.env.STRIPE_SECRET_KEY)throw new Error("STRIPE_SECRET_KEY env var is not set");new o(process.env.STRIPE_SECRET_KEY,{apiVersion:"2022-11-15"});const n=a.toSchema();exports.builder=a,exports.createStripeGraphQLServer=({cors:e,isAllowed:r,graphiql:o,maskedErrors:a=!0}={})=>s.createYoga({cors:e,graphiql:o,context:e=>{const{request:s}=e,o=(e=>{try{const r=e.headers.get("authorization"),s=r?.split(" ")[1];if(!s)return;if(!process.env.NHOST_JWT_SECRET)throw new Error("NHOST_JWT_SECRET env var is not set");const o=JSON.parse(process.env.NHOST_JWT_SECRET);return t.verify(s,o.key)["https://hasura.io/jwt/claims"]}catch(r){return}})(s),a=s.headers.get("x-hasura-admin-secret"),n=process.env.NHOST_ADMIN_SECRET,i=s.headers.get("x-nhost-webhook-secret"),c=process.env.NHOST_WEBHOOK_SECRET,p=s.headers.get("x-hasura-role"),E=a===n||"admin"===p&&i===c,h=r||((e,r)=>r.isAdmin);return{...e,isAllowed:h,userClaims:o,isAdmin:E}},schema:n,graphqlEndpoint:"*",maskedErrors:a}),exports.schema=n;
2
+ //# sourceMappingURL=stripe-graphql-js.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripe-graphql-js.cjs","sources":["../src/builder.ts","../src/utils.ts","../src/schema/index.ts","../src/server.ts"],"sourcesContent":["import SchemaBuilder from '@pothos/core';\nimport { GraphQLJSONObject } from 'graphql-scalars';\nimport type Stripe from 'stripe';\n\nimport type {\n Context,\n StripeCharge,\n StripeInvoice,\n StripePaymentIntent,\n StripePaymentMethod,\n StripeSubscription,\n} from './types';\n\n// TODO: Make sure we either use Type or Types (e.g. StripePaymentMethodTypes or StripePaymentMethodType ) everywhere\n\nconst builder = new SchemaBuilder<{\n Scalars: {\n JSON: {\n Output: unknown;\n Input: JSON;\n };\n };\n Objects: {\n // biome-ignore lint/complexity/noBannedTypes: Pothos requires {} for empty object types in schema builder\n Stripe: {};\n // biome-ignore lint/complexity/noBannedTypes: Pothos requires {} for empty object types in schema builder\n StripeMutations: {};\n\n // CUSTOMER\n StripeCustomers: Stripe.ApiList<Stripe.Customer>;\n StripeCustomer: Stripe.Customer;\n StripeCustomerShipping: Stripe.Customer.Shipping;\n StripeCustomerTax: Stripe.Customer.Tax;\n StripeCustomerTaxAutomaticTax: Stripe.Customer.Tax.AutomaticTax;\n StripeCustomerTaxLocation: Stripe.Customer.Tax.Location;\n\n // ADDRESS\n StripeAddress: Stripe.Address;\n\n // PAYMENT METHOD\n StripePaymentMethods: Stripe.ApiList<StripePaymentMethod>;\n StripePaymentMethod: StripePaymentMethod;\n StripeCustomerListPaymentMethodsParamsType: Stripe.CustomerListPaymentMethodsParams.Type;\n StripePaymentMethodBillingDetails: Stripe.PaymentMethod.BillingDetails;\n StripePaymentMethodTypes: Stripe.PaymentMethod.Type;\n\n // PAYMENT METHOD CARD\n StripePaymentMethodCard: Stripe.PaymentMethod.Card;\n StripePaymentMethodCardChecks: Stripe.PaymentMethod.Card.Checks;\n StripePaymentMethodCardNetworks: Stripe.PaymentMethod.Card.Networks;\n StripePaymentMethodCardThreeDSecureUsage: Stripe.PaymentMethod.Card.ThreeDSecureUsage;\n StripePaymentMethodCardWallet: Stripe.PaymentMethod.Card.Wallet;\n StripePaymentMethodCardWalletMasterpass: Stripe.PaymentMethod.Card.Wallet.Masterpass;\n StripePaymentMethodCardWalletType: Stripe.PaymentMethod.Card.Wallet.Type;\n StripePaymentMethodCardWalletVisaMasterpass: Stripe.PaymentMethod.Card.Wallet.Masterpass;\n StripePaymentMethodCardWalletVisaCheckout: Stripe.PaymentMethod.Card.Wallet.VisaCheckout;\n\n // SUBSCRIPTION\n StripeSubscriptions: Stripe.ApiList<StripeSubscription>;\n StripeSubscription: StripeSubscription;\n StripeSubscriptionStatus: Stripe.Subscription.Status;\n StripeSubscriptionItems: Stripe.ApiList<Stripe.SubscriptionItem>;\n StripeSubscriptionItem: Stripe.SubscriptionItem;\n StripeSubscriptionItemBillingThresholds: Stripe.SubscriptionItem.BillingThresholds;\n StripeSubscriptionAutomaticTax: Stripe.Subscription.AutomaticTax;\n StripeSubscriptionBillingThresholds: Stripe.Subscription.BillingThresholds;\n StripeSubscriptionPauseCollection: Stripe.Subscription.PauseCollection;\n\n // INVOICE\n StripeInvoice: StripeInvoice;\n StripeInvoices: Stripe.ApiList<StripeInvoice>;\n // StripeInvoceAccountTaxIds: Array<string | Stripe.TaxId | Stripe.DeletedTaxId> | null\n StripeInvoiceAutomaticTax: Stripe.Invoice.AutomaticTax;\n StripeInvoiceCustomField: Stripe.Invoice.CustomField;\n StripeInvoiceCustomerShipping: Stripe.Invoice.CustomerShipping;\n StripeInvoiceCustomerTaxId: Stripe.Invoice.CustomerTaxId;\n StripeInvoiceRenderingOptions: Stripe.Invoice.RenderingOptions;\n StripeInvoiceStatusTransitions: Stripe.Invoice.StatusTransitions;\n\n // INVOICE LINE ITEM\n StripeInvoiceLineItems: Stripe.ApiList<Stripe.InvoiceLineItem>;\n StripeInvoiceLineItem: Stripe.InvoiceLineItem;\n StripeInvoiceLineItemPeriod: Stripe.InvoiceLineItem.Period;\n StripeInvoiceLineItemTaxAmount: Stripe.InvoiceLineItem.TaxAmount;\n\n // PRICE\n StripePrice: Stripe.Price;\n\n // PLAN\n StripePlan: Stripe.Plan;\n StripePlanTransformUsage: Stripe.Plan.TransformUsage;\n\n // PRODUCT\n StripeProduct: Stripe.Product;\n\n // TAX RATES\n StripeTaxRate: Stripe.TaxRate;\n\n // TEST CLOCK\n StripeTestClock: Stripe.TestHelpers.TestClock;\n\n // BILLING PORTAL\n StripeBillingPortalSession: Stripe.BillingPortal.Session;\n\n // PAYMENT INTENT\n StripePaymentIntent: StripePaymentIntent;\n StripePaymentIntents: Stripe.ApiList<StripePaymentIntent>;\n\n // CHARGES\n StripeCharge: StripeCharge;\n StripeCharges: Stripe.ApiList<StripeCharge>;\n\n // CONNECTED ACCOUNTS\n StripeConnectedAccount: Stripe.Account;\n StripeConnectedAccounts: Stripe.ApiList<Stripe.Account>;\n };\n Context: Context;\n}>({});\n\nbuilder.queryType();\nbuilder.mutationType();\n\nbuilder.addScalarType('JSON', GraphQLJSONObject, {});\n\nexport { builder };\n","import jwt from 'jsonwebtoken';\nimport Stripe from 'stripe';\n\nimport type { UserHasuraClaims } from './types';\n\nif (!process.env['STRIPE_SECRET_KEY']) {\n throw new Error('STRIPE_SECRET_KEY env var is not set');\n}\n\nexport const stripe = new Stripe(process.env['STRIPE_SECRET_KEY'], {\n apiVersion: '2022-11-15',\n});\n\nexport const getUserClaims = (req: Request): UserHasuraClaims | undefined => {\n try {\n const authorizationHeader = req.headers.get('authorization');\n\n const accessToken = authorizationHeader?.split(' ')[1];\n\n if (!accessToken) {\n return undefined;\n }\n\n if (!process.env['NHOST_JWT_SECRET']) {\n throw new Error('NHOST_JWT_SECRET env var is not set');\n }\n\n const jwtSecret = JSON.parse(process.env['NHOST_JWT_SECRET']);\n\n // biome-ignore lint/suspicious/noExplicitAny: JWT decode returns unknown structure\n const decodedToken = jwt.verify(accessToken, jwtSecret.key) as any;\n return decodedToken['https://hasura.io/jwt/claims'] as UserHasuraClaims;\n } catch (_error) {\n return undefined;\n }\n};\n","import './address';\nimport './customer';\nimport './customers';\nimport './customer-shipping';\nimport './customer-tax';\nimport './customer-tax-location';\nimport './payment-methods';\nimport './payment-method';\nimport './payment-method-billing-details';\nimport './payment-method-card';\nimport './payment-method-card-checks';\nimport './payment-method-card-networks';\nimport './payment-method-card-three-d-secure-usage';\nimport './payment-method-card-wallet-masterpass';\nimport './payment-method-card-wallet-visa-checkout';\nimport './payment-method-card-wallet';\nimport './stripe';\nimport './subscriptions';\nimport './subscription';\nimport './subscription-items';\nimport './subscription-item';\nimport './subscription-item-billing-thresholds';\nimport './subscription-automatic-tax';\nimport './subscription-billing-thresholds';\nimport './subscription-pause-collection';\nimport './invoices';\nimport './invoice';\nimport './invoice-automatic-tax';\nimport './invoice-custom-field';\nimport './invoice-customer-shipping';\nimport './invoice-customer-tax-id';\nimport './invoice-line-items';\nimport './invoice-line-item';\nimport './invoice-line-item-period';\nimport './invoice-line-item-tax-amount';\nimport './invoice-rendering-options';\nimport './invoice-status-transitions';\nimport './plan';\nimport './plan-transform-usage';\nimport './price';\nimport './product';\nimport './tax-rate';\nimport './test-clock';\nimport './billing-portal-session';\nimport './payment-intent';\nimport './payment-intents';\nimport './charges';\nimport './charge';\nimport './connectedAccount';\nimport './connectedAccounts';\n\nimport { builder } from '../builder';\n\nexport const schema = builder.toSchema();\n","import { createYoga, type YogaInitialContext } from 'graphql-yoga';\n\nimport { schema } from './schema';\nimport type { Context, CreateServerProps } from './types';\nimport { getUserClaims } from './utils';\n\nconst createStripeGraphQLServer = ({\n cors,\n isAllowed,\n graphiql,\n maskedErrors = true,\n}: CreateServerProps = {}) => {\n const context = (context: YogaInitialContext): Context => {\n const { request } = context;\n\n // user id\n const userClaims = getUserClaims(request);\n\n // check if using correct `x-hasura-admin-secret` header\n const adminSecretFromHeader = request.headers.get('x-hasura-admin-secret');\n const adminSecret = process.env['NHOST_ADMIN_SECRET'];\n\n // check if the request is from Hasura\n const nhostWebhookSecretFromHeader = request.headers.get(\n 'x-nhost-webhook-secret',\n );\n const nhostWebhookSecret = process.env['NHOST_WEBHOOK_SECRET'];\n const role = request.headers.get('x-hasura-role');\n\n // variables\n const isAdmin =\n adminSecretFromHeader === adminSecret ||\n (role === 'admin' && nhostWebhookSecretFromHeader === nhostWebhookSecret);\n\n // if no isAllowed function is provided, we will allow admin requests\n const isAllowedFunction =\n isAllowed ||\n ((_stripeCustomerId: string, context: Context) => {\n return context.isAdmin;\n });\n\n // return\n return {\n ...context,\n isAllowed: isAllowedFunction,\n userClaims,\n isAdmin,\n };\n };\n\n const yoga = createYoga({\n cors,\n graphiql,\n context,\n schema,\n graphqlEndpoint: '*',\n maskedErrors,\n });\n\n return yoga;\n};\n\nexport { createStripeGraphQLServer, schema };\n"],"names":["builder","SchemaBuilder","queryType","mutationType","addScalarType","GraphQLJSONObject","process","env","Error","Stripe","apiVersion","schema","toSchema","cors","isAllowed","graphiql","maskedErrors","createYoga","context","request","userClaims","req","authorizationHeader","headers","get","accessToken","split","jwtSecret","JSON","parse","jwt","verify","key","_error","getUserClaims","adminSecretFromHeader","adminSecret","nhostWebhookSecretFromHeader","nhostWebhookSecret","role","isAdmin","isAllowedFunction","_stripeCustomerId","graphqlEndpoint"],"mappings":"qNAeMA,EAAU,IAAIC,EAsGjB,CAAA,GChHH,GDkHAD,EAAQE,YACRF,EAAQG,eAERH,EAAQI,cAAc,OAAQC,EAAAA,kBAAmB,KCrH5CC,QAAQC,IAAuB,kBAClC,MAAM,IAAIC,MAAM,wCAGI,IAAIC,EAAOH,QAAQC,IAAuB,kBAAG,CACjEG,WAAY,eAGP,MCwCMC,EAASX,EAAQY,+DC/CI,EAChCC,OACAC,YACAC,WACAC,gBAAe,GACM,KAuCRC,EAAAA,WAAW,CACtBJ,OACAE,WACAG,QAzCeA,IACf,MAAMC,QAAEA,GAAYD,EAGdE,EFHmB,CAACC,IAC5B,IACE,MAAMC,EAAsBD,EAAIE,QAAQC,IAAI,iBAEtCC,EAAcH,GAAqBI,MAAM,KAAK,GAEpD,IAAKD,EACH,OAGF,IAAKnB,QAAQC,IAAsB,iBACjC,MAAM,IAAIC,MAAM,uCAGlB,MAAMmB,EAAYC,KAAKC,MAAMvB,QAAQC,IAAsB,kBAI3D,OADqBuB,EAAIC,OAAON,EAAaE,EAAUK,KACnC,+BACtB,OAASC,GACP,MACF,GElBqBC,CAAcf,GAG3BgB,EAAwBhB,EAAQI,QAAQC,IAAI,yBAC5CY,EAAc9B,QAAQC,IAAwB,mBAG9C8B,EAA+BlB,EAAQI,QAAQC,IACnD,0BAEIc,EAAqBhC,QAAQC,IAA0B,qBACvDgC,EAAOpB,EAAQI,QAAQC,IAAI,iBAG3BgB,EACJL,IAA0BC,GAChB,UAATG,GAAoBF,IAAiCC,EAGlDG,EACJ3B,GAAA,EACE4B,EAA2BxB,IACpBA,EAAQsB,SAInB,MAAO,IACFtB,EACHJ,UAAW2B,EACXrB,aACAoB,YAQF7B,SACAgC,gBAAiB,IACjB3B"}
@@ -0,0 +1,76 @@
1
+ import SchemaBuilder from "@pothos/core";
2
+ import { GraphQLJSONObject } from "graphql-scalars";
3
+ import { createYoga } from "graphql-yoga";
4
+ import jwt from "jsonwebtoken";
5
+ import Stripe from "stripe";
6
+ const builder = new SchemaBuilder({});
7
+ builder.queryType();
8
+ builder.mutationType();
9
+ builder.addScalarType("JSON", GraphQLJSONObject, {});
10
+ if (!process.env["STRIPE_SECRET_KEY"]) {
11
+ throw new Error("STRIPE_SECRET_KEY env var is not set");
12
+ }
13
+ new Stripe(process.env["STRIPE_SECRET_KEY"], {
14
+ apiVersion: "2022-11-15"
15
+ });
16
+ const getUserClaims = (req) => {
17
+ try {
18
+ const authorizationHeader = req.headers.get("authorization");
19
+ const accessToken = authorizationHeader?.split(" ")[1];
20
+ if (!accessToken) {
21
+ return void 0;
22
+ }
23
+ if (!process.env["NHOST_JWT_SECRET"]) {
24
+ throw new Error("NHOST_JWT_SECRET env var is not set");
25
+ }
26
+ const jwtSecret = JSON.parse(process.env["NHOST_JWT_SECRET"]);
27
+ const decodedToken = jwt.verify(accessToken, jwtSecret.key);
28
+ return decodedToken["https://hasura.io/jwt/claims"];
29
+ } catch (_error) {
30
+ return void 0;
31
+ }
32
+ };
33
+ const schema = builder.toSchema();
34
+ const createStripeGraphQLServer = ({
35
+ cors,
36
+ isAllowed,
37
+ graphiql,
38
+ maskedErrors = true
39
+ } = {}) => {
40
+ const context = (context2) => {
41
+ const { request } = context2;
42
+ const userClaims = getUserClaims(request);
43
+ const adminSecretFromHeader = request.headers.get("x-hasura-admin-secret");
44
+ const adminSecret = process.env["NHOST_ADMIN_SECRET"];
45
+ const nhostWebhookSecretFromHeader = request.headers.get(
46
+ "x-nhost-webhook-secret"
47
+ );
48
+ const nhostWebhookSecret = process.env["NHOST_WEBHOOK_SECRET"];
49
+ const role = request.headers.get("x-hasura-role");
50
+ const isAdmin = adminSecretFromHeader === adminSecret || role === "admin" && nhostWebhookSecretFromHeader === nhostWebhookSecret;
51
+ const isAllowedFunction = isAllowed || ((_stripeCustomerId, context3) => {
52
+ return context3.isAdmin;
53
+ });
54
+ return {
55
+ ...context2,
56
+ isAllowed: isAllowedFunction,
57
+ userClaims,
58
+ isAdmin
59
+ };
60
+ };
61
+ const yoga = createYoga({
62
+ cors,
63
+ graphiql,
64
+ context,
65
+ schema,
66
+ graphqlEndpoint: "*",
67
+ maskedErrors
68
+ });
69
+ return yoga;
70
+ };
71
+ export {
72
+ builder,
73
+ createStripeGraphQLServer,
74
+ schema
75
+ };
76
+ //# sourceMappingURL=stripe-graphql-js.js.map