@spottoai/types-package 1.0.2-dev1138.3 → 1.0.2-dev1138.5

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 (206) hide show
  1. package/README.md +9 -0
  2. package/dist/accounts/accounts.d.ts +77 -4
  3. package/dist/accounts/accounts.d.ts.map +1 -1
  4. package/dist/accounts/accounts.js +2 -1
  5. package/dist/accounts/accounts.js.map +1 -1
  6. package/dist/accounts/azureManualOnboarding.d.ts +114 -0
  7. package/dist/accounts/azureManualOnboarding.d.ts.map +1 -0
  8. package/dist/accounts/azureManualOnboarding.js +12 -0
  9. package/dist/accounts/azureManualOnboarding.js.map +1 -0
  10. package/dist/accounts/azureSpSetup.d.ts +128 -31
  11. package/dist/accounts/azureSpSetup.d.ts.map +1 -1
  12. package/dist/accounts/azureSpSetup.js +15 -0
  13. package/dist/accounts/azureSpSetup.js.map +1 -1
  14. package/dist/accounts/azureSpSetupDurable.d.ts +8 -0
  15. package/dist/accounts/azureSpSetupDurable.d.ts.map +1 -1
  16. package/dist/accounts/azureSpSetupDurable.js +28 -0
  17. package/dist/accounts/azureSpSetupDurable.js.map +1 -1
  18. package/dist/accounts/index.d.ts +1 -0
  19. package/dist/accounts/index.d.ts.map +1 -1
  20. package/dist/accounts/index.js +1 -0
  21. package/dist/accounts/index.js.map +1 -1
  22. package/dist/accounts/readPermissions.d.ts +1 -1
  23. package/dist/accounts/readPermissions.d.ts.map +1 -1
  24. package/dist/accounts/readPermissions.js.map +1 -1
  25. package/dist/accounts/validation.d.ts +24 -0
  26. package/dist/accounts/validation.d.ts.map +1 -1
  27. package/dist/ai/index.d.ts +14 -1
  28. package/dist/ai/index.d.ts.map +1 -1
  29. package/dist/ai/index.js +12 -0
  30. package/dist/ai/index.js.map +1 -1
  31. package/dist/aws/commitments-planning.d.ts +5 -0
  32. package/dist/aws/commitments-planning.d.ts.map +1 -1
  33. package/dist/aws/commitments-planning.js +19 -0
  34. package/dist/aws/commitments-planning.js.map +1 -1
  35. package/dist/aws/estates.d.ts +1 -1
  36. package/dist/aws/estates.d.ts.map +1 -1
  37. package/dist/aws/estates.js +7 -1
  38. package/dist/aws/estates.js.map +1 -1
  39. package/dist/aws/index.d.ts +5 -0
  40. package/dist/aws/index.d.ts.map +1 -1
  41. package/dist/aws/index.js +5 -0
  42. package/dist/aws/index.js.map +1 -1
  43. package/dist/aws/onboarding.d.ts +3 -0
  44. package/dist/aws/onboarding.d.ts.map +1 -1
  45. package/dist/aws/organizationCommitments.d.ts +260 -0
  46. package/dist/aws/organizationCommitments.d.ts.map +1 -0
  47. package/dist/aws/organizationCommitments.js +53 -0
  48. package/dist/aws/organizationCommitments.js.map +1 -0
  49. package/dist/aws/organizationCommitmentsApiValidation.d.ts +21 -0
  50. package/dist/aws/organizationCommitmentsApiValidation.d.ts.map +1 -0
  51. package/dist/aws/organizationCommitmentsApiValidation.js +226 -0
  52. package/dist/aws/organizationCommitmentsApiValidation.js.map +1 -0
  53. package/dist/aws/organizationCommitmentsValidation.d.ts +12 -0
  54. package/dist/aws/organizationCommitmentsValidation.d.ts.map +1 -0
  55. package/dist/aws/organizationCommitmentsValidation.js +228 -0
  56. package/dist/aws/organizationCommitmentsValidation.js.map +1 -0
  57. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifactValidation.d.ts +9 -0
  58. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifactValidation.d.ts.map +1 -0
  59. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifactValidation.js +407 -0
  60. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifactValidation.js.map +1 -0
  61. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifacts.d.ts +17 -0
  62. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifacts.d.ts.map +1 -0
  63. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifacts.js +6 -0
  64. package/dist/aws/portalOrganizationCommitmentsPlanningPublicArtifacts.js.map +1 -0
  65. package/dist/aws/requests.d.ts +13 -2
  66. package/dist/aws/requests.d.ts.map +1 -1
  67. package/dist/aws/requests.js +1 -1
  68. package/dist/aws/requests.js.map +1 -1
  69. package/dist/azure/commitmentsPlanning.d.ts +2 -2
  70. package/dist/azure/commitmentsPlanning.d.ts.map +1 -1
  71. package/dist/azure/financialAuthorityProjectionKernel.d.ts +7 -0
  72. package/dist/azure/financialAuthorityProjectionKernel.d.ts.map +1 -0
  73. package/dist/azure/financialAuthorityProjectionKernel.js +165 -0
  74. package/dist/azure/financialAuthorityProjectionKernel.js.map +1 -0
  75. package/dist/azure/financialAuthorityViewValidation.d.ts +3 -1
  76. package/dist/azure/financialAuthorityViewValidation.d.ts.map +1 -1
  77. package/dist/azure/financialAuthorityViewValidation.js +167 -2
  78. package/dist/azure/financialAuthorityViewValidation.js.map +1 -1
  79. package/dist/azure/financialChargeCompositionKernel.d.ts.map +1 -1
  80. package/dist/azure/financialChargeCompositionKernel.js +5 -1
  81. package/dist/azure/financialChargeCompositionKernel.js.map +1 -1
  82. package/dist/azure/financialDataflowKernel.d.ts.map +1 -1
  83. package/dist/azure/financialDataflowKernel.js +2 -1
  84. package/dist/azure/financialDataflowKernel.js.map +1 -1
  85. package/dist/azure/financialProjection.d.ts +11 -1
  86. package/dist/azure/financialProjection.d.ts.map +1 -1
  87. package/dist/azure/financialProjection.js.map +1 -1
  88. package/dist/azure/financialProjectionValidation.d.ts.map +1 -1
  89. package/dist/azure/financialProjectionValidation.js +43 -3
  90. package/dist/azure/financialProjectionValidation.js.map +1 -1
  91. package/dist/azure/financialSavingsAuthority.d.ts +25 -4
  92. package/dist/azure/financialSavingsAuthority.d.ts.map +1 -1
  93. package/dist/azure/financialSavingsAuthorityValidation.d.ts +6 -2
  94. package/dist/azure/financialSavingsAuthorityValidation.d.ts.map +1 -1
  95. package/dist/azure/financialSavingsAuthorityValidation.js +126 -2
  96. package/dist/azure/financialSavingsAuthorityValidation.js.map +1 -1
  97. package/dist/azure/financialSavingsCoordinateValidation.d.ts.map +1 -1
  98. package/dist/azure/financialSavingsCoordinateValidation.js +62 -19
  99. package/dist/azure/financialSavingsCoordinateValidation.js.map +1 -1
  100. package/dist/azure/financialSavingsSurfaceProjection.d.ts +58 -3
  101. package/dist/azure/financialSavingsSurfaceProjection.d.ts.map +1 -1
  102. package/dist/azure/financialSavingsSurfaceProjection.js +3 -1
  103. package/dist/azure/financialSavingsSurfaceProjection.js.map +1 -1
  104. package/dist/azure/financialSavingsSurfaceProjectionKernel.d.ts +14 -0
  105. package/dist/azure/financialSavingsSurfaceProjectionKernel.d.ts.map +1 -0
  106. package/dist/azure/financialSavingsSurfaceProjectionKernel.js +326 -0
  107. package/dist/azure/financialSavingsSurfaceProjectionKernel.js.map +1 -0
  108. package/dist/azure/financialSavingsSurfaceProjectionValidation.d.ts.map +1 -1
  109. package/dist/azure/financialSavingsSurfaceProjectionValidation.js +126 -12
  110. package/dist/azure/financialSavingsSurfaceProjectionValidation.js.map +1 -1
  111. package/dist/azure/financialScope.d.ts +2 -0
  112. package/dist/azure/financialScope.d.ts.map +1 -1
  113. package/dist/azure/financialScope.js +2 -0
  114. package/dist/azure/financialScope.js.map +1 -1
  115. package/dist/azure/governance.d.ts +145 -0
  116. package/dist/azure/governance.d.ts.map +1 -1
  117. package/dist/azure/governance.js +2 -1
  118. package/dist/azure/governance.js.map +1 -1
  119. package/dist/azure/payloads.d.ts +19 -0
  120. package/dist/azure/payloads.d.ts.map +1 -1
  121. package/dist/azure/recommendationState.d.ts +1 -1
  122. package/dist/azure/recommendationState.d.ts.map +1 -1
  123. package/dist/azure/recommendations.d.ts +3 -1
  124. package/dist/azure/recommendations.d.ts.map +1 -1
  125. package/dist/azure/serviceRetirement.d.ts +33 -2
  126. package/dist/azure/serviceRetirement.d.ts.map +1 -1
  127. package/dist/azure/subscriptions.d.ts +9 -0
  128. package/dist/azure/subscriptions.d.ts.map +1 -1
  129. package/dist/azure/views.d.ts +19 -1
  130. package/dist/azure/views.d.ts.map +1 -1
  131. package/dist/azure/views.js.map +1 -1
  132. package/dist/azure/vmPatchManagement.d.ts +109 -0
  133. package/dist/azure/vmPatchManagement.d.ts.map +1 -0
  134. package/dist/azure/vmPatchManagement.js +7 -0
  135. package/dist/azure/vmPatchManagement.js.map +1 -0
  136. package/dist/common/provider.d.ts +53 -0
  137. package/dist/common/provider.d.ts.map +1 -1
  138. package/dist/common/provider.js.map +1 -1
  139. package/dist/environment/canonicalization.d.ts +12 -0
  140. package/dist/environment/canonicalization.d.ts.map +1 -0
  141. package/dist/environment/canonicalization.js +40 -0
  142. package/dist/environment/canonicalization.js.map +1 -0
  143. package/dist/environment/contracts.d.ts +196 -0
  144. package/dist/environment/contracts.d.ts.map +1 -0
  145. package/dist/environment/contracts.js +21 -0
  146. package/dist/environment/contracts.js.map +1 -0
  147. package/dist/environment/index.d.ts +5 -0
  148. package/dist/environment/index.d.ts.map +1 -0
  149. package/dist/environment/index.js +21 -0
  150. package/dist/environment/index.js.map +1 -0
  151. package/dist/environment/internal.d.ts +21 -0
  152. package/dist/environment/internal.d.ts.map +1 -0
  153. package/dist/environment/internal.js +113 -0
  154. package/dist/environment/internal.js.map +1 -0
  155. package/dist/environment/references.d.ts +18 -0
  156. package/dist/environment/references.d.ts.map +1 -0
  157. package/dist/environment/references.js +206 -0
  158. package/dist/environment/references.js.map +1 -0
  159. package/dist/environment/validation.d.ts +28 -0
  160. package/dist/environment/validation.d.ts.map +1 -0
  161. package/dist/environment/validation.js +320 -0
  162. package/dist/environment/validation.js.map +1 -0
  163. package/dist/esm/accounts/accounts.js +1 -0
  164. package/dist/esm/accounts/azureManualOnboarding.js +8 -0
  165. package/dist/esm/accounts/azureSpSetup.js +14 -1
  166. package/dist/esm/accounts/azureSpSetupDurable.js +27 -1
  167. package/dist/esm/accounts/index.js +1 -0
  168. package/dist/esm/ai/index.js +10 -1
  169. package/dist/esm/aws/commitments-planning.js +5 -0
  170. package/dist/esm/aws/estates.js +7 -1
  171. package/dist/esm/aws/index.js +5 -0
  172. package/dist/esm/aws/organizationCommitments.js +48 -0
  173. package/dist/esm/aws/organizationCommitmentsApiValidation.js +220 -0
  174. package/dist/esm/aws/organizationCommitmentsValidation.js +224 -0
  175. package/dist/esm/aws/portalOrganizationCommitmentsPlanningPublicArtifactValidation.js +402 -0
  176. package/dist/esm/aws/portalOrganizationCommitmentsPlanningPublicArtifacts.js +2 -0
  177. package/dist/esm/aws/requests.js +1 -1
  178. package/dist/esm/azure/financialAuthorityProjectionKernel.js +159 -0
  179. package/dist/esm/azure/financialAuthorityViewValidation.js +165 -1
  180. package/dist/esm/azure/financialChargeCompositionKernel.js +5 -1
  181. package/dist/esm/azure/financialDataflowKernel.js +2 -1
  182. package/dist/esm/azure/financialProjectionValidation.js +43 -3
  183. package/dist/esm/azure/financialSavingsAuthorityValidation.js +124 -2
  184. package/dist/esm/azure/financialSavingsCoordinateValidation.js +62 -19
  185. package/dist/esm/azure/financialSavingsSurfaceProjection.js +2 -0
  186. package/dist/esm/azure/financialSavingsSurfaceProjectionKernel.js +318 -0
  187. package/dist/esm/azure/financialSavingsSurfaceProjectionValidation.js +126 -12
  188. package/dist/esm/azure/financialScope.js +2 -0
  189. package/dist/esm/azure/governance.js +1 -0
  190. package/dist/esm/azure/vmPatchManagement.js +3 -0
  191. package/dist/esm/entries/commitments-planning.js +2 -2
  192. package/dist/esm/entries/environment.js +3 -0
  193. package/dist/esm/environment/canonicalization.js +34 -0
  194. package/dist/esm/environment/contracts.js +17 -0
  195. package/dist/esm/environment/index.js +4 -0
  196. package/dist/esm/environment/internal.js +97 -0
  197. package/dist/esm/environment/references.js +194 -0
  198. package/dist/esm/environment/validation.js +303 -0
  199. package/dist/esm/index.js +2 -0
  200. package/dist/index.d.ts +2 -0
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +2 -0
  203. package/dist/index.js.map +1 -1
  204. package/dist/portfolio/portfolioOperations.d.ts +1 -1
  205. package/dist/portfolio/portfolioOperations.d.ts.map +1 -1
  206. package/package.json +14 -3
