@salesforce/plugin-trust 3.5.1 → 3.5.3

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.
@@ -80,5 +80,5 @@
80
80
  ]
81
81
  }
82
82
  },
83
- "version": "3.5.1"
83
+ "version": "3.5.3"
84
84
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-trust",
3
3
  "description": "validate a digital signature for a npm package",
4
- "version": "3.5.1",
4
+ "version": "3.5.3",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "sf-trust": "bin/dev"
@@ -9,7 +9,8 @@
9
9
  "bugs": "https://github.com/forcedotcom/cli/issues",
10
10
  "dependencies": {
11
11
  "@oclif/core": "^3.26.0",
12
- "@salesforce/core": "^6.5.5",
12
+ "@salesforce/core": "^6.7.6",
13
+ "@salesforce/kit": "^3.1.0",
13
14
  "@salesforce/sf-plugins-core": "^8.0.2",
14
15
  "got": "^13.0.0",
15
16
  "npm": "10.2.3",
@@ -19,16 +20,16 @@
19
20
  "shelljs": "^0.8.4"
20
21
  },
21
22
  "devDependencies": {
22
- "@oclif/plugin-command-snapshot": "^5.1.2",
23
- "@salesforce/cli-plugins-testkit": "^5.1.11",
24
- "@salesforce/dev-scripts": "^8.4.1",
23
+ "@oclif/plugin-command-snapshot": "^5.1.4",
24
+ "@salesforce/cli-plugins-testkit": "^5.1.13",
25
+ "@salesforce/dev-scripts": "^8.4.3",
25
26
  "@salesforce/plugin-command-reference": "^3.0.71",
26
27
  "@salesforce/plugin-telemetry": "^2.3.8",
27
28
  "@salesforce/ts-sinon": "^1.4.18",
28
29
  "@types/shelljs": "^0.8.15",
29
30
  "@types/sinon-chai": "^3.2.12",
30
31
  "eslint-plugin-sf-plugin": "^1.17.4",
31
- "oclif": "^4.6.1",
32
+ "oclif": "^4.7.2",
32
33
  "sinon-chai": "^3.7.0",
33
34
  "ts-node": "^10.9.2",
34
35
  "typescript": "^5.4.3"
@@ -218,10 +219,13 @@
218
219
  "output": []
219
220
  }
220
221
  },
221
- "exports": "./lib/index.js",
222
+ "exports": {
223
+ ".": "./lib/index.js",
224
+ "./npmName": "./lib/shared/npmName.js"
225
+ },
222
226
  "type": "module",
223
227
  "sfdx": {
224
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-trust/3.5.1.crt",
225
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-trust/3.5.1.sig"
228
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-trust/3.5.3.crt",
229
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-trust/3.5.3.sig"
226
230
  }
227
231
  }
