@pithy-sh/core 0.10.0 → 0.12.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 (270) hide show
  1. package/dist/access/access.d.ts +172 -0
  2. package/dist/access/access.d.ts.map +1 -0
  3. package/dist/access/access.js +147 -0
  4. package/dist/access/acting.d.ts +49 -0
  5. package/dist/access/acting.d.ts.map +1 -0
  6. package/dist/access/acting.js +21 -0
  7. package/dist/access/policyCheck.d.ts +33 -0
  8. package/dist/access/policyCheck.d.ts.map +1 -0
  9. package/dist/access/policyCheck.js +48 -0
  10. package/dist/access/usage.d.ts +83 -0
  11. package/dist/access/usage.d.ts.map +1 -0
  12. package/dist/access/usage.js +104 -0
  13. package/dist/access/visibility.d.ts +66 -0
  14. package/dist/access/visibility.d.ts.map +1 -0
  15. package/dist/access/visibility.js +86 -0
  16. package/dist/audit/auditEvent.d.ts +5 -0
  17. package/dist/audit/auditEvent.d.ts.map +1 -1
  18. package/dist/audit/auditEvent.js +2 -0
  19. package/dist/audit/recorder.d.ts +10 -2
  20. package/dist/audit/recorder.d.ts.map +1 -1
  21. package/dist/capability/bindings.d.ts +47 -2
  22. package/dist/capability/bindings.d.ts.map +1 -1
  23. package/dist/capability/bindings.js +117 -7
  24. package/dist/capability/capability.d.ts +110 -28
  25. package/dist/capability/capability.d.ts.map +1 -1
  26. package/dist/capability/capability.js +2 -0
  27. package/dist/capability/manifest.d.ts +2 -1
  28. package/dist/capability/manifest.d.ts.map +1 -1
  29. package/dist/capability/manifest.js +1 -1
  30. package/dist/capability/purge.d.ts +80 -0
  31. package/dist/capability/purge.d.ts.map +1 -0
  32. package/dist/capability/purge.js +76 -0
  33. package/dist/capability/settings.d.ts +86 -2
  34. package/dist/capability/settings.d.ts.map +1 -1
  35. package/dist/capability/settings.js +80 -1
  36. package/dist/cli/commandCatalog.generated.d.ts +238 -24
  37. package/dist/cli/commandCatalog.generated.d.ts.map +1 -1
  38. package/dist/cli/commandCatalog.generated.js +251 -22
  39. package/dist/cli/commandFacts.d.ts +2 -1
  40. package/dist/cli/commandFacts.d.ts.map +1 -1
  41. package/dist/cli/commandFacts.js +2 -0
  42. package/dist/controlPlane/capability.d.ts.map +1 -1
  43. package/dist/controlPlane/capability.js +19 -2
  44. package/dist/controlPlane/context.d.ts +5 -0
  45. package/dist/controlPlane/context.d.ts.map +1 -1
  46. package/dist/controlPlane/context.js +3 -1
  47. package/dist/controlPlane/data/connection.d.ts +49 -12
  48. package/dist/controlPlane/data/connection.d.ts.map +1 -1
  49. package/dist/controlPlane/data/connection.js +56 -2
  50. package/dist/controlPlane/discovery/adminRoute.d.ts +29 -0
  51. package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -1
  52. package/dist/controlPlane/discovery/adminRoute.js +3 -0
  53. package/dist/controlPlane/error/errors.d.ts +4 -3
  54. package/dist/controlPlane/error/errors.d.ts.map +1 -1
  55. package/dist/controlPlane/http/cors.d.ts +4 -4
  56. package/dist/controlPlane/http/cors.js +4 -4
  57. package/dist/controlPlane/http/guard.d.ts +11 -0
  58. package/dist/controlPlane/http/guard.d.ts.map +1 -1
  59. package/dist/controlPlane/http/guard.js +17 -1
  60. package/dist/controlPlane/http/handlers.d.ts +139 -0
  61. package/dist/controlPlane/http/handlers.d.ts.map +1 -1
  62. package/dist/controlPlane/http/handlers.js +67 -4
  63. package/dist/controlPlane/http/readiness.d.ts +33 -0
  64. package/dist/controlPlane/http/readiness.d.ts.map +1 -0
  65. package/dist/controlPlane/http/readiness.js +39 -0
  66. package/dist/controlPlane/http/responses.d.ts +245 -0
  67. package/dist/controlPlane/http/responses.d.ts.map +1 -1
  68. package/dist/controlPlane/http/responses.js +101 -4
  69. package/dist/controlPlane/http/routes.d.ts +2 -0
  70. package/dist/controlPlane/http/routes.d.ts.map +1 -1
  71. package/dist/controlPlane/http/routes.js +31 -3
  72. package/dist/controlPlane/http/verify.d.ts.map +1 -1
  73. package/dist/controlPlane/http/verify.js +2 -1
  74. package/dist/controlPlane/migrationState/migrationState.d.ts +102 -0
  75. package/dist/controlPlane/migrationState/migrationState.d.ts.map +1 -0
  76. package/dist/controlPlane/migrationState/migrationState.js +142 -0
  77. package/dist/controlPlane/migrations/0003_connection_principal.d.ts +21 -0
  78. package/dist/controlPlane/migrations/0003_connection_principal.d.ts.map +1 -0
  79. package/dist/controlPlane/migrations/0003_connection_principal.js +33 -0
  80. package/dist/controlPlane/scope/scope.d.ts +23 -2
  81. package/dist/controlPlane/scope/scope.d.ts.map +1 -1
  82. package/dist/controlPlane/scope/scope.js +24 -3
  83. package/dist/createBackend.d.ts.map +1 -1
  84. package/dist/createBackend.js +9 -2
  85. package/dist/createEntrypoint.d.ts.map +1 -1
  86. package/dist/createEntrypoint.js +5 -3
  87. package/dist/crypto/envelope.d.ts +86 -0
  88. package/dist/crypto/envelope.d.ts.map +1 -0
  89. package/dist/crypto/envelope.js +129 -0
  90. package/dist/crypto/fieldKeys.d.ts +41 -0
  91. package/dist/crypto/fieldKeys.d.ts.map +1 -0
  92. package/dist/crypto/fieldKeys.js +56 -0
  93. package/dist/data/codecs.d.ts +23 -10
  94. package/dist/data/codecs.d.ts.map +1 -1
  95. package/dist/data/codecs.js +50 -36
  96. package/dist/entitlement/allowance.d.ts +25 -0
  97. package/dist/entitlement/allowance.d.ts.map +1 -0
  98. package/dist/entitlement/allowance.js +80 -0
  99. package/dist/entitlement/entitlement.d.ts +41 -0
  100. package/dist/entitlement/entitlement.d.ts.map +1 -1
  101. package/dist/entitlement/meter.d.ts +57 -0
  102. package/dist/entitlement/meter.d.ts.map +1 -0
  103. package/dist/entitlement/meter.js +13 -0
  104. package/dist/error/extend.d.ts +6 -5
  105. package/dist/error/extend.d.ts.map +1 -1
  106. package/dist/error/http.d.ts +168 -0
  107. package/dist/error/http.d.ts.map +1 -1
  108. package/dist/error/payload.d.ts +336 -0
  109. package/dist/error/payload.d.ts.map +1 -1
  110. package/dist/error/payload.js +116 -4
  111. package/dist/error/pithyError.d.ts +18 -7
  112. package/dist/error/pithyError.d.ts.map +1 -1
  113. package/dist/error/pithyError.js +6 -0
  114. package/dist/http/authContext.d.ts +7 -0
  115. package/dist/http/authContext.d.ts.map +1 -1
  116. package/dist/http/authContext.js +8 -1
  117. package/dist/http/scopeGates.d.ts +20 -0
  118. package/dist/http/scopeGates.d.ts.map +1 -0
  119. package/dist/http/scopeGates.js +36 -0
  120. package/dist/index.d.ts +1 -1
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.js +2 -2
  123. package/dist/logger/logger.d.ts +12 -5
  124. package/dist/logger/logger.d.ts.map +1 -1
  125. package/dist/logger/record.d.ts +98 -0
  126. package/dist/logger/record.d.ts.map +1 -1
  127. package/dist/migrations/capabilitySets.d.ts +23 -0
  128. package/dist/migrations/capabilitySets.d.ts.map +1 -0
  129. package/dist/migrations/capabilitySets.js +74 -0
  130. package/dist/migrations/registry.d.ts +26 -0
  131. package/dist/migrations/registry.d.ts.map +1 -1
  132. package/dist/migrations/registry.js +38 -7
  133. package/dist/migrations/state.d.ts +60 -0
  134. package/dist/migrations/state.d.ts.map +1 -0
  135. package/dist/migrations/state.js +46 -0
  136. package/dist/naming/feature.d.ts +27 -5
  137. package/dist/naming/feature.d.ts.map +1 -1
  138. package/dist/naming/feature.js +36 -6
  139. package/dist/naming/limits.d.ts +47 -3
  140. package/dist/naming/limits.d.ts.map +1 -1
  141. package/dist/naming/limits.js +47 -3
  142. package/dist/naming/provisionScope.d.ts +6 -0
  143. package/dist/naming/provisionScope.d.ts.map +1 -1
  144. package/dist/naming/provisionScope.js +8 -3
  145. package/dist/naming/resourceNames.d.ts +21 -2
  146. package/dist/naming/resourceNames.d.ts.map +1 -1
  147. package/dist/naming/resourceNames.js +21 -3
  148. package/dist/privacy/blindIndex.d.ts +27 -0
  149. package/dist/privacy/blindIndex.d.ts.map +1 -0
  150. package/dist/privacy/blindIndex.js +57 -0
  151. package/dist/privacy/classes.d.ts +142 -0
  152. package/dist/privacy/classes.d.ts.map +1 -0
  153. package/dist/privacy/classes.js +209 -0
  154. package/dist/privacy/classify.d.ts +336 -0
  155. package/dist/privacy/classify.d.ts.map +1 -0
  156. package/dist/privacy/classify.js +1024 -0
  157. package/dist/privacy/encrypted.d.ts +210 -0
  158. package/dist/privacy/encrypted.d.ts.map +1 -0
  159. package/dist/privacy/encrypted.js +350 -0
  160. package/dist/privacy/encryptedColumns.d.ts +64 -0
  161. package/dist/privacy/encryptedColumns.d.ts.map +1 -0
  162. package/dist/privacy/encryptedColumns.js +134 -0
  163. package/dist/privacy/fieldRotation.d.ts +34 -0
  164. package/dist/privacy/fieldRotation.d.ts.map +1 -0
  165. package/dist/privacy/fieldRotation.js +186 -0
  166. package/dist/privacy/inventory.d.ts +12 -0
  167. package/dist/privacy/inventory.d.ts.map +1 -0
  168. package/dist/privacy/inventory.js +154 -0
  169. package/dist/privacy/posture.d.ts +114 -0
  170. package/dist/privacy/posture.d.ts.map +1 -0
  171. package/dist/privacy/posture.js +136 -0
  172. package/dist/privacy/redact.d.ts +7 -0
  173. package/dist/privacy/redact.d.ts.map +1 -0
  174. package/dist/privacy/redact.js +404 -0
  175. package/dist/privacy/report.d.ts +58 -0
  176. package/dist/privacy/report.d.ts.map +1 -0
  177. package/dist/privacy/report.js +15 -0
  178. package/dist/privacy/retirement.d.ts +68 -0
  179. package/dist/privacy/retirement.d.ts.map +1 -0
  180. package/dist/privacy/retirement.js +72 -0
  181. package/dist/privacy/sealed.d.ts +87 -0
  182. package/dist/privacy/sealed.d.ts.map +1 -0
  183. package/dist/privacy/sealed.js +221 -0
  184. package/dist/privacy/types.d.ts +559 -0
  185. package/dist/privacy/types.d.ts.map +1 -0
  186. package/dist/privacy/types.js +2 -0
  187. package/dist/seed/writeD1.d.ts +7 -1
  188. package/dist/seed/writeD1.d.ts.map +1 -1
  189. package/dist/seed/writeD1.js +9 -3
  190. package/dist/seed/writeKv.d.ts +2 -0
  191. package/dist/seed/writeKv.d.ts.map +1 -1
  192. package/dist/seed/writeKv.js +6 -2
  193. package/dist/version.generated.d.ts +1 -1
  194. package/dist/version.generated.js +1 -1
  195. package/dist/worker/serviceLoopback.d.ts +36 -0
  196. package/dist/worker/serviceLoopback.d.ts.map +1 -0
  197. package/dist/worker/serviceLoopback.js +74 -0
  198. package/dist/workflow/faults.d.ts +12 -1
  199. package/dist/workflow/faults.d.ts.map +1 -1
  200. package/dist/workflow/faults.js +22 -15
  201. package/package.json +2 -2
  202. package/src/access/access.ts +298 -0
  203. package/src/access/acting.ts +59 -0
  204. package/src/access/policyCheck.ts +77 -0
  205. package/src/access/usage.ts +141 -0
  206. package/src/access/visibility.ts +109 -0
  207. package/src/audit/auditEvent.ts +4 -0
  208. package/src/audit/recorder.ts +10 -2
  209. package/src/capability/bindings.ts +159 -13
  210. package/src/capability/capability.ts +114 -29
  211. package/src/capability/purge.ts +124 -0
  212. package/src/capability/settings.ts +146 -2
  213. package/src/cli/commandCatalog.generated.ts +271 -22
  214. package/src/cli/commandFacts.ts +2 -0
  215. package/src/controlPlane/capability.ts +36 -1
  216. package/src/controlPlane/context.ts +4 -0
  217. package/src/controlPlane/data/connection.ts +90 -0
  218. package/src/controlPlane/discovery/adminRoute.ts +11 -0
  219. package/src/controlPlane/error/errors.ts +4 -3
  220. package/src/controlPlane/http/cors.ts +4 -4
  221. package/src/controlPlane/http/guard.ts +21 -0
  222. package/src/controlPlane/http/handlers.ts +98 -4
  223. package/src/controlPlane/http/readiness.ts +50 -0
  224. package/src/controlPlane/http/responses.ts +240 -2
  225. package/src/controlPlane/http/routes.ts +55 -1
  226. package/src/controlPlane/http/verify.ts +2 -0
  227. package/src/controlPlane/migrationState/migrationState.ts +200 -0
  228. package/src/controlPlane/migrations/0003_connection_principal.ts +37 -0
  229. package/src/controlPlane/scope/scope.ts +25 -2
  230. package/src/controlPlane/token/base64url.ts +1 -1
  231. package/src/createBackend.ts +28 -6
  232. package/src/createEntrypoint.ts +9 -3
  233. package/src/crypto/envelope.ts +196 -0
  234. package/src/crypto/fieldKeys.ts +76 -0
  235. package/src/data/codecs.ts +69 -37
  236. package/src/entitlement/allowance.ts +85 -0
  237. package/src/entitlement/entitlement.ts +38 -0
  238. package/src/entitlement/meter.ts +69 -0
  239. package/src/error/extend.ts +6 -5
  240. package/src/error/payload.ts +253 -4
  241. package/src/error/pithyError.ts +21 -7
  242. package/src/http/authContext.ts +13 -1
  243. package/src/http/scopeGates.ts +34 -0
  244. package/src/index.ts +2 -0
  245. package/src/logger/logger.ts +12 -5
  246. package/src/migrations/capabilitySets.ts +87 -0
  247. package/src/migrations/registry.ts +46 -2
  248. package/src/migrations/state.ts +94 -0
  249. package/src/naming/feature.ts +46 -7
  250. package/src/naming/limits.ts +35 -3
  251. package/src/naming/provisionScope.ts +19 -1
  252. package/src/naming/resourceNames.ts +52 -5
  253. package/src/privacy/blindIndex.ts +81 -0
  254. package/src/privacy/classes.ts +277 -0
  255. package/src/privacy/classify.ts +1447 -0
  256. package/src/privacy/encrypted.ts +513 -0
  257. package/src/privacy/encryptedColumns.ts +185 -0
  258. package/src/privacy/fieldRotation.ts +234 -0
  259. package/src/privacy/inventory.ts +147 -0
  260. package/src/privacy/posture.ts +205 -0
  261. package/src/privacy/redact.ts +423 -0
  262. package/src/privacy/report.ts +64 -0
  263. package/src/privacy/retirement.ts +102 -0
  264. package/src/privacy/sealed.ts +323 -0
  265. package/src/privacy/types.ts +804 -0
  266. package/src/seed/writeD1.ts +13 -4
  267. package/src/seed/writeKv.ts +6 -2
  268. package/src/version.generated.ts +1 -1
  269. package/src/worker/serviceLoopback.ts +105 -0
  270. package/src/workflow/faults.ts +51 -24
