@1password/sdk 0.5.0 → 0.5.1-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.
@@ -1,6 +1,6 @@
1
1
  import { ClientAuthConfig, WorkloadDetails } from "./core.js";
2
2
  export declare const LANGUAGE = "JS";
3
- export declare const VERSION = "0050002";
3
+ export declare const VERSION = "0050101";
4
4
  export interface ClientConfiguration {
5
5
  auth?: Auth;
6
6
  integrationName: string;
@@ -5,6 +5,13 @@ import { Core } from "./core";
5
5
  export declare class SharedLibCore implements Core {
6
6
  private lib;
7
7
  private acccountName;
8
+ /**
9
+ * Loads the 1Password desktop app's shared library.
10
+ *
11
+ * Throws if the desktop app can't be found or its library can't be loaded, so
12
+ * `createClient` rejects and the caller can handle it (for example, fall back
13
+ * to another auth method). It doesn't log the error itself.
14
+ */
8
15
  constructor(accountName: string);
9
16
  /**
10
17
  * callSharedLibrary - send string to native function, receive string back.
@@ -93,29 +93,30 @@ const find1PasswordLibPath = () => {
93
93
  * SharedLibCore: wrapper around the dynamically loaded shared library
94
94
  */
95
95
  class SharedLibCore {
96
+ /**
97
+ * Loads the 1Password desktop app's shared library.
98
+ *
99
+ * Throws if the desktop app can't be found or its library can't be loaded, so
100
+ * `createClient` rejects and the caller can handle it (for example, fall back
101
+ * to another auth method). It doesn't log the error itself.
102
+ */
96
103
  constructor(accountName) {
97
104
  this.lib = null;
98
- try {
99
- const libPath = find1PasswordLibPath();
100
- const moduleStub = { exports: {} };
101
- process.dlopen(moduleStub, libPath);
102
- // Safely check the structure of the loaded module before casting.
103
- if (typeof moduleStub === "object" &&
104
- moduleStub !== null &&
105
- typeof moduleStub.exports === "object" &&
106
- moduleStub.exports !== null &&
107
- "sendMessage" in moduleStub.exports &&
108
- typeof moduleStub.exports.sendMessage ===
109
- "function") {
110
- this.lib = moduleStub.exports;
111
- }
112
- else {
113
- throw new Error("Failed to initialize native library: sendMessage function not found on module.");
114
- }
105
+ const libPath = find1PasswordLibPath();
106
+ const moduleStub = { exports: {} };
107
+ process.dlopen(moduleStub, libPath);
108
+ // Safely check the structure of the loaded module before casting.
109
+ if (typeof moduleStub === "object" &&
110
+ moduleStub !== null &&
111
+ typeof moduleStub.exports === "object" &&
112
+ moduleStub.exports !== null &&
113
+ "sendMessage" in moduleStub.exports &&
114
+ typeof moduleStub.exports.sendMessage ===
115
+ "function") {
116
+ this.lib = moduleStub.exports;
115
117
  }
116
- catch (e) {
117
- console.error("A critical error occurred while loading the native addon:", e);
118
- this.lib = null;
118
+ else {
119
+ throw new Error("Failed to initialize native library: sendMessage function not found on module.");
119
120
  }
120
121
  this.acccountName = accountName;
121
122
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.5.0";
2
- export declare const SDK_BUILD_NUMBER = "0050002";
1
+ export declare const SDK_VERSION = "0.5.1-beta.1";
2
+ export declare const SDK_BUILD_NUMBER = "0050101";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_BUILD_NUMBER = exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.5.0";
5
- exports.SDK_BUILD_NUMBER = "0050002";
4
+ exports.SDK_VERSION = "0.5.1-beta.1";
5
+ exports.SDK_BUILD_NUMBER = "0050101";
6
6
  const SDK_CORE_VERSION = "0.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1password/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-beta.1",
4
4
  "description": "The 1Password JavaScript SDK offers programmatic read access to your secrets in 1Password in an interface native to JavaScript. The SDK currently supports `Node.JS`",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -43,5 +43,10 @@
43
43
  "prettier-plugin-organize-imports": "^3.2.3",
44
44
  "ts-jest": "^29.1.1",
45
45
  "typescript": "^5.3.3"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/1Password/onepassword-sdk-js.git",
50
+ "directory": "client"
46
51
  }
47
52
  }