@yadsh/dsh-qa-integrations 0.5.0 → 0.7.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 (206) hide show
  1. package/README.md +636 -202
  2. package/compatibility.json +1 -1
  3. package/lib/broker.js +468 -9
  4. package/lib/broker.js.map +1 -1
  5. package/lib/client/bitrix24.js +67 -5
  6. package/lib/client/bitrix24.js.map +1 -1
  7. package/lib/client/card.js +8 -1
  8. package/lib/client/card.js.map +1 -1
  9. package/lib/client/confluence.js +98 -129
  10. package/lib/client/confluence.js.map +1 -1
  11. package/lib/client/gitlab.js +41 -5
  12. package/lib/client/gitlab.js.map +1 -1
  13. package/lib/client/index.js +33 -11
  14. package/lib/client/index.js.map +1 -1
  15. package/lib/client/integrations.js +40 -3
  16. package/lib/client/integrations.js.map +1 -1
  17. package/lib/client/jira.js +96 -127
  18. package/lib/client/jira.js.map +1 -1
  19. package/lib/client/operator-card.js +537 -0
  20. package/lib/client/operator-card.js.map +1 -0
  21. package/lib/client/operator-controls.js +232 -0
  22. package/lib/client/operator-controls.js.map +1 -0
  23. package/lib/client/provider-card.js +138 -4
  24. package/lib/client/provider-card.js.map +1 -1
  25. package/lib/client/styles.js +68 -5
  26. package/lib/client/styles.js.map +1 -1
  27. package/lib/client/teamcity.js +31 -4
  28. package/lib/client/teamcity.js.map +1 -1
  29. package/lib/client/testit.js +101 -0
  30. package/lib/client/testit.js.map +1 -0
  31. package/lib/client/weblate.js +105 -0
  32. package/lib/client/weblate.js.map +1 -0
  33. package/lib/client.js +5214 -1054
  34. package/lib/client.js.map +1 -1
  35. package/lib/coerce.js +16 -7
  36. package/lib/coerce.js.map +1 -1
  37. package/lib/config.js +12 -0
  38. package/lib/config.js.map +1 -1
  39. package/lib/errors.js.map +1 -1
  40. package/lib/index.js +444 -57
  41. package/lib/index.js.map +1 -1
  42. package/lib/providers/bitrix24/catalog.js +151 -8
  43. package/lib/providers/bitrix24/catalog.js.map +1 -1
  44. package/lib/providers/bitrix24/config.js +87 -13
  45. package/lib/providers/bitrix24/config.js.map +1 -1
  46. package/lib/providers/bitrix24/credential-help.js +24 -0
  47. package/lib/providers/bitrix24/credential-help.js.map +1 -0
  48. package/lib/providers/bitrix24/index.js +122 -0
  49. package/lib/providers/bitrix24/index.js.map +1 -1
  50. package/lib/providers/bitrix24/operations.js +60 -1
  51. package/lib/providers/bitrix24/operations.js.map +1 -1
  52. package/lib/providers/bitrix24/tools.js +95 -3
  53. package/lib/providers/bitrix24/tools.js.map +1 -1
  54. package/lib/providers/confluence/catalog.js +51 -3
  55. package/lib/providers/confluence/catalog.js.map +1 -1
  56. package/lib/providers/confluence/credential-help.js +29 -0
  57. package/lib/providers/confluence/credential-help.js.map +1 -0
  58. package/lib/providers/confluence/index.js +302 -35
  59. package/lib/providers/confluence/index.js.map +1 -1
  60. package/lib/providers/confluence/operations.js +1 -1
  61. package/lib/providers/confluence/operations.js.map +1 -1
  62. package/lib/providers/gitlab/catalog.js +108 -15
  63. package/lib/providers/gitlab/catalog.js.map +1 -1
  64. package/lib/providers/gitlab/config.js +11 -3
  65. package/lib/providers/gitlab/config.js.map +1 -1
  66. package/lib/providers/gitlab/credential-help.js +33 -0
  67. package/lib/providers/gitlab/credential-help.js.map +1 -0
  68. package/lib/providers/gitlab/index.js +337 -6
  69. package/lib/providers/gitlab/index.js.map +1 -1
  70. package/lib/providers/jira/catalog.js +73 -3
  71. package/lib/providers/jira/catalog.js.map +1 -1
  72. package/lib/providers/jira/credential-help.js +31 -0
  73. package/lib/providers/jira/credential-help.js.map +1 -0
  74. package/lib/providers/jira/index.js +275 -12
  75. package/lib/providers/jira/index.js.map +1 -1
  76. package/lib/providers/registry.js +4 -0
  77. package/lib/providers/registry.js.map +1 -1
  78. package/lib/providers/shared/credential-help.js +29 -0
  79. package/lib/providers/shared/credential-help.js.map +1 -0
  80. package/lib/providers/shared/service-boundary.js +44 -0
  81. package/lib/providers/shared/service-boundary.js.map +1 -0
  82. package/lib/providers/teamcity/catalog.js +56 -2
  83. package/lib/providers/teamcity/catalog.js.map +1 -1
  84. package/lib/providers/teamcity/credential-help.js +25 -0
  85. package/lib/providers/teamcity/credential-help.js.map +1 -0
  86. package/lib/providers/teamcity/index.js +254 -2
  87. package/lib/providers/teamcity/index.js.map +1 -1
  88. package/lib/providers/testit/attachments.js +131 -0
  89. package/lib/providers/testit/attachments.js.map +1 -0
  90. package/lib/providers/testit/catalog.js +302 -0
  91. package/lib/providers/testit/catalog.js.map +1 -0
  92. package/lib/providers/testit/config.js +175 -0
  93. package/lib/providers/testit/config.js.map +1 -0
  94. package/lib/providers/testit/credential-help.js +29 -0
  95. package/lib/providers/testit/credential-help.js.map +1 -0
  96. package/lib/providers/testit/index.js +458 -0
  97. package/lib/providers/testit/index.js.map +1 -0
  98. package/lib/providers/testit/operations.js +1070 -0
  99. package/lib/providers/testit/operations.js.map +1 -0
  100. package/lib/providers/testit/tools.js +717 -0
  101. package/lib/providers/testit/tools.js.map +1 -0
  102. package/lib/providers/testit/transport.js +158 -0
  103. package/lib/providers/testit/transport.js.map +1 -0
  104. package/lib/providers/weblate/catalog.js +279 -0
  105. package/lib/providers/weblate/catalog.js.map +1 -0
  106. package/lib/providers/weblate/config.js +147 -0
  107. package/lib/providers/weblate/config.js.map +1 -0
  108. package/lib/providers/weblate/credential-help.js +26 -0
  109. package/lib/providers/weblate/credential-help.js.map +1 -0
  110. package/lib/providers/weblate/index.js +419 -0
  111. package/lib/providers/weblate/index.js.map +1 -0
  112. package/lib/providers/weblate/operations.js +703 -0
  113. package/lib/providers/weblate/operations.js.map +1 -0
  114. package/lib/providers/weblate/query.js +80 -0
  115. package/lib/providers/weblate/query.js.map +1 -0
  116. package/lib/providers/weblate/tools.js +408 -0
  117. package/lib/providers/weblate/tools.js.map +1 -0
  118. package/lib/providers/weblate/transport.js +179 -0
  119. package/lib/providers/weblate/transport.js.map +1 -0
  120. package/lib/repository.js +197 -13
  121. package/lib/repository.js.map +1 -1
  122. package/lib/service-credentials/config.js +179 -0
  123. package/lib/service-credentials/config.js.map +1 -0
  124. package/lib/service-credentials/policy.js +92 -0
  125. package/lib/service-credentials/policy.js.map +1 -0
  126. package/lib/service-credentials/registry.js +142 -0
  127. package/lib/service-credentials/registry.js.map +1 -0
  128. package/lib/service-credentials/state.js +30 -0
  129. package/lib/service-credentials/state.js.map +1 -0
  130. package/lib/service-credentials/types.js +20 -0
  131. package/lib/service-credentials/types.js.map +1 -0
  132. package/lib/shared/settings.js +8 -13
  133. package/lib/shared/settings.js.map +1 -1
  134. package/lib/tools.js +27 -2
  135. package/lib/tools.js.map +1 -1
  136. package/lib/typert.host.js +1340 -100
  137. package/lib/typert.remote-client.d.ts +45 -11
  138. package/lib/typert.remote-client.js +1101 -38
  139. package/lib/types/broker.d.ts +79 -5
  140. package/lib/types/client/bitrix24.d.ts +24 -2
  141. package/lib/types/client/card.d.ts +3 -1
  142. package/lib/types/client/confluence.d.ts +19 -3
  143. package/lib/types/client/gitlab.d.ts +15 -2
  144. package/lib/types/client/index.d.ts +7 -5
  145. package/lib/types/client/integrations.d.ts +12 -3
  146. package/lib/types/client/jira.d.ts +20 -3
  147. package/lib/types/client/operator-card.d.ts +22 -0
  148. package/lib/types/client/operator-controls.d.ts +135 -0
  149. package/lib/types/client/provider-card.d.ts +50 -8
  150. package/lib/types/client/styles.d.ts +4 -3
  151. package/lib/types/client/teamcity.d.ts +15 -2
  152. package/lib/types/client/testit.d.ts +28 -0
  153. package/lib/types/client/weblate.d.ts +28 -0
  154. package/lib/types/coerce.d.ts +2 -2
  155. package/lib/types/config.d.ts +21 -0
  156. package/lib/types/errors.d.ts +9 -1
  157. package/lib/types/index.d.ts +183 -18
  158. package/lib/types/providers/bitrix24/catalog.d.ts +9 -1
  159. package/lib/types/providers/bitrix24/config.d.ts +23 -22
  160. package/lib/types/providers/bitrix24/credential-help.d.ts +8 -0
  161. package/lib/types/providers/bitrix24/index.d.ts +41 -1
  162. package/lib/types/providers/bitrix24/tools.d.ts +4 -0
  163. package/lib/types/providers/confluence/catalog.d.ts +11 -3
  164. package/lib/types/providers/confluence/credential-help.d.ts +9 -0
  165. package/lib/types/providers/confluence/index.d.ts +66 -7
  166. package/lib/types/providers/confluence/operations.d.ts +2 -0
  167. package/lib/types/providers/contract.d.ts +62 -1
  168. package/lib/types/providers/gitlab/catalog.d.ts +20 -5
  169. package/lib/types/providers/gitlab/config.d.ts +14 -3
  170. package/lib/types/providers/gitlab/credential-help.d.ts +9 -0
  171. package/lib/types/providers/gitlab/index.d.ts +51 -1
  172. package/lib/types/providers/jira/catalog.d.ts +13 -0
  173. package/lib/types/providers/jira/credential-help.d.ts +8 -0
  174. package/lib/types/providers/jira/index.d.ts +53 -1
  175. package/lib/types/providers/registry.d.ts +2 -0
  176. package/lib/types/providers/shared/credential-help.d.ts +17 -0
  177. package/lib/types/providers/shared/service-boundary.d.ts +25 -0
  178. package/lib/types/providers/teamcity/catalog.d.ts +18 -2
  179. package/lib/types/providers/teamcity/credential-help.d.ts +8 -0
  180. package/lib/types/providers/teamcity/index.d.ts +53 -2
  181. package/lib/types/providers/testit/attachments.d.ts +20 -0
  182. package/lib/types/providers/testit/catalog.d.ts +87 -0
  183. package/lib/types/providers/testit/config.d.ts +61 -0
  184. package/lib/types/providers/testit/credential-help.d.ts +8 -0
  185. package/lib/types/providers/testit/index.d.ts +119 -0
  186. package/lib/types/providers/testit/operations.d.ts +95 -0
  187. package/lib/types/providers/testit/tools.d.ts +15 -0
  188. package/lib/types/providers/testit/transport.d.ts +67 -0
  189. package/lib/types/providers/weblate/catalog.d.ts +60 -0
  190. package/lib/types/providers/weblate/config.d.ts +57 -0
  191. package/lib/types/providers/weblate/credential-help.d.ts +9 -0
  192. package/lib/types/providers/weblate/index.d.ts +92 -0
  193. package/lib/types/providers/weblate/operations.d.ts +77 -0
  194. package/lib/types/providers/weblate/query.d.ts +37 -0
  195. package/lib/types/providers/weblate/tools.d.ts +15 -0
  196. package/lib/types/providers/weblate/transport.d.ts +60 -0
  197. package/lib/types/repository.d.ts +38 -3
  198. package/lib/types/service-credentials/config.d.ts +73 -0
  199. package/lib/types/service-credentials/policy.d.ts +44 -0
  200. package/lib/types/service-credentials/registry.d.ts +43 -0
  201. package/lib/types/service-credentials/state.d.ts +14 -0
  202. package/lib/types/service-credentials/types.d.ts +97 -0
  203. package/lib/types/shared/settings.d.ts +8 -13
  204. package/lib/types/tools.d.ts +10 -1
  205. package/lib/types/types.d.ts +114 -10
  206. package/package.json +7 -7