@@ -1,52 +0,0 @@
1
- /**
2
- * String representing the parsed components of an NpmName
3
- *
4
- * @example
5
- * const f: NpmName = NpmName.parse('@salesforce/jj@foo');
6
- * console.log(f.tag === 'foo')
7
- */
8
- export declare class NpmName {
9
- static readonly DEFAULT_TAG = "latest";
10
- tag: string;
11
- scope: string;
12
- name: string;
13
- /**
14
- * Private ctor. Use static parse method.
15
- */
16
- private constructor();
17
- /**
18
- * Parse an NPM package name into {scope, name, tag}. The tag is 'latest' by default and can be any semver string.
19
- *
20
- * @param {string} npmName - The npm name to parse.
21
- * @return {NpmName} - An object with the parsed components.
22
- */
23
- static parse(npmName: string): NpmName;
24
- /**
25
- * Static helper to parse the name and scope.
26
- *
27
- * @param {string} name - The string to parse.
28
- * @param {NpmNameInfo} returnNpmName - The object to update.
29
- */
30
- private static setNameAndScope;
31
- /**
32
- * Validate a component part that it's not empty and return it trimmed.
33
- *
34
- * @param {string} name The component to validate.
35
- * @return {string} A whitespace trimmed version of the component.
36
- */
37
- private static validateComponentString;
38
- /**
39
- * Produce a string that can be used by npm. @salesforce/jj@1.2.3 becomes "salesforce-jj-1.2.3.tgz
40
- *
41
- * @param {string} [ext = tgz] The file extension to use.
42
- * @param {boolean} includeLatestTag - True if the "latest" tag should be used. Generally you wouldn't do this.
43
- * @return {string} Formatted npm string thats compatible with the npm utility
44
- */
45
- toFilename(ext?: string, includeLatestTag?: boolean): string;
46
- /**
47
- * Produces a formatted string version of the object.
48
- *
49
- * @return {string} A formatted string version of the object.
50
- */
51
- toString(includeTag?: boolean): string;
52
- }
@@ -1,136 +0,0 @@
1
- /*
2
- * Copyright (c) 2022, salesforce.com, inc.
3
- * All rights reserved.
4
- * Licensed under the BSD 3-Clause license.
5
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
- */
7
- import { SfError } from '@salesforce/core';
8
- import { setErrorName } from './errors.js';
9
- /**
10
- * String representing the parsed components of an NpmName
11
- *
12
- * @example
13
- * const f: NpmName = NpmName.parse('@salesforce/jj@foo');
14
- * console.log(f.tag === 'foo')
15
- */
16
- export class NpmName {
17
- static DEFAULT_TAG = 'latest';
18
- tag;
19
- // next 2 props won't exist until after parse is called
20
- // TODO: make this more functional and deterministic
21
- scope;
22
- name;
23
- /**
24
- * Private ctor. Use static parse method.
25
- */
26
- constructor() {
27
- this.tag = NpmName.DEFAULT_TAG;
28
- }
29
- /**
30
- * Parse an NPM package name into {scope, name, tag}. The tag is 'latest' by default and can be any semver string.
31
- *
32
- * @param {string} npmName - The npm name to parse.
33
- * @return {NpmName} - An object with the parsed components.
34
- */
35
- static parse(npmName) {
36
- if (!npmName || npmName.length < 1) {
37
- throw setErrorName(new SfError('The npm name is missing or invalid.', 'MissingOrInvalidNpmName'), 'MissingOrInvalidNpmName');
38
- }
39
- const returnNpmName = new NpmName();
40
- const components = npmName.split('@');
41
- // salesforce/jj
42
- if (components.length === 1) {
43
- NpmName.setNameAndScope(components[0], returnNpmName);
44
- }
45
- else if (components[0].includes('/')) {
46
- NpmName.setNameAndScope(components[0], returnNpmName);
47
- }
48
- else if (components[1].includes('/')) {
49
- NpmName.setNameAndScope(components[1], returnNpmName);
50
- }
51
- else {
52
- // Allow something like salesforcedx/pre-release
53
- NpmName.setNameAndScope(components[0], returnNpmName);
54
- returnNpmName.tag = components[1];
55
- }
56
- if (components.length > 2) {
57
- returnNpmName.tag = components[2];
58
- }
59
- return returnNpmName;
60
- }
61
- /**
62
- * Static helper to parse the name and scope.
63
- *
64
- * @param {string} name - The string to parse.
65
- * @param {NpmNameInfo} returnNpmName - The object to update.
66
- */
67
- static setNameAndScope(name, returnNpmName) {
68
- // There are at least 2 components. So there is likely a scope.
69
- const subComponents = name.split('/');
70
- if (subComponents.length === 2 && subComponents[0].trim().length > 0 && subComponents[1].trim().length > 0) {
71
- returnNpmName.scope = NpmName.validateComponentString(subComponents[0]);
72
- returnNpmName.name = NpmName.validateComponentString(subComponents[1]);
73
- }
74
- else if (subComponents.length === 1) {
75
- returnNpmName.name = NpmName.validateComponentString(subComponents[0]);
76
- }
77
- else {
78
- throw setErrorName(new SfError('The npm name is invalid.', 'InvalidNpmName'), 'InvalidNpmName');
79
- }
80
- }
81
- /**
82
- * Validate a component part that it's not empty and return it trimmed.
83
- *
84
- * @param {string} name The component to validate.
85
- * @return {string} A whitespace trimmed version of the component.
86
- */
87
- static validateComponentString(name) {
88
- const trimmedName = name.trim();
89
- if (trimmedName && trimmedName.length > 0) {
90
- return trimmedName;
91
- }
92
- else {
93
- throw setErrorName(new SfError('The npm name is missing or invalid.', 'MissingOrInvalidNpmName'), 'MissingOrInvalidNpmName');
94
- }
95
- }
96
- /**
97
- * Produce a string that can be used by npm. @salesforce/jj@1.2.3 becomes "salesforce-jj-1.2.3.tgz
98
- *
99
- * @param {string} [ext = tgz] The file extension to use.
100
- * @param {boolean} includeLatestTag - True if the "latest" tag should be used. Generally you wouldn't do this.
101
- * @return {string} Formatted npm string thats compatible with the npm utility
102
- */
103
- toFilename(ext = 'tgz', includeLatestTag) {
104
- const nameComponents = [];
105
- if (this.scope) {
106
- nameComponents.push(this.scope);
107
- }
108
- nameComponents.push(this.name);
109
- if (this.tag) {
110
- if (this.tag !== NpmName.DEFAULT_TAG) {
111
- nameComponents.push(this.tag);
112
- }
113
- else if (includeLatestTag) {
114
- nameComponents.push(this.tag);
115
- }
116
- }
117
- return nameComponents.join('-').concat(ext.startsWith('.') ? ext : `.${ext}`);
118
- }
119
- /**
120
- * Produces a formatted string version of the object.
121
- *
122
- * @return {string} A formatted string version of the object.
123
- */
124
- toString(includeTag = false) {
125
- const nameComponents = [];
126
- if (this.scope && this.scope.length > 0) {
127
- nameComponents.push(`@${this.scope}/`);
128
- }
129
- nameComponents.push(this.name);
130
- if (includeTag && this.tag && this.tag.length > 0) {
131
- nameComponents.push(`@${this.tag}`);
132
- }
133
- return nameComponents.join('');
134
- }
135
- }
136
- //# sourceMappingURL=NpmName.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NpmName.js","sourceRoot":"","sources":["../../src/shared/NpmName.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C;;;;;;GAMG;AACH,MAAM,OAAO,OAAO;IACX,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC;IACvC,GAAG,CAAS;IACnB,uDAAuD;IACvD,oDAAoD;IAC7C,KAAK,CAAU;IACf,IAAI,CAAU;IAErB;;OAEG;IACH;QACE,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC;IACjC,CAAC;IACD;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,OAAe;QACjC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,YAAY,CAChB,IAAI,OAAO,CAAC,qCAAqC,EAAE,yBAAyB,CAAC,EAC7E,yBAAyB,CAC1B,CAAC;QACJ,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;QAEpC,MAAM,UAAU,GAAa,OAAO,CAAC,KAAK,CAAC,GAAG,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