@superblocksteam/shared 0.9620.0 → 0.9620.1

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 (314) hide show
  1. package/dist/bindings/utils.d.ts.map +1 -1
  2. package/dist/constants.d.ts +7 -9
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +11 -13
  5. package/dist/constants.js.map +1 -1
  6. package/dist/database-lifecycle/appDatabaseCompatibility.d.ts +2 -2
  7. package/dist/database-lifecycle/appDatabaseCompatibility.d.ts.map +1 -1
  8. package/dist/database-lifecycle/appDatabaseImport.d.ts +2 -2
  9. package/dist/database-lifecycle/appDatabaseImport.d.ts.map +1 -1
  10. package/dist/database-lifecycle/appDatabaseStatus.d.ts +1 -1
  11. package/dist/database-lifecycle/appDatabaseStatus.d.ts.map +1 -1
  12. package/dist/database-lifecycle/appDatabaseStatus.test.js.map +1 -1
  13. package/dist/database-lifecycle/capacityPolicy.d.ts +2 -2
  14. package/dist/database-lifecycle/capacityPolicy.d.ts.map +1 -1
  15. package/dist/database-lifecycle/capacityPolicy.js.map +1 -1
  16. package/dist/database-lifecycle/dataImport.d.ts +4 -4
  17. package/dist/database-lifecycle/dataImport.d.ts.map +1 -1
  18. package/dist/database-lifecycle/destructiveMigrations.d.ts +3 -3
  19. package/dist/database-lifecycle/destructiveMigrations.js.map +1 -1
  20. package/dist/database-lifecycle/importCompatibility.d.ts +4 -4
  21. package/dist/database-lifecycle/importCompatibility.d.ts.map +1 -1
  22. package/dist/database-lifecycle/importCompatibility.test.js.map +1 -1
  23. package/dist/database-lifecycle/index.d.ts +13 -13
  24. package/dist/database-lifecycle/index.d.ts.map +1 -1
  25. package/dist/database-lifecycle/physicalPoolIdentity.d.ts.map +1 -1
  26. package/dist/database-lifecycle/physicalPoolIdentity.js.map +1 -1
  27. package/dist/errors/git.d.ts.map +1 -1
  28. package/dist/errors/http.d.ts.map +1 -1
  29. package/dist/errors/integration.d.ts.map +1 -1
  30. package/dist/jwt/verifier.d.ts.map +1 -1
  31. package/dist/observability/index.d.ts.map +1 -1
  32. package/dist/org-features/index.d.ts +2 -2
  33. package/dist/org-features/index.d.ts.map +1 -1
  34. package/dist/pageMigrations/migrations/v4to5.d.ts.map +1 -1
  35. package/dist/pageMigrations/migrations/v5to6.d.ts.map +1 -1
  36. package/dist/pageMigrations/migrations/v5to6.test.js +1 -1
  37. package/dist/pageMigrations/migrations/v6to7/adjustModalCanvases.d.ts.map +1 -1
  38. package/dist/pageMigrations/migrations/v6to7/adjustModalCanvases.test.js +1 -1
  39. package/dist/pageMigrations/migrations/v6to7/migrateToDimensions.d.ts.map +1 -1
  40. package/dist/pageMigrations/migrations/v6to7/migrateToDimensions.test.js +2 -2
  41. package/dist/pageMigrations/migrations/v6to7/migrateToSections.d.ts.map +1 -1
  42. package/dist/pageMigrations/migrations/v6to7/v6to7.d.ts.map +1 -1
  43. package/dist/pageMigrations/migrations/v7to8.d.ts.map +1 -1
  44. package/dist/pageMigrations/migrations/v7to8.test.js +1 -1
  45. package/dist/pages/pageV6.d.ts.map +1 -1
  46. package/dist/pages/pageV7.d.ts.map +1 -1
  47. package/dist/pages/pageV8.d.ts.map +1 -1
  48. package/dist/plugins/registry.d.ts.map +1 -1
  49. package/dist/plugins/templates/constants.d.ts +1 -1
  50. package/dist/plugins/templates/constants.d.ts.map +1 -1
  51. package/dist/plugins/templates/graphql.d.ts.map +1 -1
  52. package/dist/plugins/templates/gsheets.d.ts.map +1 -1
  53. package/dist/plugins/templates/lakebase.d.ts.map +1 -1
  54. package/dist/plugins/templates/mcp.d.ts.map +1 -1
  55. package/dist/plugins/templates/mcp.test.js +13 -0
  56. package/dist/plugins/templates/mcp.test.js.map +1 -1
  57. package/dist/plugins/templates/salesforce.d.ts.map +1 -1
  58. package/dist/plugins/templates/shared/auth.d.ts.map +1 -1
  59. package/dist/plugins/templates/shared/auth.js +16 -0
  60. package/dist/plugins/templates/shared/auth.js.map +1 -1
  61. package/dist/plugins/templates/shared/aws.d.ts.map +1 -1
  62. package/dist/plugins/templates/shared/db.d.ts.map +1 -1
  63. package/dist/plugins/templates/shared/openapi.d.ts.map +1 -1
  64. package/dist/plugins/templates/shared/restapiintegration.d.ts.map +1 -1
  65. package/dist/plugins/templates/shared/sql.d.ts.map +1 -1
  66. package/dist/plugins/templates/shared/sshtunnel.d.ts.map +1 -1
  67. package/dist/plugins/templates/snowflakepostgres.d.ts.map +1 -1
  68. package/dist/refactoring/refactor.test.js +274 -260
  69. package/dist/refactoring/refactor.test.js.map +1 -1
  70. package/dist/refactoring/rename.js.map +1 -1
  71. package/dist/relay/builder.d.ts.map +1 -1
  72. package/dist/signing/JSON/portable.js +2 -2
  73. package/dist/signing/index.js.map +1 -1
  74. package/dist/socket/heartbeat.d.ts.map +1 -1
  75. package/dist/socket/heartbeat.js.map +1 -1
  76. package/dist/socket/heartbeat.test.js.map +1 -1
  77. package/dist/socket/protocol.d.ts +6 -1
  78. package/dist/socket/protocol.d.ts.map +1 -1
  79. package/dist/socket/socket.d.ts +1 -1
  80. package/dist/socket/socket.d.ts.map +1 -1
  81. package/dist/socket/socket.js +2 -2
  82. package/dist/socket/socketWithClientAuth.d.ts.map +1 -1
  83. package/dist/socket/tracedSocket.d.ts.map +1 -1
  84. package/dist/socket/types.d.ts.map +1 -1
  85. package/dist/socket/util.js.map +1 -1
  86. package/dist/tracing/methodTracing.js +1 -1
  87. package/dist/types/ai/builder-caller.d.ts.map +1 -1
  88. package/dist/types/ai/builder-caller.js.map +1 -1
  89. package/dist/types/ai/index.d.ts +16 -4
  90. package/dist/types/ai/index.d.ts.map +1 -1
  91. package/dist/types/ai/index.js +1 -0
  92. package/dist/types/ai/index.js.map +1 -1
  93. package/dist/types/ai/native-builder-model.d.ts +21 -0
  94. package/dist/types/ai/native-builder-model.d.ts.map +1 -0
  95. package/dist/types/ai/native-builder-model.js +26 -0
  96. package/dist/types/ai/native-builder-model.js.map +1 -0
  97. package/dist/types/ai/native-builder-model.test.d.ts +2 -0
  98. package/dist/types/ai/native-builder-model.test.d.ts.map +1 -0
  99. package/dist/types/ai/native-builder-model.test.js +30 -0
  100. package/dist/types/ai/native-builder-model.test.js.map +1 -0
  101. package/dist/types/ai/provider-credential.d.ts +1 -1
  102. package/dist/types/ai/provider-credential.d.ts.map +1 -1
  103. package/dist/types/ai/quota-paywall.d.ts.map +1 -1
  104. package/dist/types/ai/safety-classification.d.ts +1 -1
  105. package/dist/types/ai/safety-classification.d.ts.map +1 -1
  106. package/dist/types/api/control-flow.d.ts +12 -12
  107. package/dist/types/api/control-flow.d.ts.map +1 -1
  108. package/dist/types/api/control-flow.js.map +1 -1
  109. package/dist/types/api/execution.d.ts.map +1 -1
  110. package/dist/types/api/global.d.ts.map +1 -1
  111. package/dist/types/api/global.js +1 -2
  112. package/dist/types/api/global.js.map +1 -1
  113. package/dist/types/api/index.d.ts +1 -1
  114. package/dist/types/api/index.d.ts.map +1 -1
  115. package/dist/types/api/schedule.d.ts.map +1 -1
  116. package/dist/types/application/index.d.ts +2 -1
  117. package/dist/types/application/index.d.ts.map +1 -1
  118. package/dist/types/application/index.js.map +1 -1
  119. package/dist/types/application/index.test.js.map +1 -1
  120. package/dist/types/audit/ocsf.d.ts.map +1 -1
  121. package/dist/types/audit/ocsf.js +1 -0
  122. package/dist/types/audit/ocsf.js.map +1 -1
  123. package/dist/types/branch/index.d.ts +40 -9
  124. package/dist/types/branch/index.d.ts.map +1 -1
  125. package/dist/types/codeSecurity/index.d.ts +3 -3
  126. package/dist/types/codeSecurity/index.d.ts.map +1 -1
  127. package/dist/types/common/env.d.ts.map +1 -1
  128. package/dist/types/common/response.d.ts.map +1 -1
  129. package/dist/types/credentials/index.d.ts +3 -3
  130. package/dist/types/credentials/index.d.ts.map +1 -1
  131. package/dist/types/customAgents.d.ts +2 -3
  132. package/dist/types/customAgents.d.ts.map +1 -1
  133. package/dist/types/datasource/auth.d.ts.map +1 -1
  134. package/dist/types/datasource/auth.js.map +1 -1
  135. package/dist/types/datasource/index.d.ts.map +1 -1
  136. package/dist/types/datasource/metadata/database.d.ts.map +1 -1
  137. package/dist/types/event/index.d.ts +3 -3
  138. package/dist/types/group/index.d.ts.map +1 -1
  139. package/dist/types/integration/index.d.ts.map +1 -1
  140. package/dist/types/integration/index.js +2 -2
  141. package/dist/types/metadata/index.d.ts.map +1 -1
  142. package/dist/types/organization/agent.d.ts.map +1 -1
  143. package/dist/types/organization/token.d.ts.map +1 -1
  144. package/dist/types/page/Dimension.d.ts +7 -7
  145. package/dist/types/page/Dimension.d.ts.map +1 -1
  146. package/dist/types/page/Dimension.js +1 -1
  147. package/dist/types/page/Dimension.js.map +1 -1
  148. package/dist/types/page/Dimension.test.js +1 -1
  149. package/dist/types/page/Padding.d.ts +2 -2
  150. package/dist/types/page/Padding.d.ts.map +1 -1
  151. package/dist/types/page/Padding.js +1 -1
  152. package/dist/types/plugin/evaluation.d.ts +12 -5
  153. package/dist/types/plugin/evaluation.d.ts.map +1 -1
  154. package/dist/types/plugin/evaluation.js +5 -5
  155. package/dist/types/plugin/evaluation.js.map +1 -1
  156. package/dist/types/plugin/form.d.ts +1 -1
  157. package/dist/types/plugin/form.d.ts.map +1 -1
  158. package/dist/types/plugin/index.d.ts.map +1 -1
  159. package/dist/types/plugin/integration.d.ts.map +1 -1
  160. package/dist/types/plugin/js-tokenizer.d.ts +14 -0
  161. package/dist/types/plugin/js-tokenizer.d.ts.map +1 -0
  162. package/dist/types/plugin/js-tokenizer.js +97 -0
  163. package/dist/types/plugin/js-tokenizer.js.map +1 -0
  164. package/dist/types/plugin/js-tokenizer.test.d.ts +2 -0
  165. package/dist/types/plugin/js-tokenizer.test.d.ts.map +1 -0
  166. package/dist/types/plugin/js-tokenizer.test.js +126 -0
  167. package/dist/types/plugin/js-tokenizer.test.js.map +1 -0
  168. package/dist/types/policyGate/errors.d.ts +23 -23
  169. package/dist/types/policyGate/errors.d.ts.map +1 -1
  170. package/dist/types/profile/index.d.ts.map +1 -1
  171. package/dist/types/publishPipeline/index.d.ts +6 -6
  172. package/dist/types/publishPipeline/index.d.ts.map +1 -1
  173. package/dist/types/publishPipeline/policyStatus.js.map +1 -1
  174. package/dist/types/rbac/index.d.ts +4 -0
  175. package/dist/types/rbac/index.d.ts.map +1 -1
  176. package/dist/types/rbac/index.js +4 -0
  177. package/dist/types/rbac/index.js.map +1 -1
  178. package/dist/types/repository/index.d.ts.map +1 -1
  179. package/dist/types/repository/index.js.map +1 -1
  180. package/dist/types/response/IssueSuperblocksResponseBody.d.ts +6 -0
  181. package/dist/types/response/IssueSuperblocksResponseBody.d.ts.map +1 -1
  182. package/dist/types/reviewPolicy/index.d.ts +24 -24
  183. package/dist/types/reviewPolicy/index.d.ts.map +1 -1
  184. package/dist/types/user/analytics.d.ts +1 -1
  185. package/dist/types/user/analytics.d.ts.map +1 -1
  186. package/dist/utils/apiv2.d.ts.map +1 -1
  187. package/dist/utils/apiv2.js +1 -1
  188. package/dist/utils/apiv2.test.js +10 -10
  189. package/dist/utils/appDSL.d.ts.map +1 -1
  190. package/dist/utils/attachment-upload.d.ts +1 -1
  191. package/dist/utils/attachment-upload.d.ts.map +1 -1
  192. package/dist/utils/attachment-upload.js +3 -1
  193. package/dist/utils/attachment-upload.js.map +1 -1
  194. package/dist/utils/attachment-validation.d.ts +6 -6
  195. package/dist/utils/attachment-validation.d.ts.map +1 -1
  196. package/dist/utils/attachment-validation.js.map +1 -1
  197. package/dist/utils/azure-devops-workflow.js.map +1 -1
  198. package/dist/utils/bitbucket-workflow.js.map +1 -1
  199. package/dist/utils/bytestring.js +1 -1
  200. package/dist/utils/env.d.ts.map +1 -1
  201. package/dist/utils/env.js +4 -4
  202. package/dist/utils/github-workflow.js.map +1 -1
  203. package/dist/utils/gitlab-workflow.js.map +1 -1
  204. package/dist/utils/index.d.ts +2 -0
  205. package/dist/utils/index.d.ts.map +1 -1
  206. package/dist/utils/index.js +2 -0
  207. package/dist/utils/index.js.map +1 -1
  208. package/dist/utils/localNativeBuilderFlags.d.ts +9 -0
  209. package/dist/utils/localNativeBuilderFlags.d.ts.map +1 -0
  210. package/dist/utils/localNativeBuilderFlags.js +26 -0
  211. package/dist/utils/localNativeBuilderFlags.js.map +1 -0
  212. package/dist/utils/localNativeBuilderFlags.test.d.ts +2 -0
  213. package/dist/utils/localNativeBuilderFlags.test.d.ts.map +1 -0
  214. package/dist/utils/localNativeBuilderFlags.test.js +35 -0
  215. package/dist/utils/localNativeBuilderFlags.test.js.map +1 -0
  216. package/dist/utils/maskCredential.d.ts.map +1 -1
  217. package/dist/utils/openApiSpecRef.d.ts.map +1 -1
  218. package/dist/utils/pageFixtures/v4/container.d.ts +346 -346
  219. package/dist/utils/pageFixtures/v4/container.d.ts.map +1 -1
  220. package/dist/utils/pageFixtures/v4/empty.d.ts.map +1 -1
  221. package/dist/utils/pageFixtures/v4/form.d.ts +11 -11
  222. package/dist/utils/pageFixtures/v4/form.d.ts.map +1 -1
  223. package/dist/utils/pageFixtures/v4/grid.d.ts +9 -9
  224. package/dist/utils/pageFixtures/v4/grid.d.ts.map +1 -1
  225. package/dist/utils/pageFixtures/v4/slideout.d.ts.map +1 -1
  226. package/dist/utils/pageFixtures/v4/tabs.d.ts.map +1 -1
  227. package/dist/utils/pageFixtures/v5/codeTrigger.d.ts.map +1 -1
  228. package/dist/utils/pageFixtures/v5/complexTriggers.d.ts.map +1 -1
  229. package/dist/utils/pageFixtures/v5/duplicateTriggers.d.ts.map +1 -1
  230. package/dist/utils/pageFixtures/v5/missingTriggers.d.ts.map +1 -1
  231. package/dist/utils/pageFixtures/v6/initial_app.d.ts.map +1 -1
  232. package/dist/utils/pageFixtures/v6/nested_modal.d.ts +32 -32
  233. package/dist/utils/pageFixtures/v6/nested_modal.d.ts.map +1 -1
  234. package/dist/utils/pageFixtures/v6/slideout_without_child.d.ts.map +1 -1
  235. package/dist/utils/pageFixtures/v6/with_2_modals.d.ts +30 -30
  236. package/dist/utils/pageFixtures/v6/with_2_modals.d.ts.map +1 -1
  237. package/dist/utils/pageFixtures/v6/with_main_canvas_children.d.ts +97 -97
  238. package/dist/utils/pageFixtures/v6/with_main_canvas_children.d.ts.map +1 -1
  239. package/dist/utils/pageFixtures/v6/with_slideouts.d.ts +42 -42
  240. package/dist/utils/pageFixtures/v6/with_slideouts.d.ts.map +1 -1
  241. package/dist/utils/pageFixtures/v6/with_widgets_named_page.d.ts.map +1 -1
  242. package/dist/utils/pageFixtures/v7/canvases.d.ts +29 -29
  243. package/dist/utils/pageFixtures/v7/canvases.d.ts.map +1 -1
  244. package/dist/utils/pageFixtures/v7/grids_and_forms.d.ts +56 -56
  245. package/dist/utils/pageFixtures/v7/grids_and_forms.d.ts.map +1 -1
  246. package/dist/utils/pageFixtures/v7/images.d.ts.map +1 -1
  247. package/dist/utils/pageFixtures/v7/initial_app.d.ts.map +1 -1
  248. package/dist/utils/pageFixtures/v7/nested_containers.d.ts +2 -2
  249. package/dist/utils/pageFixtures/v7/nested_containers.d.ts.map +1 -1
  250. package/dist/utils/platform-mcp-server-routes.d.ts +23 -0
  251. package/dist/utils/platform-mcp-server-routes.d.ts.map +1 -0
  252. package/dist/utils/platform-mcp-server-routes.js +59 -0
  253. package/dist/utils/platform-mcp-server-routes.js.map +1 -0
  254. package/dist/utils/platform-mcp-server-routes.test.d.ts +2 -0
  255. package/dist/utils/platform-mcp-server-routes.test.d.ts.map +1 -0
  256. package/dist/utils/platform-mcp-server-routes.test.js +21 -0
  257. package/dist/utils/platform-mcp-server-routes.test.js.map +1 -0
  258. package/dist/utils/string.d.ts.map +1 -1
  259. package/dist/utils/string.js +1 -1
  260. package/dist/utils/tracedEventEmitter.d.ts.map +1 -1
  261. package/dist/utils/tracedEventEmitter.js +3 -3
  262. package/dist/utils/truncate.d.ts.map +1 -1
  263. package/dist/utils/truncate.test.js +1 -1
  264. package/dist/utils/url.d.ts.map +1 -1
  265. package/dist/utils/url.js.map +1 -1
  266. package/package.json +11 -5
  267. package/src/constants.ts +11 -14
  268. package/src/pageMigrations/migrations/v4to5.ts +1 -1
  269. package/src/pageMigrations/migrations/v5to6.test.ts +1 -1
  270. package/src/pageMigrations/migrations/v6to7/adjustModalCanvases.test.ts +1 -1
  271. package/src/pageMigrations/migrations/v6to7/migrateToDimensions.test.ts +2 -2
  272. package/src/pageMigrations/migrations/v7to8.test.ts +1 -1
  273. package/src/plugins/templates/mcp.test.ts +17 -0
  274. package/src/plugins/templates/shared/auth.ts +16 -0
  275. package/src/refactoring/refactor.test.ts +306 -287
  276. package/src/signing/JSON/portable.ts +2 -2
  277. package/src/socket/protocol.ts +6 -1
  278. package/src/socket/socket.ts +2 -2
  279. package/src/socket/types.ts +1 -1
  280. package/src/tracing/methodTracing.ts +1 -1
  281. package/src/types/ai/index.ts +14 -1
  282. package/src/types/ai/native-builder-model.test.ts +33 -0
  283. package/src/types/ai/native-builder-model.ts +28 -0
  284. package/src/types/api/global.ts +1 -3
  285. package/src/types/application/index.ts +2 -1
  286. package/src/types/audit/ocsf.ts +1 -0
  287. package/src/types/branch/index.ts +33 -6
  288. package/src/types/customAgents.ts +2 -3
  289. package/src/types/datasource/metadata/index.ts +4 -4
  290. package/src/types/event/index.ts +1 -1
  291. package/src/types/integration/index.ts +3 -3
  292. package/src/types/page/Dimension.test.ts +1 -1
  293. package/src/types/page/Dimension.ts +1 -1
  294. package/src/types/page/Padding.ts +1 -1
  295. package/src/types/plugin/evaluation.ts +17 -12
  296. package/src/types/plugin/form.ts +1 -1
  297. package/src/types/plugin/js-tokenizer.test.ts +139 -0
  298. package/src/types/plugin/js-tokenizer.ts +98 -0
  299. package/src/types/rbac/index.ts +4 -0
  300. package/src/types/response/IssueSuperblocksResponseBody.ts +6 -0
  301. package/src/utils/apiv2.test.ts +10 -10
  302. package/src/utils/apiv2.ts +1 -1
  303. package/src/utils/attachment-upload.ts +4 -1
  304. package/src/utils/bytestring.ts +1 -1
  305. package/src/utils/env.ts +5 -5
  306. package/src/utils/index.ts +2 -0
  307. package/src/utils/localNativeBuilderFlags.test.ts +39 -0
  308. package/src/utils/localNativeBuilderFlags.ts +27 -0
  309. package/src/utils/page.ts +1 -1
  310. package/src/utils/platform-mcp-server-routes.test.ts +27 -0
  311. package/src/utils/platform-mcp-server-routes.ts +65 -0
  312. package/src/utils/string.ts +1 -1
  313. package/src/utils/tracedEventEmitter.ts +5 -5
  314. package/src/utils/truncate.test.ts +1 -1