@@ -0,0 +1,196 @@
1
+ /** Phase-one environment-memory contract constants shared by producers and consumers. */
2
+ export declare const ENVIRONMENT_CONTRACT_LIMITS_V1: Readonly<{
3
+ readonly completedPointerBytes: number;
4
+ readonly projectionBytes: number;
5
+ readonly environmentIndexBytes: number;
6
+ readonly costPillarBytes: number;
7
+ readonly boundedListItems: 50;
8
+ readonly customerStringScalars: 4096;
9
+ readonly safeLabelScalars: 512;
10
+ readonly scopeIdentifierScalars: 2048;
11
+ readonly environmentRunIdAsciiCharacters: 128;
12
+ readonly sourceIdentityScalars: 256;
13
+ readonly logicalReferencePayloadBytes: number;
14
+ readonly validatedContainerDepth: 8;
15
+ }>;
16
+ export declare const ENVIRONMENT_DOCUMENT_NAMES_V1: readonly ["projection.json", "environment-index.md", "pillars/cost.md"];
17
+ export declare const ENVIRONMENT_ARTIFACT_KINDS_V1: readonly ["subscription-summary", "subscription-resources", "subscription-recommendations"];
18
+ export type EnvironmentDocumentNameV1 = (typeof ENVIRONMENT_DOCUMENT_NAMES_V1)[number];
19
+ export type EnvironmentArtifactKindV1 = (typeof ENVIRONMENT_ARTIFACT_KINDS_V1)[number];
20
+ export type EnvironmentMoneyBasisV1 = 'billed' | 'amortized';
21
+ export type EnvironmentSavingsAdditivityV1 = 'additive' | 'scenario-non-additive';
22
+ export type EnvironmentMoneyProvenanceV1 = 'subscription-summary' | 'subscription-resources' | 'cost-savings-summary' | 'savings-aggregate' | 'recommendation';
23
+ export interface EnvironmentScopeV1 {
24
+ kind: 'azure-subscription';
25
+ tenantId: string;
26
+ companyId: string;
27
+ subscriptionId: string;
28
+ }
29
+ export interface EnvironmentSourceGenerationV1 {
30
+ viewSetSchemaVersion: 1;
31
+ publicationId: string;
32
+ portalRunId: string;
33
+ pluginRunId: string;
34
+ economicsGenerationId: string;
35
+ economicsFingerprint: string;
36
+ completedAt: string;
37
+ }
38
+ export interface EnvironmentSourceBindingV1 extends EnvironmentSourceGenerationV1 {
39
+ kind: 'azure-subscription-view-set';
40
+ scope: EnvironmentScopeV1;
41
+ }
42
+ export type EnvironmentLogicalArtifactReferenceV1 = `spotto://artifact/v1/${EnvironmentArtifactKindV1}/${string}`;
43
+ export type EnvironmentLogicalResourceReferenceV1 = `spotto://resource/v1/${string}`;
44
+ export type EnvironmentLogicalEvidenceReferenceV1 = EnvironmentLogicalArtifactReferenceV1 | EnvironmentLogicalResourceReferenceV1;
45
+ export interface ParsedEnvironmentLogicalArtifactReferenceV1 {
46
+ kind: 'artifact';
47
+ artifactKind: EnvironmentArtifactKindV1;
48
+ subject: string;
49
+ }
50
+ export interface ParsedEnvironmentLogicalResourceReferenceV1 {
51
+ kind: 'resource';
52
+ resourceId: string;
53
+ }
54
+ export type ParsedEnvironmentLogicalEvidenceReferenceV1 = ParsedEnvironmentLogicalArtifactReferenceV1 | ParsedEnvironmentLogicalResourceReferenceV1;
55
+ export interface EnvironmentMoneyValueV1 {
56
+ amount: string;
57
+ currencyCode: string;
58
+ basis: EnvironmentMoneyBasisV1;
59
+ period: string;
60
+ provenance: EnvironmentMoneyProvenanceV1;
61
+ savingsAdditivity?: EnvironmentSavingsAdditivityV1;
62
+ }
63
+ interface EnvironmentCoverageBaseV1 {
64
+ observedAt?: string;
65
+ completeThrough?: string;
66
+ }
67
+ export interface EnvironmentCompleteCoverageStateV1 extends EnvironmentCoverageBaseV1 {
68
+ status: 'complete';
69
+ reason?: never;
70
+ }
71
+ export interface EnvironmentPartialCoverageStateV1 extends EnvironmentCoverageBaseV1 {
72
+ status: 'partial';
73
+ reason: string;
74
+ }
75
+ export interface EnvironmentUnavailableCoverageStateV1 {
76
+ status: 'unavailable';
77
+ reason: string;
78
+ observedAt?: never;
79
+ completeThrough?: never;
80
+ }
81
+ export interface EnvironmentStaleCoverageStateV1 extends EnvironmentCoverageBaseV1 {
82
+ status: 'stale';
83
+ reason: string;
84
+ observedAt: string;
85
+ }
86
+ export interface EnvironmentNotCollectedCoverageStateV1 {
87
+ status: 'not-collected';
88
+ reason: string;
89
+ observedAt?: never;
90
+ completeThrough?: never;
91
+ }
92
+ export type EnvironmentCoverageStateV1 = EnvironmentCompleteCoverageStateV1 | EnvironmentPartialCoverageStateV1 | EnvironmentUnavailableCoverageStateV1 | EnvironmentStaleCoverageStateV1 | EnvironmentNotCollectedCoverageStateV1;
93
+ export interface EnvironmentBoundedListV1<T> {
94
+ items: T[];
95
+ totalCount: number;
96
+ includedCount: number;
97
+ truncated: boolean;
98
+ continuationReference?: EnvironmentLogicalEvidenceReferenceV1;
99
+ }
100
+ export interface EnvironmentSubscriptionSummaryV1 {
101
+ safeLabel: string;
102
+ portalRoute: string;
103
+ }
104
+ export interface EnvironmentSourceCoverageV1 {
105
+ subscriptionSummary: EnvironmentCoverageStateV1;
106
+ resources: EnvironmentCoverageStateV1;
107
+ recommendations: EnvironmentCoverageStateV1;
108
+ costs: EnvironmentCoverageStateV1;
109
+ savings: EnvironmentCoverageStateV1;
110
+ }
111
+ export interface EnvironmentCostSummaryV1 {
112
+ observedCost?: EnvironmentMoneyValueV1;
113
+ potentialSavings?: EnvironmentMoneyValueV1;
114
+ resourceCount?: number;
115
+ recommendationCount?: number;
116
+ }
117
+ export interface EnvironmentCostRollupV1 {
118
+ key: string;
119
+ safeLabel: string;
120
+ resourceCount: number;
121
+ observedCost?: EnvironmentMoneyValueV1;
122
+ potentialSavings?: EnvironmentMoneyValueV1;
123
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
124
+ }
125
+ export interface EnvironmentCostDriverV1 {
126
+ key: string;
127
+ safeLabel: string;
128
+ description?: string;
129
+ observedCost?: EnvironmentMoneyValueV1;
130
+ portalRoute?: string;
131
+ resourceReference?: EnvironmentLogicalResourceReferenceV1;
132
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
133
+ }
134
+ export interface EnvironmentCostRecommendationV1 {
135
+ recommendationId: string;
136
+ safeLabel: string;
137
+ description?: string;
138
+ potentialSavings?: EnvironmentMoneyValueV1;
139
+ portalRoute: string;
140
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
141
+ }
142
+ export interface EnvironmentCostChangeV1 {
143
+ key: string;
144
+ safeLabel: string;
145
+ description: string;
146
+ direction: 'increase' | 'decrease' | 'unchanged' | 'unknown';
147
+ amount?: EnvironmentMoneyValueV1;
148
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
149
+ }
150
+ export interface EnvironmentProjectionWarningV1 {
151
+ code: string;
152
+ safeLabel: string;
153
+ detail?: string;
154
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
155
+ }
156
+ export interface EnvironmentSubscriptionCostProjectionV1 {
157
+ schemaVersion: 1;
158
+ scope: EnvironmentScopeV1;
159
+ sourceBinding: EnvironmentSourceBindingV1;
160
+ generatedAt: string;
161
+ subscription: EnvironmentSubscriptionSummaryV1;
162
+ sourceCoverage: EnvironmentSourceCoverageV1;
163
+ costSummary: EnvironmentCostSummaryV1;
164
+ serviceFamilyRollups: EnvironmentBoundedListV1<EnvironmentCostRollupV1>;
165
+ estateCostRollups: EnvironmentBoundedListV1<EnvironmentCostRollupV1>;
166
+ costDrivers: EnvironmentBoundedListV1<EnvironmentCostDriverV1>;
167
+ recommendations: EnvironmentBoundedListV1<EnvironmentCostRecommendationV1>;
168
+ changes: EnvironmentBoundedListV1<EnvironmentCostChangeV1>;
169
+ warnings: EnvironmentBoundedListV1<EnvironmentProjectionWarningV1>;
170
+ sourceReferences: EnvironmentLogicalEvidenceReferenceV1[];
171
+ }
172
+ export type EnvironmentDocumentDescriptorV1 = {
173
+ name: 'projection.json';
174
+ mediaType: 'application/json';
175
+ byteCount: number;
176
+ contentSha256: string;
177
+ approximateTokenCount: number;
178
+ } | {
179
+ name: 'environment-index.md' | 'pillars/cost.md';
180
+ mediaType: 'text/markdown; charset=utf-8';
181
+ byteCount: number;
182
+ contentSha256: string;
183
+ approximateTokenCount: number;
184
+ };
185
+ export interface EnvironmentCompiledGenerationPointerV1 {
186
+ schemaVersion: 1;
187
+ status: 'completed';
188
+ environmentRunId: string;
189
+ scope: EnvironmentScopeV1;
190
+ sourceBinding: EnvironmentSourceBindingV1;
191
+ treeDigestSha256: string;
192
+ fileCount: 3;
193
+ generatedAt: string;
194
+ }
195
+ export {};
196
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/environment/contracts.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;EAahC,CAAC;AAEZ,eAAO,MAAM,6BAA6B,yEAA0E,CAAC;AAErH,eAAO,MAAM,6BAA6B,6FAA8F,CAAC;AAEzI,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC7D,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,uBAAuB,CAAC;AAClF,MAAM,MAAM,4BAA4B,GACpC,sBAAsB,GACtB,wBAAwB,GACxB,sBAAsB,GACtB,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC5C,oBAAoB,EAAE,CAAC,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,0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.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENVIRONMENT_ARTIFACT_KINDS_V1 = exports.ENVIRONMENT_DOCUMENT_NAMES_V1 = exports.ENVIRONMENT_CONTRACT_LIMITS_V1 = void 0;
4
+ /** Phase-one environment-memory contract constants shared by producers and consumers. */
5
+ exports.ENVIRONMENT_CONTRACT_LIMITS_V1 = Object.freeze({
6
+ completedPointerBytes: 16 * 1024,
7
+ projectionBytes: 64 * 1024,
8
+ environmentIndexBytes: 4 * 1024,
9
+ costPillarBytes: 8 * 1024,
10
+ boundedListItems: 50,
11
+ customerStringScalars: 4096,
12
+ safeLabelScalars: 512,
13
+ scopeIdentifierScalars: 2048,
14
+ environmentRunIdAsciiCharacters: 128,
15
+ sourceIdentityScalars: 256,
16
+ logicalReferencePayloadBytes: 4 * 1024,
17
+ validatedContainerDepth: 8,
18
+ });
19
+ exports.ENVIRONMENT_DOCUMENT_NAMES_V1 = ['projection.json', 'environment-index.md', 'pillars/cost.md'];
20
+ exports.ENVIRONMENT_ARTIFACT_KINDS_V1 = ['subscription-summary', 'subscription-resources', 'subscription-recommendations'];
21
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/environment/contracts.ts"],"names":[],"mappings":";;;AAAA,yFAAyF;AAC5E,QAAA,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1D,qBAAqB,EAAE,EAAE,GAAG,IAAI;IAChC,eAAe,EAAE,EAAE,GAAG,IAAI;IAC1B,qBAAqB,EAAE,CAAC,GAAG,IAAI;IAC/B,eAAe,EAAE,CAAC,GAAG,IAAI;IACzB,gBAAgB,EAAE,EAAE;IACpB,qBAAqB,EAAE,IAAI;IAC3B,gBAAgB,EAAE,GAAG;IACrB,sBAAsB,EAAE,IAAI;IAC5B,+BAA+B,EAAE,GAAG;IACpC,qBAAqB,EAAE,GAAG;IAC1B,4BAA4B,EAAE,CAAC,GAAG,IAAI;IACtC,uBAAuB,EAAE,CAAC;CAClB,CAAC,CAAC;AAEC,QAAA,6BAA6B,GAAG,CAAC,iBAAiB,EAAE,sBAAsB,EAAE,iBAAiB,CAAU,CAAC;AAExG,QAAA,6BAA6B,GAAG,CAAC,sBAAsB,EAAE,wBAAwB,EAAE,8BAA8B,CAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './contracts.js';
2
+ export * from './references.js';
3
+ export * from './validation.js';
4
+ export * from './canonicalization.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./contracts.js"), exports);
18
+ __exportStar(require("./references.js"), exports);
19
+ __exportStar(require("./validation.js"), exports);
20
+ __exportStar(require("./canonicalization.js"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,kDAAgC;AAChC,kDAAgC;AAChC,wDAAsC"}
@@ -0,0 +1,21 @@
1
+ export declare const SHA256_PATTERN: RegExp;
2
+ export declare const ENVIRONMENT_RUN_ID_PATTERN: RegExp;
3
+ export declare const DECIMAL_PATTERN: RegExp;
4
+ export declare const CURRENCY_PATTERN: RegExp;
5
+ export declare const PROTOTYPE_KEYS: Set<string>;
6
+ export declare const hasControlCharacter: (value: string) => boolean;
7
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
8
+ export declare const hasExactKeys: (value: Record<string, unknown>, required: readonly string[], optional?: readonly string[]) => boolean;
9
+ export declare const isBoundedString: (value: unknown, maximumScalars: number, options?: {
10
+ trimmed?: boolean;
11
+ controls?: boolean;
12
+ }) => value is string;
13
+ export declare const isCustomerString: (value: unknown) => value is string;
14
+ export declare const isSafeLabel: (value: unknown) => value is string;
15
+ export declare const isScopeIdentifier: (value: unknown) => value is string;
16
+ export declare const isSourceIdentity: (value: unknown) => value is string;
17
+ export declare const isNonNegativeInteger: (value: unknown) => value is number;
18
+ export declare const isCanonicalUtcTimestamp: (value: unknown) => value is string;
19
+ export declare const utf8ByteLength: (value: string) => number;
20
+ export declare const hasSafeContainerShape: (value: unknown, depth?: number, seen?: Set<object>) => boolean;
21
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/environment/internal.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,0BAA0B,QAAuB,CAAC;AAC/D,eAAO,MAAM,eAAe,QAAgC,CAAC;AAC7D,eAAO,MAAM,gBAAgB,QAAgB,CAAC;AAC9C,eAAO,MAAM,cAAc,aAAqD,CAAC;AAEjF,eAAO,MAAM,mBAAmB,GAAI,OAAO,MAAM,KAAG,OAMnD,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAIxE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,SAAS,MAAM,EAAE,EAAE,WAAU,SAAS,MAAM,EAAO,KAAG,OAI5H,CAAC;AAkBF,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,EAAE,gBAAgB,MAAM,EAAE,UAAS;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,KAAK,IAAI,MAM1I,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACuC,CAAC;AAEnG,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACsD,CAAC;AAE7G,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACsD,CAAC;AAEnH,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACsD,CAAC;AAElH,eAAO,MAAM,oBAAoB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAA+D,CAAC;AAE/H,eAAO,MAAM,uBAAuB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAIjE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MAU9C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,EAAE,cAAS,EAAE,kBAAwB,KAAG,OAe3F,CAAC"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasSafeContainerShape = exports.utf8ByteLength = exports.isCanonicalUtcTimestamp = exports.isNonNegativeInteger = exports.isSourceIdentity = exports.isScopeIdentifier = exports.isSafeLabel = exports.isCustomerString = exports.isBoundedString = exports.hasExactKeys = exports.isRecord = exports.hasControlCharacter = exports.PROTOTYPE_KEYS = exports.CURRENCY_PATTERN = exports.DECIMAL_PATTERN = exports.ENVIRONMENT_RUN_ID_PATTERN = exports.SHA256_PATTERN = void 0;
4
+ const contracts_js_1 = require("./contracts.js");
5
+ exports.SHA256_PATTERN = /^[a-f0-9]{64}$/u;
6
+ exports.ENVIRONMENT_RUN_ID_PATTERN = /^[A-Za-z0-9._-]+$/u;
7
+ exports.DECIMAL_PATTERN = /^(?:0|[1-9]\d*)(?:\.\d+)?$/u;
8
+ exports.CURRENCY_PATTERN = /^[A-Z]{3}$/u;
9
+ exports.PROTOTYPE_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
10
+ const hasControlCharacter = (value) => {
11
+ for (const character of value) {
12
+ const codePoint = character.codePointAt(0);
13
+ if (codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f))
14
+ return true;
15
+ }
16
+ return false;
17
+ };
18
+ exports.hasControlCharacter = hasControlCharacter;
19
+ const isRecord = (value) => {
20
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
21
+ return false;
22
+ const prototype = Object.getPrototypeOf(value);
23
+ return prototype === Object.prototype || prototype === null;
24
+ };
25
+ exports.isRecord = isRecord;
26
+ const hasExactKeys = (value, required, optional = []) => {
27
+ const allowed = new Set([...required, ...optional]);
28
+ const keys = Object.keys(value);
29
+ return required.every(key => Object.prototype.hasOwnProperty.call(value, key)) && keys.every(key => allowed.has(key) && !exports.PROTOTYPE_KEYS.has(key));
30
+ };
31
+ exports.hasExactKeys = hasExactKeys;
32
+ const scalarLength = (value) => {
33
+ let count = 0;
34
+ for (let index = 0; index < value.length; index += 1) {
35
+ const codeUnit = value.charCodeAt(index);
36
+ if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {
37
+ const trailing = value.charCodeAt(index + 1);
38
+ if (!(trailing >= 0xdc00 && trailing <= 0xdfff))
39
+ return null;
40
+ index += 1;
41
+ }
42
+ else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {
43
+ return null;
44
+ }
45
+ count += 1;
46
+ }
47
+ return count;
48
+ };
49
+ const isBoundedString = (value, maximumScalars, options = {}) => {
50
+ if (typeof value !== 'string')
51
+ return false;
52
+ if (options.trimmed && (value.length === 0 || value.trim() !== value))
53
+ return false;
54
+ if (options.controls && (0, exports.hasControlCharacter)(value))
55
+ return false;
56
+ const length = scalarLength(value);
57
+ return length !== null && length <= maximumScalars;
58
+ };
59
+ exports.isBoundedString = isBoundedString;
60
+ const isCustomerString = (value) => (0, exports.isBoundedString)(value, contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.customerStringScalars, { controls: true });
61
+ exports.isCustomerString = isCustomerString;
62
+ const isSafeLabel = (value) => (0, exports.isBoundedString)(value, contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.safeLabelScalars, { trimmed: true, controls: true });
63
+ exports.isSafeLabel = isSafeLabel;
64
+ const isScopeIdentifier = (value) => (0, exports.isBoundedString)(value, contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.scopeIdentifierScalars, { trimmed: true, controls: true });
65
+ exports.isScopeIdentifier = isScopeIdentifier;
66
+ const isSourceIdentity = (value) => (0, exports.isBoundedString)(value, contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.sourceIdentityScalars, { trimmed: true, controls: true });
67
+ exports.isSourceIdentity = isSourceIdentity;
68
+ const isNonNegativeInteger = (value) => Number.isSafeInteger(value) && value >= 0;
69
+ exports.isNonNegativeInteger = isNonNegativeInteger;
70
+ const isCanonicalUtcTimestamp = (value) => {
71
+ if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u.test(value))
72
+ return false;
73
+ const milliseconds = Date.parse(value);
74
+ return Number.isFinite(milliseconds) && new Date(milliseconds).toISOString() === value;
75
+ };
76
+ exports.isCanonicalUtcTimestamp = isCanonicalUtcTimestamp;
77
+ const utf8ByteLength = (value) => {
78
+ let bytes = 0;
79
+ for (const character of value) {
80
+ const codePoint = character.codePointAt(0);
81
+ if (codePoint <= 0x7f)
82
+ bytes += 1;
83
+ else if (codePoint <= 0x7ff)
84
+ bytes += 2;
85
+ else if (codePoint <= 0xffff)
86
+ bytes += 3;
87
+ else
88
+ bytes += 4;
89
+ }
90
+ return bytes;
91
+ };
92
+ exports.utf8ByteLength = utf8ByteLength;
93
+ const hasSafeContainerShape = (value, depth = 0, seen = new Set()) => {
94
+ if (depth > contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.validatedContainerDepth)
95
+ return false;
96
+ if (typeof value !== 'object' || value === null)
97
+ return true;
98
+ if (seen.has(value))
99
+ return false;
100
+ seen.add(value);
101
+ if (Array.isArray(value)) {
102
+ const valid = value.length <= contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.boundedListItems && value.every(item => (0, exports.hasSafeContainerShape)(item, depth + 1, seen));
103
+ seen.delete(value);
104
+ return valid;
105
+ }
106
+ if (!(0, exports.isRecord)(value))
107
+ return false;
108
+ const valid = Object.keys(value).every(key => !exports.PROTOTYPE_KEYS.has(key) && (0, exports.hasSafeContainerShape)(value[key], depth + 1, seen));
109
+ seen.delete(value);
110
+ return valid;
111
+ };
112
+ exports.hasSafeContainerShape = hasSafeContainerShape;
113
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/environment/internal.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEnD,QAAA,cAAc,GAAG,iBAAiB,CAAC;AACnC,QAAA,0BAA0B,GAAG,oBAAoB,CAAC;AAClD,QAAA,eAAe,GAAG,6BAA6B,CAAC;AAChD,QAAA,gBAAgB,GAAG,aAAa,CAAC;AACjC,QAAA,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAE1E,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAW,EA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KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,6BAAqB,EAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QACvI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC,IAAA,gBAAQ,EAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,sBAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAA,6BAAqB,EAAC,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9H,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAfW,QAAA,qBAAqB,yBAehC"}
@@ -0,0 +1,18 @@
1
+ import { type EnvironmentArtifactKindV1, type EnvironmentLogicalArtifactReferenceV1, type EnvironmentLogicalEvidenceReferenceV1, type EnvironmentLogicalResourceReferenceV1, type ParsedEnvironmentLogicalArtifactReferenceV1, type ParsedEnvironmentLogicalEvidenceReferenceV1, type ParsedEnvironmentLogicalResourceReferenceV1 } from './contracts.js';
2
+ /** Builds an opaque logical artifact reference. The decoded subject is never a storage path. */
3
+ export declare const buildEnvironmentLogicalArtifactReferenceV1: (artifactKind: EnvironmentArtifactKindV1, canonicalScopeQualifiedSubject: string) => EnvironmentLogicalArtifactReferenceV1;
4
+ /** Parses a V1 logical artifact reference into its allowlisted kind and opaque subject. */
5
+ export declare const parseEnvironmentLogicalArtifactReferenceV1: (value: unknown) => ParsedEnvironmentLogicalArtifactReferenceV1 | null;
6
+ /** Builds an opaque logical Azure resource reference from a canonical resource ID. */
7
+ export declare const buildEnvironmentLogicalResourceReferenceV1: (canonicalAzureResourceId: string) => EnvironmentLogicalResourceReferenceV1;
8
+ /** Parses a V1 logical resource reference into a canonical Azure resource ID. */
9
+ export declare const parseEnvironmentLogicalResourceReferenceV1: (value: unknown) => ParsedEnvironmentLogicalResourceReferenceV1 | null;
10
+ /** Parses either closed V1 logical evidence-reference kind. */
11
+ export declare const parseEnvironmentLogicalEvidenceReferenceV1: (value: unknown) => ParsedEnvironmentLogicalEvidenceReferenceV1 | null;
12
+ /** Returns true when a value is a canonical V1 logical artifact reference. */
13
+ export declare const isEnvironmentLogicalArtifactReferenceV1: (value: unknown) => value is EnvironmentLogicalArtifactReferenceV1;
14
+ /** Returns true when a value is a canonical V1 logical resource reference. */
15
+ export declare const isEnvironmentLogicalResourceReferenceV1: (value: unknown) => value is EnvironmentLogicalResourceReferenceV1;
16
+ /** Returns true when a value is one of the closed V1 logical evidence-reference kinds. */
17
+ export declare const isEnvironmentLogicalEvidenceReferenceV1: (value: unknown) => value is EnvironmentLogicalEvidenceReferenceV1;
18
+ //# sourceMappingURL=references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../src/environment/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC1C,KAAK,2CAA2C,EAChD,KAAK,2CAA2C,EAChD,KAAK,2CAA2C,EACjD,MAAM,gBAAgB,CAAC;AA2IxB,gGAAgG;AAChG,eAAO,MAAM,0CAA0C,GACrD,cAAc,yBAAyB,EACvC,gCAAgC,MAAM,KACrC,qCAOF,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,0CAA0C,GAAI,OAAO,OAAO,KAAG,2CAA2C,GAAG,IAYzH,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,0CAA0C,GAAI,0BAA0B,MAAM,KAAG,qCAI7F,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,0CAA0C,GAAI,OAAO,OAAO,KAAG,2CAA2C,GAAG,IAKzH,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,0CAA0C,GAAI,OAAO,OAAO,KAAG,2CAA2C,GAAG,IAClB,CAAC;AAEzG,8EAA8E;AAC9E,eAAO,MAAM,uCAAuC,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,qCACtB,CAAC;AAE7D,8EAA8E;AAC9E,eAAO,MAAM,uCAAuC,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,qCACtB,CAAC;AAE7D,0FAA0F;AAC1F,eAAO,MAAM,uCAAuC,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,qCACtB,CAAC"}
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEnvironmentLogicalEvidenceReferenceV1 = exports.isEnvironmentLogicalResourceReferenceV1 = exports.isEnvironmentLogicalArtifactReferenceV1 = exports.parseEnvironmentLogicalEvidenceReferenceV1 = exports.parseEnvironmentLogicalResourceReferenceV1 = exports.buildEnvironmentLogicalResourceReferenceV1 = exports.parseEnvironmentLogicalArtifactReferenceV1 = exports.buildEnvironmentLogicalArtifactReferenceV1 = void 0;
4
+ const contracts_js_1 = require("./contracts.js");
5
+ const internal_js_1 = require("./internal.js");
6
+ const BASE64URL_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
7
+ const ARTIFACT_PREFIX = 'spotto://artifact/v1/';
8
+ const RESOURCE_PREFIX = 'spotto://resource/v1/';
9
+ const ARTIFACT_KINDS = new Set(contracts_js_1.ENVIRONMENT_ARTIFACT_KINDS_V1);
10
+ const isCanonicalScopeQualifiedSubject = (value) => {
11
+ try {
12
+ const parsed = JSON.parse(value);
13
+ return (Array.isArray(parsed) &&
14
+ parsed.length === 4 &&
15
+ parsed[0] === 'azure-subscription' &&
16
+ parsed
17
+ .slice(1)
18
+ .every(item => (0, internal_js_1.isBoundedString)(item, contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.scopeIdentifierScalars, { trimmed: true, controls: true })) &&
19
+ JSON.stringify(parsed) === value);
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ };
25
+ const encodeUtf8 = (value) => {
26
+ const bytes = [];
27
+ for (const character of value) {
28
+ const codePoint = character.codePointAt(0);
29
+ if (codePoint <= 0x7f)
30
+ bytes.push(codePoint);
31
+ else if (codePoint <= 0x7ff)
32
+ bytes.push(0xc0 | (codePoint >> 6), 0x80 | (codePoint & 0x3f));
33
+ else if (codePoint <= 0xffff)
34
+ bytes.push(0xe0 | (codePoint >> 12), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
35
+ else
36
+ bytes.push(0xf0 | (codePoint >> 18), 0x80 | ((codePoint >> 12) & 0x3f), 0x80 | ((codePoint >> 6) & 0x3f), 0x80 | (codePoint & 0x3f));
37
+ }
38
+ return bytes;
39
+ };
40
+ const encodeBase64Url = (bytes) => {
41
+ let output = '';
42
+ for (let index = 0; index < bytes.length; index += 3) {
43
+ const first = bytes[index];
44
+ const second = bytes[index + 1];
45
+ const third = bytes[index + 2];
46
+ output += BASE64URL_ALPHABET[first >> 2];
47
+ output += BASE64URL_ALPHABET[((first & 0x03) << 4) | ((second ?? 0) >> 4)];
48
+ if (second !== undefined)
49
+ output += BASE64URL_ALPHABET[((second & 0x0f) << 2) | ((third ?? 0) >> 6)];
50
+ if (third !== undefined)
51
+ output += BASE64URL_ALPHABET[third & 0x3f];
52
+ }
53
+ return output;
54
+ };
55
+ const decodeBase64Url = (value) => {
56
+ if (!/^[A-Za-z0-9_-]+$/u.test(value) || value.length % 4 === 1)
57
+ return null;
58
+ const bytes = [];
59
+ for (let index = 0; index < value.length; index += 4) {
60
+ const first = BASE64URL_ALPHABET.indexOf(value[index]);
61
+ const second = BASE64URL_ALPHABET.indexOf(value[index + 1]);
62
+ const thirdCharacter = value[index + 2];
63
+ const fourthCharacter = value[index + 3];
64
+ const third = thirdCharacter === undefined ? 0 : BASE64URL_ALPHABET.indexOf(thirdCharacter);
65
+ const fourth = fourthCharacter === undefined ? 0 : BASE64URL_ALPHABET.indexOf(fourthCharacter);
66
+ if (first < 0 || second < 0 || third < 0 || fourth < 0)
67
+ return null;
68
+ bytes.push((first << 2) | (second >> 4));
69
+ if (thirdCharacter !== undefined)
70
+ bytes.push(((second & 0x0f) << 4) | (third >> 2));
71
+ if (fourthCharacter !== undefined)
72
+ bytes.push(((third & 0x03) << 6) | fourth);
73
+ }
74
+ return encodeBase64Url(bytes) === value ? bytes : null;
75
+ };
76
+ const decodeUtf8 = (bytes) => {
77
+ let output = '';
78
+ for (let index = 0; index < bytes.length;) {
79
+ const first = bytes[index];
80
+ let codePoint;
81
+ let continuationCount;
82
+ if (first <= 0x7f) {
83
+ codePoint = first;
84
+ continuationCount = 0;
85
+ }
86
+ else if (first >= 0xc2 && first <= 0xdf) {
87
+ codePoint = first & 0x1f;
88
+ continuationCount = 1;
89
+ }
90
+ else if (first >= 0xe0 && first <= 0xef) {
91
+ codePoint = first & 0x0f;
92
+ continuationCount = 2;
93
+ }
94
+ else if (first >= 0xf0 && first <= 0xf4) {
95
+ codePoint = first & 0x07;
96
+ continuationCount = 3;
97
+ }
98
+ else
99
+ return null;
100
+ if (index + continuationCount >= bytes.length)
101
+ return null;
102
+ for (let offset = 1; offset <= continuationCount; offset += 1) {
103
+ const next = bytes[index + offset];
104
+ if ((next & 0xc0) !== 0x80)
105
+ return null;
106
+ codePoint = (codePoint << 6) | (next & 0x3f);
107
+ }
108
+ if ((continuationCount === 2 && codePoint < 0x800) ||
109
+ (continuationCount === 3 && codePoint < 0x10000) ||
110
+ (codePoint >= 0xd800 && codePoint <= 0xdfff) ||
111
+ codePoint > 0x10ffff) {
112
+ return null;
113
+ }
114
+ output += String.fromCodePoint(codePoint);
115
+ index += continuationCount + 1;
116
+ }
117
+ return output;
118
+ };
119
+ const decodePayload = (value) => {
120
+ const bytes = decodeBase64Url(value);
121
+ if (bytes === null || bytes.length > contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.logicalReferencePayloadBytes)
122
+ return null;
123
+ const decoded = decodeUtf8(bytes);
124
+ if (decoded === null || encodeBase64Url(encodeUtf8(decoded)) !== value)
125
+ return null;
126
+ return decoded;
127
+ };
128
+ const assertReferencePayload = (value, label, maximumScalars) => {
129
+ if (!(0, internal_js_1.isBoundedString)(value, maximumScalars, { trimmed: true, controls: true })) {
130
+ throw new TypeError(`${label} must be a non-empty, trimmed, bounded Unicode string without control characters.`);
131
+ }
132
+ if ((0, internal_js_1.utf8ByteLength)(value) > contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.logicalReferencePayloadBytes) {
133
+ throw new RangeError(`${label} exceeds the V1 logical-reference payload limit.`);
134
+ }
135
+ };
136
+ const isCanonicalAzureResourceId = (value) => {
137
+ if (!/^\/subscriptions\/[^/]+\/(?:resourceGroups\/[^/]+\/)?providers\/[^/]+\/[^/]+\/[^/]+(?:\/[^/]+\/[^/]+)*$/iu.test(value) ||
138
+ value.includes('\\') ||
139
+ value.includes('?') ||
140
+ value.includes('#') ||
141
+ value.includes('%') ||
142
+ (0, internal_js_1.hasControlCharacter)(value)) {
143
+ return false;
144
+ }
145
+ return value.split('/').every(segment => segment !== '.' && segment !== '..');
146
+ };
147
+ /** Builds an opaque logical artifact reference. The decoded subject is never a storage path. */
148
+ const buildEnvironmentLogicalArtifactReferenceV1 = (artifactKind, canonicalScopeQualifiedSubject) => {
149
+ if (!ARTIFACT_KINDS.has(artifactKind))
150
+ throw new TypeError('Unsupported V1 environment artifact kind.');
151
+ assertReferencePayload(canonicalScopeQualifiedSubject, 'Artifact subject', contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.customerStringScalars);
152
+ if (!isCanonicalScopeQualifiedSubject(canonicalScopeQualifiedSubject)) {
153
+ throw new TypeError('Artifact subject is not a canonical V1 scope-qualified subject.');
154
+ }
155
+ return `${ARTIFACT_PREFIX}${artifactKind}/${encodeBase64Url(encodeUtf8(canonicalScopeQualifiedSubject))}`;
156
+ };
157
+ exports.buildEnvironmentLogicalArtifactReferenceV1 = buildEnvironmentLogicalArtifactReferenceV1;
158
+ /** Parses a V1 logical artifact reference into its allowlisted kind and opaque subject. */
159
+ const parseEnvironmentLogicalArtifactReferenceV1 = (value) => {
160
+ if (typeof value !== 'string' || !value.startsWith(ARTIFACT_PREFIX))
161
+ return null;
162
+ const remainder = value.slice(ARTIFACT_PREFIX.length);
163
+ const separator = remainder.indexOf('/');
164
+ if (separator <= 0 || remainder.indexOf('/', separator + 1) >= 0)
165
+ return null;
166
+ const artifactKind = remainder.slice(0, separator);
167
+ if (!ARTIFACT_KINDS.has(artifactKind))
168
+ return null;
169
+ const subject = decodePayload(remainder.slice(separator + 1));
170
+ if (subject === null || !isCanonicalScopeQualifiedSubject(subject)) {
171
+ return null;
172
+ }
173
+ return { kind: 'artifact', artifactKind: artifactKind, subject };
174
+ };
175
+ exports.parseEnvironmentLogicalArtifactReferenceV1 = parseEnvironmentLogicalArtifactReferenceV1;
176
+ /** Builds an opaque logical Azure resource reference from a canonical resource ID. */
177
+ const buildEnvironmentLogicalResourceReferenceV1 = (canonicalAzureResourceId) => {
178
+ assertReferencePayload(canonicalAzureResourceId, 'Azure resource ID', contracts_js_1.ENVIRONMENT_CONTRACT_LIMITS_V1.scopeIdentifierScalars);
179
+ if (!isCanonicalAzureResourceId(canonicalAzureResourceId))
180
+ throw new TypeError('Azure resource ID is not canonical or safe.');
181
+ return `${RESOURCE_PREFIX}${encodeBase64Url(encodeUtf8(canonicalAzureResourceId))}`;
182
+ };
183
+ exports.buildEnvironmentLogicalResourceReferenceV1 = buildEnvironmentLogicalResourceReferenceV1;
184
+ /** Parses a V1 logical resource reference into a canonical Azure resource ID. */
185
+ const parseEnvironmentLogicalResourceReferenceV1 = (value) => {
186
+ if (typeof value !== 'string' || !value.startsWith(RESOURCE_PREFIX))
187
+ return null;
188
+ const resourceId = decodePayload(value.slice(RESOURCE_PREFIX.length));
189
+ if (resourceId === null || !isCanonicalAzureResourceId(resourceId))
190
+ return null;
191
+ return { kind: 'resource', resourceId };
192
+ };
193
+ exports.parseEnvironmentLogicalResourceReferenceV1 = parseEnvironmentLogicalResourceReferenceV1;
194
+ /** Parses either closed V1 logical evidence-reference kind. */
195
+ const parseEnvironmentLogicalEvidenceReferenceV1 = (value) => (0, exports.parseEnvironmentLogicalArtifactReferenceV1)(value) ?? (0, exports.parseEnvironmentLogicalResourceReferenceV1)(value);
196
+ exports.parseEnvironmentLogicalEvidenceReferenceV1 = parseEnvironmentLogicalEvidenceReferenceV1;
197
+ /** Returns true when a value is a canonical V1 logical artifact reference. */
198
+ const isEnvironmentLogicalArtifactReferenceV1 = (value) => (0, exports.parseEnvironmentLogicalArtifactReferenceV1)(value) !== null;
199
+ exports.isEnvironmentLogicalArtifactReferenceV1 = isEnvironmentLogicalArtifactReferenceV1;
200
+ /** Returns true when a value is a canonical V1 logical resource reference. */
201
+ const isEnvironmentLogicalResourceReferenceV1 = (value) => (0, exports.parseEnvironmentLogicalResourceReferenceV1)(value) !== null;
202
+ exports.isEnvironmentLogicalResourceReferenceV1 = isEnvironmentLogicalResourceReferenceV1;
203
+ /** Returns true when a value is one of the closed V1 logical evidence-reference kinds. */
204
+ const isEnvironmentLogicalEvidenceReferenceV1 = (value) => (0, exports.parseEnvironmentLogicalEvidenceReferenceV1)(value) !== null;
205
+ exports.isEnvironmentLogicalEvidenceReferenceV1 = isEnvironmentLogicalEvidenceReferenceV1;
206
+ //# sourceMappingURL=references.js.map