@salesforce/packaging 5.0.9-spi-dev.0 → 5.0.9-spi.0

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.
@@ -170,6 +170,12 @@ export type PackageTrustLinkRequestResult = {
170
170
  VerifiedOrgId: string;
171
171
  Status: string;
172
172
  };
173
+ export type PackageTrustLinkUnlinkResult = {
174
+ removed: boolean;
175
+ LinkRequestId?: string;
176
+ VerifiedOrgId?: string;
177
+ Status?: string;
178
+ };
173
179
  export type PackagePushRequestReportQueryOptions = {
174
180
  packagePushRequestId: string;
175
181
  };
@@ -1,5 +1,5 @@
1
1
  import { Connection } from '@salesforce/core';
2
- import { PackageTrustLinkRequestOptions, PackageTrustLinkRequestResult } from '../interfaces';
2
+ import { PackageTrustLinkRequestOptions, PackageTrustLinkRequestResult, PackageTrustLinkUnlinkResult } from '../interfaces';
3
3
  export declare class PackageTrustLink {
4
4
  constructor();
5
5
  /**
@@ -14,4 +14,17 @@ export declare class PackageTrustLink {
14
14
  * @returns the created trust relationship Id, verified org ID, and status.
15
15
  */
16
16
  static request(connection: Connection, options: PackageTrustLinkRequestOptions): Promise<PackageTrustLinkRequestResult>;
17
+ /**
18
+ * Clear the connected authoring org's Public Secure (VerifiedDev) trust link, returning it to the
19
+ * `Not Linked` state.
20
+ *
21
+ * Deletes the authoring org's single trust relationship regardless of its current status. This is
22
+ * the developer/authoring-org side operation used both to abandon a request and to retry after a
23
+ * decline (unlink, then request again). It is idempotent: if the org has no trust link, it reports
24
+ * `removed: false` rather than erroring.
25
+ *
26
+ * @param connection - Connection to the authoring org (the 1GP namespace org or 2GP Dev Hub).
27
+ * @returns whether a link was removed and, when one existed, its Id, verified org ID, and status.
28
+ */
29
+ static unlink(connection: Connection): Promise<PackageTrustLinkUnlinkResult>;
17
30
  }
@@ -51,6 +51,36 @@ class PackageTrustLink {
51
51
  Status: 'Pending',
52
52
  };
53
53
  }
54
+ /**
55
+ * Clear the connected authoring org's Public Secure (VerifiedDev) trust link, returning it to the
56
+ * `Not Linked` state.
57
+ *
58
+ * Deletes the authoring org's single trust relationship regardless of its current status. This is
59
+ * the developer/authoring-org side operation used both to abandon a request and to retry after a
60
+ * decline (unlink, then request again). It is idempotent: if the org has no trust link, it reports
61
+ * `removed: false` rather than erroring.
62
+ *
63
+ * @param connection - Connection to the authoring org (the 1GP namespace org or 2GP Dev Hub).
64
+ * @returns whether a link was removed and, when one existed, its Id, verified org ID, and status.
65
+ */
66
+ static async unlink(connection) {
67
+ // An authoring org holds at most one trust relationship, and the Tooling API query runs against
68
+ // the connected org (AuthoringOrg is server-set), so this returns that org's own link if any.
69
+ const existing = await queryExistingTrustLink(connection);
70
+ if (!existing) {
71
+ return { removed: false };
72
+ }
73
+ const deleteResult = await connection.tooling.sobject(TRUST_LINK_SOBJECT).destroy(existing.Id);
74
+ if (!deleteResult.success) {
75
+ throw (0, packageUtils_1.combineSaveErrors)(TRUST_LINK_SOBJECT, 'delete', deleteResult.errors);
76
+ }
77
+ return {
78
+ removed: true,
79
+ LinkRequestId: existing.Id,
80
+ VerifiedOrgId: existing.VerifiedOrg,
81
+ Status: existing.Status,
82
+ };
83
+ }
54
84
  }
55
85
  exports.PackageTrustLink = PackageTrustLink;
56
86
  async function queryExistingTrustLink(connection) {
@@ -5,3 +5,7 @@ The Verified Org ID %s isn't valid. Specify a valid organization ID (starts with
5
5
  # trustLinkAlreadyExists
6
6
 
7
7
  This org already has a trust link to Verified Org %s with status '%s'. An org can have only one trust link at a time; delete the existing trust link before requesting a new one.
8
+
9
+ # trustLinkNotFound
10
+
11
+ This org has no trust link to remove; it's already in the Not Linked state.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/packaging",
3
- "version": "5.0.9-spi-dev.0",
3
+ "version": "5.0.9-spi.0",
4
4
  "description": "Packaging library for the Salesforce packaging platform",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",