@@ -148,6 +148,34 @@ const COMMANDS = {
148
148
  },
149
149
  "groups": []
150
150
  },
151
+ "completion": {
152
+ "positionals": [{
153
+ "name": "shell",
154
+ "required": false,
155
+ "variadic": false
156
+ }],
157
+ "flags": {
158
+ "--remove": {
159
+ "type": "boolean",
160
+ "required": false,
161
+ "repeatable": false
162
+ },
163
+ "--status": {
164
+ "type": "boolean",
165
+ "required": false,
166
+ "repeatable": false
167
+ },
168
+ "--json": {
169
+ "type": "boolean",
170
+ "required": false,
171
+ "repeatable": false
172
+ }
173
+ },
174
+ "groups": [{
175
+ "kind": "atMostOne",
176
+ "flags": ["--remove", "--status"]
177
+ }]
178
+ },
151
179
  "contract": {
152
180
  "positionals": [],
153
181
  "flags": {
@@ -238,6 +266,16 @@ const COMMANDS = {
238
266
  "type": "string",
239
267
  "required": false,
240
268
  "repeatable": false
269
+ },
270
+ "--purpose": {
271
+ "type": "string",
272
+ "required": false,
273
+ "repeatable": false
274
+ },
275
+ "--kind": {
276
+ "type": "string",
277
+ "required": false,
278
+ "repeatable": false
241
279
  }
242
280
  },
243
281
  "groups": [
@@ -259,13 +297,20 @@ const COMMANDS = {
259
297
  "needs": ["--public-key"],
260
298
  "any": false
261
299
  },
300
+ {
301
+ "kind": "requires",
302
+ "flag": "--kind",
303
+ "needs": ["--public-key"],
304
+ "any": false
305
+ },
262
306
  {
263
307
  "kind": "requires",
264
308
  "flag": "--update",
265
309
  "needs": [
266
310
  "--worker-url",
267
311
  "--scope",
268
- "--public-key"
312
+ "--public-key",
313
+ "--purpose"
269
314
  ],
270
315
  "any": true
271
316
  }
@@ -787,6 +832,10 @@ const COMMANDS = {
787
832
  "invite",
788
833
  "testerNudge",
789
834
  "passwordChanged",
835
+ "accountSuspended",
836
+ "accountReinstated",
837
+ "deletionScheduled",
838
+ "deletionComplete",
790
839
  "operationalNotice",
791
840
  "newsletter",
792
841
  "leadCapture",
@@ -980,11 +1029,6 @@ const COMMANDS = {
980
1029
  "required": false,
981
1030
  "repeatable": false
982
1031
  },
983
- "--api-token": {
984
- "type": "string",
985
- "required": false,
986
- "repeatable": false
987
- },
988
1032
  "--r2-access-key-id": {
989
1033
  "type": "string",
990
1034
  "required": false,
@@ -995,11 +1039,6 @@ const COMMANDS = {
995
1039
  "required": false,
996
1040
  "repeatable": false
997
1041
  },
998
- "--r2-api-token": {
999
- "type": "string",
1000
- "required": false,
1001
- "repeatable": false
1002
- },
1003
1042
  "--json": {
1004
1043
  "type": "boolean",
1005
1044
  "required": false,
@@ -1120,6 +1159,31 @@ const COMMANDS = {
1120
1159
  },
1121
1160
  "groups": []
1122
1161
  },
1162
+ "privacy enable": {
1163
+ "positionals": [],
1164
+ "flags": {
1165
+ "--class": {
1166
+ "type": "string",
1167
+ "required": false,
1168
+ "repeatable": true
1169
+ },
1170
+ "--json": {
1171
+ "type": "boolean",
1172
+ "required": false,
1173
+ "repeatable": false
1174
+ }
1175
+ },
1176
+ "groups": []
1177
+ },
1178
+ "privacy scan": {
1179
+ "positionals": [],
1180
+ "flags": { "--json": {
1181
+ "type": "boolean",
1182
+ "required": false,
1183
+ "repeatable": false
1184
+ } },
1185
+ "groups": []
1186
+ },
1123
1187
  "provision": {
1124
1188
  "positionals": [],
1125
1189
  "flags": {
@@ -1303,6 +1367,31 @@ const COMMANDS = {
1303
1367
  } },
1304
1368
  "groups": []
1305
1369
  },
1370
+ "secrets retire-version": {
1371
+ "positionals": [{
1372
+ "name": "version",
1373
+ "required": true,
1374
+ "variadic": false
1375
+ }],
1376
+ "flags": {
1377
+ "--env": {
1378
+ "type": "string",
1379
+ "required": false,
1380
+ "repeatable": false
1381
+ },
1382
+ "--past-guard": {
1383
+ "type": "boolean",
1384
+ "required": false,
1385
+ "repeatable": false
1386
+ },
1387
+ "--json": {
1388
+ "type": "boolean",
1389
+ "required": false,
1390
+ "repeatable": false
1391
+ }
1392
+ },
1393
+ "groups": []
1394
+ },
1306
1395
  "secrets rm": {
1307
1396
  "positionals": [{
1308
1397
  "name": "name",
@@ -1354,6 +1443,28 @@ const COMMANDS = {
1354
1443
  },
1355
1444
  "groups": []
1356
1445
  },
1446
+ "secrets tables": {
1447
+ "positionals": [],
1448
+ "flags": {
1449
+ "--env": {
1450
+ "type": "string",
1451
+ "required": false,
1452
+ "repeatable": false,
1453
+ "default": "dev"
1454
+ },
1455
+ "--worker": {
1456
+ "type": "string",
1457
+ "required": false,
1458
+ "repeatable": false
1459
+ },
1460
+ "--json": {
1461
+ "type": "boolean",
1462
+ "required": false,
1463
+ "repeatable": false
1464
+ }
1465
+ },
1466
+ "groups": []
1467
+ },
1357
1468
  "secrets update": {
1358
1469
  "positionals": [{
1359
1470
  "name": "name",
@@ -1452,6 +1563,27 @@ const COMMANDS = {
1452
1563
  },
1453
1564
  "groups": []
1454
1565
  },
1566
+ "setup": {
1567
+ "positionals": [],
1568
+ "flags": {
1569
+ "--skip-install": {
1570
+ "type": "boolean",
1571
+ "required": false,
1572
+ "repeatable": false
1573
+ },
1574
+ "--dry-run": {
1575
+ "type": "boolean",
1576
+ "required": false,
1577
+ "repeatable": false
1578
+ },
1579
+ "--json": {
1580
+ "type": "boolean",
1581
+ "required": false,
1582
+ "repeatable": false
1583
+ }
1584
+ },
1585
+ "groups": []
1586
+ },
1455
1587
  "storage deprovision": {
1456
1588
  "positionals": [],
1457
1589
  "flags": {
@@ -1491,11 +1623,6 @@ const COMMANDS = {
1491
1623
  "required": false,
1492
1624
  "repeatable": false
1493
1625
  },
1494
- "--api-token": {
1495
- "type": "string",
1496
- "required": false,
1497
- "repeatable": false
1498
- },
1499
1626
  "--r2-access-key-id": {
1500
1627
  "type": "string",
1501
1628
  "required": false,
@@ -1872,6 +1999,32 @@ const COMMANDS = {
1872
1999
  },
1873
2000
  "groups": []
1874
2001
  },
2002
+ "token forget": {
2003
+ "positionals": [{
2004
+ "name": "profile",
2005
+ "required": true,
2006
+ "variadic": false
2007
+ }],
2008
+ "flags": {
2009
+ "--env": {
2010
+ "type": "string",
2011
+ "required": false,
2012
+ "repeatable": false,
2013
+ "default": "dev"
2014
+ },
2015
+ "--force": {
2016
+ "type": "boolean",
2017
+ "required": false,
2018
+ "repeatable": false
2019
+ },
2020
+ "--json": {
2021
+ "type": "boolean",
2022
+ "required": false,
2023
+ "repeatable": false
2024
+ }
2025
+ },
2026
+ "groups": []
2027
+ },
1875
2028
  "token list": {
1876
2029
  "positionals": [],
1877
2030
  "flags": {
@@ -1930,7 +2083,12 @@ const COMMANDS = {
1930
2083
  "vectorize:write",
1931
2084
  "ai:read",
1932
2085
  "zone:read",
1933
- "routes:write"
2086
+ "routes:write",
2087
+ "analytics:read",
2088
+ "images:write",
2089
+ "stream:write",
2090
+ "queues:write",
2091
+ "artifacts:write"
1934
2092
  ]
1935
2093
  },
1936
2094
  "--json": {
@@ -2003,7 +2161,12 @@ const COMMANDS = {
2003
2161
  "vectorize:write",
2004
2162
  "ai:read",
2005
2163
  "zone:read",
2006
- "routes:write"
2164
+ "routes:write",
2165
+ "analytics:read",
2166
+ "images:write",
2167
+ "stream:write",
2168
+ "queues:write",
2169
+ "artifacts:write"
2007
2170
  ]
2008
2171
  },
2009
2172
  "--keep-previous": {
@@ -2282,6 +2445,32 @@ const COMMANDS = {
2282
2445
  },
2283
2446
  "groups": []
2284
2447
  },
2448
+ "worker bind": {
2449
+ "positionals": [],
2450
+ "flags": {
2451
+ "--from": {
2452
+ "type": "string",
2453
+ "required": false,
2454
+ "repeatable": false
2455
+ },
2456
+ "--to": {
2457
+ "type": "string",
2458
+ "required": false,
2459
+ "repeatable": false
2460
+ },
2461
+ "--binding": {
2462
+ "type": "string",
2463
+ "required": false,
2464
+ "repeatable": false
2465
+ },
2466
+ "--json": {
2467
+ "type": "boolean",
2468
+ "required": false,
2469
+ "repeatable": false
2470
+ }
2471
+ },
2472
+ "groups": []
2473
+ },
2285
2474
  "worker list": {
2286
2475
  "positionals": [],
2287
2476
  "flags": { "--json": {
@@ -2306,15 +2495,25 @@ const COMMANDS = {
2306
2495
  },
2307
2496
  "worker rename": {
2308
2497
  "positionals": [{
2309
- "name": "from",
2310
- "required": true,
2498
+ "name": "old",
2499
+ "required": false,
2311
2500
  "variadic": false
2312
2501
  }, {
2313
- "name": "to",
2314
- "required": true,
2502
+ "name": "new",
2503
+ "required": false,
2315
2504
  "variadic": false
2316
2505
  }],
2317
2506
  "flags": {
2507
+ "--from": {
2508
+ "type": "string",
2509
+ "required": false,
2510
+ "repeatable": false
2511
+ },
2512
+ "--to": {
2513
+ "type": "string",
2514
+ "required": false,
2515
+ "repeatable": false
2516
+ },
2318
2517
  "--force": {
2319
2518
  "type": "boolean",
2320
2519
  "required": false,
@@ -2353,6 +2552,35 @@ const COMMANDS = {
2353
2552
  }
2354
2553
  },
2355
2554
  "groups": []
2555
+ },
2556
+ "worker unbind": {
2557
+ "positionals": [],
2558
+ "flags": {
2559
+ "--from": {
2560
+ "type": "string",
2561
+ "required": false,
2562
+ "repeatable": false
2563
+ },
2564
+ "--to": {
2565
+ "type": "string",
2566
+ "required": false,
2567
+ "repeatable": false
2568
+ },
2569
+ "--binding": {
2570
+ "type": "string",
2571
+ "required": false,
2572
+ "repeatable": false
2573
+ },
2574
+ "--json": {
2575
+ "type": "boolean",
2576
+ "required": false,
2577
+ "repeatable": false
2578
+ }
2579
+ },
2580
+ "groups": [{
2581
+ "kind": "exactlyOne",
2582
+ "flags": ["--to", "--binding"]
2583
+ }]
2356
2584
  }
2357
2585
  };
2358
2586
  /** The flags every command takes, answered before any command runs. */
@@ -2376,6 +2604,7 @@ const GROUPS = [
2376
2604
  "feature",
2377
2605
  "media",
2378
2606
  "payments",
2607
+ "privacy",
2379
2608
  "secrets",
2380
2609
  "storage",
2381
2610
  "support",
@@ -31,7 +31,7 @@ export type WorkerScopedPath = (typeof WORKER_SCOPED)[number];
31
31
  * The commands that take `--worker` and do not need it: each fans out over every Worker, or falls back to the
32
32
  * first that answers, and the flag narrows.
33
33
  */
34
- export declare const WORKER_NARROWS: readonly ["contract", "dashboard disconnect", "dashboard revoke-key", "dashboard rotate", "dashboard status", "doctor", "env", "init", "migrate", "seed", "support deprovision", "upgrade"];
34
+ export declare const WORKER_NARROWS: readonly ["contract", "dashboard disconnect", "dashboard revoke-key", "dashboard rotate", "dashboard status", "doctor", "env", "init", "migrate", "secrets tables", "seed", "support deprovision", "upgrade"];
35
35
  /**
36
36
  * A command only a person runs, at a terminal, where the Worker is asked for. `pithy remove` refuses every run
37
37
  * that cannot ask (`core/person_required`).
@@ -68,6 +68,7 @@ export declare const DESTRUCTIVE_COMMANDS: {
68
68
  readonly "media deprovision": "the media Worker, and with --storage its bucket";
69
69
  readonly remove: "a capability's wiring";
70
70
  readonly "secrets deprovision": "the secrets manager, and with --keys the store's keys";
71
+ readonly "secrets retire-version": "a field-key version, and every ciphertext still sealed under it";
71
72
  readonly "secrets rm": "a stored secret";
72
73
  readonly "storage deprovision": "the storage Worker, and with --storage its bucket";
73
74
  readonly "support deprovision": "the support Workers, and with --storage its attachments";
@@ -1 +1 @@
1
- {"version":3,"file":"commandFacts.d.ts","sourceRoot":"","sources":["../../src/cli/commandFacts.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,eAAO,MAAM,aAAa,YACxB,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,aAAa,CACL,CAAC;AAEX,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,cAAc,YACzB,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,SAAS,EACT,MAAM,EACN,qBAAqB,EACrB,SAAS,CACD,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,WAAW,YAAI,QAAQ,CAAU,CAAC;AAE/C,uHAAuH;AACvH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAuB,CAAC;AAEhG;;;;GAIG;AACH,eAAO,M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A;CAAE,EAEnG,CAAC"}
@@ -57,6 +57,7 @@ const WORKER_NARROWS = [
57
57
  "env",
58
58
  "init",
59
59
  "migrate",
60
+ "secrets tables",
60
61
  "seed",
61
62
  "support deprovision",
62
63
  "upgrade"
@@ -97,6 +98,7 @@ const DESTRUCTIVE_COMMANDS = {
97
98
  "media deprovision": "the media Worker, and with --storage its bucket",
98
99
  remove: "a capability's wiring",
99
100
  "secrets deprovision": "the secrets manager, and with --keys the store's keys",
101
+ "secrets retire-version": "a field-key version, and every ciphertext still sealed under it",
100
102
  "secrets rm": "a stored secret",
101
103
  "storage deprovision": "the storage Worker, and with --storage its bucket",
102
104
  "support deprovision": "the support Workers, and with --storage its attachments",
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/controlPlane/capability.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,0BAA0B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,kBAAkB,CAAC;AAGvE,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAWnF,OAAO,EACL,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,uEAAuE;AACvE,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,CAAC;IAC7G,gCAAgC;IAChC,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,sBAAsB,CAErG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,sBAAsB,CAmKtF;AAED,4GAA4G;AAC5G,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/controlPlane/capability.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,0BAA0B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,kBAAkB,CAAC;AAKvE,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAkBnF,OAAO,EACL,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,uEAAuE;AACvE,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,CAAC;IAC7G,gCAAgC;IAChC,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,sBAAsB,CAErG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,sBAAsB,CA6LtF;AAED,4GAA4G;AAC5G,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,16 +1,20 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { defineCapability } from "../capability/capability.js";
4
+ import { readRetirement } from "../privacy/fieldRotation.js";
5
+ import { lazyPrivacyInventory } from "../privacy/inventory.js";
4
6
  import { PACKAGE_NAME, PACKAGE_VERSION } from "../version.generated.js";
5
7
  import "../worker/identity.js";
6
8
  import { ControlPlaneConfig } from "./config/config.js";
7
9
  import { ControlPlaneConnection } from "./data/connection.js";
8
10
  import { CONTROL_PLANE_CONNECTIONS_TABLE, controlPlaneTables } from "./data/tables.js";
9
- import { capabilityHealthSources } from "./discovery/health.js";
11
+ import { capabilityHealthSources, defineCapabilityHealth } from "./discovery/health.js";
10
12
  import { createControlPlaneVerifier } from "./http/guard.js";
13
+ import { MIGRATION_HEALTH_KEYS, composeMigrationDatabases, readMigrationHealth } from "./migrationState/migrationState.js";
11
14
  import { controlPlaneRouteDescriptors, registerControlPlaneRoutes } from "./http/routes.js";
12
15
  import { controlplane_0001_init } from "./migrations/0001_init.js";
13
16
  import { controlplane_0002_management_origin } from "./migrations/0002_management_origin.js";
17
+ import { controlplane_0003_connection_principal } from "./migrations/0003_connection_principal.js";
14
18
  import { d1ReplayGuard } from "./replay/d1Guard.js";
15
19
  import { CONTROL_PLANE_KV_BINDING, controlPlaneKvNamespaces, kvReplayGuard } from "./replay/kvGuard.js";
16
20
  //#region src/controlPlane/capability.ts
@@ -52,7 +56,8 @@ function controlplane(options = {}) {
52
56
  const config = ControlPlaneConfig.parse(options);
53
57
  const migrations = {
54
58
  "0001_init": controlplane_0001_init,
55
- "0002_management_origin": controlplane_0002_management_origin
59
+ "0002_management_origin": controlplane_0002_management_origin,
60
+ "0003_connection_principal": controlplane_0003_connection_principal
56
61
  };
57
62
  const requiredBindings = [{
58
63
  type: "d1",
@@ -83,6 +88,9 @@ function controlplane(options = {}) {
83
88
  });
84
89
  let composed = [];
85
90
  let health = /* @__PURE__ */ new Map();
91
+ let migrationDatabases = [];
92
+ let composedCapabilities = [];
93
+ const privacy = lazyPrivacyInventory(() => composedCapabilities);
86
94
  return {
87
95
  ...defineCapability({
88
96
  name: "controlplane",
@@ -98,6 +106,10 @@ function controlplane(options = {}) {
98
106
  } },
99
107
  kvNamespaces: usesKvReplay ? controlPlaneKvNamespaces(config.jtiTtlSeconds) : {},
100
108
  adminRoutes: controlPlaneRouteDescriptors(config.basePath),
109
+ health: defineCapabilityHealth({
110
+ keys: MIGRATION_HEALTH_KEYS,
111
+ read: (c) => readMigrationHealth(c.env, migrationDatabases)
112
+ }),
101
113
  compose: ({ capabilities }) => {
102
114
  composed = capabilities.map((cap) => ({
103
115
  name: cap.name,
@@ -109,6 +121,8 @@ function controlplane(options = {}) {
109
121
  config: { ...cap.manifestConfig?.values ?? {} }
110
122
  }));
111
123
  health = capabilityHealthSources(capabilities);
124
+ migrationDatabases = composeMigrationDatabases(capabilities);
125
+ composedCapabilities = [...capabilities];
112
126
  },
113
127
  middleware: [(app) => {
114
128
  app.use("*", async (c, next) => {
@@ -135,6 +149,9 @@ function controlplane(options = {}) {
135
149
  database,
136
150
  composedCapabilities: () => composed,
137
151
  composedHealth: () => health,
152
+ composedMigrations: () => migrationDatabases,
153
+ privacyInventory: privacy,
154
+ retirement: (env) => readRetirement(env, composedCapabilities),
138
155
  now
139
156
  });
140
157
  }
@@ -24,6 +24,11 @@ export declare const ControlPlaneContext: z.ZodObject<{
24
24
  grantedScopes: z.ZodArray<z.ZodString>;
25
25
  keyId: z.ZodString;
26
26
  tokenId: z.ZodString;
27
+ actorKind: z.ZodNullable<z.ZodEnum<{
28
+ agent: "agent";
29
+ dashboard: "dashboard";
30
+ script: "script";
31
+ }>>;
27
32
  }, z.core.$strip>;
28
33
  export type ControlPlaneContext = z.output<typeof ControlPlaneContext>;
29
34
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/controlPlane/context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;iBAyC7B,CAAC;AACJ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/controlPlane/context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;iBA4C7B,CAAC;AACJ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { ControlPlaneScope } from "./scope/scope.js";
4
+ import { ControlPlaneActorKind } from "./data/connection.js";
4
5
  import { z } from "zod";
5
6
  //#region src/controlPlane/context.ts
6
7
  /**
@@ -25,7 +26,8 @@ const ControlPlaneContext = z.object({
25
26
  scope: ControlPlaneScope.describe("The single scope this token was minted for. One call, one operation — a token carrying the whole grant would make every call as dangerous as the most dangerous one."),
26
27
  grantedScopes: z.array(ControlPlaneScope).describe("Every scope the adopter granted this connection, read from their own row. The authority: a scope absent here is denied however the token is written."),
27
28
  keyId: z.string().describe("Which registered key verified this call. Recorded so a rotation can be traced through the trail, and so a key still in use is visible before it is expired."),
28
- tokenId: z.string().describe("The token's `jti`, already claimed in the replay set. Recorded to tie one audit event to one call.")
29
+ tokenId: z.string().describe("The token's `jti`, already claimed in the replay set. Recorded to tie one audit event to one call."),
30
+ actorKind: ControlPlaneActorKind.nullable().describe("What kind of client the connection is for — `agent`, `dashboard` or `script` — read from the adopter's own row, never from the token. The gate stamps it onto every control-plane audit row this call writes. Null for a connection registered before the kind was recorded (#721).")
29
31
  }).describe("The verified control-plane caller for one request. Never an AuthContext: a management client is not a user of the adopter's app.");
30
32
  //#endregion
31
33
  export { ControlPlaneContext };
@@ -37,6 +37,46 @@ export declare const RegisteredKey: z.ZodObject<{
37
37
  revokedAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
38
38
  }, z.core.$strip>;
39
39
  export type RegisteredKey = z.output<typeof RegisteredKey>;
40
+ /**
41
+ * What kind of client a connection is for (#721): `agent`, `dashboard` or `script`.
42
+ *
43
+ * The audit trail's `actorType: "control-plane"` names all three identically, and the questions asked
44
+ * after an incident are exactly the ones that tell them apart — was it a person at the dashboard, a
45
+ * script somebody wrote, or an agent running unattended. So the kind is recorded on the connection when
46
+ * it is registered and stamped from there onto every row its calls write.
47
+ *
48
+ * It follows the path, never a guess: the device-code flow is a dashboard, always, and a key the
49
+ * operator registered themselves is whichever of the other two they say, out loud, with `--kind`.
50
+ */
51
+ export declare const ControlPlaneActorKind: z.ZodEnum<{
52
+ agent: "agent";
53
+ dashboard: "dashboard";
54
+ script: "script";
55
+ }>;
56
+ export type ControlPlaneActorKind = z.output<typeof ControlPlaneActorKind>;
57
+ /**
58
+ * Who sanctioned a connection: the email address of the signed-in Cloudflare session that registered it.
59
+ *
60
+ * **A plain string, deliberately not a reference.** An adopter's `pithy_auth_users` are their customers,
61
+ * and the operator who registers a connection is their staff, so a join into the organization model would
62
+ * be empty for most of them. A string is readable by anybody, and matchable against a directory where the
63
+ * operator is in one.
64
+ *
65
+ * **Derived, never asserted.** No flag supplies it; the CLI reads it from `GET /user` under the session.
66
+ */
67
+ export declare const ConnectionPrincipal: z.ZodEmail;
68
+ export type ConnectionPrincipal = z.output<typeof ConnectionPrincipal>;
69
+ /** The longest purpose a connection may carry. One line on a review screen, with room to say what it does. */
70
+ export declare const MAX_CONNECTION_PURPOSE = 200;
71
+ /**
72
+ * What a connection is for, in the words of whoever registered it (#721).
73
+ *
74
+ * **Required at registration, and refused when absent**, because a review listing credentials by key id
75
+ * cannot support the decision it exists for. **Untrusted input**: a customer writes it and something else
76
+ * renders it, so it is validated on the way in, and again on every read of the row.
77
+ */
78
+ export declare const ConnectionPurpose: z.ZodString;
79
+ export type ConnectionPurpose = z.output<typeof ConnectionPurpose>;
40
80
  /**
41
81
  * One management-client connection — the row in `pithy_controlplane_connections`.
42
82
  *
@@ -52,18 +92,15 @@ export declare const ControlPlaneConnection: z.ZodObject<{
52
92
  workerUrl: z.ZodURL;
53
93
  basePath: z.ZodDefault<z.ZodString>;
54
94
  managementOrigin: z.ZodDefault<z.ZodNullable<z.ZodURL>>;
55
- scopes: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodArray<z.ZodString>>;
56
- keys: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
57
- keyId: z.ZodString;
58
- publicKey: z.ZodObject<{
59
- kty: z.ZodLiteral<"OKP">;
60
- crv: z.ZodLiteral<"Ed25519">;
61
- x: z.ZodString;
62
- }, z.core.$strip>;
63
- validFrom: z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>;
64
- validUntil: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
65
- revokedAt: z.ZodNullable<z.ZodCodec<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodDate]>, z.ZodDate>>;
66
- }, z.core.$strip>>]>, z.ZodArray<z.ZodObject<{
95
+ authorizedBy: z.ZodDefault<z.ZodNullable<z.ZodEmail>>;
96
+ actorKind: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
97
+ agent: "agent";
98
+ dashboard: "dashboard";
99
+ script: "script";
100
+ }>>>;
101
+ purpose: z.ZodDefault<z.ZodNullable<z.ZodString>>;
102
+ scopes: import("../../data/codecs").SqliteJson<z.ZodArray<z.ZodString>>;
103
+ keys: import("../../data/codecs").SqliteJson<z.ZodArray<z.ZodObject<{
67
104
  keyId: z.ZodString;
68
105
  publicKey: z.ZodObject<{
69
106
  kty: z.ZodLiteral<"OKP">;
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/data/connection.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