@@ -0,0 +1,179 @@
1
+ import { createHash } from "node:crypto";
2
+ import z from "@deepseek-ai/schemastery";
3
+ export const MANAGED_SERVICE_CREDENTIALS_DEFAULTS = Object.freeze({
4
+ enabled: false,
5
+ defaultForNewConnections: true,
6
+ });
7
+ /**
8
+ * Config schema of this slice. Profile entries stay opaque here on purpose:
9
+ * `resolveManagedServiceCredentials` validates them in one place, where it can
10
+ * fail loudly with the profile id in the message instead of an anonymous
11
+ * schema error.
12
+ */
13
+ export const managedServiceCredentialsSchema = z.object({
14
+ enabled: z.boolean().default(MANAGED_SERVICE_CREDENTIALS_DEFAULTS.enabled),
15
+ defaultForNewConnections: z
16
+ .boolean()
17
+ .default(MANAGED_SERVICE_CREDENTIALS_DEFAULTS.defaultForNewConnections),
18
+ profiles: z.array(z.any()).default([]),
19
+ });
20
+ const PROFILE_ID = /^[a-z0-9][a-z0-9-]{0,63}$/u;
21
+ const PROVIDER_ID = /^[a-z0-9][a-z0-9-]{0,31}$/u;
22
+ const RESOURCE_KIND = /^[a-z][a-z0-9_]{0,31}$/u;
23
+ const SECRET_ENV = /^[A-Z][A-Z0-9_]{0,63}$/u;
24
+ const MAX_PROFILES = 64;
25
+ const MAX_RESOURCES_PER_KIND = 512;
26
+ function configError(message) {
27
+ return new Error(`qa-integrations managed service credentials: ${message}`);
28
+ }
29
+ function nonEmpty(value, what, index) {
30
+ const text = typeof value === "string" ? value.trim() : "";
31
+ if (text === "")
32
+ throw configError(`profiles[${index}].${what} is required`);
33
+ return text;
34
+ }
35
+ /**
36
+ * One resource list of a profile. Values are the identifiers the provider
37
+ * itself accepts in a call — a GitLab project id or full path, a TeamCity
38
+ * project id — so the boundary and a tool argument compare as strings.
39
+ */
40
+ function normalizeResources(input, id) {
41
+ const kinds = {};
42
+ for (const [rawKind, values] of Object.entries(input ?? {})) {
43
+ const kind = rawKind.trim();
44
+ if (!RESOURCE_KIND.test(kind)) {
45
+ throw configError(`profile ${id} has an invalid resource kind "${rawKind}"`);
46
+ }
47
+ if (!Array.isArray(values)) {
48
+ throw configError(`profile ${id}.resources.${kind} must be a list`);
49
+ }
50
+ if (values.length > MAX_RESOURCES_PER_KIND) {
51
+ throw configError(`profile ${id}.resources.${kind} accepts at most ${MAX_RESOURCES_PER_KIND} entries`);
52
+ }
53
+ const refs = [];
54
+ for (const value of values) {
55
+ const ref = typeof value === "number" && Number.isFinite(value)
56
+ ? String(value)
57
+ : typeof value === "string"
58
+ ? value.trim()
59
+ : "";
60
+ if (ref === "") {
61
+ throw configError(`profile ${id}.resources.${kind} entries must be non-empty strings or numbers`);
62
+ }
63
+ if (!refs.includes(ref))
64
+ refs.push(ref);
65
+ }
66
+ if (refs.length === 0) {
67
+ throw configError(`profile ${id}.resources.${kind} is empty`);
68
+ }
69
+ kinds[kind] = Object.freeze(refs);
70
+ }
71
+ if (Object.keys(kinds).length === 0) {
72
+ // A managed credential without a resource boundary would see everything its
73
+ // upstream identity sees, which is the opposite of the model this feature
74
+ // implements. Refusing here keeps that invariant a load-time one.
75
+ throw configError(`profile ${id} must define a resource boundary (resources.<kind>)`);
76
+ }
77
+ return Object.freeze(kinds);
78
+ }
79
+ /**
80
+ * Administrator policy of one profile. The service ceiling is a hard maximum,
81
+ * so this map may only remove: a key set to anything but `deny` is rejected
82
+ * rather than ignored, because an operator who wrote `allow` believes they
83
+ * widened something.
84
+ */
85
+ function normalizePolicy(input, id) {
86
+ const policy = {};
87
+ for (const [rawKey, value] of Object.entries(input ?? {})) {
88
+ const key = rawKey.trim();
89
+ if (key === "") {
90
+ throw configError(`profile ${id} has an empty policy key`);
91
+ }
92
+ if (value !== "deny") {
93
+ throw configError(`profile ${id}.policy["${rawKey}"] must be "deny": the service ceiling can only be narrowed`);
94
+ }
95
+ policy[key] = "deny";
96
+ }
97
+ return Object.freeze(policy);
98
+ }
99
+ function normalizeProfile(input, index, seen) {
100
+ const id = nonEmpty(input.id, "id", index);
101
+ if (!PROFILE_ID.test(id)) {
102
+ throw configError(`profiles[${index}].id must be lowercase latin, digits or dashes`);
103
+ }
104
+ if (seen.has(id))
105
+ throw configError(`profiles[${index}].id is a duplicate`);
106
+ seen.add(id);
107
+ const provider = nonEmpty(input.provider, "provider", index);
108
+ if (!PROVIDER_ID.test(provider)) {
109
+ throw configError(`profiles[${index}].provider must be a provider id`);
110
+ }
111
+ const instance = nonEmpty(input.instance, "instance", index);
112
+ const secretFile = typeof input.credential?.secretFile === "string"
113
+ ? input.credential.secretFile.trim()
114
+ : "";
115
+ const secretEnv = typeof input.credential?.secretEnv === "string"
116
+ ? input.credential.secretEnv.trim()
117
+ : "";
118
+ if (secretFile === "" && secretEnv === "") {
119
+ throw configError(`profile ${id} needs credential.secretFile or credential.secretEnv`);
120
+ }
121
+ if (secretFile !== "" && secretEnv !== "") {
122
+ throw configError(`profile ${id} must set either credential.secretFile or credential.secretEnv, not both`);
123
+ }
124
+ if (secretEnv !== "" && !SECRET_ENV.test(secretEnv)) {
125
+ throw configError(`profile ${id}.credential.secretEnv must be an environment variable name`);
126
+ }
127
+ const label = typeof input.label === "string" ? input.label.trim() : "";
128
+ const authType = typeof input.credential?.type === "string" &&
129
+ input.credential.type.trim() !== ""
130
+ ? input.credential.type.trim()
131
+ : "token";
132
+ return Object.freeze({
133
+ id,
134
+ provider,
135
+ instance,
136
+ label: label === "" ? id : label,
137
+ enabled: input.enabled ?? true,
138
+ authType,
139
+ secretRef: secretFile === "" ? `env:${secretEnv}` : `file:${secretFile}`,
140
+ resources: normalizeResources(input.resources, id),
141
+ policy: normalizePolicy(input.policy, id),
142
+ });
143
+ }
144
+ export function resolveManagedServiceCredentials(input = {}) {
145
+ const profiles = input.profiles ?? [];
146
+ if (!Array.isArray(profiles)) {
147
+ throw configError("profiles must be a list");
148
+ }
149
+ if (profiles.length > MAX_PROFILES) {
150
+ throw configError(`profiles accepts at most ${MAX_PROFILES} entries`);
151
+ }
152
+ const seen = new Set();
153
+ return Object.freeze({
154
+ enabled: input.enabled ?? MANAGED_SERVICE_CREDENTIALS_DEFAULTS.enabled,
155
+ defaultForNewConnections: input.defaultForNewConnections ??
156
+ MANAGED_SERVICE_CREDENTIALS_DEFAULTS.defaultForNewConnections,
157
+ profiles: Object.freeze(profiles.map((profile, index) => normalizeProfile(profile, index, seen))),
158
+ });
159
+ }
160
+ /**
161
+ * Revision of everything about a profile that policy decisions depend on. A
162
+ * change here means every cache, cursor and pending action that was produced
163
+ * under the previous revision has to be treated as stale.
164
+ */
165
+ export function profilePolicyRevision(profile) {
166
+ return digest(JSON.stringify({
167
+ id: profile.id,
168
+ provider: profile.provider,
169
+ portal: profile.instance,
170
+ enabled: profile.enabled,
171
+ resources: profile.resources,
172
+ policy: profile.policy,
173
+ }));
174
+ }
175
+ /** Short content digest; used for revisions and never as a secret fingerprint. */
176
+ export function digest(value) {
177
+ return createHash("sha256").update(value).digest("hex").slice(0, 16);
178
+ }
179
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/service-credentials/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,CAAC,MAAM,0BAA0B,CAAC;AA2DzC,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC,MAAM,CAAC;IAChE,OAAO,EAAE,KAAK;IACd,wBAAwB,EAAE,IAAI;CAC/B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAA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AU,CAAC;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,oCAAoC,CAAC,OAAO;QACtE,wBAAwB,EACtB,KAAK,CAAC,wBAAwB;YAC9B,oCAAoC,CAAC,wBAAwB;QAC/D,QAAQ,EAAE,MAAM,CAAC,MAAM,CACrB,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CACzE;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAA8C;IAE9C,OAAO,MAAM,CACX,IAAI,CAAC,SAAS,CAAC;QACb,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,OAAO,CAAC,QAAQ;QACxB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,MAAM,CAAC,KAAsB;IAC3C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * The service ceiling: an operation reaches a managed credential only when it
3
+ * is a read, carries no more than normal sensitivity, and was classified as
4
+ * service-safe on purpose. Upstream permissions are never part of this test:
5
+ * a service token that happens to be able to trigger a build still cannot,
6
+ * because the operation is a write.
7
+ */
8
+ export const SERVICE_CEILING = Object.freeze({
9
+ effect: "read",
10
+ sensitivity: "normal",
11
+ serviceCredential: "allow",
12
+ });
13
+ const ALLOWED = Object.freeze({ allowed: true });
14
+ function denied(code, message) {
15
+ return { allowed: false, code, message };
16
+ }
17
+ /**
18
+ * Decide one operation against the service ceiling and the administrator's
19
+ * narrowing of it. The order of the checks is the order of the guarantees: an
20
+ * operation is refused for being a write before it is refused for being
21
+ * sensitive, so a caller can never widen the ceiling by re-classifying an
22
+ * operation as sensitive.
23
+ */
24
+ export function evaluateServiceOperation(query) {
25
+ const { metadata, capability, profile, boundaryKind } = query;
26
+ if (metadata.effect !== "read") {
27
+ return denied("OperationNotAllowedWithServiceCredential", "Only read operations are available through the service credential");
28
+ }
29
+ if (metadata.sensitivity !== "normal") {
30
+ return denied("SensitiveReadRequiresPersonalCredential", "This operation can return personal or otherwise sensitive data");
31
+ }
32
+ if (metadata.serviceCredential !== "allow") {
33
+ return denied("OperationNotAllowedWithServiceCredential", "This operation is not enabled for the service credential");
34
+ }
35
+ if (narrowed(profile, capability) !== undefined) {
36
+ return denied("OperationNotAllowedWithServiceCredential", "This operation is disabled for the service credential by deployment policy");
37
+ }
38
+ if (metadata.requiresResourceBoundary === true) {
39
+ if (boundaryKind === undefined) {
40
+ // The provider did not say which boundary the operation reads; without
41
+ // that there is no way to hold the call inside the boundary, so it fails
42
+ // closed instead of reading the service account's whole upstream view.
43
+ return denied("ServiceResourceNotAllowed", "This operation is not scoped to a resource the service credential may read");
44
+ }
45
+ const allowed = profile.resources[boundaryKind];
46
+ if (allowed === undefined || allowed.length === 0) {
47
+ return denied("ServiceResourceNotAllowed", `The service credential does not bound ${boundaryKind}`);
48
+ }
49
+ }
50
+ return ALLOWED;
51
+ }
52
+ /** The policy key that narrows an operation, if the administrator set one. */
53
+ function narrowed(profile, capability) {
54
+ const keys = Object.keys(profile.policy);
55
+ if (keys.length === 0)
56
+ return undefined;
57
+ for (const key of keys) {
58
+ if (capability !== undefined && key === capability)
59
+ return key;
60
+ if (key.startsWith(`${profile.provider}.`)) {
61
+ const bare = key.slice(profile.provider.length + 1);
62
+ if (capability !== undefined && bare === capability)
63
+ return key;
64
+ }
65
+ }
66
+ return undefined;
67
+ }
68
+ /** Exact membership of one identifier in one kind of a boundary. */
69
+ export function boundaryHas(boundary, kind, ref) {
70
+ return (boundary[kind] ?? []).includes(ref);
71
+ }
72
+ /**
73
+ * Narrow a profile boundary by a user's own selection. A user may only remove:
74
+ * anything not present in the profile boundary is dropped, so a forged
75
+ * selection that named a resource outside the administrator's list can never
76
+ * widen what the deployment allows.
77
+ */
78
+ export function narrowBoundary(boundary, selection) {
79
+ if (selection === undefined)
80
+ return boundary;
81
+ const narrowed = {};
82
+ for (const [kind, allowed] of Object.entries(boundary)) {
83
+ // Anything that is not a list of identifiers reads as "nothing narrowed": a
84
+ // malformed selection can only fail to remove, never to add.
85
+ const chosen = selection[kind];
86
+ narrowed[kind] = Array.isArray(chosen)
87
+ ? Object.freeze(allowed.filter((ref) => chosen.includes(ref)))
88
+ : allowed;
89
+ }
90
+ return Object.freeze(narrowed);
91
+ }
92
+ //# sourceMappingURL=policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/service-credentials/policy.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAA8B,MAAM,CAAC,MAAM,CAAC;IACtE,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,QAAQ;IACrB,iBAAiB,EAAE,OAAO;CAC3B,CAAC,CAAC;AAUH,MAAM,OAAO,GAA0B,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AAExE,SAAS,MAAM,CACb,IAA0B,EAC1B,OAAe;IAEf,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC;AAWD;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACtC,KAA4B;IAE5B,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,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,OAAO,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { readFileSync, statSync } from "node:fs";
2
+ import { IntegrationError } from "../errors.js";
3
+ import { digest, profilePolicyRevision, } from "./config.js";
4
+ /**
5
+ * Deployment-owned service credentials. Profiles come from operator
6
+ * configuration, their secrets from a mounted file or the environment, and
7
+ * nothing here is reachable from a user: a user cannot create a profile, change
8
+ * a secret, move an upstream identity or choose a profile by id.
9
+ *
10
+ * Secrets are read lazily and cached by file stamp, so rotating a mounted
11
+ * secret takes effect on the next call without anyone reconnecting and without
12
+ * restarting the host.
13
+ */
14
+ export class ServiceCredentialRegistry {
15
+ profiles;
16
+ byPortal = new Map();
17
+ secrets = new Map();
18
+ env;
19
+ constructor(config, resolvePortal, options = {}) {
20
+ this.env = options.env ?? process.env;
21
+ const seen = new Set();
22
+ this.profiles = Object.freeze(config.profiles.map((profile) => {
23
+ const portal = resolvePortal(profile.provider, profile.instance);
24
+ if (portal === undefined || portal === "") {
25
+ throw new Error(`qa-integrations managed service credentials: profile ${profile.id} names unknown ${profile.provider} instance "${profile.instance}"`);
26
+ }
27
+ const resolved = Object.freeze({
28
+ id: profile.id,
29
+ provider: profile.provider,
30
+ instance: profile.instance,
31
+ portal,
32
+ label: profile.label,
33
+ authType: profile.authType,
34
+ secretRef: profile.secretRef,
35
+ enabled: profile.enabled,
36
+ resources: profile.resources,
37
+ policy: profile.policy,
38
+ policyRevision: profilePolicyRevision(profile),
39
+ });
40
+ const key = portalKey(profile.provider, portal);
41
+ if (seen.has(key)) {
42
+ throw new Error(`qa-integrations managed service credentials: two profiles bind ${profile.provider} instance "${profile.instance}"`);
43
+ }
44
+ seen.add(key);
45
+ this.byPortal.set(key, resolved);
46
+ return resolved;
47
+ }));
48
+ }
49
+ /** The profile a binding of this provider and portal resolves to, if any. */
50
+ find(provider, portal) {
51
+ return this.byPortal.get(portalKey(provider, portal));
52
+ }
53
+ /** True when this provider/portal can offer service mode at all. */
54
+ available(provider, portal) {
55
+ return this.find(provider, portal)?.enabled === true;
56
+ }
57
+ list() {
58
+ return this.profiles;
59
+ }
60
+ /**
61
+ * The secret of one profile plus the revision of its content. Throwing here
62
+ * is the fail-closed path: a profile whose secret is missing, empty or
63
+ * unreadable serves nothing, and the message names the reference, never the
64
+ * value.
65
+ */
66
+ readSecret(profile) {
67
+ const cached = this.load(profile);
68
+ return {
69
+ profile,
70
+ secret: cached.secret,
71
+ credentialRevision: cached.revision,
72
+ };
73
+ }
74
+ /** Drop a cached secret; the next read re-reads it. Used by rotation tests. */
75
+ forget(profileId) {
76
+ this.secrets.delete(profileId);
77
+ }
78
+ load(profile) {
79
+ if (profile.secretRef.startsWith("env:")) {
80
+ return this.loadEnv(profile, profile.secretRef.slice("env:".length));
81
+ }
82
+ return this.loadFile(profile, profile.secretRef.slice("file:".length));
83
+ }
84
+ loadEnv(profile, name) {
85
+ const raw = this.env[name];
86
+ const value = typeof raw === "string" ? raw.trim() : "";
87
+ if (value === "") {
88
+ throw new IntegrationError("ServiceCredentialUnavailable", `Service credential ${profile.id} is not available`);
89
+ }
90
+ const revision = digest(value);
91
+ const cached = this.secrets.get(profile.id);
92
+ if (cached !== undefined && cached.revision === revision)
93
+ return cached;
94
+ const next = {
95
+ revision,
96
+ secret: value,
97
+ mtimeMs: 0,
98
+ size: 0,
99
+ };
100
+ this.secrets.set(profile.id, next);
101
+ return next;
102
+ }
103
+ loadFile(profile, filePath) {
104
+ let stamp;
105
+ try {
106
+ const stat = statSync(filePath);
107
+ stamp = { mtimeMs: stat.mtimeMs, size: stat.size };
108
+ }
109
+ catch {
110
+ throw new IntegrationError("ServiceCredentialUnavailable", `Service credential ${profile.id} is not available`);
111
+ }
112
+ const cached = this.secrets.get(profile.id);
113
+ if (cached !== undefined &&
114
+ cached.mtimeMs === stamp.mtimeMs &&
115
+ cached.size === stamp.size) {
116
+ return cached;
117
+ }
118
+ let value;
119
+ try {
120
+ value = readFileSync(filePath, "utf8").trim();
121
+ }
122
+ catch {
123
+ throw new IntegrationError("ServiceCredentialUnavailable", `Service credential ${profile.id} is not available`);
124
+ }
125
+ if (value === "") {
126
+ throw new IntegrationError("ServiceCredentialUnavailable", `Service credential ${profile.id} is not available`);
127
+ }
128
+ const next = {
129
+ revision: digest(value),
130
+ secret: value,
131
+ mtimeMs: stamp.mtimeMs,
132
+ size: stamp.size,
133
+ };
134
+ this.secrets.set(profile.id, next);
135
+ return next;
136
+ }
137
+ }
138
+ /** Profiles are matched by provider and portal, never by a caller-chosen id. */
139
+ export function portalKey(provider, portal) {
140
+ return `${provider}\u0000${portal}`;
141
+ }
142
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/service-credentials/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,MAAM,EACN,qBAAqB,GAGtB,MAAM,aAAa,CAAC;AAcrB;;;;;;;;;GASG;AACH,MAAM,OAAO,yBAAyB;IACnB,QAAQ,CAAsC;IAC9C,QAAQ,GAAG,IAAI,GAAG,EAAoC,CAAC;IACvD,OAAO,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1C,GAAG,CAAoB;IAExC,YACE,MAAuC,EACvC,aAAyE,EACzE,OAAO,GAAyC,EAAE;QAElD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QACtC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAC3B,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,MAAM,MAAM,GAAG,aAAa,CAA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AAI,EAC1B,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,IAAI,KAAa,CAAC;QAClB,IAAI,CAAC;YACH,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,gBAAgB,CACxB,8BAA8B,EAC9B,sBAAsB,OAAO,CAAC,EAAE,mBAAmB,CACpD,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,gBAAgB,CACxB,8BAA8B,EAC9B,sBAAsB,OAAO,CAAC,EAAE,mBAAmB,CACpD,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAiB;YACzB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC;YACvB,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,gFAAgF;AAChF,MAAM,UAAU,SAAS,CAAC,QAAgB,EAAE,MAAc;IACxD,OAAO,GAAG,QAAQ,SAAS,MAAM,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * How one capability of a provider behaves under the managed credential,
3
+ * derived from the classifications of the operations that make it up. A
4
+ * capability with no classified operation — or one whose provider never listed
5
+ * it — is reported as unavailable, so a client never shows a switch that would
6
+ * do nothing.
7
+ */
8
+ export function operationCapabilityServiceState(operations, capability) {
9
+ let seen = false;
10
+ let sensitive = false;
11
+ for (const definition of Object.values(operations)) {
12
+ if (definition.capability !== capability)
13
+ continue;
14
+ seen = true;
15
+ const { effect, sensitivity, serviceCredential } = definition.security;
16
+ if (effect !== "read" || serviceCredential !== "allow") {
17
+ // A write, an admin action or an explicitly denied operation makes the
18
+ // whole capability unreachable through a shared credential; a sensitive
19
+ // read only makes it personal-only, because sensitive reads stay
20
+ // available to the user's own account.
21
+ if (effect !== "read" || sensitivity === "normal")
22
+ return "unavailable";
23
+ sensitive = true;
24
+ }
25
+ }
26
+ if (!seen)
27
+ return "unavailable";
28
+ return sensitive ? "sensitive" : "available";
29
+ }
30
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/service-credentials/state.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,UAQC,EACD,UAAkB;IAElB,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACnD,IAAI,UAAU,CAAC,UAAU,KAAK,UAAU;YAAE,SAAS;QACnD,IAAI,GAAG,IAAI,CAAC;QACZ,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,QAAQ,CAAC;QACvE,IAAI,MAAM,KAAK,MAAM,IAAI,iBAAiB,KAAK,OAAO,EAAE,CAAC;YACvD,uEAAuE;YACvE,wEAAwE;YACxE,iEAAiE;YACjE,uCAAuC;YACvC,IAAI,MAAM,KAAK,MAAM,IAAI,WAAW,KAAK,QAAQ;gBAAE,OAAO,aAAa,CAAC;YACxE,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI;QAAE,OAAO,aAAa,CAAC;IAChC,OAAO,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const CREDENTIAL_SOURCES = Object.freeze([
2
+ "personal",
3
+ "service",
4
+ ]);
5
+ export function isCredentialSource(value) {
6
+ return value === "personal" || value === "service";
7
+ }
8
+ /**
9
+ * Classification of an operation its provider does not classify. Deliberately
10
+ * the most restrictive values in every field, so an operation added by a
11
+ * provider update is unreachable through the managed credential until someone
12
+ * classifies it on purpose. This is a release-blocking invariant.
13
+ */
14
+ export const UNCLASSIFIED_OPERATION = Object.freeze({
15
+ effect: "admin",
16
+ sensitivity: "secret",
17
+ serviceCredential: "deny",
18
+ requiresResourceBoundary: true,
19
+ });
20
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/service-credentials/types.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,MAAM,kBAAkB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC3E,UAAU;IACV,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,SAAS,CAAC;AACrD,CAAC;AA4BD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA8B,MAAM,CAAC,MAAM,CAAC;IAC7E,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,QAAQ;IACrB,iBAAiB,EAAE,MAAM;IACzB,wBAAwB,EAAE,IAAI;CAC/B,CAAC,CAAC"}
@@ -1,19 +1,14 @@
1
1
  /**
2
- * The one place that names the settings namespace. The Host serves the section
3
- * and the browser card keys on it, so both halves must agree without importing
4
- * each other (the host entry pulls Node code into the bundle, the card pulls
5
- * DOM code into the Host).
6
- * @module shared/settings
2
+ * Identity shared by the Host plugin and its operator card.
3
+ *
4
+ * This module must stay dependency-free: the card bundle inlines it, and a
5
+ * browser build must not pull the Host config surface (schemastery) into the
6
+ * page just to learn the namespace name.
7
7
  */