@@ -1,298 +1,317 @@
1
- import { tokenize } from 'esprima';
2
- import { describe, it, expect } from 'vitest';
1
+ import { it, expect } from 'vitest';
3
2
 
4
3
  import { type EvaluationPair, extractJsEvaluationPairsWithTokenizer, LanguagePluginID } from '../types/index.js';
4
+ import { tokenizeJs } from '../types/plugin/js-tokenizer.js';
5
5
  import { refactorNameInCode, refactorNameInString, refactorNameInValue, refactorNameInStep } from './refactor.js';
6
6
 
7
- describe('Refactoring', () => {
8
- describe('Page Scope', () => {
9
- describe('refactorNameInCode', () => {
10
- it('should refactor the old name to the new name in the code', async () => {
11
- const value = 'return oldName;';
12
- const oldName = 'oldName';
13
- const newName = 'newName';
14
- const dataTree = {
15
- oldName: {}
16
- };
17
-
18
- const result = await refactorNameInCode({
19
- value,
20
- oldName,
21
- newName,
22
- dataTree,
23
- extractPairs: extractJsEvaluationPairs
24
- });
25
-
26
- expect(result).toEqual('return newName;');
27
- });
28
- });
29
-
30
- describe('refactorNameInString', () => {
31
- it('should refactor the old name to the new name in the string', async () => {
32
- const value = 'Hello, {{oldName}}!';
33
- const oldName = 'oldName';
34
- const newName = 'newName';
35
- const dataTree = {
36
- oldName: {}
37
- };
38
-
39
- const result = await refactorNameInString({
40
- value,
41
- oldName,
42
- newName,
43
- dataTree,
44
- extractPairs: extractJsEvaluationPairs
45
- });
46
-
47
- expect(result).toEqual('Hello, {{newName}}!');
48
- });
49
- });
50
-
51
- describe('refactorNameInValue', () => {
52
- it('in object', async () => {
53
- const oldValue = {
54
- name: '{{oldName}}',
55
- age: 30
56
- };
57
- const oldName = 'oldName';
58
- const newName = 'newName';
59
- const dataTree = {
60
- oldName: {}
61
- };
62
-
63
- const result = await refactorNameInValue({
64
- oldValue,
65
- oldName,
66
- newName,
67
- dataTree,
68
- extractPairs: extractJsEvaluationPairs
69
- });
70
-
71
- expect(result).toEqual({
72
- name: '{{newName}}',
73
- age: 30
74
- });
75
- });
76
- });
77
-
78
- it('in array', async () => {
79
- const oldValue = ['{{oldName}}', 30];
80
- const oldName = 'oldName';
81
- const newName = 'newName';
82
- const dataTree = {
83
- oldName: {}
84
- };
85
-
86
- const result = await refactorNameInValue({
87
- oldValue,
88
- oldName,
89
- newName,
90
- dataTree,
91
- extractPairs: extractJsEvaluationPairs
92
- });
93
-
94
- expect(result).toEqual(['{{newName}}', 30]);
95
- });
96
- it('in string', async () => {
97
- const oldValue = '{{oldName}}';
98
- const oldName = 'oldName';
99
- const newName = 'newName';
100
- const dataTree = {
101
- oldName: {}
102
- };
103
-
104
- const result = await refactorNameInValue({
105
- oldValue,
106
- oldName,
107
- newName,
108
- dataTree,
109
- extractPairs: extractJsEvaluationPairs
110
- });
111
-
112
- expect(result).toEqual('{{newName}}');
113
- });
7
+ it('Page Scope refactorNameInCode should refactor the old name to the new name in the code', async () => {
8
+ const value = 'return oldName;';
9
+ const oldName = 'oldName';
10
+ const newName = 'newName';
11
+ const dataTree = {
12
+ oldName: {}
13
+ };
14
+
15
+ const result = await refactorNameInCode({
16
+ value,
17
+ oldName,
18
+ newName,
19
+ dataTree,
20
+ extractPairs: extractJsEvaluationPairs
114
21
  });
115
22
 
116
- describe('App Scope', () => {
117
- describe('refactorNameInCode', () => {
118
- it('should refactor the old name to the new name in the code', async () => {
119
- const value = 'return App.oldName;';
120
- const oldName = 'oldName';
121
- const newName = 'newName';
122
- const dataTree = {
123
- oldName: {}
124
- };
125
-
126
- const result = await refactorNameInCode({
127
- value,
128
- oldName,
129
- newName,
130
- dataTree,
131
- namespace: 'App',
132
- extractPairs: extractJsEvaluationPairs
133
- });
134
-
135
- expect(result).toEqual('return App.newName;');
136
- });
137
- });
138
-
139
- describe('refactorNameInString', () => {
140
- it('should refactor the old name to the new name in the string', async () => {
141
- const value = 'Hello, {{App.oldName}}!';
142
- const oldName = 'oldName';
143
- const newName = 'newName';
144
- const dataTree = {
145
- oldName: {}
146
- };
147
-
148
- const result = await refactorNameInString({
149
- value,
150
- oldName,
151
- newName,
152
- dataTree,
153
- namespace: 'App',
154
- extractPairs: extractJsEvaluationPairs
155
- });
156
-
157
- expect(result).toEqual('Hello, {{App.newName}}!');
158
- });
159
- });
160
-
161
- describe('refactorNameInValue', () => {
162
- it('in object', async () => {
163
- const oldValue = {
164
- name: '{{App.oldName}}',
165
- age: 30
166
- };
167
- const oldName = 'oldName';
168
- const newName = 'newName';
169
- const dataTree = {
170
- oldName: {}
171
- };
172
-
173
- const result = await refactorNameInValue({
174
- oldValue,
175
- oldName,
176
- newName,
177
- dataTree,
178
- namespace: 'App',
179
- extractPairs: extractJsEvaluationPairs
180
- });
181
-
182
- expect(result).toEqual({
183
- name: '{{App.newName}}',
184
- age: 30
185
- });
186
- });
187
- });
188
-
189
- it('in array', async () => {
190
- const oldValue = ['{{App.oldName}}', 30];
191
- const oldName = 'oldName';
192
- const newName = 'newName';
193
- const dataTree = {
194
- oldName: {}
195
- };
196
-
197
- const result = await refactorNameInValue({
198
- oldValue,
199
- oldName,
200
- newName,
201
- dataTree,
202
- namespace: 'App',
203
- extractPairs: extractJsEvaluationPairs
204
- });
205
-
206
- expect(result).toEqual(['{{App.newName}}', 30]);
207
- });
208
- it('in string', async () => {
209
- const oldValue = '{{App.oldName}}';
210
- const oldName = 'oldName';
211
- const newName = 'newName';
212
- const dataTree = {
213
- oldName: {}
214
- };
215
-
216
- const result = await refactorNameInValue({
217
- oldValue,
218
- oldName,
219
- newName,
220
- dataTree,
221
- namespace: 'App',
222
- extractPairs: extractJsEvaluationPairs
223
- });
224
-
225
- expect(result).toEqual('{{App.newName}}');
226
- });
23
+ expect(result).toEqual('return newName;');
24
+ });
25
+
26
+ it('Page Scope refactorNameInString should refactor the old name to the new name in the string', async () => {
27
+ const value = 'Hello, {{oldName}}!';
28
+ const oldName = 'oldName';
29
+ const newName = 'newName';
30
+ const dataTree = {
31
+ oldName: {}
32
+ };
33
+
34
+ const result = await refactorNameInString({
35
+ value,
36
+ oldName,
37
+ newName,
38
+ dataTree,
39
+ extractPairs: extractJsEvaluationPairs
227
40
  });
228
41
 
229
- describe('refactorNameInStep', () => {
230
- it('should refactor names in JS steps', async () => {
231
- const oldName = 'oldName';
232
- const newName = 'newName';
233
- const dataTree = {
234
- oldName: {}
235
- };
236
- const configuration = {
237
- body: 'return {{oldName}};'
238
- };
239
- await refactorNameInStep({
240
- configuration,
241
- oldName,
242
- newName,
243
- dataTree,
244
- namespace: undefined,
245
- pluginId: LanguagePluginID.JavaScript,
246
- extractor: extractJsEvaluationPairs
247
- });
248
- expect(configuration.body).toEqual('return {{newName}};');
249
- });
250
-
251
- it('should refactor names in steps with nested configurations, i.e. Databricks, Kinesis, etc', async () => {
252
- const oldName = 'oldName';
253
- const newName = 'newName';
254
- const dataTree = {
255
- oldName: {}
256
- };
257
- const configuration = {
258
- get: {
259
- limit: 10,
260
- pollingCooldownMs: 1000,
261
- shardIteratorType: 'SHARD_ITERATOR_TYPE_LATEST',
262
- streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
263
- },
264
- put: {
265
- data: '"test": {{oldName.text}}',
266
- streamName: '{{oldName.text}}',
267
- streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
268
- },
269
- operationType: 'OPERATION_TYPE_PUT'
270
- };
271
- await refactorNameInStep({
272
- configuration,
273
- oldName,
274
- newName,
275
- dataTree,
276
- namespace: undefined,
277
- pluginId: '12345',
278
- extractor: extractJsEvaluationPairs
279
- });
280
- expect(configuration).toEqual({
281
- get: {
282
- limit: 10,
283
- pollingCooldownMs: 1000,
284
- shardIteratorType: 'SHARD_ITERATOR_TYPE_LATEST',
285
- streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
286
- },
287
- put: {
288
- data: '"test": {{newName.text}}',
289
- streamName: '{{newName.text}}',
290
- streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
291
- },
292
- operationType: 'OPERATION_TYPE_PUT'
293
- });
294
- });
42
+ expect(result).toEqual('Hello, {{newName}}!');
43
+ });
44
+
45
+ it('Page Scope refactorNameInValue in object', async () => {
46
+ const oldValue = {
47
+ name: '{{oldName}}',
48
+ age: 30
49
+ };
50
+ const oldName = 'oldName';
51
+ const newName = 'newName';
52
+ const dataTree = {
53
+ oldName: {}
54
+ };
55
+
56
+ const result = await refactorNameInValue({
57
+ oldValue,
58
+ oldName,
59
+ newName,
60
+ dataTree,
61
+ extractPairs: extractJsEvaluationPairs
62
+ });
63
+
64
+ expect(result).toEqual({
65
+ name: '{{newName}}',
66
+ age: 30
67
+ });
68
+ });
69
+
70
+ it('Page Scope refactorNameInValue in array', async () => {
71
+ const oldValue = ['{{oldName}}', 30];
72
+ const oldName = 'oldName';
73
+ const newName = 'newName';
74
+ const dataTree = {
75
+ oldName: {}
76
+ };
77
+
78
+ const result = await refactorNameInValue({
79
+ oldValue,
80
+ oldName,
81
+ newName,
82
+ dataTree,
83
+ extractPairs: extractJsEvaluationPairs
84
+ });
85
+
86
+ expect(result).toEqual(['{{newName}}', 30]);
87
+ });
88
+ it('Page Scope refactorNameInValue in string', async () => {
89
+ const oldValue = '{{oldName}}';
90
+ const oldName = 'oldName';
91
+ const newName = 'newName';
92
+ const dataTree = {
93
+ oldName: {}
94
+ };
95
+
96
+ const result = await refactorNameInValue({
97
+ oldValue,
98
+ oldName,
99
+ newName,
100
+ dataTree,
101
+ extractPairs: extractJsEvaluationPairs
102
+ });
103
+
104
+ expect(result).toEqual('{{newName}}');
105
+ });
106
+
107
+ it('App Scope refactorNameInCode should refactor the old name to the new name in the code', async () => {
108
+ const value = 'return App.oldName;';
109
+ const oldName = 'oldName';
110
+ const newName = 'newName';
111
+ const dataTree = {
112
+ oldName: {}
113
+ };
114
+
115
+ const result = await refactorNameInCode({
116
+ value,
117
+ oldName,
118
+ newName,
119
+ dataTree,
120
+ namespace: 'App',
121
+ extractPairs: extractJsEvaluationPairs
122
+ });
123
+
124
+ expect(result).toEqual('return App.newName;');
125
+ });
126
+
127
+ it('refactorNameInCode leaves a name inside a regex on the line after a block alone', async () => {
128
+ const value = '{}\n/App.oldName/.test(x)';
129
+
130
+ const result = await refactorNameInCode({
131
+ value,
132
+ oldName: 'oldName',
133
+ newName: 'newName',
134
+ dataTree: { oldName: {} },
135
+ namespace: 'App',
136
+ extractPairs: extractJsEvaluationPairs
137
+ });
138
+
139
+ expect(result).toEqual(value);
140
+ });
141
+
142
+ it('App Scope refactorNameInString should refactor the old name to the new name in the string', async () => {
143
+ const value = 'Hello, {{App.oldName}}!';
144
+ const oldName = 'oldName';
145
+ const newName = 'newName';
146
+ const dataTree = {
147
+ oldName: {}
148
+ };
149
+
150
+ const result = await refactorNameInString({
151
+ value,
152
+ oldName,
153
+ newName,
154
+ dataTree,
155
+ namespace: 'App',
156
+ extractPairs: extractJsEvaluationPairs
295
157
  });
158
+
159
+ expect(result).toEqual('Hello, {{App.newName}}!');
160
+ });
161
+
162
+ it('App Scope refactorNameInValue in object', async () => {
163
+ const oldValue = {
164
+ name: '{{App.oldName}}',
165
+ age: 30
166
+ };
167
+ const oldName = 'oldName';
168
+ const newName = 'newName';
169
+ const dataTree = {
170
+ oldName: {}
171
+ };
172
+
173
+ const result = await refactorNameInValue({
174
+ oldValue,
175
+ oldName,
176
+ newName,
177
+ dataTree,
178
+ namespace: 'App',
179
+ extractPairs: extractJsEvaluationPairs
180
+ });
181
+
182
+ expect(result).toEqual({
183
+ name: '{{App.newName}}',
184
+ age: 30
185
+ });
186
+ });
187
+
188
+ it('App Scope refactorNameInValue in array', async () => {
189
+ const oldValue = ['{{App.oldName}}', 30];
190
+ const oldName = 'oldName';
191
+ const newName = 'newName';
192
+ const dataTree = {
193
+ oldName: {}
194
+ };
195
+
196
+ const result = await refactorNameInValue({
197
+ oldValue,
198
+ oldName,
199
+ newName,
200
+ dataTree,
201
+ namespace: 'App',
202
+ extractPairs: extractJsEvaluationPairs
203
+ });
204
+
205
+ expect(result).toEqual(['{{App.newName}}', 30]);
206
+ });
207
+ it('App Scope refactorNameInValue in string', async () => {
208
+ const oldValue = '{{App.oldName}}';
209
+ const oldName = 'oldName';
210
+ const newName = 'newName';
211
+ const dataTree = {
212
+ oldName: {}
213
+ };
214
+
215
+ const result = await refactorNameInValue({
216
+ oldValue,
217
+ oldName,
218
+ newName,
219
+ dataTree,
220
+ namespace: 'App',
221
+ extractPairs: extractJsEvaluationPairs
222
+ });
223
+
224
+ expect(result).toEqual('{{App.newName}}');
225
+ });
226
+
227
+ it('refactorNameInStep should refactor names in JS steps', async () => {
228
+ const oldName = 'oldName';
229
+ const newName = 'newName';
230
+ const dataTree = {
231
+ oldName: {}
232
+ };
233
+ const configuration = {
234
+ body: 'return {{oldName}};'
235
+ };
236
+ await refactorNameInStep({
237
+ configuration,
238
+ oldName,
239
+ newName,
240
+ dataTree,
241
+ namespace: undefined,
242
+ pluginId: LanguagePluginID.JavaScript,
243
+ extractor: extractJsEvaluationPairs
244
+ });
245
+ expect(configuration.body).toEqual('return {{newName}};');
246
+ });
247
+
248
+ it('refactorNameInStep should refactor names in steps with nested configurations, i.e. Databricks, Kinesis, etc', async () => {
249
+ const oldName = 'oldName';
250
+ const newName = 'newName';
251
+ const dataTree = {
252
+ oldName: {}
253
+ };
254
+ const configuration = {
255
+ get: {
256
+ limit: 10,
257
+ pollingCooldownMs: 1000,
258
+ shardIteratorType: 'SHARD_ITERATOR_TYPE_LATEST',
259
+ streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
260
+ },
261
+ put: {
262
+ data: '"test": {{oldName.text}}',
263
+ streamName: '{{oldName.text}}',
264
+ streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
265
+ },
266
+ operationType: 'OPERATION_TYPE_PUT'
267
+ };
268
+ await refactorNameInStep({
269
+ configuration,
270
+ oldName,
271
+ newName,
272
+ dataTree,
273
+ namespace: undefined,
274
+ pluginId: '12345',
275
+ extractor: extractJsEvaluationPairs
276
+ });
277
+ expect(configuration).toEqual({
278
+ get: {
279
+ limit: 10,
280
+ pollingCooldownMs: 1000,
281
+ shardIteratorType: 'SHARD_ITERATOR_TYPE_LATEST',
282
+ streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
283
+ },
284
+ put: {
285
+ data: '"test": {{newName.text}}',
286
+ streamName: '{{newName.text}}',
287
+ streamIdentifierType: 'STREAM_IDENTIFIER_STREAM_NAME'
288
+ },
289
+ operationType: 'OPERATION_TYPE_PUT'
290
+ });
291
+ });
292
+
293
+ it.each([
294
+ // Syntax the old tokenizer also read: results must not change.
295
+ ['return oldName?.value ?? fallback;', 'return newName?.value ?? fallback;'],
296
+ ['return other?.oldName;', 'return other?.oldName;'],
297
+ ['x ??= oldName.value; y ||= oldName; z &&= oldName;', 'x ??= newName.value; y ||= newName; z &&= newName;'],
298
+ ['class Counter { count = oldName.value; static label = "n"; }', 'class Counter { count = newName.value; static label = "n"; }'],
299
+ ['return `${oldName.value}-${other}`;', 'return `${newName.value}-${other}`;'],
300
+ ['return oldName.value / 2 + /old/.test(oldName.text);', 'return newName.value / 2 + /old/.test(newName.text);'],
301
+ // Syntax the old tokenizer rejected, which left the code unrenamed.
302
+ ['return 1_000 + oldName.value;', 'return 1_000 + newName.value;'],
303
+ ['return BigInt(oldName.value) * 10n;', 'return BigInt(newName.value) * 10n;'],
304
+ ['class Counter { #count = oldName.value; }', 'class Counter { #count = newName.value; }']
305
+ ])('refactorNameInCode renames page scope references in %s', async (value, expected) => {
306
+ const result = await refactorNameInCode({
307
+ value,
308
+ oldName: 'oldName',
309
+ newName: 'newName',
310
+ dataTree: { oldName: {} },
311
+ extractPairs: extractJsEvaluationPairs
312
+ });
313
+
314
+ expect(result).toEqual(expected);
296
315
  });
297
316
 
298
317
  async function extractJsEvaluationPairs(
@@ -301,5 +320,5 @@ async function extractJsEvaluationPairs(
301
320
  dataTree: Record<Exclude<string, 'API' | 'WIDGETS'>, unknown>,
302
321
  namespacedEntitiesToExtract?: Record<string, Set<string>>
303
322
  ): Promise<EvaluationPair[]> {
304
- return extractJsEvaluationPairsWithTokenizer(jsSnippet, entitiesToExtract, dataTree, tokenize, namespacedEntitiesToExtract);
323
+ return extractJsEvaluationPairsWithTokenizer(jsSnippet, entitiesToExtract, dataTree, tokenizeJs, namespacedEntitiesToExtract);
305
324
  }
@@ -36,7 +36,7 @@ function escapeChar(char: string): string {
36
36
  // * surrogate code points (U+D800 through U+DFFF), which should only match when unpaired, which is are actually invalid in unicode, but RFC 8259 suggests to escape them when they appear because of errors
37
37
  // We use the `u` flag to match surrogates only when they are unpaired
38
38
  // Note: this is one of the rare occasions where we do want control characters in a regex, so we disable the eslint rule
39
- // eslint-disable-next-line no-control-regex
39
+ // oxlint-disable-next-line no-control-regex
40
40
  const charsToEscape = /[\u0000-\u001f\ud800-\udfff"\\]/gu;
41
41
 
42
42
  function JSONStringifyString(str: string) {
@@ -63,7 +63,7 @@ function compareObjectKeys(a: string, b: string): number {
63
63
  export function stableJSONStringify_portable(data: unknown): string | undefined {
64
64
  // track the objects being serialized, so that we don't get into an infinite cycle
65
65
  const seen = new Set<unknown>();
66
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
67
67
  return (function stringify(node: any) {
68
68
  if (typeof node?.toJSON === 'function') {
69
69
  node = node.toJSON();
@@ -154,9 +154,14 @@ export interface ServerMethods {
154
154
  >;
155
155
  /** Id of the active chat session, created if the app has none yet. Reads no messages. */
156
156
  resolveBuilderBinding: ServerMethodSchema<
157
- { applicationId: string; branchName: string; preferredHarness: 'clark' | 'codex' },
157
+ { applicationId: string; branchName: string; preferredHarness: 'clark' | 'codex' | 'claude_code' },
158
158
  import('../types/ai/index.js').AiBuilderBinding
159
159
  >;
160
+ /** Workspace placement for an app branch from the primary chat's existing binding. Creates nothing. */
161
+ resolveWorkspacePlacement: ServerMethodSchema<
162
+ { applicationId: string; branchName: string },
163
+ import('../types/ai/index.js').WorkspaceBinding
164
+ >;
160
165
  saveBuilderSession: ServerMethodSchema<
161
166
  { applicationId: string; branchName: string; chatSessionId: string; runtimeSessionId: string; nativeSessionId: string },
162
167
  void
@@ -248,7 +248,7 @@ export class ISocket<ImplementedMethods, CallableMethods, RequestContext extends
248
248
  this.clearPendingRequestState(message.response.id);
249
249
  return;
250
250
  }
251
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
251
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
252
252
  responseHandler.resolve(message.response.payload as any);
253
253
  this.clearPendingRequestState(message.response.id);
254
254
  } else {
@@ -500,7 +500,7 @@ export function createISocketClient<CallableMethods, ImplementedMethods, Request
500
500
  return {
501
501
  close: (reason?: string) => socket.close(reason),
502
502
  closeAndRejectPendingRequests: (reason?: string) => socket.closeAndRejectPendingRequests(reason),
503
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
503
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
504
504
  call: createIsocketProxy(socket, undefined) as any,
505
505
  requestWithTracing: <Params, Result>(
506
506
  method: string,
@@ -12,7 +12,7 @@ export type MethodHandler<Params, Result, PeerMethods, RequestContext> = (
12
12
  ) => Promise<Result>;
13
13
 
14
14
  // A generic middleware is a method handler that can be chained with any other method handler, so it uses `any` for the params and result types
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  export type GenericMiddleware<PeerMethods, RequestContext> = MethodHandler<any, any, PeerMethods, RequestContext>;
17
17
 
18
18
  type NonEmptyArray<T> = [...T[], T];
@@ -12,7 +12,7 @@ import { sanitizeError } from './errorSanitizer.js';
12
12
  export function traceMethod(className: string, methodName: string, descriptor: PropertyDescriptor, tracer: Tracer): PropertyDescriptor {
13
13
  const originalMethod = descriptor.value;
14
14
 
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  descriptor.value = function (...args: any[]) {
17
17
  // Potentially, we can pass this from tracing middleware to req and then to ActionHandler
18
18
  const parentSpan = trace.getActiveSpan() as Span | undefined;