@forge/util 1.4.0 → 1.4.1-next.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/packages/analytics-node-client/src/index.js +1 -1
  4. package/packages/ari/_tsup-dts-rollup.d.ts +331 -0
  5. package/packages/ari/beacon/custom-detection/index.d.ts +3 -0
  6. package/packages/ari/beacon/custom-detection/index.js +346 -0
  7. package/packages/ari/beacon/custom-detection/index.mjs +17 -0
  8. package/packages/ari/beacon/custom-detection/types.d.ts +3 -0
  9. package/packages/ari/beacon/custom-detection/types.js +29 -0
  10. package/packages/ari/beacon/custom-detection/types.mjs +8 -0
  11. package/packages/ari/beacon/index.d.ts +1 -0
  12. package/packages/ari/beacon/index.js +64 -0
  13. package/packages/ari/beacon/index.mjs +13 -8
  14. package/packages/ari/bitbucket/index.mjs +8 -8
  15. package/packages/ari/brie/index.mjs +4 -4
  16. package/packages/ari/canvas/index.mjs +4 -4
  17. package/packages/ari/chunk-5DRIX3CB.mjs +7 -0
  18. package/packages/ari/chunk-6YGOGAWM.mjs +7 -0
  19. package/packages/ari/chunk-AWSUWYDF.mjs +80 -0
  20. package/packages/ari/chunk-BGUJ6GY2.mjs +62 -0
  21. package/packages/ari/chunk-D5S55TXO.mjs +7 -0
  22. package/packages/ari/chunk-DFCDGB7O.mjs +80 -0
  23. package/packages/ari/chunk-IUUUDGF6.mjs +7 -0
  24. package/packages/ari/chunk-OWEX3L44.mjs +7 -0
  25. package/packages/ari/chunk-PVBPUKXI.mjs +7 -0
  26. package/packages/ari/chunk-PXLAHM4C.mjs +73 -0
  27. package/packages/ari/chunk-QSH6F5SY.mjs +7 -0
  28. package/packages/ari/chunk-SCWWMMV2.mjs +80 -0
  29. package/packages/ari/chunk-SNAPC4SA.mjs +7 -0
  30. package/packages/ari/chunk-T3KJWGQY.mjs +73 -0
  31. package/packages/ari/chunk-TULGFGJW.mjs +69 -0
  32. package/packages/ari/chunk-WLBIOO7O.mjs +76 -0
  33. package/packages/ari/chunk-XB3V3IB3.mjs +66 -0
  34. package/packages/ari/chunk-XL2VWTF2.mjs +7 -0
  35. package/packages/ari/chunk-YNVYZG5X.mjs +0 -0
  36. package/packages/ari/cmdb/index.mjs +4 -4
  37. package/packages/ari/commerce/index.mjs +14 -14
  38. package/packages/ari/compass/index.mjs +14 -14
  39. package/packages/ari/confluence/index.mjs +17 -17
  40. package/packages/ari/conversational-help/index.mjs +4 -4
  41. package/packages/ari/devops/index.mjs +4 -4
  42. package/packages/ari/ecosystem/index.mjs +4 -4
  43. package/packages/ari/google/index.mjs +4 -4
  44. package/packages/ari/graph/index.d.ts +2 -0
  45. package/packages/ari/graph/index.js +127 -0
  46. package/packages/ari/graph/index.mjs +48 -38
  47. package/packages/ari/graph/post-incident-review/index.d.ts +3 -0
  48. package/packages/ari/graph/post-incident-review/index.js +342 -0
  49. package/packages/ari/graph/post-incident-review/index.mjs +17 -0
  50. package/packages/ari/graph/post-incident-review/types.d.ts +3 -0
  51. package/packages/ari/graph/post-incident-review/types.js +29 -0
  52. package/packages/ari/graph/post-incident-review/types.mjs +8 -0
  53. package/packages/ari/graph/post-incident-review-history/index.d.ts +3 -0
  54. package/packages/ari/graph/post-incident-review-history/index.js +349 -0
  55. package/packages/ari/graph/post-incident-review-history/index.mjs +17 -0
  56. package/packages/ari/graph/post-incident-review-history/types.d.ts +3 -0
  57. package/packages/ari/graph/post-incident-review-history/types.js +29 -0
  58. package/packages/ari/graph/post-incident-review-history/types.mjs +8 -0
  59. package/packages/ari/help/index.mjs +8 -8
  60. package/packages/ari/identity/index.mjs +11 -11
  61. package/packages/ari/index.d.ts +1 -0
  62. package/packages/ari/index.js +55 -2
  63. package/packages/ari/index.mjs +365 -343
  64. package/packages/ari/jira/index.d.ts +2 -0
  65. package/packages/ari/jira/index.js +135 -0
  66. package/packages/ari/jira/index.mjs +82 -72
  67. package/packages/ari/jira/post-incident-review/index.d.ts +3 -0
  68. package/packages/ari/jira/post-incident-review/index.js +346 -0
  69. package/packages/ari/jira/post-incident-review/index.mjs +17 -0
  70. package/packages/ari/jira/post-incident-review/types.d.ts +3 -0
  71. package/packages/ari/jira/post-incident-review/types.js +29 -0
  72. package/packages/ari/jira/post-incident-review/types.mjs +8 -0
  73. package/packages/ari/jira/post-incident-review-history/index.d.ts +3 -0
  74. package/packages/ari/jira/post-incident-review-history/index.js +353 -0
  75. package/packages/ari/jira/post-incident-review-history/index.mjs +17 -0
  76. package/packages/ari/jira/post-incident-review-history/types.d.ts +3 -0
  77. package/packages/ari/jira/post-incident-review-history/types.js +29 -0
  78. package/packages/ari/jira/post-incident-review-history/types.mjs +8 -0
  79. package/packages/ari/jira-align/epic/index.d.ts +3 -0
  80. package/packages/ari/jira-align/epic/index.js +339 -0
  81. package/packages/ari/jira-align/epic/index.mjs +17 -0
  82. package/packages/ari/jira-align/epic/types.d.ts +3 -0
  83. package/packages/ari/jira-align/epic/types.js +29 -0
  84. package/packages/ari/jira-align/epic/types.mjs +8 -0
  85. package/packages/ari/jira-align/index.d.ts +1 -0
  86. package/packages/ari/jira-align/index.js +57 -0
  87. package/packages/ari/jira-align/index.mjs +6 -1
  88. package/packages/ari/jira-software/card-color/index.d.ts +3 -0
  89. package/packages/ari/jira-software/card-color/index.js +353 -0
  90. package/packages/ari/jira-software/card-color/index.mjs +17 -0
  91. package/packages/ari/jira-software/card-color/types.d.ts +3 -0
  92. package/packages/ari/jira-software/card-color/types.js +29 -0
  93. package/packages/ari/jira-software/card-color/types.mjs +8 -0
  94. package/packages/ari/jira-software/card-layout/index.d.ts +3 -0
  95. package/packages/ari/jira-software/card-layout/index.js +353 -0
  96. package/packages/ari/jira-software/card-layout/index.mjs +17 -0
  97. package/packages/ari/jira-software/card-layout/types.d.ts +3 -0
  98. package/packages/ari/jira-software/card-layout/types.js +29 -0
  99. package/packages/ari/jira-software/card-layout/types.mjs +8 -0
  100. package/packages/ari/jira-software/index.d.ts +2 -0
  101. package/packages/ari/jira-software/index.js +142 -0
  102. package/packages/ari/jira-software/index.mjs +27 -17
  103. package/packages/ari/marketplace/index.d.ts +1 -0
  104. package/packages/ari/marketplace/index.js +331 -0
  105. package/packages/ari/marketplace/index.mjs +13 -0
  106. package/packages/ari/marketplace/team/index.d.ts +3 -0
  107. package/packages/ari/marketplace/team/index.js +335 -0
  108. package/packages/ari/marketplace/team/index.mjs +17 -0
  109. package/packages/ari/marketplace/team/types.d.ts +3 -0
  110. package/packages/ari/marketplace/team/types.js +29 -0
  111. package/packages/ari/marketplace/team/types.mjs +8 -0
  112. package/packages/ari/measurement/index.mjs +4 -4
  113. package/packages/ari/mercury/index.mjs +8 -8
  114. package/packages/ari/opsgenie/index.mjs +28 -28
  115. package/packages/ari/package.json +1 -1
  116. package/packages/ari/papi/index.mjs +4 -4
  117. package/packages/ari/people-perftool/index.mjs +4 -4
  118. package/packages/ari/platform/index.mjs +8 -8
  119. package/packages/ari/resource-types/card-color.d.ts +1 -0
  120. package/packages/ari/resource-types/card-color.js +27 -0
  121. package/packages/ari/resource-types/card-color.mjs +5 -0
  122. package/packages/ari/resource-types/card-layout.d.ts +1 -0
  123. package/packages/ari/resource-types/card-layout.js +27 -0
  124. package/packages/ari/resource-types/card-layout.mjs +5 -0
  125. package/packages/ari/resource-types/custom-detection.d.ts +1 -0
  126. package/packages/ari/resource-types/custom-detection.js +27 -0
  127. package/packages/ari/resource-types/custom-detection.mjs +5 -0
  128. package/packages/ari/resource-types/embed.d.ts +1 -0
  129. package/packages/ari/resource-types/embed.js +27 -0
  130. package/packages/ari/resource-types/embed.mjs +5 -0
  131. package/packages/ari/resource-types/post-incident-review-history.d.ts +1 -0
  132. package/packages/ari/resource-types/post-incident-review-history.js +27 -0
  133. package/packages/ari/resource-types/post-incident-review-history.mjs +5 -0
  134. package/packages/ari/resource-types/post-incident-review.d.ts +1 -0
  135. package/packages/ari/resource-types/post-incident-review.js +27 -0
  136. package/packages/ari/resource-types/post-incident-review.mjs +5 -0
  137. package/packages/ari/statuspage/index.mjs +4 -4
  138. package/packages/ari/townsquare/index.mjs +4 -4
  139. package/packages/ari/trello/index.mjs +4 -4
  140. package/packages/ari/virtual-agent/index.mjs +4 -4
  141. package/packages/logger-interface/CHANGELOG.md +6 -0
  142. package/packages/logger-interface/README.md +3 -1
  143. package/packages/logger-interface/package.json +3 -2
  144. package/packages/metrics-interface/CHANGELOG.md +15 -0
  145. package/packages/metrics-interface/dist/metrics.d.ts +5 -0
  146. package/packages/metrics-interface/dist/metrics.d.ts.map +1 -1
  147. package/packages/metrics-interface/dist/metrics.js +5 -0
  148. package/packages/metrics-interface/dist/metrics.js.map +1 -1
  149. package/packages/metrics-interface/dist/mocks/index.d.ts +8 -1
  150. package/packages/metrics-interface/dist/mocks/index.d.ts.map +1 -1
  151. package/packages/metrics-interface/dist/mocks/index.js +10 -1
  152. package/packages/metrics-interface/dist/mocks/index.js.map +1 -1
  153. package/packages/metrics-interface/package.json +1 -1
  154. /package/packages/ari/{chunk-ENGY2TDF.mjs → chunk-D7D3B454.mjs} +0 -0
  155. /package/packages/ari/{chunk-KNBR3WSA.mjs → chunk-JEDPRILO.mjs} +0 -0
  156. /package/packages/ari/{chunk-PU63LMKI.mjs → chunk-P2RGZTM3.mjs} +0 -0
  157. /package/packages/ari/{chunk-RLLBEQ3Y.mjs → chunk-VPUECY5E.mjs} +0 -0
  158. /package/packages/ari/{chunk-V7XF5L23.mjs → chunk-VZUAPXXZ.mjs} +0 -0