8
8
  /**
9
- * Settings namespace of the Integrations card.
10
- *
11
- * The Plugins tab dispatches a card by the namespace its Host serves, so the
12
- * deployment mounts this section to give the browser half a key. It carries no
13
- * editable value on purpose: the provider switches, the address policy and the
14
- * vault path are composition-time decisions (`cordis.patch.yml`) that the
15
- * runtime resolves once at boot, and a settings field the runtime only honored
16
- * after a restart would read as a save that applied.
9
+ * Settings namespace the plugin owns and its operator card binds to. The
10
+ * namespace carries the deployment configuration the card edits; the profile
11
+ * composition row stays the base layer an override reverts to.
17
12
  */
18
13
  export const QA_INTEGRATIONS_SETTINGS_NAMESPACE = "qa-integrations";
19
14
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/shared/settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC"}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/shared/settings.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,iBAAiB,CAAC"}
package/lib/tools.js CHANGED
@@ -1,8 +1,10 @@
1
- import { createBitrix24Tools, BITRIX24_TOOL_NAMES, } from "./providers/bitrix24/tools.js";
1
+ import { createBitrix24Tools, BITRIX24_COMMENT_TOOL_NAME, BITRIX24_TOOL_NAMES, } from "./providers/bitrix24/tools.js";
2
2
  import { createConfluenceTools, CONFLUENCE_TOOL_NAMES, } from "./providers/confluence/tools.js";
