@superblocksteam/sdk 2.0.102 → 2.0.103

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 (150) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/application-build.d.mts.map +1 -1
  3. package/dist/application-build.mjs +1 -1
  4. package/dist/application-build.mjs.map +1 -1
  5. package/dist/cli-replacement/auth-hot-reload.d.mts.map +1 -1
  6. package/dist/cli-replacement/auth-hot-reload.mjs.map +1 -1
  7. package/dist/cli-replacement/automatic-upgrades.d.ts +1 -1
  8. package/dist/cli-replacement/automatic-upgrades.d.ts.map +1 -1
  9. package/dist/cli-replacement/automatic-upgrades.js +1 -1
  10. package/dist/cli-replacement/automatic-upgrades.js.map +1 -1
  11. package/dist/cli-replacement/dev.d.mts.map +1 -1
  12. package/dist/cli-replacement/dev.mjs +5 -7
  13. package/dist/cli-replacement/dev.mjs.map +1 -1
  14. package/dist/cli-replacement/git-repo-setup.d.mts.map +1 -1
  15. package/dist/cli-replacement/git-repo-setup.mjs +30 -0
  16. package/dist/cli-replacement/git-repo-setup.mjs.map +1 -1
  17. package/dist/cli-replacement/git-repo-setup.test.mjs.map +1 -1
  18. package/dist/cli-replacement/init.d.ts +2 -2
  19. package/dist/cli-replacement/init.d.ts.map +1 -1
  20. package/dist/cli-replacement/init.js.map +1 -1
  21. package/dist/cli-replacement/version-detection.d.ts.map +1 -1
  22. package/dist/cli-replacement/version-detection.js.map +1 -1
  23. package/dist/cli-replacement/version-detection.test.js.map +1 -1
  24. package/dist/client-sync.test.mjs.map +1 -1
  25. package/dist/client.d.ts +252 -3
  26. package/dist/client.d.ts.map +1 -1
  27. package/dist/client.fetch-audit-events.test.d.ts +2 -0
  28. package/dist/client.fetch-audit-events.test.d.ts.map +1 -0
  29. package/dist/client.fetch-audit-events.test.js +69 -0
  30. package/dist/client.fetch-audit-events.test.js.map +1 -0
  31. package/dist/client.js +762 -5
  32. package/dist/client.js.map +1 -1
  33. package/dist/collect-sdk-apis.d.mts.map +1 -1
  34. package/dist/collect-sdk-apis.mjs.map +1 -1
  35. package/dist/collect-sdk-apis.test.mjs.map +1 -1
  36. package/dist/dbfs/client.d.ts.map +1 -1
  37. package/dist/dbfs/client.js.map +1 -1
  38. package/dist/dbfs/client.test.js +1 -1
  39. package/dist/dbfs/client.test.js.map +1 -1
  40. package/dist/dbfs/local.d.ts.map +1 -1
  41. package/dist/dbfs/local.js.map +1 -1
  42. package/dist/dev-utils/custom-build.d.mts.map +1 -1
  43. package/dist/dev-utils/custom-build.mjs.map +1 -1
  44. package/dist/dev-utils/custom-config.d.mts.map +1 -1
  45. package/dist/dev-utils/custom-config.mjs.map +1 -1
  46. package/dist/dev-utils/dev-server.d.mts +2 -2
  47. package/dist/dev-utils/dev-server.d.mts.map +1 -1
  48. package/dist/dev-utils/dev-server.mjs +5 -4
  49. package/dist/dev-utils/dev-server.mjs.map +1 -1
  50. package/dist/dev-utils/token-manager.d.ts.map +1 -1
  51. package/dist/dev-utils/token-manager.js.map +1 -1
  52. package/dist/extract-api-integrations.d.mts +1 -16
  53. package/dist/extract-api-integrations.d.mts.map +1 -1
  54. package/dist/extract-api-integrations.mjs +1 -232
  55. package/dist/extract-api-integrations.mjs.map +1 -1
  56. package/dist/extract-api-integrations.test.mjs.map +1 -1
  57. package/dist/flag.d.ts.map +1 -1
  58. package/dist/flag.js.map +1 -1
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js.map +1 -1
  62. package/dist/parse-sdk-registry.d.mts.map +1 -1
  63. package/dist/parse-sdk-registry.mjs.map +1 -1
  64. package/dist/parse-sdk-registry.test.mjs.map +1 -1
  65. package/dist/sdk.d.ts +59 -4
  66. package/dist/sdk.d.ts.map +1 -1
  67. package/dist/sdk.js +184 -1
  68. package/dist/sdk.js.map +1 -1
  69. package/dist/sdk.test.js +72 -2
  70. package/dist/sdk.test.js.map +1 -1
  71. package/dist/socket/handlers.d.ts +1 -1
  72. package/dist/socket/handlers.d.ts.map +1 -1
  73. package/dist/socket/handlers.js.map +1 -1
  74. package/dist/socket/index.d.ts +1 -1
  75. package/dist/socket/index.d.ts.map +1 -1
  76. package/dist/socket/index.js.map +1 -1
  77. package/dist/socket/signing.d.ts +1 -1
  78. package/dist/socket/signing.d.ts.map +1 -1
  79. package/dist/socket/signing.js.map +1 -1
  80. package/dist/telemetry/index.d.ts.map +1 -1
  81. package/dist/telemetry/index.js.map +1 -1
  82. package/dist/telemetry/logging.d.ts.map +1 -1
  83. package/dist/telemetry/logging.js +1 -1
  84. package/dist/telemetry/logging.js.map +1 -1
  85. package/dist/types/common.d.ts +1 -1
  86. package/dist/types/common.d.ts.map +1 -1
  87. package/dist/types/common.js.map +1 -1
  88. package/dist/utils.d.ts +1 -1
  89. package/dist/utils.d.ts.map +1 -1
  90. package/dist/utils.js.map +1 -1
  91. package/dist/version-control.d.mts +1 -1
  92. package/dist/version-control.d.mts.map +1 -1
  93. package/dist/version-control.mjs +2 -2
  94. package/dist/version-control.mjs.map +1 -1
  95. package/dist/vite-plugin-generate-api-build-manifest.d.mts.map +1 -1
  96. package/dist/vite-plugin-generate-api-build-manifest.mjs +3 -3
  97. package/dist/vite-plugin-generate-api-build-manifest.mjs.map +1 -1
  98. package/dist/vite-plugin-inject-sb-ids-transform.d.mts.map +1 -1
  99. package/dist/vite-plugin-inject-sb-ids-transform.mjs +1 -1
  100. package/dist/vite-plugin-inject-sb-ids-transform.mjs.map +1 -1
  101. package/dist/vite-plugin-sdk-api-entry-point.d.mts.map +1 -1
  102. package/dist/vite-plugin-sdk-api-entry-point.mjs.map +1 -1
  103. package/dist/vite-plugin-sdk-api-entry-point.test.mjs.map +1 -1
  104. package/eslint.config.js +2 -17
  105. package/package.json +6 -6
  106. package/src/application-build.mts +4 -1
  107. package/src/cli-replacement/auth-hot-reload.mts +2 -2
  108. package/src/cli-replacement/automatic-upgrades.ts +10 -7
  109. package/src/cli-replacement/dev.mts +17 -17
  110. package/src/cli-replacement/git-repo-setup.mts +34 -1
  111. package/src/cli-replacement/git-repo-setup.test.mts +4 -1
  112. package/src/cli-replacement/init.ts +5 -4
  113. package/src/cli-replacement/version-detection.test.ts +2 -0
  114. package/src/cli-replacement/version-detection.ts +1 -0
  115. package/src/client-sync.test.mts +1 -0
  116. package/src/client.fetch-audit-events.test.ts +82 -0
  117. package/src/client.ts +1204 -21
  118. package/src/collect-sdk-apis.mts +1 -0
  119. package/src/collect-sdk-apis.test.mts +2 -0
  120. package/src/dbfs/client.test.ts +2 -1
  121. package/src/dbfs/client.ts +1 -0
  122. package/src/dbfs/local.ts +2 -0
  123. package/src/dev-utils/custom-build.mts +3 -1
  124. package/src/dev-utils/custom-config.mts +1 -0
  125. package/src/dev-utils/dev-server.mts +22 -19
  126. package/src/dev-utils/token-manager.ts +1 -0
  127. package/src/extract-api-integrations.mts +5 -345
  128. package/src/extract-api-integrations.test.mts +1 -0
  129. package/src/flag.ts +1 -0
  130. package/src/index.ts +7 -0
  131. package/src/parse-sdk-registry.mts +1 -0
  132. package/src/parse-sdk-registry.test.mts +2 -0
  133. package/src/sdk.test.ts +85 -5
  134. package/src/sdk.ts +324 -14
  135. package/src/socket/handlers.ts +3 -2
  136. package/src/socket/index.ts +4 -3
  137. package/src/socket/signing.ts +5 -3
  138. package/src/telemetry/index.ts +5 -2
  139. package/src/telemetry/logging.ts +4 -3
  140. package/src/types/common.ts +2 -1
  141. package/src/utils.ts +4 -2
  142. package/src/version-control.mts +21 -18
  143. package/src/vite-plugin-generate-api-build-manifest.mts +10 -7
  144. package/src/vite-plugin-inject-sb-ids-transform.mts +5 -2
  145. package/src/vite-plugin-sdk-api-entry-point.mts +1 -0
  146. package/src/vite-plugin-sdk-api-entry-point.test.mts +2 -0
  147. package/test/clients.test.mts +4 -1
  148. package/test/safe-stringify.test.mts +1 -0
  149. package/test/version-control.test.mts +17 -14
  150. package/tsconfig.tsbuildinfo +1 -1
