@nhost/stripe-graphql-js 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts +2 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -7
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +26 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { schema } from './schema';
|
|
3
|
-
import { CreateServerProps } from './types';
|
|
4
|
-
declare const createStripeGraphQLServer: (
|
|
2
|
+
import { Context, CreateServerProps } from './types';
|
|
3
|
+
declare const createStripeGraphQLServer: ({ cors, isAllowed, graphiql, maskedErrors, }?: CreateServerProps) => import("graphql-yoga").YogaServerInstance<{}, Context>;
|
|
5
4
|
export { createStripeGraphQLServer, schema };
|
|
6
5
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGpD,QAAA,MAAM,yBAAyB,kDAK5B,iBAAiB,2DA+CnB,CAAA;AAED,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/server.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.schema = exports.createStripeGraphQLServer = void 0;
|
|
4
|
-
const node_http_1 = require("node:http");
|
|
5
4
|
const graphql_yoga_1 = require("graphql-yoga");
|
|
6
5
|
const schema_1 = require("./schema");
|
|
7
6
|
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return schema_1.schema; } });
|
|
8
7
|
const utils_1 = require("./utils");
|
|
9
|
-
const createStripeGraphQLServer = (
|
|
10
|
-
const cors = params === null || params === void 0 ? void 0 : params.cors;
|
|
11
|
-
const isAllowed = params === null || params === void 0 ? void 0 : params.isAllowed;
|
|
12
|
-
const graphiql = params === null || params === void 0 ? void 0 : params.graphiql;
|
|
8
|
+
const createStripeGraphQLServer = ({ cors, isAllowed, graphiql, maskedErrors = true, } = {}) => {
|
|
13
9
|
const context = (context) => {
|
|
14
10
|
const { request } = context;
|
|
15
11
|
// user id
|
|
@@ -38,9 +34,10 @@ const createStripeGraphQLServer = (params) => {
|
|
|
38
34
|
graphiql,
|
|
39
35
|
context,
|
|
40
36
|
schema: schema_1.schema,
|
|
41
|
-
graphqlEndpoint: '*'
|
|
37
|
+
graphqlEndpoint: '*',
|
|
38
|
+
maskedErrors,
|
|
42
39
|
});
|
|
43
|
-
return
|
|
40
|
+
return yoga;
|
|
44
41
|
};
|
|
45
42
|
exports.createStripeGraphQLServer = createStripeGraphQLServer;
|
|
46
43
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAG7D,qCAAiC;AA0DG,uFA1D3B,eAAM,OA0D2B;AAxD1C,mCAAuC;AAEvC,MAAM,yBAAyB,GAAG,CAAC,EACjC,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,GAAG,IAAI,MACE,EAAE,EAAE,EAAE;IAC3B,MAAM,OAAO,GAAG,CAAC,OAA2B,EAAW,EAAE;QACvD,MAAM,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phql-yoga';
|
|
3
|
-
export
|
|
3
|
+
export type StripeGraphQLContext = {
|
|
4
4
|
isAllowed: (stripeCustomerId: string, context: Context) => boolean | Promise<boolean>;
|
|
5
5
|
userClaims?: UserHasuraClaims;
|
|
6
6
|
isAdmin: boolean;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type Context = YogaInitialContext & StripeGraphQLContext;
|
|
9
|
+
export type CreateServerProps = {
|
|
10
|
+
/**
|
|
11
|
+
* GraphQL Yoga CORS configuration
|
|
12
|
+
* @see {@link https://www.the-guild.dev/graphql/yoga-server/docs/features/cors}
|
|
13
|
+
*/
|
|
10
14
|
cors?: CORSOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Function to determine more granular user permission
|
|
17
|
+
*/
|
|
11
18
|
isAllowed?: (stripeCustomerId: string, context: Context) => boolean | Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to enable the GraphiQL interface
|
|
21
|
+
*/
|
|
12
22
|
graphiql?: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable GraphQL Yoga error masking
|
|
25
|
+
* @see {@link https://the-guild.dev/graphql/yoga-server/docs/features/error-masking#disabling-error-masking}
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
maskedErrors?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type StripePaymentMethod = Stripe.PaymentMethod & {
|
|
15
31
|
customer: string | null;
|
|
16
32
|
};
|
|
17
|
-
export
|
|
33
|
+
export type StripeSubscription = Stripe.Subscription & {
|
|
18
34
|
customer: string;
|
|
19
35
|
test_clock: string | null;
|
|
20
36
|
};
|
|
21
|
-
export
|
|
37
|
+
export type StripeInvoice = Stripe.Invoice & {
|
|
22
38
|
id: string;
|
|
23
39
|
customer: string;
|
|
24
40
|
default_payment_method: StripePaymentMethod | null;
|
|
25
41
|
payment_intent: any;
|
|
26
42
|
};
|
|
27
|
-
export
|
|
43
|
+
export type StripePaymentIntent = Stripe.PaymentIntent & {
|
|
28
44
|
customer: string;
|
|
29
45
|
};
|
|
30
|
-
export
|
|
46
|
+
export type StripeCharge = Stripe.Charge & {
|
|
31
47
|
customer: string;
|
|
32
48
|
payment_intent: string | null;
|
|
33
49
|
};
|
|
34
|
-
export
|
|
50
|
+
export type UserHasuraClaims = {
|
|
35
51
|
'x-hasura-user-id': string;
|
|
36
52
|
'x-hasura-default-role': string;
|
|
37
53
|
'x-hasura-allowed-roles': string[];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,
|
|
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,O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
6
6
|
"keywords": [
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pothos/core": "^3.
|
|
32
|
-
"graphql": "16.
|
|
33
|
-
"graphql-scalars": "^1.
|
|
34
|
-
"graphql-yoga": "^3.
|
|
35
|
-
"jsonwebtoken": "^9.0.
|
|
36
|
-
"stripe": "^11.
|
|
31
|
+
"@pothos/core": "^3.41.0",
|
|
32
|
+
"graphql": "16.8.1",
|
|
33
|
+
"graphql-scalars": "^1.22.4",
|
|
34
|
+
"graphql-yoga": "^3.9.1",
|
|
35
|
+
"jsonwebtoken": "^9.0.2",
|
|
36
|
+
"stripe": "^11.18.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/jsonwebtoken": "^9.0.
|
|
40
|
-
"@types/node": "^18.
|
|
41
|
-
"dotenv": "^16.
|
|
39
|
+
"@types/jsonwebtoken": "^9.0.5",
|
|
40
|
+
"@types/node": "^18.19.6",
|
|
41
|
+
"dotenv": "^16.3.1",
|
|
42
42
|
"ts-node-dev": "^2.0.0",
|
|
43
|
-
"typescript": "^4.
|
|
43
|
+
"typescript": "^4.9.5"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"dev": "NODE_ENV=development ts-node-dev -r dotenv/config dev/server.ts",
|