@open-mercato/gateway-stripe 0.6.4-develop.4217.1.c9aa050183 → 0.6.4-develop.4239.1.4a264a5828

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.
@@ -1,6 +1,16 @@
1
1
  const features = [
2
- { id: "gateway_stripe.view", title: "View Stripe gateway configuration", module: "gateway_stripe" },
3
- { id: "gateway_stripe.configure", title: "Configure Stripe gateway settings", module: "gateway_stripe" }
2
+ {
3
+ id: "gateway_stripe.view",
4
+ title: "View Stripe gateway configuration",
5
+ module: "gateway_stripe",
6
+ dependsOn: ["payment_gateways.view"]
7
+ },
8
+ {
9
+ id: "gateway_stripe.configure",
10
+ title: "Configure Stripe gateway settings",
11
+ module: "gateway_stripe",
12
+ dependsOn: ["gateway_stripe.view", "payment_gateways.manage"]
13
+ }
4
14
  ];
5
15
  var acl_default = features;
6
16
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/modules/gateway_stripe/acl.ts"],
4
- "sourcesContent": ["export const features = [\n { id: 'gateway_stripe.view', title: 'View Stripe gateway configuration', module: 'gateway_stripe' },\n { id: 'gateway_stripe.configure', title: 'Configure Stripe gateway settings', module: 'gateway_stripe' },\n]\n\nexport default features\n"],
5
- "mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,EAAE,IAAI,uBAAuB,OAAO,qCAAqC,QAAQ,iBAAiB;AAAA,EAClG,EAAE,IAAI,4BAA4B,OAAO,qCAAqC,QAAQ,iBAAiB;AACzG;AAEA,IAAO,cAAQ;",
4
+ "sourcesContent": ["export const features = [\n {\n id: 'gateway_stripe.view',\n title: 'View Stripe gateway configuration',\n module: 'gateway_stripe',\n dependsOn: ['payment_gateways.view'],\n },\n {\n id: 'gateway_stripe.configure',\n title: 'Configure Stripe gateway settings',\n module: 'gateway_stripe',\n dependsOn: ['gateway_stripe.view', 'payment_gateways.manage'],\n },\n]\n\nexport default features\n"],
5
+ "mappings": "AAAO,MAAM,WAAW;AAAA,EACtB;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW,CAAC,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW,CAAC,uBAAuB,yBAAyB;AAAA,EAC9D;AACF;AAEA,IAAO,cAAQ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/gateway-stripe",
3
- "version": "0.6.4-develop.4217.1.c9aa050183",
3
+ "version": "0.6.4-develop.4239.1.4a264a5828",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -61,21 +61,21 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@open-mercato/core": "0.6.4-develop.4217.1.c9aa050183",
65
- "@open-mercato/queue": "0.6.4-develop.4217.1.c9aa050183",
66
- "@open-mercato/ui": "0.6.4-develop.4217.1.c9aa050183",
64
+ "@open-mercato/core": "0.6.4-develop.4239.1.4a264a5828",
65
+ "@open-mercato/queue": "0.6.4-develop.4239.1.4a264a5828",
66
+ "@open-mercato/ui": "0.6.4-develop.4239.1.4a264a5828",
67
67
  "@stripe/react-stripe-js": "^6.4.0",
68
68
  "@stripe/stripe-js": "^9.6.0",
69
69
  "stripe": "^22.1.1"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@mikro-orm/postgresql": "^7.0.14",
73
- "@open-mercato/shared": "0.6.4-develop.4217.1.c9aa050183",
73
+ "@open-mercato/shared": "0.6.4-develop.4239.1.4a264a5828",
74
74
  "react": "^19.0.0",
75
75
  "react-dom": "^19.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@open-mercato/shared": "0.6.4-develop.4217.1.c9aa050183",
78
+ "@open-mercato/shared": "0.6.4-develop.4239.1.4a264a5828",
79
79
  "@types/jest": "^30.0.0",
80
80
  "@types/react": "^19.2.15",
81
81
  "@types/react-dom": "^19.2.3",
