@alphawebai/hs-prism 0.1.0-rc.51 → 0.1.0-rc.53

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,7 +1,7 @@
1
1
  export declare const ALPHAWEB_STRIPE_WEBHOOK_EVENTS: readonly ["charge.dispute.closed", "charge.dispute.created", "charge.dispute.funds_reinstated", "charge.dispute.funds_withdrawn", "charge.dispute.updated", "mandate.updated", "payment_intent.amount_capturable_updated", "payment_intent.canceled", "payment_intent.payment_failed", "payment_intent.processing", "payment_intent.requires_action", "payment_intent.succeeded", "payment_method.attached", "payment_method.automatically_updated", "payment_method.detached", "payment_method.updated", "refund.created", "refund.failed", "refund.updated", "setup_intent.canceled", "setup_intent.requires_action", "setup_intent.setup_failed", "setup_intent.succeeded"];
2
2
  export declare const ALPHAWEB_PAYPAL_WEBHOOK_EVENTS: readonly ["CHECKOUT.ORDER.APPROVED", "CHECKOUT.ORDER.COMPLETED", "CHECKOUT.ORDER.PROCESSED", "CHECKOUT.PAYMENT-APPROVAL.REVERSED", "CUSTOMER.DISPUTE.CREATED", "CUSTOMER.DISPUTE.RESOLVED", "CUSTOMER.DISPUTE.UPDATED", "PAYMENT.AUTHORIZATION.CREATED", "PAYMENT.AUTHORIZATION.VOIDED", "PAYMENT.CAPTURE.COMPLETED", "PAYMENT.CAPTURE.DECLINED", "PAYMENT.CAPTURE.PENDING", "PAYMENT.CAPTURE.REFUNDED", "PAYMENT.CAPTURE.REVERSED", "PAYMENT.REFUND.FAILED", "PAYMENT.REFUND.PENDING", "RISK.DISPUTE.CREATED", "VAULT.PAYMENT-TOKEN.CREATED", "VAULT.PAYMENT-TOKEN.DELETED", "VAULT.PAYMENT-TOKEN.DELETION-INITIATED"];
