@pnp/cli-microsoft365 11.3.0 → 11.4.0-beta.0b6d893

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.
@@ -47,7 +47,7 @@ class ExternalItemAddCommand extends GraphCommand {
47
47
  // we need to rewrite the @odata properties to the correct format
48
48
  // to extract multiple values for collections into arrays
49
49
  this.rewriteCollectionProperties(args.options);
50
- this.addUnknownOptionsToPayload(requestBody, args.options);
50
+ this.addUnknownOptionsToPayload(requestBody.properties, args.options);
51
51
  const requestOptions = {
52
52
  url: `${this.resource}/v1.0/external/connections/${args.options.externalConnectionId}/items/${args.options.id}`,
53
53
  headers: {
@@ -9,7 +9,7 @@ import request from '../../../../request.js';
9
9
  const options = globalOptionsZod
10
10
  .extend({
11
11
  name: zod.alias('n', z.string()),
12
- description: zod.alias('d', z.string()).optional(),
12
+ description: zod.alias('d', z.string().optional()),
13
13
  containerTypeId: z.string()
14
14
  .refine(id => validation.isValidGuid(id), id => ({
15
15
  message: `'${id}' is not a valid GUID.`
@@ -9,8 +9,8 @@ import request from '../../../../request.js';
9
9
  import { cli } from '../../../../cli/cli.js';
10
10
  const options = globalOptionsZod
11
11
  .extend({
12
- id: zod.alias('i', z.string()).optional(),
13
- name: zod.alias('n', z.string()).optional(),
12
+ id: zod.alias('i', z.string().optional()),
13
+ name: zod.alias('n', z.string().optional()),
14
14
  containerTypeId: z.string()
15
15
  .refine(id => validation.isValidGuid(id), id => ({
16
16
  message: `'${id}' is not a valid GUID.`
@@ -1,8 +1,15 @@
1
- import { lt, valid, validRange } from 'semver';
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _DependencyRule_instances, _DependencyRule_needsUpdate, _DependencyRule_getMaxVersion;
7
+ import semver from 'semver';
2
8
  import { JsonRule } from '../../JsonRule.js';
3
9
  export class DependencyRule extends JsonRule {
4
10
  constructor(packageName, packageVersion, isDevDep = false, isOptional = false, add = true) {
5
11
  super();
12
+ _DependencyRule_instances.add(this);
6
13
  this.packageName = packageName;
7
14
  this.packageVersion = packageVersion;
8
15
  this.isDevDep = isDevDep;
@@ -39,23 +46,13 @@ export class DependencyRule extends JsonRule {
39
46
  }
40
47
  const projectDependencies = this.isDevDep ? project.packageJson.devDependencies : project.packageJson.dependencies;
41
48
  const versionEntry = projectDependencies ? projectDependencies[this.packageName] : '';
42
- const packageVersion = valid(versionEntry);
43
- const versionRange = validRange(versionEntry);
44
49
  if (this.add) {
45
50
  let jsonProperty = this.isDevDep ? 'devDependencies' : 'dependencies';
46
51
  if (versionEntry) {
47
52
  jsonProperty += `.${this.packageName}`;
48
- if (packageVersion) {
49
- if (lt(packageVersion, this.packageVersion)) {
50
- const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
51
- this.addFindingWithPosition(findings, node);
52
- }
53
- }
54
- else {
55
- if (versionRange) {
56
- const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
57
- this.addFindingWithPosition(findings, node);
58
- }
53
+ if (__classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_needsUpdate).call(this, this.packageVersion, versionEntry)) {
54
+ const node = this.getAstNodeFromFile(project.packageJson, jsonProperty);
55
+ this.addFindingWithPosition(findings, node);
59
56
  }
60
57
  }
61
58
  else {
@@ -78,4 +75,49 @@ export class DependencyRule extends JsonRule {
78
75
  }
79
76
  }
80
77
  }
78
+ _DependencyRule_instances = new WeakSet(), _DependencyRule_needsUpdate = function _DependencyRule_needsUpdate(ruleVersion, currentVersion) {
79
+ try {
80
+ // Get minimum versions for both
81
+ const ruleMin = semver.minVersion(ruleVersion);
82
+ const currentMin = semver.minVersion(currentVersion);
83
+ // Check if ranges overlap
84
+ const rangesOverlap = semver.intersects(ruleVersion, currentVersion);
85
+ if (rangesOverlap) {
86
+ // Even if they overlap, update if rule requires a higher minimum version
87
+ if (ruleMin && currentMin && semver.gt(ruleMin, currentMin)) {
88
+ return true;
89
+ }
90
+ return false;
91
+ }
92
+ // Ranges don't overlap - check if rule range is greater
93
+ // Get the maximum version that satisfies the current range
94
+ const currentMax = __classPrivateFieldGet(this, _DependencyRule_instances, "m", _DependencyRule_getMaxVersion).call(this, currentVersion);
95
+ // If rule's minimum is greater than current's maximum, update is needed
96
+ return !!(ruleMin && currentMax && semver.gt(ruleMin, currentMax));
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }, _DependencyRule_getMaxVersion = function _DependencyRule_getMaxVersion(range) {
102
+ const rangeObj = new semver.Range(range);
103
+ // If it's a specific version (no range operators), return it
104
+ if (semver.valid(range)) {
105
+ return semver.parse(range);
106
+ }
107
+ // For ranges, get the highest version from the set
108
+ // Check the range set to find upper bounds
109
+ let maxVer = null;
110
+ for (const comparatorSet of rangeObj.set) {
111
+ for (const comparator of comparatorSet) {
112
+ if (comparator.operator === '<' || comparator.operator === '<=') {
113
+ const ver = comparator.semver;
114
+ if (!maxVer || semver.gt(ver, maxVer)) {
115
+ maxVer = ver;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ // If no upper bound found, use minVersion as fallback
121
+ return maxVer || semver.minVersion(range);
122
+ };
81
123
  //# sourceMappingURL=DependencyRule.js.map