package/src/sdk.ts CHANGED
@@ -1,9 +1,29 @@
1
1
  import {
2
2
  CommitType,
3
3
  ExportViewMode,
4
+ type AssignmentDto,
5
+ type OCSFAuditEvent,
6
+ type AuditLogDto,
7
+ type AuditLogEntity,
8
+ type FactDto,
9
+ type FactListQuery,
4
10
  type GetPublicOrganizationSummaryResponseBody,
11
+ type IHomepageApplicationV2Dto,
5
12
  } from "@superblocksteam/shared";
13
+ import type {
14
+ ComponentEvent,
15
+ LocalGitRepoState,
16
+ SuperblocksResourceType,
17
+ } from "@superblocksteam/util";
18
+
6
19
  import {
20
+ createFolder,
21
+ createIntegration,
22
+ createRbacAssignments,
23
+ createApplication,
24
+ deleteFolder,
25
+ deleteIntegration,
26
+ deleteRbacAssignment,
7
27
  fetchApi,
8
28
  fetchApiCommits,
9
29
  fetchApis,
@@ -12,8 +32,20 @@ import {
12
32
  fetchApplicationCommits,
13
33
  fetchApplications,
14
34
  fetchApplicationWithComponents,
35
+ fetchAuditEntities,
36
+ fetchAuditEvents,
37
+ fetchAuditLogs,
38
+ fetchBillingPlanSummary,
39
+ fetchBillingUsageDaily,
40
+ fetchBillingUsageRecords,
15
41
  fetchCurrentUser,
42
+ fetchFact,
43
+ fetchFacts,
44
+ fetchFolders,
45
+ fetchIntegrationById,
46
+ fetchIntegrations,
16
47
  fetchOrganizationSummary,
48
+ fetchRbacAssignments,
17
49
  getApplicationGitConfig,
18
50
  getGitFreshToken,
19
51
  sync,
@@ -22,10 +54,32 @@ import {
22
54
  pushApplicationCodeMode,
23
55
  registerComponents,
24
56
  uploadComponents,
57
+ updateFolder,
58
+ updateIntegration,
59
+ updateRbacAssignment,
25
60
  validateGitSetup,
26
61
  deployApplication,
27
62
  deployApi,
28
63
  } from "./client.js";
64
+ import type {
65
+ ApplicationGitConfig,
66
+ CreateApplicationResult,
67
+ CreateRbacAssignmentsRequest,
68
+ DailyUsageRow,
69
+ FolderMutationPayload,
70
+ FolderSummary,
71
+ GitFreshToken,
72
+ IntegrationDetail,
73
+ IntegrationMutationPayload,
74
+ IntegrationSummary,
75
+ PlanSummary,
76
+ PushApiWithCommitConfig,
77
+ PushMultiPageApplicationWithCommitConfig,
78
+ SyncRequest,
79
+ SyncResponse,
80
+ UpdateRbacAssignmentRequest,
81
+ UsageRecordRow,
82
+ } from "./client.js";
29
83
  import {
30
84
  downloadApplicationDirectory,
31
85
  downloadDirectoryByHash,
@@ -37,20 +91,7 @@ import {
37
91
  } from "./dbfs/client.js";
38
92
  import { hashLocalDirectory } from "./dbfs/local.js";
39
93
  import { FeatureFlags } from "./flag.js";
40
- import type {
41
- ApplicationGitConfig,
42
- GitFreshToken,
43
- SyncRequest,
44
- SyncResponse,
45
- PushApiWithCommitConfig,
46
- PushMultiPageApplicationWithCommitConfig,
47
- } from "./client.js";
48
94
  import type { UserMeDto } from "./types/index.js";
49
- import type {
50
- ComponentEvent,
51
- LocalGitRepoState,
52
- SuperblocksResourceType,
53
- } from "@superblocksteam/util";
54
95
 
55
96
  // Exporting here instead of index.ts because only sdk.ts is exposed outside in package.json
56
97
  export * from "./errors.js";
@@ -220,7 +261,9 @@ export class SuperblocksSdk {
220
261
  });
221
262
  }
222
263
 
223
- async fetchApplications(headers?: Record<string, string>) {
264
+ async fetchApplications(
265
+ headers?: Record<string, string>,
266
+ ): Promise<IHomepageApplicationV2Dto[]> {
224
267
  return fetchApplications(
225
268
  this.cliVersion,
226
269
  this.token,
@@ -229,6 +272,214 @@ export class SuperblocksSdk {
229
272
  );
230
273
  }
231
274
 
275
+ async fetchRbacAssignments(
276
+ resourceType: string,
277
+ resourceId: string,
278
+ ): Promise<AssignmentDto[]> {
279
+ return fetchRbacAssignments({
280
+ cliVersion: this.cliVersion,
281
+ token: this.token,
282
+ superblocksBaseUrl: this.superblocksBaseUrl,
283
+ resourceType,
284
+ resourceId,
285
+ });
286
+ }
287
+
288
+ async createRbacAssignments(
289
+ payload: CreateRbacAssignmentsRequest,
290
+ ): Promise<AssignmentDto[]> {
291
+ return createRbacAssignments({
292
+ cliVersion: this.cliVersion,
293
+ token: this.token,
294
+ superblocksBaseUrl: this.superblocksBaseUrl,
295
+ payload,
296
+ });
297
+ }
298
+
299
+ async updateRbacAssignment(
300
+ assignmentRecordId: string,
301
+ payload: UpdateRbacAssignmentRequest,
302
+ ): Promise<AssignmentDto> {
303
+ return updateRbacAssignment({
304
+ cliVersion: this.cliVersion,
305
+ token: this.token,
306
+ superblocksBaseUrl: this.superblocksBaseUrl,
307
+ assignmentRecordId,
308
+ payload,
309
+ });
310
+ }
311
+
312
+ async deleteRbacAssignment(
313
+ assignmentRecordId: string,
314
+ ): Promise<AssignmentDto> {
315
+ return deleteRbacAssignment({
316
+ cliVersion: this.cliVersion,
317
+ token: this.token,
318
+ superblocksBaseUrl: this.superblocksBaseUrl,
319
+ assignmentRecordId,
320
+ });
321
+ }
322
+
323
+ async fetchAuditLogs(filters: {
324
+ startTime: string;
325
+ endTime: string;
326
+ entityType?: number;
327
+ auditEntityId?: string;
328
+ auditEntityType?: number;
329
+ status?: string;
330
+ deployed?: boolean;
331
+ triggeredBy?: string[];
332
+ }): Promise<AuditLogDto[]> {
333
+ return fetchAuditLogs({
334
+ cliVersion: this.cliVersion,
335
+ token: this.token,
336
+ superblocksBaseUrl: this.superblocksBaseUrl,
337
+ filters,
338
+ });
339
+ }
340
+
341
+ async fetchAuditEvents(filters: {
342
+ timeStart: string;
343
+ timeEnd: string;
344
+ classUid?: number;
345
+ status?: number;
346
+ severity?: number;
347
+ actor?: string;
348
+ resourceType?: string;
349
+ resourceId?: string;
350
+ search?: string;
351
+ cursor?: string;
352
+ limit?: number;
353
+ }): Promise<{ events: OCSFAuditEvent[]; next_cursor: string | null }> {
354
+ return fetchAuditEvents({
355
+ cliVersion: this.cliVersion,
356
+ token: this.token,
357
+ superblocksBaseUrl: this.superblocksBaseUrl,
358
+ filters,
359
+ });
360
+ }
361
+
362
+ async fetchAuditEntities(): Promise<AuditLogEntity[]> {
363
+ return fetchAuditEntities({
364
+ cliVersion: this.cliVersion,
365
+ token: this.token,
366
+ superblocksBaseUrl: this.superblocksBaseUrl,
367
+ });
368
+ }
369
+
370
+ async fetchFacts(query?: FactListQuery): Promise<FactDto[]> {
371
+ return fetchFacts({
372
+ cliVersion: this.cliVersion,
373
+ token: this.token,
374
+ superblocksBaseUrl: this.superblocksBaseUrl,
375
+ query,
376
+ });
377
+ }
378
+
379
+ async fetchFact(factId: string): Promise<FactDto> {
380
+ return fetchFact({
381
+ cliVersion: this.cliVersion,
382
+ token: this.token,
383
+ superblocksBaseUrl: this.superblocksBaseUrl,
384
+ factId,
385
+ });
386
+ }
387
+
388
+ async fetchIntegrations(filters?: {
389
+ kind?: string[];
390
+ slug?: string[];
391
+ }): Promise<IntegrationSummary[]> {
392
+ return fetchIntegrations({
393
+ cliVersion: this.cliVersion,
394
+ token: this.token,
395
+ superblocksBaseUrl: this.superblocksBaseUrl,
396
+ filters,
397
+ });
398
+ }
399
+
400
+ async fetchIntegrationById(
401
+ integrationId: string,
402
+ ): Promise<IntegrationDetail> {
403
+ return fetchIntegrationById({
404
+ cliVersion: this.cliVersion,
405
+ token: this.token,
406
+ superblocksBaseUrl: this.superblocksBaseUrl,
407
+ integrationId,
408
+ });
409
+ }
410
+
411
+ async createIntegration(
412
+ payload: IntegrationMutationPayload,
413
+ ): Promise<IntegrationDetail> {
414
+ return createIntegration({
415
+ cliVersion: this.cliVersion,
416
+ token: this.token,
417
+ superblocksBaseUrl: this.superblocksBaseUrl,
418
+ payload,
419
+ });
420
+ }
421
+
422
+ async updateIntegration(
423
+ integrationId: string,
424
+ payload: IntegrationMutationPayload,
425
+ ): Promise<IntegrationDetail> {
426
+ return updateIntegration({
427
+ cliVersion: this.cliVersion,
428
+ token: this.token,
429
+ superblocksBaseUrl: this.superblocksBaseUrl,
430
+ integrationId,
431
+ payload,
432
+ });
433
+ }
434
+
435
+ async deleteIntegration(integrationId: string): Promise<IntegrationDetail> {
436
+ return deleteIntegration({
437
+ cliVersion: this.cliVersion,
438
+ token: this.token,
439
+ superblocksBaseUrl: this.superblocksBaseUrl,
440
+ integrationId,
441
+ });
442
+ }
443
+
444
+ async fetchFolders(): Promise<FolderSummary[]> {
445
+ return fetchFolders({
446
+ cliVersion: this.cliVersion,
447
+ token: this.token,
448
+ superblocksBaseUrl: this.superblocksBaseUrl,
449
+ });
450
+ }
451
+
452
+ async createFolder(payload: FolderMutationPayload): Promise<FolderSummary> {
453
+ return createFolder({
454
+ cliVersion: this.cliVersion,
455
+ token: this.token,
456
+ superblocksBaseUrl: this.superblocksBaseUrl,
457
+ payload,
458
+ });
459
+ }
460
+
461
+ async updateFolder(
462
+ folderId: string,
463
+ payload: FolderMutationPayload,
464
+ ): Promise<FolderSummary> {
465
+ return updateFolder({
466
+ cliVersion: this.cliVersion,
467
+ token: this.token,
468
+ superblocksBaseUrl: this.superblocksBaseUrl,
469
+ folderId,
470
+ payload,
471
+ });
472
+ }
473
+
474
+ async deleteFolder(folderId: string): Promise<FolderSummary> {
475
+ return deleteFolder({
476
+ cliVersion: this.cliVersion,
477
+ token: this.token,
478
+ superblocksBaseUrl: this.superblocksBaseUrl,
479
+ folderId,
480
+ });
481
+ }
482
+
232
483
  async fetchApi({
233
484
  apiId,
234
485
  branch,
@@ -502,6 +753,31 @@ export class SuperblocksSdk {
502
753
  return await hashLocalDirectory(localDirectoryPath);
503
754
  }
504
755
 
756
+ async createApplication({
757
+ name,
758
+ organizationId,
759
+ codeMode,
760
+ templateName,
761
+ folderId,
762
+ }: {
763
+ name: string;
764
+ organizationId: string;
765
+ codeMode?: boolean;
766
+ templateName?: string;
767
+ folderId?: string;
768
+ }): Promise<CreateApplicationResult> {
769
+ return createApplication({
770
+ cliVersion: this.cliVersion,
771
+ token: this.token,
772
+ superblocksBaseUrl: this.superblocksBaseUrl,
773
+ name,
774
+ organizationId,
775
+ codeMode,
776
+ templateName,
777
+ folderId,
778
+ });
779
+ }
780
+
505
781
  async deployApplication(applicationId: string, commitId?: string) {
506
782
  return deployApplication(
507
783
  this.cliVersion,
@@ -522,6 +798,40 @@ export class SuperblocksSdk {
522
798
  );
523
799
  }
524
800
 
801
+ async fetchBillingUsageDaily(
802
+ startDate: string,
803
+ endDate: string,
804
+ ): Promise<DailyUsageRow[]> {
805
+ return fetchBillingUsageDaily({
806
+ cliVersion: this.cliVersion,
807
+ token: this.token,
808
+ superblocksBaseUrl: this.superblocksBaseUrl,
809
+ startDate,
810
+ endDate,
811
+ });
812
+ }
813
+
814
+ async fetchBillingUsageRecords(
815
+ startDate: string,
816
+ endDate: string,
817
+ ): Promise<UsageRecordRow[]> {
818
+ return fetchBillingUsageRecords({
819
+ cliVersion: this.cliVersion,
820
+ token: this.token,
821
+ superblocksBaseUrl: this.superblocksBaseUrl,
822
+ startDate,
823
+ endDate,
824
+ });
825
+ }
826
+
827
+ async fetchBillingPlanSummary(): Promise<PlanSummary> {
828
+ return fetchBillingPlanSummary({
829
+ cliVersion: this.cliVersion,
830
+ token: this.token,
831
+ superblocksBaseUrl: this.superblocksBaseUrl,
832
+ });
833
+ }
834
+
525
835
  async sync({
526
836
  applicationId,
527
837
  payload,
@@ -1,5 +1,3 @@
1
- import { signResource, verifyResources } from "./signing.js";
2
- import type { AppToSign, AppToVerify, MethodHandlers } from "../types/index.js";
3
1
  import type {
4
2
  ApiToSign,
5
3
  ApiToVerify,
@@ -9,6 +7,9 @@ import type {
9
7
  } from "@superblocksteam/shared";
10
8
  import type { Signature } from "@superblocksteam/util";
11
9
 
10
+ import type { AppToSign, AppToVerify, MethodHandlers } from "../types/index.js";
11
+ import { signResource, verifyResources } from "./signing.js";
12
+
12
13
  // This file contains the definition of the protocol used for communication between the SB server and clients
13
14
 
14
15
  export type ResponseMeta = {
@@ -3,15 +3,16 @@ import {
3
3
  createISocketClient,
4
4
  ISocketWithClientAuth,
5
5
  } from "@superblocksteam/shared";
6
- import { getTracer } from "../telemetry/index.js";
7
- import { createRequestHandlers } from "./handlers.js";
8
- import type { ISocketClient } from "../types/index.js";
9
6
  import type {
10
7
  ClientMethods,
11
8
  RequestContextBase,
12
9
  ServerMethods,
13
10
  } from "@superblocksteam/shared";
14
11
 
12
+ import { getTracer } from "../telemetry/index.js";
13
+ import type { ISocketClient } from "../types/index.js";
14
+ import { createRequestHandlers } from "./handlers.js";
15
+
15
16
  export type StdISocketRPCClient = ISocketClient<ServerMethods>;
16
17
 
17
18
  export async function connectToISocketRPCServer({
@@ -1,12 +1,14 @@
1
1
  import axios from "axios";
2
- import { getSanitizedApi } from "../utils.js";
2
+ import type { AxiosRequestConfig, Method } from "axios";
3
+
4
+ import type { Signature } from "@superblocksteam/util";
5
+
3
6
  import type {
4
7
  ApiResource,
5
8
  GenericResource,
6
9
  SignatureResponse,
7
10
  } from "../types/index.js";
8
- import type { Signature } from "@superblocksteam/util";
9
- import type { AxiosRequestConfig, Method } from "axios";
11
+ import { getSanitizedApi } from "../utils.js";
10
12
 
11
13
  export async function signResource({
12
14
  token,
@@ -1,8 +1,11 @@
1
1
  import os from "node:os";
2
+
2
3
  import { trace, type Tracer } from "@opentelemetry/api";
3
4
  import { logs, type Logger } from "@opentelemetry/api-logs";
4
5
  import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
5
6
  import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
7
+ import type ddTraceDefault from "dd-trace";
8
+
6
9
  import {
7
10
  DeploymentTypeEnum,
8
11
  OBS_TAG_APPLICATION_ID,
@@ -18,7 +21,9 @@ import {
18
21
  resetTelemetry,
19
22
  getDefaultPolicy,
20
23
  } from "@superblocksteam/telemetry";
24
+
21
25
  import packageJson from "../../package.json" with { type: "json" };
26
+ import type { ApplicationConfigWithTokenConfigAndUserInfo } from "../types/index.js";
22
27
  import {
23
28
  ATTR_SUPERBLOCKS_BASE_URL,
24
29
  ATTR_SUPERBLOCKS_CLI_TOKEN,
@@ -30,8 +35,6 @@ import {
30
35
  import { applyLocalObsEnvVars, isLocalObsEnabled } from "./local-obs.js";
31
36
  import { getLogger as getStandardLogger } from "./logging.js";
32
37
  import { getConfiguration, SERVICE_NAME } from "./util.js";
33
- import type { ApplicationConfigWithTokenConfigAndUserInfo } from "../types/index.js";
34
- import type ddTraceDefault from "dd-trace";
35
38
 
36
39
  // Apply local observability env vars early, before dd-trace auto-init
37
40
  applyLocalObsEnvVars();
@@ -1,10 +1,11 @@
1
1
  import { SeverityNumber } from "@opentelemetry/api-logs";
2
- import { createLogger, format, transports } from "winston";
3
- import { safeStringify } from "./safe-stringify.js";
4
- import { getLogger as getTracedLogger } from "./index.js";
5
2
  import type { AnyValueMap } from "@opentelemetry/api-logs";
3
+ import { createLogger, format, transports } from "winston";
6
4
  import type winston from "winston";
7
5
 
6
+ import { getLogger as getTracedLogger } from "./index.js";
7
+ import { safeStringify } from "./safe-stringify.js";
8
+
8
9
  const activeTransports: winston.transport[] = [];
9
10
 
10
11
  if (process.env.SUPERBLOCKS_IS_CSB === "true") {
@@ -1,6 +1,7 @@
1
- import type { FeatureFlags } from "../flag.js";
2
1
  import type { Api } from "@superblocksteam/util";
3
2
 
3
+ import type { FeatureFlags } from "../flag.js";
4
+
4
5
  export interface UserMeDto {
5
6
  user: User;
6
7
  organizations: Organization[];
package/src/utils.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import axios from "axios";
2
+ import type { AxiosRequestConfig } from "axios";
3
+
4
+ import type { Api } from "@superblocksteam/util";
5
+
2
6
  import {
3
7
  AgentStatus,
4
8
  OpenAiPluginId,
5
9
  transcribeAudioToTextTranslateToEnglishTruthyValues,
6
10
  } from "./types/index.js";
7
11
  import type { Agent, AgentType } from "./types/index.js";
8
- import type { Api } from "@superblocksteam/util";
9
- import type { AxiosRequestConfig } from "axios";
10
12
 
11
13
  export async function getAgentUrl(
12
14
  agents: Agent[],
@@ -1,6 +1,16 @@
1
1
  import * as https from "https";
2
2
  import path from "node:path";
3
3
  import { dirname } from "path";
4
+
5
+ import { bold } from "colorette";
6
+ import fs from "fs-extra";
7
+ import { isEmpty, isArray, isObject, get } from "lodash-es";
8
+ import * as semver from "semver";
9
+ import { simpleGit } from "simple-git";
10
+ import type { SimpleGit, StatusResult } from "simple-git";
11
+ import slugify from "slugify";
12
+ import { parse, stringify as ymlstringify } from "yaml";
13
+
4
14
  import { DEFAULT_BRANCH, ExportViewMode } from "@superblocksteam/shared";
5
15
  import {
6
16
  RESOURCE_CONFIG_PATH,
@@ -13,23 +23,6 @@ import {
13
23
  writeApiFiles,
14
24
  DEFAULT_LINES_FOR_LARGE_STEPS,
15
25
  } from "@superblocksteam/util";
16
- import { bold } from "colorette";
17
- import fs from "fs-extra";
18
- import { isEmpty, isArray, isObject, get } from "lodash-es";
19
- import * as semver from "semver";
20
- import { simpleGit } from "simple-git";
21
- import slugify from "slugify";
22
- import { parse, stringify as ymlstringify } from "yaml";
23
- import { getLogger } from "./telemetry/logging.js";
24
- import type {
25
- ApplicationWrapper,
26
- MultiPageApplicationWrapper,
27
- MultiPageApplicationWrapperWithComponents,
28
- CodeModeApplicationWrapper,
29
- } from "./client.js";
30
- import type { FeatureFlags } from "./flag.js";
31
- import type { SuperblocksSdk } from "./sdk.js";
32
- import type { ApiWithPb, Page } from "./types/index.js";
33
26
  import type {
34
27
  LocalGitRepoState,
35
28
  SuperblocksBackendConfig,
@@ -44,7 +37,17 @@ import type {
44
37
  ApiWrapper,
45
38
  AdditionalStepFiles,
46
39
  } from "@superblocksteam/util";
47
- import type { SimpleGit, StatusResult } from "simple-git";
40
+
41
+ import type {
42
+ ApplicationWrapper,
43
+ MultiPageApplicationWrapper,
44
+ MultiPageApplicationWrapperWithComponents,
45
+ CodeModeApplicationWrapper,
46
+ } from "./client.js";
47
+ import type { FeatureFlags } from "./flag.js";
48
+ import type { SuperblocksSdk } from "./sdk.js";
49
+ import { getLogger } from "./telemetry/logging.js";
50
+ import type { ApiWithPb, Page } from "./types/index.js";
48
51
 
49
52
  export { DEFAULT_BRANCH };
50
53
 
@@ -1,19 +1,22 @@
1
1
  import path from "node:path";
2
+
3
+ import { yellow, red } from "colorette";
4
+ import fg from "fast-glob";
5
+ import fs from "fs-extra";
6
+ import { createLogger } from "vite";
7
+ import type { Plugin } from "vite";
8
+ import yaml from "yaml";
9
+
10
+ import type { DeleteMeLibraryApi } from "@superblocksteam/library-shared/types";
2
11
  import { isSdkApiTemplate } from "@superblocksteam/shared";
3
12
  import { resolveLanguageSpecificStepContentFromBlocks } from "@superblocksteam/util";
4
13
  import {
5
14
  getPageName,
6
15
  getScopeIdFromName,
7
16
  } from "@superblocksteam/vite-plugin-file-sync";
8
- import { yellow, red } from "colorette";
9
- import fg from "fast-glob";
10
- import fs from "fs-extra";
11
- import { createLogger } from "vite";
12
- import yaml from "yaml";
17
+
13
18
  import { collectSdkApisFromRegistry } from "./collect-sdk-apis.mjs";
14
19
  import { getLogger } from "./telemetry/logging.js";
15
- import type { DeleteMeLibraryApi } from "@superblocksteam/library-shared/types";
16
- import type { Plugin } from "vite";
17
20
 
18
21
  type ApiDependency = {
19
22
  apiName: string;
@@ -1,13 +1,16 @@
1
1
  import path from "node:path";
2
+
2
3
  import { transformFromAstSync } from "@babel/core";
3
4
  import { parse } from "@babel/parser";
4
5
  import tsTransformPlugin from "@babel/plugin-transform-typescript";
5
- import { supplementElementIds } from "@superblocksteam/vite-plugin-file-sync";
6
6
  import { red, yellow } from "colorette";
7
7
  import { createLogger } from "vite";
8
- import { getLogger } from "./telemetry/logging.js";
9
8
  import type { Plugin } from "vite";
10
9
 
10
+ import { supplementElementIds } from "@superblocksteam/vite-plugin-file-sync";
11
+
12
+ import { getLogger } from "./telemetry/logging.js";
13
+
11
14
  /**
12
15
  * Creates a Vite plugin that injects Superblocks IDs into the application.
13
16
  * This will primarily be used during builds, as the dev server leverages the
@@ -1,4 +1,5 @@
1
1
  import path from "node:path";
2
+
2
3
  import type { Plugin } from "vite";
3
4
 
4
5
  /**
@@ -1,5 +1,7 @@
1
1
  import path from "node:path";
2
+
2
3
  import { describe, it, expect } from "vitest";
4
+
3
5
  import { sdkApiEntryPointPlugin } from "./vite-plugin-sdk-api-entry-point.mjs";
4
6
 
5
7
  type TransformResult = {
@@ -1,9 +1,12 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+
3
4
  import { afterAll, beforeAll, describe, expect, it } from "vitest";
5
+
6
+ import type { SuperblocksDevEnvironmentConfig } from "@superblocksteam/util";
7
+
4
8
  import { BranchSource, getCurrentBranchInfo } from "../src/client.js";
5
9
  import { getCurrentGitBranch } from "../src/version-control.mjs";
6
- import type { SuperblocksDevEnvironmentConfig } from "@superblocksteam/util";
7
10
 
8
11
  // The .superblocks folder is located in the 'test' directory, so we need to prefix the path in order to find it.
9
12
  const testPathPrefix = "test";
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
+
2
3
  import { safeStringify } from "../src/telemetry/safe-stringify.js";
3
4
 
4
5
  describe("safeStringify", () => {