3
3
  export declare const ALPHAWEB_PRISM_COMPATIBILITY_MANIFEST: Readonly<{
4
- readonly release: "0.1.0-rc.51";
4
+ readonly release: "0.1.0-rc.53";
5
5
  readonly upstreamCommit: "b07af7d9dac271de729548e74217ddcf895c602b";
6
6
  readonly medusaRange: ">=2.17.2 <2.18.0";
7
7
  readonly stripeApiVersion: "2026-06-24.dahlia";
@@ -49,7 +49,7 @@ exports.ALPHAWEB_PAYPAL_WEBHOOK_EVENTS = Object.freeze([
49
49
  'VAULT.PAYMENT-TOKEN.DELETION-INITIATED',
50
50
  ]);
51
51
  exports.ALPHAWEB_PRISM_COMPATIBILITY_MANIFEST = Object.freeze({
52
- release: '0.1.0-rc.51',
52
+ release: '0.1.0-rc.53',
53
53
  upstreamCommit: 'b07af7d9dac271de729548e74217ddcf895c602b',
54
54
  medusaRange: '>=2.17.2 <2.18.0',
55
55
  stripeApiVersion: '2026-06-24.dahlia',
@@ -629,6 +629,10 @@ function parseWebhookDocument(input, binding) {
629
629
  }
630
630
  return { status: 'normalized', event: normalized };
631
631
  }
632
+ function stripeSecretKeyMatchesMode(key, test) {
633
+ const mode = test ? 'test' : 'live';
634
+ return key.startsWith(`sk_${mode}_`) || key.startsWith(`rk_${mode}_`);
635
+ }
632
636
  class PrismStripeConnector {
633
637
  options;
634
638
  dependencies;
@@ -653,7 +657,7 @@ class PrismStripeConnector {
653
657
  assertIdentifier(this.options.credentialBindingId, 'credentialBindingId');
654
658
  assertIdentifier(this.options.providerAccountId, 'providerAccountId');
655
659
  const test = this.options.environment === 'test';
656
- if (!this.options.secretKey.startsWith(test ? 'sk_test_' : 'sk_live_')) {
660
+ if (!stripeSecretKeyMatchesMode(this.options.secretKey, test)) {
657
661
  throw configurationError('Stripe secret key mode does not match Prism environment.', 'PRISM_KEY_MODE');
658
662
  }
659
663
  if (this.options.publishableKey &&
@@ -1397,7 +1401,7 @@ exports.PrismStripeConnector = PrismStripeConnector;
1397
1401
  */
1398
1402
  async function verifyPrismStripeRuntimeCredential(input, dependencies) {
1399
1403
  const test = input.environment === 'test';
1400
- if (!input.secretKey.startsWith(test ? 'sk_test_' : 'sk_live_')) {
1404
+ if (!stripeSecretKeyMatchesMode(input.secretKey, test)) {
1401
1405
  throw configurationError('Stripe secret key mode does not match Prism environment.', 'PRISM_KEY_MODE');
1402
1406
  }
1403
1407
  if (input.publishableKey &&
@@ -1,6 +1,8 @@
1
1
  export * from "./payments/_generated_connector_client_flows";
2
2
  export { UniffiClient } from "./payments/_generated_uniffi_client_flows";
3
3
  export type { RustBuffer, RustCallStatus } from "./payments/uniffi_client";
4
+ export { NATIVE_LIBRARY_BASENAME, SUPPORTED_LINUX_ARCHITECTURES, assertNativeLibraryPresent, resolveNativeLibraryPath, } from "./payments/native_library";
5
+ export type { NativeLibraryHost } from "./payments/native_library";
4
6
  export * from "./http_client";
5
7
  export * from './payments/generated/proto';
6
8
  export { types } from './payments/generated/proto';
package/dist/src/index.js CHANGED
@@ -14,11 +14,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ConnectorError = exports.IntegrationError = exports.GrpcClient = exports.types = exports.UniffiClient = void 0;
17
+ exports.ConnectorError = exports.IntegrationError = exports.GrpcClient = exports.types = exports.resolveNativeLibraryPath = exports.assertNativeLibraryPresent = exports.SUPPORTED_LINUX_ARCHITECTURES = exports.NATIVE_LIBRARY_BASENAME = exports.UniffiClient = void 0;
18
18
  // Re-export client classes flat (high-level API)
19
19
  __exportStar(require("./payments/_generated_connector_client_flows"), exports);
20
20
  var _generated_uniffi_client_flows_1 = require("./payments/_generated_uniffi_client_flows");
21
21
  Object.defineProperty(exports, "UniffiClient", { enumerable: true, get: function () { return _generated_uniffi_client_flows_1.UniffiClient; } });
22
+ var native_library_1 = require("./payments/native_library");
23
+ Object.defineProperty(exports, "NATIVE_LIBRARY_BASENAME", { enumerable: true, get: function () { return native_library_1.NATIVE_LIBRARY_BASENAME; } });
24
+ Object.defineProperty(exports, "SUPPORTED_LINUX_ARCHITECTURES", { enumerable: true, get: function () { return native_library_1.SUPPORTED_LINUX_ARCHITECTURES; } });
25
+ Object.defineProperty(exports, "assertNativeLibraryPresent", { enumerable: true, get: function () { return native_library_1.assertNativeLibraryPresent; } });
26
+ Object.defineProperty(exports, "resolveNativeLibraryPath", { enumerable: true, get: function () { return native_library_1.resolveNativeLibraryPath; } });
22
27
  __exportStar(require("./http_client"), exports);
23
28
  __exportStar(require("./payments/generated/proto"), exports);
24
29
  // Re-export types namespace explicitly for both runtime and type access
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/src/payments/generated/libconnector_service_ffi.so
3
- size: 105635504 bytes
4
- sha256: 4fd7a7c17ca049ff60cd08cc83f0191e95c9502c813a7f7225dcb205b7b09e12
3
+ size: 105660624 bytes
4
+ sha256: 0deb3df064b83f7762a007f206fe4934c0a7765707b2ed7fad4b9b3e190fb6ee
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/dist/src/payments/generated/linux-arm64/libconnector_service_ffi.so
3
+ size: 97990184 bytes
4
+ sha256: 604d7cfa9e552f70800bf56dd1233f8aa126fc6ecababdb463edb633f72c81f5
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Locates the packaged connector-service FFI library for the running host.
3
+ *
4
+ * Package layout (relative to this module's directory):
5
+ * generated/libconnector_service_ffi.so linux x64 (original path, kept stable)
6
+ * generated/linux-arm64/libconnector_service_ffi.so linux arm64
7
+ * generated/libconnector_service_ffi.dylib macOS local development builds
8
+ *
9
+ * The linux x64 library keeps its original path so existing consumers that pass
10
+ * that path explicitly keep working. Every other Linux architecture is rejected
11
+ * with an actionable error instead of letting dlopen report a misleading
12
+ * "cannot open shared object file" for a library built for another machine.
13
+ */
14
+ export declare const NATIVE_LIBRARY_BASENAME = "libconnector_service_ffi";
15
+ export declare const SUPPORTED_LINUX_ARCHITECTURES: readonly string[];
16
+ export interface NativeLibraryHost {
17
+ platform?: string;
18
+ arch?: string;
19
+ /** Directory that holds the packaged `generated/` folder. Defaults to this module's directory. */
20
+ baseDirectory?: string;
21
+ }
22
+ /**
23
+ * Returns the absolute path of the packaged native library for the host
24
+ * (or the given platform/arch). Throws when no build exists for a Linux
25
+ * architecture. Does not check that the file exists; see
26
+ * `assertNativeLibraryPresent`.
27
+ */
28
+ export declare function resolveNativeLibraryPath(host?: NativeLibraryHost): string;
29
+ /**
30
+ * Throws a descriptive error when the packaged library for this host is
31
+ * missing, naming the platform/arch and the path that was expected.
32
+ */
33
+ export declare function assertNativeLibraryPresent(libPath: string, host?: NativeLibraryHost): void;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * Locates the packaged connector-service FFI library for the running host.
4
+ *
5
+ * Package layout (relative to this module's directory):
6
+ * generated/libconnector_service_ffi.so linux x64 (original path, kept stable)
7
+ * generated/linux-arm64/libconnector_service_ffi.so linux arm64
8
+ * generated/libconnector_service_ffi.dylib macOS local development builds
9
+ *
10
+ * The linux x64 library keeps its original path so existing consumers that pass
11
+ * that path explicitly keep working. Every other Linux architecture is rejected
12
+ * with an actionable error instead of letting dlopen report a misleading
13
+ * "cannot open shared object file" for a library built for another machine.
14
+ */
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.SUPPORTED_LINUX_ARCHITECTURES = exports.NATIVE_LIBRARY_BASENAME = void 0;
20
+ exports.resolveNativeLibraryPath = resolveNativeLibraryPath;
21
+ exports.assertNativeLibraryPresent = assertNativeLibraryPresent;
22
+ const fs_1 = __importDefault(require("fs"));
23
+ const path_1 = __importDefault(require("path"));
24
+ exports.NATIVE_LIBRARY_BASENAME = "libconnector_service_ffi";
25
+ const LINUX_ARCH_DIRECTORIES = {
26
+ // null keeps the original flat path.
27
+ x64: null,
28
+ arm64: "linux-arm64",
29
+ };
30
+ exports.SUPPORTED_LINUX_ARCHITECTURES = Object.freeze(Object.keys(LINUX_ARCH_DIRECTORIES));
31
+ /**
32
+ * Returns the absolute path of the packaged native library for the host
33
+ * (or the given platform/arch). Throws when no build exists for a Linux
34
+ * architecture. Does not check that the file exists; see
35
+ * `assertNativeLibraryPresent`.
36
+ */
37
+ function resolveNativeLibraryPath(host = {}) {
38
+ const platform = host.platform ?? process.platform;
39
+ const arch = host.arch ?? process.arch;
40
+ const generated = path_1.default.join(host.baseDirectory ?? __dirname, "generated");
41
+ if (platform === "darwin") {
42
+ return path_1.default.join(generated, `${exports.NATIVE_LIBRARY_BASENAME}.dylib`);
43
+ }
44
+ if (platform === "linux") {
45
+ if (!Object.prototype.hasOwnProperty.call(LINUX_ARCH_DIRECTORIES, arch)) {
46
+ throw new Error(`Prism native library is not built for linux/${arch}. ` +
47
+ `Supported Linux architectures: ${exports.SUPPORTED_LINUX_ARCHITECTURES.join(", ")}.`);
48
+ }
49
+ const directory = LINUX_ARCH_DIRECTORIES[arch];
50
+ return directory
51
+ ? path_1.default.join(generated, directory, `${exports.NATIVE_LIBRARY_BASENAME}.so`)
52
+ : path_1.default.join(generated, `${exports.NATIVE_LIBRARY_BASENAME}.so`);
53
+ }
54
+ // Unchanged fallback for other platforms (previous behaviour).
55
+ return path_1.default.join(generated, `${exports.NATIVE_LIBRARY_BASENAME}.so`);
56
+ }
57
+ /**
58
+ * Throws a descriptive error when the packaged library for this host is
59
+ * missing, naming the platform/arch and the path that was expected.
60
+ */
61
+ function assertNativeLibraryPresent(libPath, host = {}) {
62
+ if (fs_1.default.existsSync(libPath))
63
+ return;
64
+ const platform = host.platform ?? process.platform;
65
+ const arch = host.arch ?? process.arch;
66
+ throw new Error(`Prism native library for ${platform}/${arch} is missing at ${libPath}. ` +
67
+ "The installed @alphawebai/hs-prism package does not include a build for this host.");
68
+ }
69
+ //# sourceMappingURL=native_library.js.map
@@ -15,12 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.UniffiClient = void 0;
17
17
  const koffi_1 = __importDefault(require("koffi"));
18
- const path_1 = __importDefault(require("path"));
19
18
  // @ts-ignore - generated CommonJS module
20
19
  const _generated_flows_js_1 = require("./_generated_flows.js");
21
20
  // @ts-ignore - generated protobuf types
22
21
  const proto_js_1 = require("./generated/proto.js");
23
22
  const errors_1 = require("./errors");
23
+ const native_library_1 = require("./native_library");
24
24
  const _dirname = __dirname;
25
25
  const FLOW_NAMES = Object.keys(_generated_flows_js_1.FLOWS);
26
26
  const SINGLE_FLOW_NAMES = Object.keys((_generated_flows_js_1.SINGLE_FLOWS || {}));
@@ -35,8 +35,8 @@ const RustCallStatusStruct = koffi_1.default.struct("RustCallStatus", {
35
35
  });
36
36
  function loadLib(libPath) {
37
37
  if (!libPath) {
38
- const ext = process.platform === "darwin" ? "dylib" : "so";
39
- libPath = path_1.default.join(_dirname, "generated", `libconnector_service_ffi.${ext}`);
38
+ libPath = (0, native_library_1.resolveNativeLibraryPath)({ baseDirectory: _dirname });
39
+ (0, native_library_1.assertNativeLibraryPresent)(libPath);
40
40
  }
41
41
  const lib = koffi_1.default.load(libPath);
42
42
  const fns = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphawebai/hs-prism",
3
- "version": "0.1.0-rc.51",
3
+ "version": "0.1.0-rc.53",
4
4
  "description": "Hyperswitch Payments SDK — Node.js client for connector integrations via UniFFI FFI",
5
5
  "main": "dist/src/index.js",
6
6
  "exports": {
@@ -51,7 +51,7 @@
51
51
  "files": [
52
52
  "dist/src/**/*.js",
53
53
  "dist/src/**/*.d.ts",
54
- "dist/src/payments/generated/*",
54
+ "dist/src/payments/generated/**",
55
55
  "dist/src/alphaweb/**/*.js",
56
56
  "dist/src/alphaweb/**/*.d.ts",
57
57
  "README.md",