@8ms/helpers 3.0.12 → 3.0.13

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,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require__class_BaseNamespace = require("../../_class/BaseNamespace.cjs");
3
3
  const require_onePassword_server_getIdsFromUrl = require("./getIdsFromUrl.cjs");
4
+ let _1password_sdk = require("@1password/sdk");
4
5
  //#region src/onePassword/server/OnePassword.ts
5
6
  var OnePassword = class extends require__class_BaseNamespace.BaseNamespace {
6
7
  init = async (config) => {
@@ -40,6 +41,32 @@ var OnePassword = class extends require__class_BaseNamespace.BaseNamespace {
40
41
  listItems = async (vaultId) => {
41
42
  return this.client.items.list(vaultId);
42
43
  };
44
+ setNote = async (url, value) => {
45
+ const item = await this.getItem(url);
46
+ item.notes = value;
47
+ return this.client.items.put(item);
48
+ };
49
+ setJsonNote = async (url, value) => {
50
+ const item = await this.getItem(url);
51
+ item.notes = JSON.stringify(value);
52
+ return this.client.items.put(item);
53
+ };
54
+ createNote = async (vaultId, title, value) => {
55
+ return this.client.items.create({
56
+ category: _1password_sdk.ItemCategory.SecureNote,
57
+ vaultId,
58
+ title,
59
+ notes: value
60
+ });
61
+ };
62
+ createJsonNote = async (vaultId, title, value) => {
63
+ return this.client.items.create({
64
+ category: _1password_sdk.ItemCategory.SecureNote,
65
+ vaultId,
66
+ title,
67
+ notes: JSON.stringify(value)
68
+ });
69
+ };
43
70
  };
44
71
  //#endregion
45
72
  exports.OnePassword = OnePassword;
@@ -15,6 +15,10 @@ declare class OnePassword extends BaseNamespace {
15
15
  getNote: (url: string) => Promise<string | null>;
16
16
  getJsonNote: (url: string) => Promise<any>;
17
17
  listItems: (vaultId: string) => Promise<import("@1password/sdk").ItemOverview[]>;
18
+ setNote: (url: string, value: string) => Promise<import("@1password/sdk").Item>;
19
+ setJsonNote: (url: string, value: any) => Promise<import("@1password/sdk").Item>;
20
+ createNote: (vaultId: string, title: string, value: string) => Promise<import("@1password/sdk").Item>;
21
+ createJsonNote: (vaultId: string, title: string, value: any) => Promise<import("@1password/sdk").Item>;
18
22
  }
19
23
  //#endregion
20
24
  export { OnePassword, OnePasswordConfig };
@@ -15,6 +15,10 @@ declare class OnePassword extends BaseNamespace {
15
15
  getNote: (url: string) => Promise<string | null>;
16
16
  getJsonNote: (url: string) => Promise<any>;
17
17
  listItems: (vaultId: string) => Promise<import("@1password/sdk").ItemOverview[]>;
18
+ setNote: (url: string, value: string) => Promise<import("@1password/sdk").Item>;
19
+ setJsonNote: (url: string, value: any) => Promise<import("@1password/sdk").Item>;
20
+ createNote: (vaultId: string, title: string, value: string) => Promise<import("@1password/sdk").Item>;
21
+ createJsonNote: (vaultId: string, title: string, value: any) => Promise<import("@1password/sdk").Item>;
18
22
  }
19
23
  //#endregion
20
24
  export { OnePassword, OnePasswordConfig };
@@ -1,5 +1,6 @@
1
1
  import { BaseNamespace } from "../../_class/BaseNamespace.mjs";
2
2
  import { getIdsFromUrl } from "./getIdsFromUrl.mjs";
3
+ import { ItemCategory } from "@1password/sdk";
3
4
  //#region src/onePassword/server/OnePassword.ts
4
5
  var OnePassword = class extends BaseNamespace {
5
6
  init = async (config) => {
@@ -39,6 +40,32 @@ var OnePassword = class extends BaseNamespace {
39
40
  listItems = async (vaultId) => {
40
41
  return this.client.items.list(vaultId);
41
42
  };
43
+ setNote = async (url, value) => {
44
+ const item = await this.getItem(url);
45
+ item.notes = value;
46
+ return this.client.items.put(item);
47
+ };
48
+ setJsonNote = async (url, value) => {
49
+ const item = await this.getItem(url);
50
+ item.notes = JSON.stringify(value);
51
+ return this.client.items.put(item);
52
+ };
53
+ createNote = async (vaultId, title, value) => {
54
+ return this.client.items.create({
55
+ category: ItemCategory.SecureNote,
56
+ vaultId,
57
+ title,
58
+ notes: value
59
+ });
60
+ };
61
+ createJsonNote = async (vaultId, title, value) => {
62
+ return this.client.items.create({
63
+ category: ItemCategory.SecureNote,
64
+ vaultId,
65
+ title,
66
+ notes: JSON.stringify(value)
67
+ });
68
+ };
42
69
  };
43
70
  //#endregion
44
71
  export { OnePassword };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "3.0.12",
4
+ "version": "3.0.13",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -1213,6 +1213,6 @@
1213
1213
  "./package.json": "./package.json"
1214
1214
  },
1215
1215
  "inlinedDependencies": {
1216
- "@smithy/types": "4.14.2"
1216
+ "@smithy/types": "4.15.0"
1217
1217
  }
1218
1218
  }