@forge/util 4.0.1-next.0 → 4.1.0-next.1-experimental-a5f8a43

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.
@@ -0,0 +1 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=class extends Error{};function t(t){if(t!==`cloud`&&t!==`third-party`)throw new e(`Identifier must have a qualifier of 'cloud' or 'third-party'. Received: ${t}`)}function n(t){if(t!==`ati`)throw new e(`ATI must have a qualifier of 'ati'. Received: ${t}`)}function r(t){if(t!==`ari`)throw new e(`ARI must have a qualifier of 'ari'. Received: ${t}`)}var i=5,a=`:`,o=class{static getIdentifierSegments(t,n){let r=t.split(a);if(r.length<n)throw new e(`Input string must have ${n} segments.`);if(r.length>n){let e=r.slice(0,i-1),t=r.slice(i-1,r.length);return[...e,t.join(a)]}return r}};function s(t,n=/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{0,255}$`)){if(!t.match(n))throw new e(`Invalid cloud ID, expected ID of format ${n}.`)}function c(t,n=/* @__PURE__ */ RegExp(`[!a-zA-Z0-9\\-_.~@:;{}=]+(/[!a-zA-Z0-9\\-_.~@:;{}=]+)*`),r=`resourceId`){let i=RegExp(`^${n.source}$`);if(!t.match(i))throw new e(`Invalid ${r} - ${t}, expected ID of format ${i}.`)}function l(e,t){Object.entries(e).forEach(([e,n])=>{c(n,t?.[e],e)})}function u(t,n){if(n&&t!==n)throw new e(`Invalid resource owner - ${t}, expected ${n}.`)}function d(t,n){if(n&&t!==n)throw new e(`Invalid resource type - ${t}, expected ${n}.`)}var f=5,p=class extends o{static fromString(e,t){let[n,r,i,a,o]=this.getIdentifierSegments(e,f),[s,...c]=o.split(`/`),l={qualifier:n,platformQualifier:r,cloudId:a,resourceOwner:i,resourceType:s,resourceId:c.join(`/`),resourceIdSegmentValues:t!=null&&t.resourceIdSlug?this.ariSegmentValuesFromSlug(t.resourceIdSlug,c.join(`/`),Object.keys(t.resourceIdSegmentFormats)):{}};return this.fromOpts(l,t)}static fromOpts(e,n){let{qualifier:i=`ari`,platformQualifier:a=`cloud`,resourceOwner:o,cloudId:c,resourceId:f,resourceIdSegmentValues:p,resourceType:m}=e;return r(i),t(a),s(e.cloudId||``,n?.cloudId),u(o,n?.resourceOwner),d(m,n?.resourceType),l(p,n?.resourceIdSegmentFormats),{qualifier:i,resourceOwner:o,resourceType:m,platformQualifier:a,cloudId:c,resourceId:f,resourceIdSegmentValues:p}}static ariSegmentValuesFromSlug(t,n,r){let i=RegExp(`^`+t.replace(/\{(.*?)\}/g,`(?<$1>.*?)`)+`$`).exec(n);if(!i)throw new e(`Segment '${n}' don't match expected slug: ${t}`);return r.forEach(n=>{var r;if(!((r=i.groups)!=null&&r[n]))throw new e(`No value supplied for '${n}' based on slug ${t}`)}),i.groups||{}}},m=4,h=class extends o{static fromString(e,r){let[i=`ati`,a=`cloud`,o,s]=this.getIdentifierSegments(e,m);return n(i),t(a),u(o,r?.resourceOwner),d(s,r?.resourceType),{platformQualifier:a,resourceOwner:o,resourceType:s}}static fromOpts(e,r){let{qualifier:i,platformQualifier:a,resourceOwner:o,resourceType:s}=e;return n(i),t(a),u(o,r?.resourceOwner),d(s,r?.resourceType),{platformQualifier:a,resourceOwner:o,resourceType:s}}},g=class e{constructor(e,t,n){this._platformQualifier=e,this._resourceOwner=t,this._resourceType=n}get platformQualifier(){return this._platformQualifier}get resourceOwner(){return this._resourceOwner}get resourceType(){return this._resourceType}static create(t){return new e(t.platformQualifier||`cloud`,t.resourceOwner,t.resourceType)}static parse(t,n){let r=h.fromString(t,n);return new e(r.platformQualifier,r.resourceOwner,r.resourceType)}toString(){return`ati:${this.platformQualifier}:${this.resourceOwner}:${this.resourceType}`}toJSON(){return this.toString()}toOpts(){return{platformQualifier:this._platformQualifier,resourceOwner:this._resourceOwner,resourceType:this._resourceType}}},_=class{constructor(e){this._ati=g.create({platformQualifier:e.platformQualifier||`cloud`,resourceOwner:e.resourceOwner,resourceType:e.resourceType}),this._cloudId=e.cloudId===``?void 0:e.cloudId,this._resourceId=e.resourceId}get platformQualifier(){return this._ati.platformQualifier}get cloudId(){return this._cloudId}get resourceOwner(){return this._ati.resourceOwner}get resourceType(){return this._ati.resourceType}get resourceId(){return this._resourceId}get ati(){return this._ati}equals(e){return this.toString()===e.toString()}toString(){return`ari:${this.platformQualifier}:${this.resourceOwner}:${this.cloudId||``}:${this.resourceType}/${this.resourceId}`}toJSON(){return this.toString()}toOpts(){return{platformQualifier:this.platformQualifier,resourceOwner:this.resourceOwner,cloudId:this.cloudId,resourceType:this.resourceType,resourceId:this.resourceId}}},v=class e extends _{constructor(e){super(e)}static create(t,n){let r={...t,resourceIdSegmentValues:{}},i=p.fromOpts(r,n);return new e(i)}static parse(t,n){let r=p.fromString(t,n);return new e(r)}static check(t){try{return e.parse(t.toString()),!0}catch{return!1}}asAnyAri(){return this}},y=class extends _{static check(e){try{return this.parse(e.toString()),!0}catch{return!1}}asAnyAri(){return v.parse(this.toString())}},b={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`jira`,resourceType:`workspace`,resourceIdSlug:`{activationId}`,resourceIdSegmentFormats:{activationId:/[a-zA-Z0-9\-]+/}},x=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._activationId=e.resourceIdSegmentValues.activationId}get siteId(){return this._siteId}get activationId(){return this._activationId}static create(t){let n={qualifier:b.qualifier,platformQualifier:b.platformQualifier,cloudId:t.siteId,resourceOwner:b.resourceOwner,resourceType:b.resourceType,resourceId:`${t.activationId}`,resourceIdSegmentValues:{activationId:t.activationId}},r=p.fromOpts(n,b);return new e(r)}static parse(t){let n=p.fromString(t,b);return new e(n)}getVariables(){return{siteId:this.siteId,activationId:this.activationId}}},S={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`graph`,resourceType:`workspace`,resourceIdSlug:`{workspaceId}`,resourceIdSegmentFormats:{workspaceId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},C=class e extends y{constructor(e){super(e),this._workspaceId=e.resourceIdSegmentValues.workspaceId}get workspaceId(){return this._workspaceId}static create(t){let n={qualifier:S.qualifier,platformQualifier:S.platformQualifier,cloudId:void 0,resourceOwner:S.resourceOwner,resourceType:S.resourceType,resourceId:`${t.workspaceId}`,resourceIdSegmentValues:{workspaceId:t.workspaceId}},r=p.fromOpts(n,S);return new e(r)}static parse(t){let n=p.fromString(t,S);return new e(n)}getVariables(){return{workspaceId:this.workspaceId}}},w={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app`,resourceIdSlug:`{appId}`,resourceIdSegmentFormats:{appId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},T=class e extends y{constructor(e){super(e),this._appId=e.resourceIdSegmentValues.appId}get appId(){return this._appId}static create(t){let n={qualifier:w.qualifier,platformQualifier:w.platformQualifier,cloudId:void 0,resourceOwner:w.resourceOwner,resourceType:w.resourceType,resourceId:`${t.appId}`,resourceIdSegmentValues:{appId:t.appId}},r=p.fromOpts(n,w);return new e(r)}static parse(t){let n=p.fromString(t,w);return new e(n)}getVariables(){return{appId:this.appId}}},E={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app-environment-version`,resourceIdSlug:`{appId}/{environmentId}/{versionId}`,resourceIdSegmentFormats:{appId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/,environmentId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/,versionId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},D=class e extends y{constructor(e){super(e),this._appId=e.resourceIdSegmentValues.appId,this._environmentId=e.resourceIdSegmentValues.environmentId,this._versionId=e.resourceIdSegmentValues.versionId}get appId(){return this._appId}get environmentId(){return this._environmentId}get versionId(){return this._versionId}static create(t){let n={qualifier:E.qualifier,platformQualifier:E.platformQualifier,cloudId:void 0,resourceOwner:E.resourceOwner,resourceType:E.resourceType,resourceId:`${t.appId}/${t.environmentId}/${t.versionId}`,resourceIdSegmentValues:{appId:t.appId,environmentId:t.environmentId,versionId:t.versionId}},r=p.fromOpts(n,E);return new e(r)}static parse(t){let n=p.fromString(t,E);return new e(n)}getVariables(){return{appId:this.appId,environmentId:this.environmentId,versionId:this.versionId}}},O={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app-placement`,resourceIdSlug:`{placementType}/{placementId}`,resourceIdSegmentFormats:{placementType:/(isolation-context|region|customer-data-plane)/,placementId:/[a-zA-Z0-9-._]+/}},k=class e extends y{constructor(e){super(e),this._placementType=e.resourceIdSegmentValues.placementType,this._placementId=e.resourceIdSegmentValues.placementId}get placementType(){return this._placementType}get placementId(){return this._placementId}static create(t){let n={qualifier:O.qualifier,platformQualifier:O.platformQualifier,cloudId:void 0,resourceOwner:O.resourceOwner,resourceType:O.resourceType,resourceId:`${t.placementType}/${t.placementId}`,resourceIdSegmentValues:{placementType:t.placementType,placementId:t.placementId}},r=p.fromOpts(n,O);return new e(r)}static parse(t){let n=p.fromString(t,O);return new e(n)}getVariables(){return{placementType:this.placementType,placementId:this.placementId}}},A={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`compass`,resourceType:`workspace`,resourceIdSlug:`{workspaceId}`,resourceIdSegmentFormats:{workspaceId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},j=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._workspaceId=e.resourceIdSegmentValues.workspaceId}get siteId(){return this._siteId}get workspaceId(){return this._workspaceId}static create(t){let n={qualifier:A.qualifier,platformQualifier:A.platformQualifier,cloudId:t.siteId,resourceOwner:A.resourceOwner,resourceType:A.resourceType,resourceId:`${t.workspaceId}`,resourceIdSegmentValues:{workspaceId:t.workspaceId}},r=p.fromOpts(n,A);return new e(r)}static parse(t){let n=p.fromString(t,A);return new e(n)}getVariables(){return{siteId:this.siteId,workspaceId:this.workspaceId}}},M={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`confluence`,resourceType:`workspace`,resourceIdSlug:`{activationId}`,resourceIdSegmentFormats:{activationId:/[a-zA-Z0-9\-]+/}},N=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._activationId=e.resourceIdSegmentValues.activationId}get siteId(){return this._siteId}get activationId(){return this._activationId}static create(t){let n={qualifier:M.qualifier,platformQualifier:M.platformQualifier,cloudId:t.siteId,resourceOwner:M.resourceOwner,resourceType:M.resourceType,resourceId:`${t.activationId}`,resourceIdSegmentValues:{activationId:t.activationId}},r=p.fromOpts(n,M);return new e(r)}static parse(t){let n=p.fromString(t,M);return new e(n)}getVariables(){return{siteId:this.siteId,activationId:this.activationId}}};exports.AnyAri=v,exports.Ari=_,exports.CompassWorkspaceAri=j,exports.ConfluenceWorkspaceAri=N,exports.EcosystemAppAri=T,exports.EcosystemAppEnvironmentVersionAri=D,exports.EcosystemAppPlacementAri=k,exports.GraphWorkspaceAri=C,exports.JiraWorkspaceAri=x;
@@ -0,0 +1,218 @@
1
+ declare class AnyAri extends Ari {
2
+ private constructor();
3
+ static create(ariOpts: AriCreateOpts, ariStaticOpts?: AriStaticProperties): AnyAri;
4
+ static parse(maybeAri: string, ariStaticOpts?: AriStaticProperties): AnyAri;
5
+ static check(maybeAri: any): boolean;
6
+ asAnyAri(): this;
7
+ }
8
+ declare abstract class Ari implements AriOpts {
9
+ protected static create: (ariOpts: any, ariStaticOpts?: AriStaticProperties) => Ari;
10
+ protected static parse: (maybeAri: string) => Ari;
11
+ protected static check: (maybeAri: any) => boolean;
12
+ private readonly _ati;
13
+ private readonly _cloudId;
14
+ private readonly _resourceId;
15
+ protected constructor(opts: AriDerivedProperties);
16
+ get platformQualifier(): PlatformQualifier;
17
+ get cloudId(): CloudId;
18
+ get resourceOwner(): string;
19
+ get resourceType(): string;
20
+ get resourceId(): string;
21
+ get ati(): Ati;
22
+ abstract asAnyAri(): AnyAri;
23
+ equals(other: Ari): boolean;
24
+ toString(): string;
25
+ toJSON(): string;
26
+ toOpts(): AriOpts;
27
+ }
28
+ declare interface AriCreateOpts {
29
+ platformQualifier?: PlatformQualifier;
30
+ cloudId?: string | undefined;
31
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
32
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
33
+ resourceId: ResourceId;
34
+ }
35
+ declare interface AriDerivedProperties {
36
+ qualifier: AriQualifier;
37
+ platformQualifier: PlatformQualifier;
38
+ cloudId: CloudId;
39
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
40
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
41
+ resourceId: ResourceId;
42
+ resourceIdSegmentValues: Record<string, ResourceId>;
43
+ }
44
+ declare interface AriOpts {
45
+ platformQualifier: PlatformQualifier;
46
+ cloudId: string | undefined;
47
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
48
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
49
+ resourceId: ResourceId;
50
+ }
51
+ declare type AriQualifier = 'ari';
52
+ declare interface AriStaticProperties {
53
+ qualifier: AriQualifier;
54
+ platformQualifier: PlatformQualifier;
55
+ cloudId: RegExp;
56
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
57
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
58
+ resourceIdSlug: string;
59
+ resourceIdSegmentFormats: Record<string, RegExp>;
60
+ }
61
+ declare class Ati implements AtiOpts {
62
+ private readonly _platformQualifier;
63
+ private readonly _resourceOwner;
64
+ private readonly _resourceType;
65
+ private constructor();
66
+ get platformQualifier(): PlatformQualifier;
67
+ get resourceOwner(): ResourceOwner_alias_1 | UnknownResourceOwner;
68
+ get resourceType(): ResourceType_alias_1 | UnknownResourceType;
69
+ static create(opts: AtiCreateOpts): Ati;
70
+ static parse(maybeAti: string, atiOpts?: AtiStaticProperties): Ati;
71
+ toString(): string;
72
+ toJSON(): string;
73
+ toOpts(): AtiOpts;
74
+ }
75
+ declare interface AtiCreateOpts {
76
+ platformQualifier?: PlatformQualifier;
77
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
78
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
79
+ }
80
+ declare interface AtiOpts {
81
+ platformQualifier: PlatformQualifier;
82
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
83
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
84
+ }
85
+ declare type AtiQualifier = 'ati';
86
+ declare interface AtiStaticProperties {
87
+ qualifier: AtiQualifier;
88
+ platformQualifier: PlatformQualifier;
89
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
90
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
91
+ }
92
+ declare type CloudId = string | undefined;
93
+ declare class CompassWorkspaceAri extends RegisteredAri {
94
+ private constructor();
95
+ private readonly _siteId;
96
+ private readonly _workspaceId;
97
+ get siteId(): string;
98
+ get workspaceId(): string;
99
+ static create(opts: CompassWorkspaceAriOpts): CompassWorkspaceAri;
100
+ static parse(maybeAri: string): CompassWorkspaceAri;
101
+ getVariables(): {
102
+ siteId: string;
103
+ workspaceId: string;
104
+ };
105
+ }
106
+ declare interface CompassWorkspaceAriOpts {
107
+ siteId: string;
108
+ workspaceId: string;
109
+ }
110
+ declare class ConfluenceWorkspaceAri extends RegisteredAri {
111
+ private constructor();
112
+ private readonly _siteId;
113
+ private readonly _activationId;
114
+ get siteId(): string;
115
+ get activationId(): string;
116
+ static create(opts: ConfluenceWorkspaceAriOpts): ConfluenceWorkspaceAri;
117
+ static parse(maybeAri: string): ConfluenceWorkspaceAri;
118
+ getVariables(): {
119
+ siteId: string;
120
+ activationId: string;
121
+ };
122
+ }
123
+ declare interface ConfluenceWorkspaceAriOpts {
124
+ siteId: string;
125
+ activationId: string;
126
+ }
127
+ declare class EcosystemAppAri extends RegisteredAri {
128
+ private constructor();
129
+ private readonly _appId;
130
+ get appId(): string;
131
+ static create(opts: EcosystemAppAriOpts): EcosystemAppAri;
132
+ static parse(maybeAri: string): EcosystemAppAri;
133
+ getVariables(): {
134
+ appId: string;
135
+ };
136
+ }
137
+ declare interface EcosystemAppAriOpts {
138
+ appId: string;
139
+ }
140
+ declare class EcosystemAppEnvironmentVersionAri extends RegisteredAri {
141
+ private constructor();
142
+ private readonly _appId;
143
+ private readonly _environmentId;
144
+ private readonly _versionId;
145
+ get appId(): string;
146
+ get environmentId(): string;
147
+ get versionId(): string;
148
+ static create(opts: EcosystemAppEnvironmentVersionAriOpts): EcosystemAppEnvironmentVersionAri;
149
+ static parse(maybeAri: string): EcosystemAppEnvironmentVersionAri;
150
+ getVariables(): {
151
+ appId: string;
152
+ environmentId: string;
153
+ versionId: string;
154
+ };
155
+ }
156
+ declare interface EcosystemAppEnvironmentVersionAriOpts {
157
+ appId: string;
158
+ environmentId: string;
159
+ versionId: string;
160
+ }
161
+ declare class EcosystemAppPlacementAri extends RegisteredAri {
162
+ private constructor();
163
+ private readonly _placementType;
164
+ private readonly _placementId;
165
+ get placementType(): string;
166
+ get placementId(): string;
167
+ static create(opts: EcosystemAppPlacementAriOpts): EcosystemAppPlacementAri;
168
+ static parse(maybeAri: string): EcosystemAppPlacementAri;
169
+ getVariables(): {
170
+ placementType: string;
171
+ placementId: string;
172
+ };
173
+ }
174
+ declare interface EcosystemAppPlacementAriOpts {
175
+ placementType: string;
176
+ placementId: string;
177
+ }
178
+ declare class GraphWorkspaceAri extends RegisteredAri {
179
+ private constructor();
180
+ private readonly _workspaceId;
181
+ get workspaceId(): string;
182
+ static create(opts: GraphWorkspaceAriOpts): GraphWorkspaceAri;
183
+ static parse(maybeAri: string): GraphWorkspaceAri;
184
+ getVariables(): {
185
+ workspaceId: string;
186
+ };
187
+ }
188
+ declare interface GraphWorkspaceAriOpts {
189
+ workspaceId: string;
190
+ }
191
+ declare class JiraWorkspaceAri extends RegisteredAri {
192
+ private constructor();
193
+ private readonly _siteId;
194
+ private readonly _activationId;
195
+ get siteId(): string;
196
+ get activationId(): string;
197
+ static create(opts: JiraWorkspaceAriOpts): JiraWorkspaceAri;
198
+ static parse(maybeAri: string): JiraWorkspaceAri;
199
+ getVariables(): {
200
+ siteId: string;
201
+ activationId: string;
202
+ };
203
+ }
204
+ declare interface JiraWorkspaceAriOpts {
205
+ siteId: string;
206
+ activationId: string;
207
+ }
208
+ declare type PlatformQualifier = 'cloud' | 'third-party';
209
+ declare abstract class RegisteredAri extends Ari {
210
+ static check(maybeAri: any): boolean;
211
+ asAnyAri(): AnyAri;
212
+ }
213
+ declare type ResourceId = string;
214
+ declare type ResourceOwner_alias_1 = string;
215
+ declare type ResourceType_alias_1 = string;
216
+ declare type UnknownResourceOwner = string;
217
+ declare type UnknownResourceType = string;
218
+ export { AnyAri, Ari, CompassWorkspaceAri, ConfluenceWorkspaceAri, EcosystemAppAri, EcosystemAppEnvironmentVersionAri, EcosystemAppPlacementAri, GraphWorkspaceAri, JiraWorkspaceAri };
@@ -0,0 +1,218 @@
1
+ declare class AnyAri extends Ari {
2
+ private constructor();
3
+ static create(ariOpts: AriCreateOpts, ariStaticOpts?: AriStaticProperties): AnyAri;
4
+ static parse(maybeAri: string, ariStaticOpts?: AriStaticProperties): AnyAri;
5
+ static check(maybeAri: any): boolean;
6
+ asAnyAri(): this;
7
+ }
8
+ declare abstract class Ari implements AriOpts {
9
+ protected static create: (ariOpts: any, ariStaticOpts?: AriStaticProperties) => Ari;
10
+ protected static parse: (maybeAri: string) => Ari;
11
+ protected static check: (maybeAri: any) => boolean;
12
+ private readonly _ati;
13
+ private readonly _cloudId;
14
+ private readonly _resourceId;
15
+ protected constructor(opts: AriDerivedProperties);
16
+ get platformQualifier(): PlatformQualifier;
17
+ get cloudId(): CloudId;
18
+ get resourceOwner(): string;
19
+ get resourceType(): string;
20
+ get resourceId(): string;
21
+ get ati(): Ati;
22
+ abstract asAnyAri(): AnyAri;
23
+ equals(other: Ari): boolean;
24
+ toString(): string;
25
+ toJSON(): string;
26
+ toOpts(): AriOpts;
27
+ }
28
+ declare interface AriCreateOpts {
29
+ platformQualifier?: PlatformQualifier;
30
+ cloudId?: string | undefined;
31
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
32
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
33
+ resourceId: ResourceId;
34
+ }
35
+ declare interface AriDerivedProperties {
36
+ qualifier: AriQualifier;
37
+ platformQualifier: PlatformQualifier;
38
+ cloudId: CloudId;
39
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
40
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
41
+ resourceId: ResourceId;
42
+ resourceIdSegmentValues: Record<string, ResourceId>;
43
+ }
44
+ declare interface AriOpts {
45
+ platformQualifier: PlatformQualifier;
46
+ cloudId: string | undefined;
47
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
48
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
49
+ resourceId: ResourceId;
50
+ }
51
+ declare type AriQualifier = 'ari';
52
+ declare interface AriStaticProperties {
53
+ qualifier: AriQualifier;
54
+ platformQualifier: PlatformQualifier;
55
+ cloudId: RegExp;
56
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
57
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
58
+ resourceIdSlug: string;
59
+ resourceIdSegmentFormats: Record<string, RegExp>;
60
+ }
61
+ declare class Ati implements AtiOpts {
62
+ private readonly _platformQualifier;
63
+ private readonly _resourceOwner;
64
+ private readonly _resourceType;
65
+ private constructor();
66
+ get platformQualifier(): PlatformQualifier;
67
+ get resourceOwner(): ResourceOwner_alias_1 | UnknownResourceOwner;
68
+ get resourceType(): ResourceType_alias_1 | UnknownResourceType;
69
+ static create(opts: AtiCreateOpts): Ati;
70
+ static parse(maybeAti: string, atiOpts?: AtiStaticProperties): Ati;
71
+ toString(): string;
72
+ toJSON(): string;
73
+ toOpts(): AtiOpts;
74
+ }
75
+ declare interface AtiCreateOpts {
76
+ platformQualifier?: PlatformQualifier;
77
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
78
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
79
+ }
80
+ declare interface AtiOpts {
81
+ platformQualifier: PlatformQualifier;
82
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
83
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
84
+ }
85
+ declare type AtiQualifier = 'ati';
86
+ declare interface AtiStaticProperties {
87
+ qualifier: AtiQualifier;
88
+ platformQualifier: PlatformQualifier;
89
+ resourceOwner: ResourceOwner_alias_1 | UnknownResourceOwner;
90
+ resourceType: ResourceType_alias_1 | UnknownResourceType;
91
+ }
92
+ declare type CloudId = string | undefined;
93
+ declare class CompassWorkspaceAri extends RegisteredAri {
94
+ private constructor();
95
+ private readonly _siteId;
96
+ private readonly _workspaceId;
97
+ get siteId(): string;
98
+ get workspaceId(): string;
99
+ static create(opts: CompassWorkspaceAriOpts): CompassWorkspaceAri;
100
+ static parse(maybeAri: string): CompassWorkspaceAri;
101
+ getVariables(): {
102
+ siteId: string;
103
+ workspaceId: string;
104
+ };
105
+ }
106
+ declare interface CompassWorkspaceAriOpts {
107
+ siteId: string;
108
+ workspaceId: string;
109
+ }
110
+ declare class ConfluenceWorkspaceAri extends RegisteredAri {
111
+ private constructor();
112
+ private readonly _siteId;
113
+ private readonly _activationId;
114
+ get siteId(): string;
115
+ get activationId(): string;
116
+ static create(opts: ConfluenceWorkspaceAriOpts): ConfluenceWorkspaceAri;
117
+ static parse(maybeAri: string): ConfluenceWorkspaceAri;
118
+ getVariables(): {
119
+ siteId: string;
120
+ activationId: string;
121
+ };
122
+ }
123
+ declare interface ConfluenceWorkspaceAriOpts {
124
+ siteId: string;
125
+ activationId: string;
126
+ }
127
+ declare class EcosystemAppAri extends RegisteredAri {
128
+ private constructor();
129
+ private readonly _appId;
130
+ get appId(): string;
131
+ static create(opts: EcosystemAppAriOpts): EcosystemAppAri;
132
+ static parse(maybeAri: string): EcosystemAppAri;
133
+ getVariables(): {
134
+ appId: string;
135
+ };
136
+ }
137
+ declare interface EcosystemAppAriOpts {
138
+ appId: string;
139
+ }
140
+ declare class EcosystemAppEnvironmentVersionAri extends RegisteredAri {
141
+ private constructor();
142
+ private readonly _appId;
143
+ private readonly _environmentId;
144
+ private readonly _versionId;
145
+ get appId(): string;
146
+ get environmentId(): string;
147
+ get versionId(): string;
148
+ static create(opts: EcosystemAppEnvironmentVersionAriOpts): EcosystemAppEnvironmentVersionAri;
149
+ static parse(maybeAri: string): EcosystemAppEnvironmentVersionAri;
150
+ getVariables(): {
151
+ appId: string;
152
+ environmentId: string;
153
+ versionId: string;
154
+ };
155
+ }
156
+ declare interface EcosystemAppEnvironmentVersionAriOpts {
157
+ appId: string;
158
+ environmentId: string;
159
+ versionId: string;
160
+ }
161
+ declare class EcosystemAppPlacementAri extends RegisteredAri {
162
+ private constructor();
163
+ private readonly _placementType;
164
+ private readonly _placementId;
165
+ get placementType(): string;
166
+ get placementId(): string;
167
+ static create(opts: EcosystemAppPlacementAriOpts): EcosystemAppPlacementAri;
168
+ static parse(maybeAri: string): EcosystemAppPlacementAri;
169
+ getVariables(): {
170
+ placementType: string;
171
+ placementId: string;
172
+ };
173
+ }
174
+ declare interface EcosystemAppPlacementAriOpts {
175
+ placementType: string;
176
+ placementId: string;
177
+ }
178
+ declare class GraphWorkspaceAri extends RegisteredAri {
179
+ private constructor();
180
+ private readonly _workspaceId;
181
+ get workspaceId(): string;
182
+ static create(opts: GraphWorkspaceAriOpts): GraphWorkspaceAri;
183
+ static parse(maybeAri: string): GraphWorkspaceAri;
184
+ getVariables(): {
185
+ workspaceId: string;
186
+ };
187
+ }
188
+ declare interface GraphWorkspaceAriOpts {
189
+ workspaceId: string;
190
+ }
191
+ declare class JiraWorkspaceAri extends RegisteredAri {
192
+ private constructor();
193
+ private readonly _siteId;
194
+ private readonly _activationId;
195
+ get siteId(): string;
196
+ get activationId(): string;
197
+ static create(opts: JiraWorkspaceAriOpts): JiraWorkspaceAri;
198
+ static parse(maybeAri: string): JiraWorkspaceAri;
199
+ getVariables(): {
200
+ siteId: string;
201
+ activationId: string;
202
+ };
203
+ }
204
+ declare interface JiraWorkspaceAriOpts {
205
+ siteId: string;
206
+ activationId: string;
207
+ }
208
+ declare type PlatformQualifier = 'cloud' | 'third-party';
209
+ declare abstract class RegisteredAri extends Ari {
210
+ static check(maybeAri: any): boolean;
211
+ asAnyAri(): AnyAri;
212
+ }
213
+ declare type ResourceId = string;
214
+ declare type ResourceOwner_alias_1 = string;
215
+ declare type ResourceType_alias_1 = string;
216
+ declare type UnknownResourceOwner = string;
217
+ declare type UnknownResourceType = string;
218
+ export { AnyAri, Ari, CompassWorkspaceAri, ConfluenceWorkspaceAri, EcosystemAppAri, EcosystemAppEnvironmentVersionAri, EcosystemAppPlacementAri, GraphWorkspaceAri, JiraWorkspaceAri };
@@ -0,0 +1 @@
1
+ var e=class extends Error{};function t(t){if(t!==`cloud`&&t!==`third-party`)throw new e(`Identifier must have a qualifier of 'cloud' or 'third-party'. Received: ${t}`)}function n(t){if(t!==`ati`)throw new e(`ATI must have a qualifier of 'ati'. Received: ${t}`)}function r(t){if(t!==`ari`)throw new e(`ARI must have a qualifier of 'ari'. Received: ${t}`)}var i=5,a=`:`,o=class{static getIdentifierSegments(t,n){let r=t.split(a);if(r.length<n)throw new e(`Input string must have ${n} segments.`);if(r.length>n){let e=r.slice(0,i-1),t=r.slice(i-1,r.length);return[...e,t.join(a)]}return r}};function s(t,n=/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{0,255}$`)){if(!t.match(n))throw new e(`Invalid cloud ID, expected ID of format ${n}.`)}function c(t,n=/* @__PURE__ */ RegExp(`[!a-zA-Z0-9\\-_.~@:;{}=]+(/[!a-zA-Z0-9\\-_.~@:;{}=]+)*`),r=`resourceId`){let i=RegExp(`^${n.source}$`);if(!t.match(i))throw new e(`Invalid ${r} - ${t}, expected ID of format ${i}.`)}function l(e,t){Object.entries(e).forEach(([e,n])=>{c(n,t?.[e],e)})}function u(t,n){if(n&&t!==n)throw new e(`Invalid resource owner - ${t}, expected ${n}.`)}function d(t,n){if(n&&t!==n)throw new e(`Invalid resource type - ${t}, expected ${n}.`)}var f=5,p=class extends o{static fromString(e,t){let[n,r,i,a,o]=this.getIdentifierSegments(e,f),[s,...c]=o.split(`/`),l={qualifier:n,platformQualifier:r,cloudId:a,resourceOwner:i,resourceType:s,resourceId:c.join(`/`),resourceIdSegmentValues:t!=null&&t.resourceIdSlug?this.ariSegmentValuesFromSlug(t.resourceIdSlug,c.join(`/`),Object.keys(t.resourceIdSegmentFormats)):{}};return this.fromOpts(l,t)}static fromOpts(e,n){let{qualifier:i=`ari`,platformQualifier:a=`cloud`,resourceOwner:o,cloudId:c,resourceId:f,resourceIdSegmentValues:p,resourceType:m}=e;return r(i),t(a),s(e.cloudId||``,n?.cloudId),u(o,n?.resourceOwner),d(m,n?.resourceType),l(p,n?.resourceIdSegmentFormats),{qualifier:i,resourceOwner:o,resourceType:m,platformQualifier:a,cloudId:c,resourceId:f,resourceIdSegmentValues:p}}static ariSegmentValuesFromSlug(t,n,r){let i=RegExp(`^`+t.replace(/\{(.*?)\}/g,`(?<$1>.*?)`)+`$`).exec(n);if(!i)throw new e(`Segment '${n}' don't match expected slug: ${t}`);return r.forEach(n=>{var r;if(!((r=i.groups)!=null&&r[n]))throw new e(`No value supplied for '${n}' based on slug ${t}`)}),i.groups||{}}},m=4,h=class extends o{static fromString(e,r){let[i=`ati`,a=`cloud`,o,s]=this.getIdentifierSegments(e,m);return n(i),t(a),u(o,r?.resourceOwner),d(s,r?.resourceType),{platformQualifier:a,resourceOwner:o,resourceType:s}}static fromOpts(e,r){let{qualifier:i,platformQualifier:a,resourceOwner:o,resourceType:s}=e;return n(i),t(a),u(o,r?.resourceOwner),d(s,r?.resourceType),{platformQualifier:a,resourceOwner:o,resourceType:s}}},g=class e{constructor(e,t,n){this._platformQualifier=e,this._resourceOwner=t,this._resourceType=n}get platformQualifier(){return this._platformQualifier}get resourceOwner(){return this._resourceOwner}get resourceType(){return this._resourceType}static create(t){return new e(t.platformQualifier||`cloud`,t.resourceOwner,t.resourceType)}static parse(t,n){let r=h.fromString(t,n);return new e(r.platformQualifier,r.resourceOwner,r.resourceType)}toString(){return`ati:${this.platformQualifier}:${this.resourceOwner}:${this.resourceType}`}toJSON(){return this.toString()}toOpts(){return{platformQualifier:this._platformQualifier,resourceOwner:this._resourceOwner,resourceType:this._resourceType}}},_=class{constructor(e){this._ati=g.create({platformQualifier:e.platformQualifier||`cloud`,resourceOwner:e.resourceOwner,resourceType:e.resourceType}),this._cloudId=e.cloudId===``?void 0:e.cloudId,this._resourceId=e.resourceId}get platformQualifier(){return this._ati.platformQualifier}get cloudId(){return this._cloudId}get resourceOwner(){return this._ati.resourceOwner}get resourceType(){return this._ati.resourceType}get resourceId(){return this._resourceId}get ati(){return this._ati}equals(e){return this.toString()===e.toString()}toString(){return`ari:${this.platformQualifier}:${this.resourceOwner}:${this.cloudId||``}:${this.resourceType}/${this.resourceId}`}toJSON(){return this.toString()}toOpts(){return{platformQualifier:this.platformQualifier,resourceOwner:this.resourceOwner,cloudId:this.cloudId,resourceType:this.resourceType,resourceId:this.resourceId}}},v=class e extends _{constructor(e){super(e)}static create(t,n){let r={...t,resourceIdSegmentValues:{}},i=p.fromOpts(r,n);return new e(i)}static parse(t,n){let r=p.fromString(t,n);return new e(r)}static check(t){try{return e.parse(t.toString()),!0}catch{return!1}}asAnyAri(){return this}},y=class extends _{static check(e){try{return this.parse(e.toString()),!0}catch{return!1}}asAnyAri(){return v.parse(this.toString())}},b={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`jira`,resourceType:`workspace`,resourceIdSlug:`{activationId}`,resourceIdSegmentFormats:{activationId:/[a-zA-Z0-9\-]+/}},x=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._activationId=e.resourceIdSegmentValues.activationId}get siteId(){return this._siteId}get activationId(){return this._activationId}static create(t){let n={qualifier:b.qualifier,platformQualifier:b.platformQualifier,cloudId:t.siteId,resourceOwner:b.resourceOwner,resourceType:b.resourceType,resourceId:`${t.activationId}`,resourceIdSegmentValues:{activationId:t.activationId}},r=p.fromOpts(n,b);return new e(r)}static parse(t){let n=p.fromString(t,b);return new e(n)}getVariables(){return{siteId:this.siteId,activationId:this.activationId}}},S={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`graph`,resourceType:`workspace`,resourceIdSlug:`{workspaceId}`,resourceIdSegmentFormats:{workspaceId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},C=class e extends y{constructor(e){super(e),this._workspaceId=e.resourceIdSegmentValues.workspaceId}get workspaceId(){return this._workspaceId}static create(t){let n={qualifier:S.qualifier,platformQualifier:S.platformQualifier,cloudId:void 0,resourceOwner:S.resourceOwner,resourceType:S.resourceType,resourceId:`${t.workspaceId}`,resourceIdSegmentValues:{workspaceId:t.workspaceId}},r=p.fromOpts(n,S);return new e(r)}static parse(t){let n=p.fromString(t,S);return new e(n)}getVariables(){return{workspaceId:this.workspaceId}}},w={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app`,resourceIdSlug:`{appId}`,resourceIdSegmentFormats:{appId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},T=class e extends y{constructor(e){super(e),this._appId=e.resourceIdSegmentValues.appId}get appId(){return this._appId}static create(t){let n={qualifier:w.qualifier,platformQualifier:w.platformQualifier,cloudId:void 0,resourceOwner:w.resourceOwner,resourceType:w.resourceType,resourceId:`${t.appId}`,resourceIdSegmentValues:{appId:t.appId}},r=p.fromOpts(n,w);return new e(r)}static parse(t){let n=p.fromString(t,w);return new e(n)}getVariables(){return{appId:this.appId}}},E={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app-environment-version`,resourceIdSlug:`{appId}/{environmentId}/{versionId}`,resourceIdSegmentFormats:{appId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/,environmentId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/,versionId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},D=class e extends y{constructor(e){super(e),this._appId=e.resourceIdSegmentValues.appId,this._environmentId=e.resourceIdSegmentValues.environmentId,this._versionId=e.resourceIdSegmentValues.versionId}get appId(){return this._appId}get environmentId(){return this._environmentId}get versionId(){return this._versionId}static create(t){let n={qualifier:E.qualifier,platformQualifier:E.platformQualifier,cloudId:void 0,resourceOwner:E.resourceOwner,resourceType:E.resourceType,resourceId:`${t.appId}/${t.environmentId}/${t.versionId}`,resourceIdSegmentValues:{appId:t.appId,environmentId:t.environmentId,versionId:t.versionId}},r=p.fromOpts(n,E);return new e(r)}static parse(t){let n=p.fromString(t,E);return new e(n)}getVariables(){return{appId:this.appId,environmentId:this.environmentId,versionId:this.versionId}}},O={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^$`),resourceOwner:`ecosystem`,resourceType:`app-placement`,resourceIdSlug:`{placementType}/{placementId}`,resourceIdSegmentFormats:{placementType:/(isolation-context|region|customer-data-plane)/,placementId:/[a-zA-Z0-9-._]+/}},k=class e extends y{constructor(e){super(e),this._placementType=e.resourceIdSegmentValues.placementType,this._placementId=e.resourceIdSegmentValues.placementId}get placementType(){return this._placementType}get placementId(){return this._placementId}static create(t){let n={qualifier:O.qualifier,platformQualifier:O.platformQualifier,cloudId:void 0,resourceOwner:O.resourceOwner,resourceType:O.resourceType,resourceId:`${t.placementType}/${t.placementId}`,resourceIdSegmentValues:{placementType:t.placementType,placementId:t.placementId}},r=p.fromOpts(n,O);return new e(r)}static parse(t){let n=p.fromString(t,O);return new e(n)}getVariables(){return{placementType:this.placementType,placementId:this.placementId}}},A={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`compass`,resourceType:`workspace`,resourceIdSlug:`{workspaceId}`,resourceIdSegmentFormats:{workspaceId:/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/}},j=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._workspaceId=e.resourceIdSegmentValues.workspaceId}get siteId(){return this._siteId}get workspaceId(){return this._workspaceId}static create(t){let n={qualifier:A.qualifier,platformQualifier:A.platformQualifier,cloudId:t.siteId,resourceOwner:A.resourceOwner,resourceType:A.resourceType,resourceId:`${t.workspaceId}`,resourceIdSegmentValues:{workspaceId:t.workspaceId}},r=p.fromOpts(n,A);return new e(r)}static parse(t){let n=p.fromString(t,A);return new e(n)}getVariables(){return{siteId:this.siteId,workspaceId:this.workspaceId}}},M={qualifier:`ari`,platformQualifier:`cloud`,cloudId:/* @__PURE__ */ RegExp(`^[a-zA-Z0-9_\\-.]{1,255}$`),resourceOwner:`confluence`,resourceType:`workspace`,resourceIdSlug:`{activationId}`,resourceIdSegmentFormats:{activationId:/[a-zA-Z0-9\-]+/}},N=class e extends y{constructor(e){super(e),this._siteId=e.cloudId||``,this._activationId=e.resourceIdSegmentValues.activationId}get siteId(){return this._siteId}get activationId(){return this._activationId}static create(t){let n={qualifier:M.qualifier,platformQualifier:M.platformQualifier,cloudId:t.siteId,resourceOwner:M.resourceOwner,resourceType:M.resourceType,resourceId:`${t.activationId}`,resourceIdSegmentValues:{activationId:t.activationId}},r=p.fromOpts(n,M);return new e(r)}static parse(t){let n=p.fromString(t,M);return new e(n)}getVariables(){return{siteId:this.siteId,activationId:this.activationId}}};export{v as AnyAri,_ as Ari,j as CompassWorkspaceAri,N as ConfluenceWorkspaceAri,T as EcosystemAppAri,D as EcosystemAppEnvironmentVersionAri,k as EcosystemAppPlacementAri,C as GraphWorkspaceAri,x as JiraWorkspaceAri};