@@ -0,0 +1,82 @@
1
+ /** @jest-environment node */
2
+
3
+ import { describe, test, expect } from '@jest/globals'
4
+ import {
5
+ resolveAclDependencyDiagnostics,
6
+ type FeatureDescriptor,
7
+ } from '@open-mercato/shared/security/aclDependencies'
8
+ import { features as gatewayStripeFeatures } from '../acl'
9
+ import { features as paymentGatewaysFeatures } from '@open-mercato/core/modules/payment_gateways/acl'
10
+
11
+ // The gateway_stripe dependency table (spec §6.36) references features from the
12
+ // payment_gateways module, so the catalog the resolver checks against must
13
+ // include them.
14
+ const combinedCatalog: FeatureDescriptor[] = [
15
+ ...(gatewayStripeFeatures as FeatureDescriptor[]),
16
+ ...(paymentGatewaysFeatures as FeatureDescriptor[]),
17
+ ]
18
+
19
+ const gatewayStripeFeatureIds = (gatewayStripeFeatures as FeatureDescriptor[]).map((f) => f.id)
20
+
21
+ describe('gateway_stripe ACL dependency declarations', () => {
22
+ test('every gateway_stripe dependency resolves to a known feature (no unknown references)', () => {
23
+ const diagnostics = resolveAclDependencyDiagnostics(
24
+ combinedCatalog.map((f) => f.id),
25
+ combinedCatalog,
26
+ )
27
+ const gatewayStripeUnknown = diagnostics.unknownReferences.filter((entry) =>
28
+ entry.feature.startsWith('gateway_stripe.'),
29
+ )
30
+ expect(gatewayStripeUnknown).toEqual([])
31
+ })
32
+
33
+ test('view depends on the payment gateways read feature', () => {
34
+ const view = (gatewayStripeFeatures as FeatureDescriptor[]).find(
35
+ (f) => f.id === 'gateway_stripe.view',
36
+ )
37
+ expect(view?.dependsOn).toEqual(['payment_gateways.view'])
38
+ })
39
+
40
+ test('configure depends on the local view feature and the payment gateways manage feature', () => {
41
+ const configure = (gatewayStripeFeatures as FeatureDescriptor[]).find(
42
+ (f) => f.id === 'gateway_stripe.configure',
43
+ )
44
+ expect([...(configure?.dependsOn ?? [])].sort()).toEqual(
45
+ ['gateway_stripe.view', 'payment_gateways.manage'].sort(),
46
+ )
47
+ })
48
+
49
+ test('granting gateway_stripe.view alone surfaces the missing payment_gateways read dependency', () => {
50
+ const diagnostics = resolveAclDependencyDiagnostics(['gateway_stripe.view'], combinedCatalog)
51
+ const viewEntry = diagnostics.missingDependencies.find(
52
+ (entry) => entry.feature === 'gateway_stripe.view',
53
+ )
54
+ expect(viewEntry).toBeDefined()
55
+ expect([...(viewEntry?.missing ?? [])]).toEqual(['payment_gateways.view'])
56
+ })
57
+
58
+ test('granting gateway_stripe.configure alone surfaces both declared dependencies', () => {
59
+ const diagnostics = resolveAclDependencyDiagnostics(
60
+ ['gateway_stripe.configure'],
61
+ combinedCatalog,
62
+ )
63
+ const configureEntry = diagnostics.missingDependencies.find(
64
+ (entry) => entry.feature === 'gateway_stripe.configure',
65
+ )
66
+ expect(configureEntry).toBeDefined()
67
+ expect([...(configureEntry?.missing ?? [])].sort()).toEqual(
68
+ ['gateway_stripe.view', 'payment_gateways.manage'].sort(),
69
+ )
70
+ })
71
+
72
+ test('granting all referenced features clears gateway_stripe dependency warnings', () => {
73
+ const diagnostics = resolveAclDependencyDiagnostics(
74
+ combinedCatalog.map((f) => f.id),
75
+ combinedCatalog,
76
+ )
77
+ const gatewayStripeMissing = diagnostics.missingDependencies.filter((entry) =>
78
+ entry.feature.startsWith('gateway_stripe.'),
79
+ )
80
+ expect(gatewayStripeMissing).toEqual([])
81
+ })
82
+ })
@@ -1,6 +1,16 @@
1
1
  export const features = [
2
- { id: 'gateway_stripe.view', title: 'View Stripe gateway configuration', module: 'gateway_stripe' },
3
- { id: 'gateway_stripe.configure', title: 'Configure Stripe gateway settings', module: 'gateway_stripe' },
2
+ {
3
+ id: 'gateway_stripe.view',
4
+ title: 'View Stripe gateway configuration',
5
+ module: 'gateway_stripe',
6
+ dependsOn: ['payment_gateways.view'],
7
+ },
8
+ {
9
+ id: 'gateway_stripe.configure',
10
+ title: 'Configure Stripe gateway settings',
11
+ module: 'gateway_stripe',
12
+ dependsOn: ['gateway_stripe.view', 'payment_gateways.manage'],
13
+ },
4
14
  ]
5
15
 
6
16
  export default features