@@ -0,0 +1,331 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+
17
+ // src/marketplace/index.ts
18
+ var marketplace_exports = {};
19
+ __export(marketplace_exports, {
20
+ MarketplaceTeamAri: () => MarketplaceTeamAri
21
+ });
22
+ module.exports = __toCommonJS(marketplace_exports);
23
+
24
+ // src/errors.ts
25
+ var ValidationError = class extends Error {
26
+ };
27
+
28
+ // src/core/rules/cloud-id.ts
29
+ function validateCloudId(cloudId, format = new RegExp("^[a-zA-Z0-9\\-]*$")) {
30
+ if (!cloudId.match(format))
31
+ throw new ValidationError(`Invalid cloud ID, expected ID of format ${format}.`);
32
+ }
33
+
34
+ // src/core/rules/platform-qualifier.ts
35
+ function validatePlatformQualifier(qualifier) {
36
+ if (qualifier !== "cloud")
37
+ throw new ValidationError(`Identifier must have a qualifier of 'cloud'. Received: ${qualifier}`);
38
+ }
39
+
40
+ // src/core/rules/qualifier.ts
41
+ function validateAtiQualifier(qualifier) {
42
+ if (qualifier !== "ati")
43
+ throw new ValidationError(`ATI must have a qualifier of 'ati'. Received: ${qualifier}`);
44
+ }
45
+ function validateAriQualifier(qualifier) {
46
+ if (qualifier !== "ari")
47
+ throw new ValidationError(`ARI must have a qualifier of 'ari'. Received: ${qualifier}`);
48
+ }
49
+
50
+ // src/core/rules/resource-id.ts
51
+ function validateResourceId(id, format = new RegExp("[a-zA-Z0-9\\-_.~@:{}=]+(/[a-zA-Z0-9\\-_.~@:{}=]+)*" /* ANY_RESOURCE_ID */), key = "resourceId") {
52
+ let formatWithCarets = new RegExp(`^${format.source}$`);
53
+ if (!id.match(formatWithCarets))
54
+ throw new ValidationError(`Invalid ${key} - ${id}, expected ID of format ${formatWithCarets}.`);
55
+ }
56
+
57
+ // src/core/rules/resource-id-segments.ts
58
+ function validateResourceIdSegments(resourceIdSegmentValues, resourceIdSegmentFormats) {
59
+ Object.entries(resourceIdSegmentValues).forEach(([resourceIdKey, resourceIdValue]) => {
60
+ validateResourceId(resourceIdValue, resourceIdSegmentFormats == null ? void 0 : resourceIdSegmentFormats[resourceIdKey], resourceIdKey);
61
+ });
62
+ }
63
+
64
+ // src/core/rules/resource-owner.ts
65
+ function validateResourceOwner(owner, expectedResourceOwner) {
66
+ if (expectedResourceOwner && owner !== expectedResourceOwner)
67
+ throw new ValidationError(`Invalid resource owner - ${owner}, expected ${expectedResourceOwner}.`);
68
+ }
69
+
70
+ // src/core/rules/resource-type.ts
71
+ function validateResourceType(type, expectedResourceType) {
72
+ if (expectedResourceType && type !== expectedResourceType)
73
+ throw new ValidationError(`Invalid resource type - ${type}, expected ${expectedResourceType}.`);
74
+ }
75
+
76
+ // src/core/parser/base.ts
77
+ var NUMBER_OF_BASE_SEGMENTS = 5, SEGMENT_SEPARATOR = ":", BaseParser = class {
78
+ static getIdentifierSegments(inputStr, numberOfSegmentsRequired) {
79
+ let allSegments = inputStr.split(SEGMENT_SEPARATOR);
80
+ if (allSegments.length < numberOfSegmentsRequired)
81
+ throw new ValidationError(`Input string must have ${numberOfSegmentsRequired} segments.`);
82
+ if (allSegments.length > numberOfSegmentsRequired) {
83
+ let segments = allSegments.slice(0, NUMBER_OF_BASE_SEGMENTS - 1), segmentsForResourceId = allSegments.slice(NUMBER_OF_BASE_SEGMENTS - 1, allSegments.length);
84
+ return [...segments, segmentsForResourceId.join(SEGMENT_SEPARATOR)];
85
+ }
86
+ return allSegments;
87
+ }
88
+ };
89
+
90
+ // src/core/parser/ari.ts
91
+ var NUMBER_OF_ARI_SEGMENTS = 5, AriParser = class extends BaseParser {
92
+ static fromString(maybeAri, ariProperties) {
93
+ let segments = this.getIdentifierSegments(maybeAri, NUMBER_OF_ARI_SEGMENTS), [qualifier, platformQualifier, resourceOwner, cloudId, resourceTypeAndId] = segments, [resourceType, ...resourceIdSegments] = resourceTypeAndId.split("/"), maybeAriDerivedProperties = {
94
+ qualifier,
95
+ platformQualifier,
96
+ cloudId,
97
+ resourceOwner,
98
+ resourceType,
99
+ resourceId: resourceIdSegments.join("/"),
100
+ resourceIdSegmentValues: ariProperties != null && ariProperties.resourceIdSlug ? this.ariSegmentValuesFromSlug(
101
+ ariProperties.resourceIdSlug,
102
+ resourceIdSegments.join("/"),
103
+ Object.keys(ariProperties.resourceIdSegmentFormats)
104
+ ) : {}
105
+ };
106
+ return this.fromOpts(maybeAriDerivedProperties, ariProperties);
107
+ }
108
+ static fromOpts(maybeAriOpts, ariProperties) {
109
+ let {
110
+ qualifier = "ari",
111
+ platformQualifier = "cloud",
112
+ resourceOwner,
113
+ cloudId,
114
+ resourceId,
115
+ resourceIdSegmentValues,
116
+ resourceType
117
+ } = maybeAriOpts;
118
+ return validateAriQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateCloudId(maybeAriOpts.cloudId || "", ariProperties == null ? void 0 : ariProperties.cloudId), validateResourceOwner(resourceOwner, ariProperties == null ? void 0 : ariProperties.resourceOwner), validateResourceType(resourceType, ariProperties == null ? void 0 : ariProperties.resourceType), validateResourceIdSegments(resourceIdSegmentValues, ariProperties == null ? void 0 : ariProperties.resourceIdSegmentFormats), {
119
+ qualifier,
120
+ resourceOwner,
121
+ resourceType,
122
+ platformQualifier,
123
+ cloudId,
124
+ resourceId,
125
+ resourceIdSegmentValues
126
+ };
127
+ }
128
+ static ariSegmentValuesFromSlug(slug, incomingSegments, expectedKeys) {
129
+ let regexpResult = new RegExp("^" + slug.replace(/\{(.*?)\}/g, "(?<$1>.*?)") + "$").exec(incomingSegments);
130
+ if (!regexpResult)
131
+ throw new ValidationError(`Segment '${incomingSegments}' don't match expected slug: ${slug}`);
132
+ return expectedKeys.forEach((expectedKey) => {
133
+ var _a;
134
+ if (!((_a = regexpResult.groups) != null && _a[expectedKey]))
135
+ throw new ValidationError(`No value supplied for '${expectedKey}' based on slug ${slug}`);
136
+ }), regexpResult.groups || {};
137
+ }
138
+ };
139
+
140
+ // src/core/parser/ati.ts
141
+ var NUMBER_OF_ATI_SEGMENTS = 4, AtiParser = class extends BaseParser {
142
+ static fromString(inputStr, atiOpts) {
143
+ let segments = this.getIdentifierSegments(inputStr, NUMBER_OF_ATI_SEGMENTS), [qualifier = "ati", platformQualifier = "cloud", resourceOwner, resourceType] = segments;
144
+ return validateAtiQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateResourceOwner(resourceOwner, atiOpts == null ? void 0 : atiOpts.resourceOwner), validateResourceType(resourceType, atiOpts == null ? void 0 : atiOpts.resourceType), { platformQualifier, resourceOwner, resourceType };
145
+ }
146
+ static fromOpts(maybeAtiOpts, atiOpts) {
147
+ let { qualifier, platformQualifier, resourceOwner, resourceType } = maybeAtiOpts;
148
+ return validateAtiQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateResourceOwner(resourceOwner, atiOpts == null ? void 0 : atiOpts.resourceOwner), validateResourceType(resourceType, atiOpts == null ? void 0 : atiOpts.resourceType), {
149
+ platformQualifier,
150
+ resourceOwner,
151
+ resourceType
152
+ };
153
+ }
154
+ };
155
+
156
+ // src/ati.ts
157
+ var Ati = class _Ati {
158
+ constructor(platformQualifier, resourceOwner, resourceType) {
159
+ this._platformQualifier = platformQualifier, this._resourceOwner = resourceOwner, this._resourceType = resourceType;
160
+ }
161
+ get platformQualifier() {
162
+ return this._platformQualifier;
163
+ }
164
+ get resourceOwner() {
165
+ return this._resourceOwner;
166
+ }
167
+ get resourceType() {
168
+ return this._resourceType;
169
+ }
170
+ static create(opts) {
171
+ return new _Ati(opts.platformQualifier || "cloud", opts.resourceOwner, opts.resourceType);
172
+ }
173
+ static parse(maybeAti, atiOpts) {
174
+ let opts = AtiParser.fromString(maybeAti, atiOpts);
175
+ return new _Ati(opts.platformQualifier, opts.resourceOwner, opts.resourceType);
176
+ }
177
+ toString() {
178
+ return `ati:${this.platformQualifier}:${this.resourceOwner}:${this.resourceType}`;
179
+ }
180
+ toJSON() {
181
+ return this.toString();
182
+ }
183
+ toOpts() {
184
+ return {
185
+ platformQualifier: this._platformQualifier,
186
+ resourceOwner: this._resourceOwner,
187
+ resourceType: this._resourceType
188
+ };
189
+ }
190
+ };
191
+
192
+ // src/core/ari.ts
193
+ var Ari = class {
194
+ constructor(opts) {
195
+ this._ati = Ati.create({
196
+ platformQualifier: "cloud",
197
+ resourceOwner: opts.resourceOwner,
198
+ resourceType: opts.resourceType
199
+ }), this._cloudId = opts.cloudId !== "" ? opts.cloudId : void 0, this._resourceId = opts.resourceId;
200
+ }
201
+ get platformQualifier() {
202
+ return this._ati.platformQualifier;
203
+ }
204
+ get cloudId() {
205
+ return this._cloudId;
206
+ }
207
+ get resourceOwner() {
208
+ return this._ati.resourceOwner;
209
+ }
210
+ get resourceType() {
211
+ return this._ati.resourceType;
212
+ }
213
+ get resourceId() {
214
+ return this._resourceId;
215
+ }
216
+ get ati() {
217
+ return this._ati;
218
+ }
219
+ equals(other) {
220
+ return this.toString() === other.toString();
221
+ }
222
+ toString() {
223
+ return `ari:${this.platformQualifier}:${this.resourceOwner}:${this.cloudId || ""}:${this.resourceType}/${this.resourceId}`;
224
+ }
225
+ toJSON() {
226
+ return this.toString();
227
+ }
228
+ toOpts() {
229
+ return {
230
+ platformQualifier: this.platformQualifier,
231
+ resourceOwner: this.resourceOwner,
232
+ cloudId: this.cloudId,
233
+ resourceType: this.resourceType,
234
+ resourceId: this.resourceId
235
+ };
236
+ }
237
+ };
238
+
239
+ // src/any-ari.ts
240
+ var AnyAri = class _AnyAri extends Ari {
241
+ constructor(opts) {
242
+ super(opts);
243
+ }
244
+ static create(ariOpts, ariStaticOpts) {
245
+ let ariOptsWithDefaults = { ...ariOpts, resourceIdSegmentValues: {} }, validatedOpts = AriParser.fromOpts(ariOptsWithDefaults, ariStaticOpts);
246
+ return new _AnyAri(validatedOpts);
247
+ }
248
+ static parse(maybeAri, ariStaticOpts) {
249
+ let validatedOpts = AriParser.fromString(maybeAri, ariStaticOpts);
250
+ return new _AnyAri(validatedOpts);
251
+ }
252
+ static check(maybeAri) {
253
+ try {
254
+ return _AnyAri.parse(maybeAri.toString()), !0;
255
+ } catch (err) {
256
+ return !1;
257
+ }
258
+ }
259
+ asAnyAri() {
260
+ return this;
261
+ }
262
+ };
263
+
264
+ // src/core/registered-ari.ts
265
+ var RegisteredAri = class extends Ari {
266
+ static check(maybeAri) {
267
+ try {
268
+ return this.parse(maybeAri.toString()), !0;
269
+ } catch (err) {
270
+ return !1;
271
+ }
272
+ }
273
+ asAnyAri() {
274
+ return AnyAri.parse(this.toString());
275
+ }
276
+ };
277
+
278
+ // src/marketplace/team/types.ts
279
+ var MarketplaceTeamAriResourceOwner = "marketplace", MarketplaceTeamAriResourceType = "team";
280
+
281
+ // src/marketplace/team/manifest.ts
282
+ var marketplaceTeamAriStaticOpts = {
283
+ qualifier: "ari",
284
+ platformQualifier: "cloud",
285
+ cloudId: new RegExp("^$"),
286
+ resourceOwner: MarketplaceTeamAriResourceOwner,
287
+ resourceType: MarketplaceTeamAriResourceType,
288
+ resourceIdSlug: "{teamId}",
289
+ resourceIdSegmentFormats: {
290
+ teamId: /[a-zA-Z0-9.\-_~]+/
291
+ // eslint-disable-line no-useless-escape
292
+ }
293
+ };
294
+
295
+ // src/marketplace/team/index.ts
296
+ var MarketplaceTeamAri = class _MarketplaceTeamAri extends RegisteredAri {
297
+ constructor(opts) {
298
+ super(opts);
299
+ this._teamId = opts.resourceIdSegmentValues.teamId;
300
+ }
301
+ get teamId() {
302
+ return this._teamId;
303
+ }
304
+ static create(opts) {
305
+ let derivedOpts = {
306
+ qualifier: marketplaceTeamAriStaticOpts.qualifier,
307
+ platformQualifier: marketplaceTeamAriStaticOpts.platformQualifier,
308
+ cloudId: void 0,
309
+ resourceOwner: marketplaceTeamAriStaticOpts.resourceOwner,
310
+ resourceType: marketplaceTeamAriStaticOpts.resourceType,
311
+ resourceId: `${opts.teamId}`,
312
+ resourceIdSegmentValues: {
313
+ teamId: opts.teamId
314
+ }
315
+ }, ariOpts = AriParser.fromOpts(derivedOpts, marketplaceTeamAriStaticOpts);
316
+ return new _MarketplaceTeamAri(ariOpts);
317
+ }
318
+ static parse(maybeAri) {
319
+ let opts = AriParser.fromString(maybeAri, marketplaceTeamAriStaticOpts);
320
+ return new _MarketplaceTeamAri(opts);
321
+ }
322
+ getVariables() {
323
+ return {
324
+ teamId: this.teamId
325
+ };
326
+ }
327
+ };
328
+ // Annotate the CommonJS export names for ESM import in node:
329
+ 0 && (module.exports = {
330
+ MarketplaceTeamAri
331
+ });
@@ -0,0 +1,13 @@
1
+ import "../chunk-JEDPRILO.mjs";
2
+ import {
3
+ MarketplaceTeamAri
4
+ } from "../chunk-BGUJ6GY2.mjs";
5
+ import "../chunk-IUUUDGF6.mjs";
6
+ import "../chunk-PA4Y7TWI.mjs";
7
+ import "../chunk-NCC2UXNN.mjs";
8
+ import "../chunk-2UUYVBKT.mjs";
9
+ import "../chunk-GDQPXUOZ.mjs";
10
+ import "../chunk-FAZYALZ2.mjs";
11
+ export {
12
+ MarketplaceTeamAri
13
+ };
@@ -0,0 +1,3 @@
1
+ export { MarketplaceTeamAriResourceOwner } from '../../_tsup-dts-rollup';
2
+ export { MarketplaceTeamAriResourceType } from '../../_tsup-dts-rollup';
3
+ export { MarketplaceTeamAri_alias_2 as MarketplaceTeamAri } from '../../_tsup-dts-rollup';
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+
17
+ // src/marketplace/team/index.ts
18
+ var team_exports = {};
19
+ __export(team_exports, {
20
+ MarketplaceTeamAri: () => MarketplaceTeamAri,
21
+ MarketplaceTeamAriResourceOwner: () => MarketplaceTeamAriResourceOwner,
22
+ MarketplaceTeamAriResourceType: () => MarketplaceTeamAriResourceType
23
+ });
24
+ module.exports = __toCommonJS(team_exports);
25
+
26
+ // src/errors.ts
27
+ var ValidationError = class extends Error {
28
+ };
29
+
30
+ // src/core/rules/cloud-id.ts
31
+ function validateCloudId(cloudId, format = new RegExp("^[a-zA-Z0-9\\-]*$")) {
32
+ if (!cloudId.match(format))
33
+ throw new ValidationError(`Invalid cloud ID, expected ID of format ${format}.`);
34
+ }
35
+
36
+ // src/core/rules/platform-qualifier.ts
37
+ function validatePlatformQualifier(qualifier) {
38
+ if (qualifier !== "cloud")
39
+ throw new ValidationError(`Identifier must have a qualifier of 'cloud'. Received: ${qualifier}`);
40
+ }
41
+
42
+ // src/core/rules/qualifier.ts
43
+ function validateAtiQualifier(qualifier) {
44
+ if (qualifier !== "ati")
45
+ throw new ValidationError(`ATI must have a qualifier of 'ati'. Received: ${qualifier}`);
46
+ }
47
+ function validateAriQualifier(qualifier) {
48
+ if (qualifier !== "ari")
49
+ throw new ValidationError(`ARI must have a qualifier of 'ari'. Received: ${qualifier}`);
50
+ }
51
+
52
+ // src/core/rules/resource-id.ts
53
+ function validateResourceId(id, format = new RegExp("[a-zA-Z0-9\\-_.~@:{}=]+(/[a-zA-Z0-9\\-_.~@:{}=]+)*" /* ANY_RESOURCE_ID */), key = "resourceId") {
54
+ let formatWithCarets = new RegExp(`^${format.source}$`);
55
+ if (!id.match(formatWithCarets))
56
+ throw new ValidationError(`Invalid ${key} - ${id}, expected ID of format ${formatWithCarets}.`);
57
+ }
58
+
59
+ // src/core/rules/resource-id-segments.ts
60
+ function validateResourceIdSegments(resourceIdSegmentValues, resourceIdSegmentFormats) {
61
+ Object.entries(resourceIdSegmentValues).forEach(([resourceIdKey, resourceIdValue]) => {
62
+ validateResourceId(resourceIdValue, resourceIdSegmentFormats == null ? void 0 : resourceIdSegmentFormats[resourceIdKey], resourceIdKey);
63
+ });
64
+ }
65
+
66
+ // src/core/rules/resource-owner.ts
67
+ function validateResourceOwner(owner, expectedResourceOwner) {
68
+ if (expectedResourceOwner && owner !== expectedResourceOwner)
69
+ throw new ValidationError(`Invalid resource owner - ${owner}, expected ${expectedResourceOwner}.`);
70
+ }
71
+
72
+ // src/core/rules/resource-type.ts
73
+ function validateResourceType(type, expectedResourceType) {
74
+ if (expectedResourceType && type !== expectedResourceType)
75
+ throw new ValidationError(`Invalid resource type - ${type}, expected ${expectedResourceType}.`);
76
+ }
77
+
78
+ // src/core/parser/base.ts
79
+ var NUMBER_OF_BASE_SEGMENTS = 5, SEGMENT_SEPARATOR = ":", BaseParser = class {
80
+ static getIdentifierSegments(inputStr, numberOfSegmentsRequired) {
81
+ let allSegments = inputStr.split(SEGMENT_SEPARATOR);
82
+ if (allSegments.length < numberOfSegmentsRequired)
83
+ throw new ValidationError(`Input string must have ${numberOfSegmentsRequired} segments.`);
84
+ if (allSegments.length > numberOfSegmentsRequired) {
85
+ let segments = allSegments.slice(0, NUMBER_OF_BASE_SEGMENTS - 1), segmentsForResourceId = allSegments.slice(NUMBER_OF_BASE_SEGMENTS - 1, allSegments.length);
86
+ return [...segments, segmentsForResourceId.join(SEGMENT_SEPARATOR)];
87
+ }
88
+ return allSegments;
89
+ }
90
+ };
91
+
92
+ // src/core/parser/ari.ts
93
+ var NUMBER_OF_ARI_SEGMENTS = 5, AriParser = class extends BaseParser {
94
+ static fromString(maybeAri, ariProperties) {
95
+ let segments = this.getIdentifierSegments(maybeAri, NUMBER_OF_ARI_SEGMENTS), [qualifier, platformQualifier, resourceOwner, cloudId, resourceTypeAndId] = segments, [resourceType, ...resourceIdSegments] = resourceTypeAndId.split("/"), maybeAriDerivedProperties = {
96
+ qualifier,
97
+ platformQualifier,
98
+ cloudId,
99
+ resourceOwner,
100
+ resourceType,
101
+ resourceId: resourceIdSegments.join("/"),
102
+ resourceIdSegmentValues: ariProperties != null && ariProperties.resourceIdSlug ? this.ariSegmentValuesFromSlug(
103
+ ariProperties.resourceIdSlug,
104
+ resourceIdSegments.join("/"),
105
+ Object.keys(ariProperties.resourceIdSegmentFormats)
106
+ ) : {}
107
+ };
108
+ return this.fromOpts(maybeAriDerivedProperties, ariProperties);
109
+ }
110
+ static fromOpts(maybeAriOpts, ariProperties) {
111
+ let {
112
+ qualifier = "ari",
113
+ platformQualifier = "cloud",
114
+ resourceOwner,
115
+ cloudId,
116
+ resourceId,
117
+ resourceIdSegmentValues,
118
+ resourceType
119
+ } = maybeAriOpts;
120
+ return validateAriQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateCloudId(maybeAriOpts.cloudId || "", ariProperties == null ? void 0 : ariProperties.cloudId), validateResourceOwner(resourceOwner, ariProperties == null ? void 0 : ariProperties.resourceOwner), validateResourceType(resourceType, ariProperties == null ? void 0 : ariProperties.resourceType), validateResourceIdSegments(resourceIdSegmentValues, ariProperties == null ? void 0 : ariProperties.resourceIdSegmentFormats), {
121
+ qualifier,
122
+ resourceOwner,
123
+ resourceType,
124
+ platformQualifier,
125
+ cloudId,
126
+ resourceId,
127
+ resourceIdSegmentValues
128
+ };
129
+ }
130
+ static ariSegmentValuesFromSlug(slug, incomingSegments, expectedKeys) {
131
+ let regexpResult = new RegExp("^" + slug.replace(/\{(.*?)\}/g, "(?<$1>.*?)") + "$").exec(incomingSegments);
132
+ if (!regexpResult)
133
+ throw new ValidationError(`Segment '${incomingSegments}' don't match expected slug: ${slug}`);
134
+ return expectedKeys.forEach((expectedKey) => {
135
+ var _a;
136
+ if (!((_a = regexpResult.groups) != null && _a[expectedKey]))
137
+ throw new ValidationError(`No value supplied for '${expectedKey}' based on slug ${slug}`);
138
+ }), regexpResult.groups || {};
139
+ }
140
+ };
141
+
142
+ // src/core/parser/ati.ts
143
+ var NUMBER_OF_ATI_SEGMENTS = 4, AtiParser = class extends BaseParser {
144
+ static fromString(inputStr, atiOpts) {
145
+ let segments = this.getIdentifierSegments(inputStr, NUMBER_OF_ATI_SEGMENTS), [qualifier = "ati", platformQualifier = "cloud", resourceOwner, resourceType] = segments;
146
+ return validateAtiQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateResourceOwner(resourceOwner, atiOpts == null ? void 0 : atiOpts.resourceOwner), validateResourceType(resourceType, atiOpts == null ? void 0 : atiOpts.resourceType), { platformQualifier, resourceOwner, resourceType };
147
+ }
148
+ static fromOpts(maybeAtiOpts, atiOpts) {
149
+ let { qualifier, platformQualifier, resourceOwner, resourceType } = maybeAtiOpts;
150
+ return validateAtiQualifier(qualifier), validatePlatformQualifier(platformQualifier), validateResourceOwner(resourceOwner, atiOpts == null ? void 0 : atiOpts.resourceOwner), validateResourceType(resourceType, atiOpts == null ? void 0 : atiOpts.resourceType), {
151
+ platformQualifier,
152
+ resourceOwner,
153
+ resourceType
154
+ };
155
+ }
156
+ };
157
+
158
+ // src/ati.ts
159
+ var Ati = class _Ati {
160
+ constructor(platformQualifier, resourceOwner, resourceType) {
161
+ this._platformQualifier = platformQualifier, this._resourceOwner = resourceOwner, this._resourceType = resourceType;
162
+ }
163
+ get platformQualifier() {
164
+ return this._platformQualifier;
165
+ }
166
+ get resourceOwner() {
167
+ return this._resourceOwner;
168
+ }
169
+ get resourceType() {
170
+ return this._resourceType;
171
+ }
172
+ static create(opts) {
173
+ return new _Ati(opts.platformQualifier || "cloud", opts.resourceOwner, opts.resourceType);
174
+ }
175
+ static parse(maybeAti, atiOpts) {
176
+ let opts = AtiParser.fromString(maybeAti, atiOpts);
177
+ return new _Ati(opts.platformQualifier, opts.resourceOwner, opts.resourceType);
178
+ }
179
+ toString() {
180
+ return `ati:${this.platformQualifier}:${this.resourceOwner}:${this.resourceType}`;
181
+ }
182
+ toJSON() {
183
+ return this.toString();
184
+ }
185
+ toOpts() {
186
+ return {
187
+ platformQualifier: this._platformQualifier,
188
+ resourceOwner: this._resourceOwner,
189
+ resourceType: this._resourceType
190
+ };
191
+ }
192
+ };
193
+
194
+ // src/core/ari.ts
195
+ var Ari = class {
196
+ constructor(opts) {
197
+ this._ati = Ati.create({
198
+ platformQualifier: "cloud",
199
+ resourceOwner: opts.resourceOwner,
200
+ resourceType: opts.resourceType
201
+ }), this._cloudId = opts.cloudId !== "" ? opts.cloudId : void 0, this._resourceId = opts.resourceId;
202
+ }
203
+ get platformQualifier() {
204
+ return this._ati.platformQualifier;
205
+ }
206
+ get cloudId() {
207
+ return this._cloudId;
208
+ }
209
+ get resourceOwner() {
210
+ return this._ati.resourceOwner;
211
+ }
212
+ get resourceType() {
213
+ return this._ati.resourceType;
214
+ }
215
+ get resourceId() {
216
+ return this._resourceId;
217
+ }
218
+ get ati() {
219
+ return this._ati;
220
+ }
221
+ equals(other) {
222
+ return this.toString() === other.toString();
223
+ }
224
+ toString() {
225
+ return `ari:${this.platformQualifier}:${this.resourceOwner}:${this.cloudId || ""}:${this.resourceType}/${this.resourceId}`;
226
+ }
227
+ toJSON() {
228
+ return this.toString();
229
+ }
230
+ toOpts() {
231
+ return {
232
+ platformQualifier: this.platformQualifier,
233
+ resourceOwner: this.resourceOwner,
234
+ cloudId: this.cloudId,
235
+ resourceType: this.resourceType,
236
+ resourceId: this.resourceId
237
+ };
238
+ }
239
+ };
240
+
241
+ // src/any-ari.ts
242
+ var AnyAri = class _AnyAri extends Ari {
243
+ constructor(opts) {
244
+ super(opts);
245
+ }
246
+ static create(ariOpts, ariStaticOpts) {
247
+ let ariOptsWithDefaults = { ...ariOpts, resourceIdSegmentValues: {} }, validatedOpts = AriParser.fromOpts(ariOptsWithDefaults, ariStaticOpts);
248
+ return new _AnyAri(validatedOpts);
249
+ }
250
+ static parse(maybeAri, ariStaticOpts) {
251
+ let validatedOpts = AriParser.fromString(maybeAri, ariStaticOpts);
252
+ return new _AnyAri(validatedOpts);
253
+ }
254
+ static check(maybeAri) {
255
+ try {
256
+ return _AnyAri.parse(maybeAri.toString()), !0;
257
+ } catch (err) {
258
+ return !1;
259
+ }
260
+ }
261
+ asAnyAri() {
262
+ return this;
263
+ }
264
+ };
265
+
266
+ // src/core/registered-ari.ts
267
+ var RegisteredAri = class extends Ari {
268
+ static check(maybeAri) {
269
+ try {
270
+ return this.parse(maybeAri.toString()), !0;
271
+ } catch (err) {
272
+ return !1;
273
+ }
274
+ }
275
+ asAnyAri() {
276
+ return AnyAri.parse(this.toString());
277
+ }
278
+ };
279
+
280
+ // src/marketplace/team/types.ts
281
+ var MarketplaceTeamAriResourceOwner = "marketplace", MarketplaceTeamAriResourceType = "team";
282
+
283
+ // src/marketplace/team/manifest.ts
284
+ var marketplaceTeamAriStaticOpts = {
285
+ qualifier: "ari",
286
+ platformQualifier: "cloud",
287
+ cloudId: new RegExp("^$"),
288
+ resourceOwner: MarketplaceTeamAriResourceOwner,
289
+ resourceType: MarketplaceTeamAriResourceType,
290
+ resourceIdSlug: "{teamId}",
291
+ resourceIdSegmentFormats: {
292
+ teamId: /[a-zA-Z0-9.\-_~]+/
293
+ // eslint-disable-line no-useless-escape
294
+ }
295
+ };
296
+
297
+ // src/marketplace/team/index.ts
298
+ var MarketplaceTeamAri = class _MarketplaceTeamAri extends RegisteredAri {
299
+ constructor(opts) {
300
+ super(opts);
301
+ this._teamId = opts.resourceIdSegmentValues.teamId;
302
+ }
303
+ get teamId() {
304
+ return this._teamId;
305
+ }
306
+ static create(opts) {
307
+ let derivedOpts = {
308
+ qualifier: marketplaceTeamAriStaticOpts.qualifier,
309
+ platformQualifier: marketplaceTeamAriStaticOpts.platformQualifier,
310
+ cloudId: void 0,
311
+ resourceOwner: marketplaceTeamAriStaticOpts.resourceOwner,
312
+ resourceType: marketplaceTeamAriStaticOpts.resourceType,
313
+ resourceId: `${opts.teamId}`,
314
+ resourceIdSegmentValues: {
315
+ teamId: opts.teamId
316
+ }
317
+ }, ariOpts = AriParser.fromOpts(derivedOpts, marketplaceTeamAriStaticOpts);
318
+ return new _MarketplaceTeamAri(ariOpts);
319
+ }
320
+ static parse(maybeAri) {
321
+ let opts = AriParser.fromString(maybeAri, marketplaceTeamAriStaticOpts);
322
+ return new _MarketplaceTeamAri(opts);
323
+ }
324
+ getVariables() {
325
+ return {
326
+ teamId: this.teamId
327
+ };
328
+ }
329
+ };
330
+ // Annotate the CommonJS export names for ESM import in node:
331
+ 0 && (module.exports = {
332
+ MarketplaceTeamAri,
333
+ MarketplaceTeamAriResourceOwner,
334
+ MarketplaceTeamAriResourceType
335
+ });
@@ -0,0 +1,17 @@
1
+ import {
2
+ MarketplaceTeamAri
3
+ } from "../../chunk-BGUJ6GY2.mjs";
4
+ import {
5
+ MarketplaceTeamAriResourceOwner,
6
+ MarketplaceTeamAriResourceType
7
+ } from "../../chunk-IUUUDGF6.mjs";
8
+ import "../../chunk-PA4Y7TWI.mjs";
9
+ import "../../chunk-NCC2UXNN.mjs";
10
+ import "../../chunk-2UUYVBKT.mjs";
11
+ import "../../chunk-GDQPXUOZ.mjs";
12
+ import "../../chunk-FAZYALZ2.mjs";
13
+ export {
14
+ MarketplaceTeamAri,
15
+ MarketplaceTeamAriResourceOwner,
16
+ MarketplaceTeamAriResourceType
17
+ };