3
3
  import { createGitlabTools, GITLAB_TOOL_NAMES, } from "./providers/gitlab/tools.js";
4
4
  import { createJiraTools, JIRA_TOOL_NAMES } from "./providers/jira/tools.js";
5
+ import { createTestitTools, TESTIT_TOOL_NAMES, } from "./providers/testit/tools.js";
5
6
  import { createTeamcityTools, TEAMCITY_TOOL_NAMES, } from "./providers/teamcity/tools.js";
7
+ import { createWeblateTools, WEBLATE_TOOL_NAMES, } from "./providers/weblate/tools.js";
6
8
  /**
7
9
  * Model-facing tool names of every enabled provider, in registration order. The
8
10
  * QA surface admits exactly these names as principal-scoped, so this list is the
@@ -14,15 +16,38 @@ export const INTEGRATION_TOOL_NAMES = [
14
16
  ...GITLAB_TOOL_NAMES,
15
17
  ...TEAMCITY_TOOL_NAMES,
16
18
  ...JIRA_TOOL_NAMES,
19
+ ...TESTIT_TOOL_NAMES,
20
+ ...WEBLATE_TOOL_NAMES,
17
21
  ];
22
+ /**
23
+ * The names to admit and mount for one deployment: the read-only catalog plus,
24
+ * only when the operator switched it on, the Bitrix24 timeline comment. The
25
+ * mount and the admission list must always be derived through this function so
26
+ * the two cannot drift apart.
27
+ */
28
+ export function integrationToolNames(options = {}) {
29
+ if (options.bitrix24CrmCommentWrite !== true)
30
+ return INTEGRATION_TOOL_NAMES;
31
+ // The mounted list carries the comment tool at the end of the Bitrix24
32
+ // block, where the provider module mounts it.
33
+ const names = [...INTEGRATION_TOOL_NAMES];
34
+ names.splice(BITRIX24_TOOL_NAMES.length, 0, BITRIX24_COMMENT_TOOL_NAME);
35
+ return names;
36
+ }
18
37
  /** Provider tool modules, composed into one registration list. */
19
38
  export function createIntegrationTools(options) {
20
39
  return [
21
- ...createBitrix24Tools(options),
40
+ ...createBitrix24Tools({
41
+ broker: options.broker,
42
+ principalForSession: options.principalForSession,
43
+ crmCommentWrite: options.bitrix24CrmCommentWrite === true,
44
+ }),
22
45
  ...createConfluenceTools(options),
23
46
  ...createGitlabTools(options),
24
47
  ...createTeamcityTools(options),
25
48
  ...createJiraTools(options),
49
+ ...createTestitTools(options),
50
+ ...createWeblateTools(options),
26
51
  ];
27
52
  }
28
53
  //# sourceMappingURL=tools.js.map
package/lib/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,i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