@superblocksteam/sdk 2.0.101-next.4 → 2.0.101-next.6
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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/application-build.d.mts.map +1 -1
- package/dist/application-build.mjs +1 -1
- package/dist/application-build.mjs.map +1 -1
- package/dist/cli-replacement/auth-hot-reload.d.mts.map +1 -1
- package/dist/cli-replacement/auth-hot-reload.mjs.map +1 -1
- package/dist/cli-replacement/automatic-upgrades.d.ts +1 -1
- package/dist/cli-replacement/automatic-upgrades.d.ts.map +1 -1
- package/dist/cli-replacement/automatic-upgrades.js +1 -1
- package/dist/cli-replacement/automatic-upgrades.js.map +1 -1
- package/dist/cli-replacement/dev.d.mts.map +1 -1
- package/dist/cli-replacement/dev.mjs +7 -5
- package/dist/cli-replacement/dev.mjs.map +1 -1
- package/dist/cli-replacement/git-repo-setup.d.mts.map +1 -1
- package/dist/cli-replacement/git-repo-setup.mjs +0 -30
- package/dist/cli-replacement/git-repo-setup.mjs.map +1 -1
- package/dist/cli-replacement/git-repo-setup.test.mjs.map +1 -1
- package/dist/cli-replacement/init.d.ts +2 -2
- package/dist/cli-replacement/init.d.ts.map +1 -1
- package/dist/cli-replacement/init.js.map +1 -1
- package/dist/cli-replacement/version-detection.d.ts.map +1 -1
- package/dist/cli-replacement/version-detection.js.map +1 -1
- package/dist/cli-replacement/version-detection.test.js.map +1 -1
- package/dist/client-sync.test.mjs.map +1 -1
- package/dist/client.d.ts +3 -252
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -762
- package/dist/client.js.map +1 -1
- package/dist/collect-sdk-apis.d.mts.map +1 -1
- package/dist/collect-sdk-apis.mjs.map +1 -1
- package/dist/collect-sdk-apis.test.mjs.map +1 -1
- package/dist/dbfs/client.d.ts.map +1 -1
- package/dist/dbfs/client.js.map +1 -1
- package/dist/dbfs/client.test.js +1 -1
- package/dist/dbfs/client.test.js.map +1 -1
- package/dist/dbfs/local.d.ts.map +1 -1
- package/dist/dbfs/local.js.map +1 -1
- package/dist/dev-utils/custom-build.d.mts.map +1 -1
- package/dist/dev-utils/custom-build.mjs.map +1 -1
- package/dist/dev-utils/custom-config.d.mts.map +1 -1
- package/dist/dev-utils/custom-config.mjs.map +1 -1
- package/dist/dev-utils/dev-server.d.mts +2 -2
- package/dist/dev-utils/dev-server.d.mts.map +1 -1
- package/dist/dev-utils/dev-server.mjs +4 -5
- package/dist/dev-utils/dev-server.mjs.map +1 -1
- package/dist/dev-utils/token-manager.d.ts.map +1 -1
- package/dist/dev-utils/token-manager.js.map +1 -1
- package/dist/extract-api-integrations.d.mts +16 -1
- package/dist/extract-api-integrations.d.mts.map +1 -1
- package/dist/extract-api-integrations.mjs +232 -1
- package/dist/extract-api-integrations.mjs.map +1 -1
- package/dist/extract-api-integrations.test.mjs.map +1 -1
- package/dist/flag.d.ts.map +1 -1
- package/dist/flag.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/parse-sdk-registry.d.mts.map +1 -1
- package/dist/parse-sdk-registry.mjs.map +1 -1
- package/dist/parse-sdk-registry.test.mjs.map +1 -1
- package/dist/sdk.d.ts +4 -59
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +1 -184
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.test.js +2 -72
- package/dist/sdk.test.js.map +1 -1
- package/dist/socket/handlers.d.ts +1 -1
- package/dist/socket/handlers.d.ts.map +1 -1
- package/dist/socket/handlers.js.map +1 -1
- package/dist/socket/index.d.ts +1 -1
- package/dist/socket/index.d.ts.map +1 -1
- package/dist/socket/index.js.map +1 -1
- package/dist/socket/signing.d.ts +1 -1
- package/dist/socket/signing.d.ts.map +1 -1
- package/dist/socket/signing.js.map +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/logging.d.ts.map +1 -1
- package/dist/telemetry/logging.js +1 -1
- package/dist/telemetry/logging.js.map +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/version-control.d.mts +1 -1
- package/dist/version-control.d.mts.map +1 -1
- package/dist/version-control.mjs +2 -2
- package/dist/version-control.mjs.map +1 -1
- package/dist/vite-plugin-generate-api-build-manifest.d.mts.map +1 -1
- package/dist/vite-plugin-generate-api-build-manifest.mjs +3 -3
- package/dist/vite-plugin-generate-api-build-manifest.mjs.map +1 -1
- package/dist/vite-plugin-inject-sb-ids-transform.d.mts.map +1 -1
- package/dist/vite-plugin-inject-sb-ids-transform.mjs +1 -1
- package/dist/vite-plugin-inject-sb-ids-transform.mjs.map +1 -1
- package/dist/vite-plugin-sdk-api-entry-point.d.mts.map +1 -1
- package/dist/vite-plugin-sdk-api-entry-point.mjs.map +1 -1
- package/dist/vite-plugin-sdk-api-entry-point.test.mjs.map +1 -1
- package/eslint.config.js +17 -2
- package/package.json +6 -6
- package/src/application-build.mts +1 -4
- package/src/cli-replacement/auth-hot-reload.mts +2 -2
- package/src/cli-replacement/automatic-upgrades.ts +7 -10
- package/src/cli-replacement/dev.mts +17 -17
- package/src/cli-replacement/git-repo-setup.mts +1 -34
- package/src/cli-replacement/git-repo-setup.test.mts +1 -4
- package/src/cli-replacement/init.ts +4 -5
- package/src/cli-replacement/version-detection.test.ts +0 -2
- package/src/cli-replacement/version-detection.ts +0 -1
- package/src/client-sync.test.mts +0 -1
- package/src/client.ts +21 -1204
- package/src/collect-sdk-apis.mts +0 -1
- package/src/collect-sdk-apis.test.mts +0 -2
- package/src/dbfs/client.test.ts +1 -2
- package/src/dbfs/client.ts +0 -1
- package/src/dbfs/local.ts +0 -2
- package/src/dev-utils/custom-build.mts +1 -3
- package/src/dev-utils/custom-config.mts +0 -1
- package/src/dev-utils/dev-server.mts +19 -22
- package/src/dev-utils/token-manager.ts +0 -1
- package/src/extract-api-integrations.mts +345 -5
- package/src/extract-api-integrations.test.mts +0 -1
- package/src/flag.ts +0 -1
- package/src/index.ts +0 -7
- package/src/parse-sdk-registry.mts +0 -1
- package/src/parse-sdk-registry.test.mts +0 -2
- package/src/sdk.test.ts +5 -85
- package/src/sdk.ts +14 -324
- package/src/socket/handlers.ts +2 -3
- package/src/socket/index.ts +3 -4
- package/src/socket/signing.ts +3 -5
- package/src/telemetry/index.ts +2 -5
- package/src/telemetry/logging.ts +3 -4
- package/src/types/common.ts +1 -2
- package/src/utils.ts +2 -4
- package/src/version-control.mts +18 -21
- package/src/vite-plugin-generate-api-build-manifest.mts +7 -10
- package/src/vite-plugin-inject-sb-ids-transform.mts +2 -5
- package/src/vite-plugin-sdk-api-entry-point.mts +0 -1
- package/src/vite-plugin-sdk-api-entry-point.test.mts +0 -2
- package/test/clients.test.mts +1 -4
- package/test/safe-stringify.test.mts +0 -1
- package/test/version-control.test.mts +14 -17
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/client.fetch-audit-events.test.d.ts +0 -2
- package/dist/client.fetch-audit-events.test.d.ts.map +0 -1
- package/dist/client.fetch-audit-events.test.js +0 -69
- package/dist/client.fetch-audit-events.test.js.map +0 -1
- package/src/client.fetch-audit-events.test.ts +0 -82
package/src/sdk.ts
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
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,
|
|
10
4
|
type GetPublicOrganizationSummaryResponseBody,
|
|
11
|
-
type IHomepageApplicationV2Dto,
|
|
12
5
|
} from "@superblocksteam/shared";
|
|
13
|
-
import type {
|
|
14
|
-
ComponentEvent,
|
|
15
|
-
LocalGitRepoState,
|
|
16
|
-
SuperblocksResourceType,
|
|
17
|
-
} from "@superblocksteam/util";
|
|
18
|
-
|
|
19
6
|
import {
|
|
20
|
-
createFolder,
|
|
21
|
-
createIntegration,
|
|
22
|
-
createRbacAssignments,
|
|
23
|
-
createApplication,
|
|
24
|
-
deleteFolder,
|
|
25
|
-
deleteIntegration,
|
|
26
|
-
deleteRbacAssignment,
|
|
27
7
|
fetchApi,
|
|
28
8
|
fetchApiCommits,
|
|
29
9
|
fetchApis,
|
|
@@ -32,20 +12,8 @@ import {
|
|
|
32
12
|
fetchApplicationCommits,
|
|
33
13
|
fetchApplications,
|
|
34
14
|
fetchApplicationWithComponents,
|
|
35
|
-
fetchAuditEntities,
|
|
36
|
-
fetchAuditEvents,
|
|
37
|
-
fetchAuditLogs,
|
|
38
|
-
fetchBillingPlanSummary,
|
|
39
|
-
fetchBillingUsageDaily,
|
|
40
|
-
fetchBillingUsageRecords,
|
|
41
15
|
fetchCurrentUser,
|
|
42
|
-
fetchFact,
|
|
43
|
-
fetchFacts,
|
|
44
|
-
fetchFolders,
|
|
45
|
-
fetchIntegrationById,
|
|
46
|
-
fetchIntegrations,
|
|
47
16
|
fetchOrganizationSummary,
|
|
48
|
-
fetchRbacAssignments,
|
|
49
17
|
getApplicationGitConfig,
|
|
50
18
|
getGitFreshToken,
|
|
51
19
|
sync,
|
|
@@ -54,32 +22,10 @@ import {
|
|
|
54
22
|
pushApplicationCodeMode,
|
|
55
23
|
registerComponents,
|
|
56
24
|
uploadComponents,
|
|
57
|
-
updateFolder,
|
|
58
|
-
updateIntegration,
|
|
59
|
-
updateRbacAssignment,
|
|
60
25
|
validateGitSetup,
|
|
61
26
|
deployApplication,
|
|
62
27
|
deployApi,
|
|
63
28
|
} 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";
|
|
83
29
|
import {
|
|
84
30
|
downloadApplicationDirectory,
|
|
85
31
|
downloadDirectoryByHash,
|
|
@@ -91,7 +37,20 @@ import {
|
|
|
91
37
|
} from "./dbfs/client.js";
|
|
92
38
|
import { hashLocalDirectory } from "./dbfs/local.js";
|
|
93
39
|
import { FeatureFlags } from "./flag.js";
|
|
40
|
+
import type {
|
|
41
|
+
ApplicationGitConfig,
|
|
42
|
+
GitFreshToken,
|
|
43
|
+
SyncRequest,
|
|
44
|
+
SyncResponse,
|
|
45
|
+
PushApiWithCommitConfig,
|
|
46
|
+
PushMultiPageApplicationWithCommitConfig,
|
|
47
|
+
} from "./client.js";
|
|
94
48
|
import type { UserMeDto } from "./types/index.js";
|
|
49
|
+
import type {
|
|
50
|
+
ComponentEvent,
|
|
51
|
+
LocalGitRepoState,
|
|
52
|
+
SuperblocksResourceType,
|
|
53
|
+
} from "@superblocksteam/util";
|
|
95
54
|
|
|
96
55
|
// Exporting here instead of index.ts because only sdk.ts is exposed outside in package.json
|
|
97
56
|
export * from "./errors.js";
|
|
@@ -261,9 +220,7 @@ export class SuperblocksSdk {
|
|
|
261
220
|
});
|
|
262
221
|
}
|
|
263
222
|
|
|
264
|
-
async fetchApplications(
|
|
265
|
-
headers?: Record<string, string>,
|
|
266
|
-
): Promise<IHomepageApplicationV2Dto[]> {
|
|
223
|
+
async fetchApplications(headers?: Record<string, string>) {
|
|
267
224
|
return fetchApplications(
|
|
268
225
|
this.cliVersion,
|
|
269
226
|
this.token,
|
|
@@ -272,214 +229,6 @@ export class SuperblocksSdk {
|
|
|
272
229
|
);
|
|
273
230
|
}
|
|
274
231
|
|
|
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
|
-
|
|
483
232
|
async fetchApi({
|
|
484
233
|
apiId,
|
|
485
234
|
branch,
|
|
@@ -753,31 +502,6 @@ export class SuperblocksSdk {
|
|
|
753
502
|
return await hashLocalDirectory(localDirectoryPath);
|
|
754
503
|
}
|
|
755
504
|
|
|
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
|
-
|
|
781
505
|
async deployApplication(applicationId: string, commitId?: string) {
|
|
782
506
|
return deployApplication(
|
|
783
507
|
this.cliVersion,
|
|
@@ -798,40 +522,6 @@ export class SuperblocksSdk {
|
|
|
798
522
|
);
|
|
799
523
|
}
|
|
800
524
|
|
|
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
|
-
|
|
835
525
|
async sync({
|
|
836
526
|
applicationId,
|
|
837
527
|
payload,
|
package/src/socket/handlers.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { signResource, verifyResources } from "./signing.js";
|
|
2
|
+
import type { AppToSign, AppToVerify, MethodHandlers } from "../types/index.js";
|
|
1
3
|
import type {
|
|
2
4
|
ApiToSign,
|
|
3
5
|
ApiToVerify,
|
|
@@ -7,9 +9,6 @@ import type {
|
|
|
7
9
|
} from "@superblocksteam/shared";
|
|
8
10
|
import type { Signature } from "@superblocksteam/util";
|
|
9
11
|
|
|
10
|
-
import type { AppToSign, AppToVerify, MethodHandlers } from "../types/index.js";
|
|
11
|
-
import { signResource, verifyResources } from "./signing.js";
|
|
12
|
-
|
|
13
12
|
// This file contains the definition of the protocol used for communication between the SB server and clients
|
|
14
13
|
|
|
15
14
|
export type ResponseMeta = {
|
package/src/socket/index.ts
CHANGED
|
@@ -3,16 +3,15 @@ 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";
|
|
6
9
|
import type {
|
|
7
10
|
ClientMethods,
|
|
8
11
|
RequestContextBase,
|
|
9
12
|
ServerMethods,
|
|
10
13
|
} from "@superblocksteam/shared";
|
|
11
14
|
|
|
12
|
-
import { getTracer } from "../telemetry/index.js";
|
|
13
|
-
import type { ISocketClient } from "../types/index.js";
|
|
14
|
-
import { createRequestHandlers } from "./handlers.js";
|
|
15
|
-
|
|
16
15
|
export type StdISocketRPCClient = ISocketClient<ServerMethods>;
|
|
17
16
|
|
|
18
17
|
export async function connectToISocketRPCServer({
|
package/src/socket/signing.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import type { Signature } from "@superblocksteam/util";
|
|
5
|
-
|
|
2
|
+
import { getSanitizedApi } from "../utils.js";
|
|
6
3
|
import type {
|
|
7
4
|
ApiResource,
|
|
8
5
|
GenericResource,
|
|
9
6
|
SignatureResponse,
|
|
10
7
|
} from "../types/index.js";
|
|
11
|
-
import {
|
|
8
|
+
import type { Signature } from "@superblocksteam/util";
|
|
9
|
+
import type { AxiosRequestConfig, Method } from "axios";
|
|
12
10
|
|
|
13
11
|
export async function signResource({
|
|
14
12
|
token,
|
package/src/telemetry/index.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
|
-
|
|
3
2
|
import { trace, type Tracer } from "@opentelemetry/api";
|
|
4
3
|
import { logs, type Logger } from "@opentelemetry/api-logs";
|
|
5
4
|
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
|
|
6
5
|
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
|
|
7
|
-
import type ddTraceDefault from "dd-trace";
|
|
8
|
-
|
|
9
6
|
import {
|
|
10
7
|
DeploymentTypeEnum,
|
|
11
8
|
OBS_TAG_APPLICATION_ID,
|
|
@@ -21,9 +18,7 @@ import {
|
|
|
21
18
|
resetTelemetry,
|
|
22
19
|
getDefaultPolicy,
|
|
23
20
|
} from "@superblocksteam/telemetry";
|
|
24
|
-
|
|
25
21
|
import packageJson from "../../package.json" with { type: "json" };
|
|
26
|
-
import type { ApplicationConfigWithTokenConfigAndUserInfo } from "../types/index.js";
|
|
27
22
|
import {
|
|
28
23
|
ATTR_SUPERBLOCKS_BASE_URL,
|
|
29
24
|
ATTR_SUPERBLOCKS_CLI_TOKEN,
|
|
@@ -35,6 +30,8 @@ import {
|
|
|
35
30
|
import { applyLocalObsEnvVars, isLocalObsEnabled } from "./local-obs.js";
|
|
36
31
|
import { getLogger as getStandardLogger } from "./logging.js";
|
|
37
32
|
import { getConfiguration, SERVICE_NAME } from "./util.js";
|
|
33
|
+
import type { ApplicationConfigWithTokenConfigAndUserInfo } from "../types/index.js";
|
|
34
|
+
import type ddTraceDefault from "dd-trace";
|
|
38
35
|
|
|
39
36
|
// Apply local observability env vars early, before dd-trace auto-init
|
|
40
37
|
applyLocalObsEnvVars();
|
package/src/telemetry/logging.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SeverityNumber } from "@opentelemetry/api-logs";
|
|
2
|
-
import type { AnyValueMap } from "@opentelemetry/api-logs";
|
|
3
2
|
import { createLogger, format, transports } from "winston";
|
|
4
|
-
import type winston from "winston";
|
|
5
|
-
|
|
6
|
-
import { getLogger as getTracedLogger } from "./index.js";
|
|
7
3
|
import { safeStringify } from "./safe-stringify.js";
|
|
4
|
+
import { getLogger as getTracedLogger } from "./index.js";
|
|
5
|
+
import type { AnyValueMap } from "@opentelemetry/api-logs";
|
|
6
|
+
import type winston from "winston";
|
|
8
7
|
|
|
9
8
|
const activeTransports: winston.transport[] = [];
|
|
10
9
|
|
package/src/types/common.ts
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import type { AxiosRequestConfig } from "axios";
|
|
3
|
-
|
|
4
|
-
import type { Api } from "@superblocksteam/util";
|
|
5
|
-
|
|
6
2
|
import {
|
|
7
3
|
AgentStatus,
|
|
8
4
|
OpenAiPluginId,
|
|
9
5
|
transcribeAudioToTextTranslateToEnglishTruthyValues,
|
|
10
6
|
} from "./types/index.js";
|
|
11
7
|
import type { Agent, AgentType } from "./types/index.js";
|
|
8
|
+
import type { Api } from "@superblocksteam/util";
|
|
9
|
+
import type { AxiosRequestConfig } from "axios";
|
|
12
10
|
|
|
13
11
|
export async function getAgentUrl(
|
|
14
12
|
agents: Agent[],
|
package/src/version-control.mts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
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
|
-
|
|
14
4
|
import { DEFAULT_BRANCH, ExportViewMode } from "@superblocksteam/shared";
|
|
15
5
|
import {
|
|
16
6
|
RESOURCE_CONFIG_PATH,
|
|
@@ -23,6 +13,23 @@ import {
|
|
|
23
13
|
writeApiFiles,
|
|
24
14
|
DEFAULT_LINES_FOR_LARGE_STEPS,
|
|
25
15
|
} 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";
|
|
26
33
|
import type {
|
|
27
34
|
LocalGitRepoState,
|
|
28
35
|
SuperblocksBackendConfig,
|
|
@@ -37,17 +44,7 @@ import type {
|
|
|
37
44
|
ApiWrapper,
|
|
38
45
|
AdditionalStepFiles,
|
|
39
46
|
} from "@superblocksteam/util";
|
|
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";
|
|
47
|
+
import type { SimpleGit, StatusResult } from "simple-git";
|
|
51
48
|
|
|
52
49
|
export { DEFAULT_BRANCH };
|
|
53
50
|
|
|
@@ -1,22 +1,19 @@
|
|
|
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";
|
|
11
2
|
import { isSdkApiTemplate } from "@superblocksteam/shared";
|
|
12
3
|
import { resolveLanguageSpecificStepContentFromBlocks } from "@superblocksteam/util";
|
|
13
4
|
import {
|
|
14
5
|
getPageName,
|
|
15
6
|
getScopeIdFromName,
|
|
16
7
|
} from "@superblocksteam/vite-plugin-file-sync";
|
|
17
|
-
|
|
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";
|
|
18
13
|
import { collectSdkApisFromRegistry } from "./collect-sdk-apis.mjs";
|
|
19
14
|
import { getLogger } from "./telemetry/logging.js";
|
|
15
|
+
import type { DeleteMeLibraryApi } from "@superblocksteam/library-shared/types";
|
|
16
|
+
import type { Plugin } from "vite";
|
|
20
17
|
|
|
21
18
|
type ApiDependency = {
|
|
22
19
|
apiName: string;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
|
|
3
2
|
import { transformFromAstSync } from "@babel/core";
|
|
4
3
|
import { parse } from "@babel/parser";
|
|
5
4
|
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 type { Plugin } from "vite";
|
|
9
|
-
|
|
10
|
-
import { supplementElementIds } from "@superblocksteam/vite-plugin-file-sync";
|
|
11
|
-
|
|
12
8
|
import { getLogger } from "./telemetry/logging.js";
|
|
9
|
+
import type { Plugin } from "vite";
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
* Creates a Vite plugin that injects Superblocks IDs into the application.
|
package/test/clients.test.mts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
|
|
4
3
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
5
|
-
|
|
6
|
-
import type { SuperblocksDevEnvironmentConfig } from "@superblocksteam/util";
|
|
7
|
-
|
|
8
4
|
import { BranchSource, getCurrentBranchInfo } from "../src/client.js";
|
|
9
5
|
import { getCurrentGitBranch } from "../src/version-control.mjs";
|
|
6
|
+
import type { SuperblocksDevEnvironmentConfig } from "@superblocksteam/util";
|
|
10
7
|
|
|
11
8
|
// The .superblocks folder is located in the 'test' directory, so we need to prefix the path in order to find it.
|
|
12
9
|
const testPathPrefix = "test";
|