@superblocksteam/sdk 2.0.80 → 2.0.81-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/cli-replacement/automatic-upgrades.d.ts.map +1 -1
- package/dist/cli-replacement/automatic-upgrades.js.map +1 -1
- package/dist/cli-replacement/socket-utils.d.mts +0 -1
- package/dist/cli-replacement/socket-utils.d.mts.map +1 -1
- package/dist/cli-replacement/socket-utils.mjs +0 -11
- package/dist/cli-replacement/socket-utils.mjs.map +1 -1
- package/dist/client.d.ts +4 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -9
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/sdk.d.ts +6 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/telemetry/logging.d.ts.map +1 -1
- package/dist/telemetry/logging.js +18 -14
- package/dist/telemetry/logging.js.map +1 -1
- package/dist/types/common.d.ts +9 -9
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +2 -2
- package/dist/types/common.js.map +1 -1
- package/dist/types/signing.d.ts +0 -31
- package/dist/types/signing.d.ts.map +1 -1
- package/dist/types/socket.d.ts +2 -19
- package/dist/types/socket.d.ts.map +1 -1
- package/dist/types/socket.js +1 -10
- package/dist/types/socket.js.map +1 -1
- package/dist/utils/token-utils.d.mts +1 -8
- package/dist/utils/token-utils.d.mts.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/version-control.d.mts +1 -6
- package/dist/version-control.d.mts.map +1 -1
- package/dist/version-control.mjs +5 -5
- package/dist/version-control.mjs.map +1 -1
- package/dist/vite-plugin-generate-api-build-manifest.d.mts +0 -2
- package/dist/vite-plugin-generate-api-build-manifest.d.mts.map +1 -1
- package/dist/vite-plugin-generate-api-build-manifest.mjs +0 -2
- package/dist/vite-plugin-generate-api-build-manifest.mjs.map +1 -1
- package/package.json +5 -18
- package/src/cli-replacement/automatic-upgrades.ts +0 -1
- package/src/cli-replacement/socket-utils.mts +0 -14
- package/src/client.ts +5 -15
- package/src/index.ts +2 -76
- package/src/telemetry/logging.ts +25 -21
- package/src/types/common.ts +8 -15
- package/src/types/signing.ts +0 -36
- package/src/types/socket.ts +2 -38
- package/src/utils/token-utils.mts +2 -2
- package/src/utils.ts +1 -1
- package/src/version-control.mts +5 -5
- package/src/vite-plugin-generate-api-build-manifest.mts +0 -3
- package/tsconfig.json +2 -4
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.81-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Superblocks JS SDK",
|
|
6
6
|
"homepage": "https://www.superblocks.com",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"@babel/parser": "^7.25.8",
|
|
21
21
|
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
22
22
|
"@babel/plugin-transform-typescript": "7.28.0",
|
|
23
|
-
"@babel/traverse": "^7.25.7",
|
|
24
23
|
"@opentelemetry/api": "^1.9.0",
|
|
25
24
|
"@opentelemetry/api-logs": "^0.203.0",
|
|
26
25
|
"@opentelemetry/context-async-hooks": "^2.0.1",
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
"@opentelemetry/instrumentation-express": "^0.45.0",
|
|
30
29
|
"@opentelemetry/instrumentation-http": "^0.55.0",
|
|
31
30
|
"@opentelemetry/resources": "^1.28.0",
|
|
32
|
-
"@opentelemetry/sdk-logs": "^0.203.0",
|
|
33
31
|
"@opentelemetry/sdk-node": "^0.55.0",
|
|
34
32
|
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
35
33
|
"@superblocksteam/bucketeer-sdk": "1.1.0",
|
|
@@ -37,11 +35,8 @@
|
|
|
37
35
|
"axios": "^1.13.2",
|
|
38
36
|
"chokidar": "^4.0.3",
|
|
39
37
|
"colorette": "^2.0.20",
|
|
40
|
-
"common-tags": "^1.8.2",
|
|
41
38
|
"cors": "^2.8.5",
|
|
42
39
|
"dd-trace": "^5.57.1",
|
|
43
|
-
"debug": "^4.4.0",
|
|
44
|
-
"diff": "^8.0.2",
|
|
45
40
|
"express": "^4.21.1",
|
|
46
41
|
"fast-glob": "^3.3.3",
|
|
47
42
|
"form-data": "^4.0.5",
|
|
@@ -57,13 +52,11 @@
|
|
|
57
52
|
"vite": "6.4.1",
|
|
58
53
|
"vite-tsconfig-paths": "^6.0.4",
|
|
59
54
|
"winston": "^3.17.0",
|
|
60
|
-
"ws": "^8.17.0",
|
|
61
55
|
"yaml": "^2.7.1",
|
|
62
|
-
"@superblocksteam/library-shared": "2.0.
|
|
63
|
-
"@superblocksteam/shared": "0.
|
|
64
|
-
"@superblocksteam/
|
|
65
|
-
"@superblocksteam/
|
|
66
|
-
"@superblocksteam/library": "2.0.80"
|
|
56
|
+
"@superblocksteam/library-shared": "2.0.81-next.0",
|
|
57
|
+
"@superblocksteam/shared": "0.9562.0",
|
|
58
|
+
"@superblocksteam/util": "2.0.81-next.0",
|
|
59
|
+
"@superblocksteam/vite-plugin-file-sync": "2.0.81-next.0"
|
|
67
60
|
},
|
|
68
61
|
"optionalDependencies": {
|
|
69
62
|
"@rollup/rollup-darwin-arm64": "^4.34.9",
|
|
@@ -74,19 +67,14 @@
|
|
|
74
67
|
"@rollup/rollup-win32-x64-msvc": "^4.34.9"
|
|
75
68
|
},
|
|
76
69
|
"devDependencies": {
|
|
77
|
-
"@babel/types": "7.28.2",
|
|
78
70
|
"@eslint/js": "^9.39.2",
|
|
79
71
|
"@types/babel__core": "^7.20.5",
|
|
80
|
-
"@types/babel__traverse": "^7.20.6",
|
|
81
|
-
"@types/common-tags": "^1.8.4",
|
|
82
72
|
"@types/cors": "^2.8.18",
|
|
83
|
-
"@types/debug": "^4.1.12",
|
|
84
73
|
"@types/express": "^4.17.10",
|
|
85
74
|
"@types/fs-extra": "^11.0.4",
|
|
86
75
|
"@types/lodash-es": "^4.17.12",
|
|
87
76
|
"@types/node": "^24",
|
|
88
77
|
"@types/semver": "^7.5.8",
|
|
89
|
-
"@types/ws": "^8.18.1",
|
|
90
78
|
"eslint": "^9.39.2",
|
|
91
79
|
"eslint-config-prettier": "^10.1.8",
|
|
92
80
|
"eslint-config-turbo": "^2.7.4",
|
|
@@ -94,7 +82,6 @@
|
|
|
94
82
|
"eslint-plugin-prettier": "^5.5.4",
|
|
95
83
|
"eslint-plugin-unicorn": "^62.0.0",
|
|
96
84
|
"globals": "^17.0.0",
|
|
97
|
-
"tslib": "^2.8.0",
|
|
98
85
|
"tsx": "^4.19.2",
|
|
99
86
|
"typescript": "^5.9.3",
|
|
100
87
|
"typescript-eslint": "^8.53.0",
|
|
@@ -332,7 +332,6 @@ export async function checkVersionsAndWritePackageJson(
|
|
|
332
332
|
const packageJson = JSON.parse(
|
|
333
333
|
await fs.readFile(path.join(process.cwd(), "package.json"), "utf8"),
|
|
334
334
|
);
|
|
335
|
-
|
|
336
335
|
packageJson.dependencies ??= {};
|
|
337
336
|
packageJson.devDependencies ??= {};
|
|
338
337
|
if (targetVersions.library.includes("-SNAPSHOT")) {
|
|
@@ -76,20 +76,6 @@ export async function getSocketFileForPid(pid: string): Promise<string | null> {
|
|
|
76
76
|
return existsSync(socketPath) ? socketPath : null;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
// Find any available socket file
|
|
80
|
-
export async function findAnySocketFile(): Promise<string | null> {
|
|
81
|
-
const socketFiles = await getAllSocketFiles();
|
|
82
|
-
|
|
83
|
-
// Return the first existing socket file
|
|
84
|
-
for (const socketInfo of socketFiles) {
|
|
85
|
-
if (existsSync(socketInfo.fullPath)) {
|
|
86
|
-
return socketInfo.fullPath;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
79
|
// Clean up a specific socket file
|
|
94
80
|
export async function cleanupSocketFile(socketPath: string): Promise<boolean> {
|
|
95
81
|
try {
|
package/src/client.ts
CHANGED
|
@@ -58,7 +58,7 @@ const SUPERBLOCKS_MAX_FILE_SIZE_MB = 30;
|
|
|
58
58
|
const CLI_VERSION_HEADER = "x-superblocks-cli-version";
|
|
59
59
|
const SUPERBLOCKS_URL_HEADER = "x-superblocks-url";
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
interface UploadFile {
|
|
62
62
|
name: string;
|
|
63
63
|
filename: string;
|
|
64
64
|
ContentType: string;
|
|
@@ -105,18 +105,18 @@ export type PushApiWithCommitConfig = {
|
|
|
105
105
|
skipCommit: boolean;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
type Branches = {
|
|
109
109
|
branches: Branch[];
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
type Branch = {
|
|
113
113
|
name: string;
|
|
114
114
|
isDefault: boolean;
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
type ResponseWithMeta<T> = { responseMeta: unknown; data: T };
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
interface CommitDto {
|
|
120
120
|
commitMessage: string;
|
|
121
121
|
committer: {
|
|
122
122
|
name?: string;
|
|
@@ -187,16 +187,6 @@ export class CurrentBranch {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
const DEFAULT_BRANCH_INFO = new CurrentBranch({
|
|
191
|
-
branchName: DEFAULT_BRANCH,
|
|
192
|
-
source: BranchSource.DEFAULT,
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
// TODO (randall): Remove this and the 'index.ts' export when it is no longer needed in the CLI.
|
|
196
|
-
export function getDefaultBranchInfo(): CurrentBranch {
|
|
197
|
-
return DEFAULT_BRANCH_INFO;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
190
|
/**
|
|
201
191
|
* Returns the current branch name, in the following order of precedence:
|
|
202
192
|
* 1. If a branch name is specified in the dev environment config, use that
|
|
@@ -969,7 +959,7 @@ export async function fetchCurrentUser(
|
|
|
969
959
|
}
|
|
970
960
|
}
|
|
971
961
|
|
|
972
|
-
|
|
962
|
+
const createSocketConnectionIfNeeded = async (
|
|
973
963
|
cliVersion: string,
|
|
974
964
|
token: string,
|
|
975
965
|
superblocksBaseUrl: string,
|
package/src/index.ts
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
1
|
export { buildApplication } from "./application-build.mjs";
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
-
createSocketConnectionIfNeeded,
|
|
5
|
-
fetchApi,
|
|
6
|
-
fetchApiCommits,
|
|
7
|
-
fetchApis,
|
|
8
|
-
fetchApplication,
|
|
9
|
-
fetchApplicationBranches,
|
|
10
|
-
fetchApplicationCommits,
|
|
11
|
-
fetchApplicationWithComponents,
|
|
12
|
-
fetchApplications,
|
|
13
|
-
fetchCurrentUser,
|
|
14
|
-
getDefaultBranchInfo,
|
|
15
4
|
getCurrentBranchInfo,
|
|
16
|
-
pushApi,
|
|
17
|
-
pushApplication,
|
|
18
|
-
pushApplicationCodeMode,
|
|
19
|
-
registerComponents,
|
|
20
|
-
uploadComponents,
|
|
21
|
-
validateGitSetup,
|
|
22
5
|
uploadApplication,
|
|
23
|
-
type ApplicationWrapper,
|
|
24
|
-
type Branch,
|
|
25
|
-
type Branches,
|
|
26
|
-
type BranchSource,
|
|
27
6
|
type CodeModeApplicationWrapper,
|
|
28
|
-
type CommitDto,
|
|
29
7
|
type CurrentBranch,
|
|
30
8
|
type GetCommitsResponseBody,
|
|
31
|
-
type MultiPageApplicationWrapper,
|
|
32
9
|
type MultiPageApplicationWrapperWithComponents,
|
|
33
|
-
type PushApiWithCommitConfig,
|
|
34
|
-
type PushMultiPageApplicationWithCommitConfig,
|
|
35
|
-
type UploadFile,
|
|
36
10
|
} from "./client.js";
|
|
37
11
|
|
|
38
|
-
export {
|
|
12
|
+
export { FeatureFlags } from "./flag.js";
|
|
39
13
|
|
|
40
14
|
export {
|
|
41
15
|
BranchNotCheckedOutError,
|
|
@@ -45,62 +19,21 @@ export {
|
|
|
45
19
|
} from "./sdk.js";
|
|
46
20
|
|
|
47
21
|
export {
|
|
48
|
-
AgentStatus,
|
|
49
|
-
AgentType,
|
|
50
|
-
OpenAiPluginId,
|
|
51
|
-
Profile,
|
|
52
|
-
ProfileType,
|
|
53
|
-
SocketErrorException,
|
|
54
|
-
transcribeAudioToTextTranslateToEnglishTruthyValues,
|
|
55
|
-
type Agent,
|
|
56
|
-
type AgentTags,
|
|
57
|
-
type ApiResource,
|
|
58
|
-
type ApiToSign,
|
|
59
|
-
type ApiToVerify,
|
|
60
|
-
type ApiWithPb,
|
|
61
|
-
type AppToSign,
|
|
62
|
-
type AppToVerify,
|
|
63
22
|
type ApplicationConfigWithTokenConfigAndUserInfo,
|
|
64
23
|
type ApplicationConfig,
|
|
65
|
-
type ApplicationSettingsHashes,
|
|
66
|
-
type ApplicationSignatureTree,
|
|
67
|
-
type ApplicationSignatureTreeSigned,
|
|
68
|
-
type FlagBootstrap,
|
|
69
|
-
type GenericMiddleware,
|
|
70
|
-
type GenericResource,
|
|
71
|
-
type ISocketClient,
|
|
72
|
-
type MethodHandler,
|
|
73
|
-
type MethodHandlers,
|
|
74
|
-
type MethodSchema,
|
|
75
|
-
type NonEmptyArray,
|
|
76
|
-
type Organization,
|
|
77
|
-
type Page,
|
|
78
|
-
type RemoteCommitDto,
|
|
79
|
-
type RequestContextBase,
|
|
80
|
-
type SignatureResponse,
|
|
81
|
-
type SocketTimeouts,
|
|
82
24
|
type TokenUpdateEvent,
|
|
83
25
|
type TokenConfig,
|
|
84
|
-
type User,
|
|
85
|
-
type UserMeDto,
|
|
86
|
-
type ViewMode,
|
|
87
26
|
} from "./types/index.js";
|
|
88
27
|
|
|
89
28
|
export {
|
|
90
29
|
DEFAULT_BRANCH,
|
|
91
|
-
DEPLOYED_MODE,
|
|
92
30
|
FileStructureType,
|
|
93
|
-
LATEST_EDITS_MODE,
|
|
94
31
|
DRAFT_MODE,
|
|
95
|
-
MOST_RECENT_COMMIT_MODE,
|
|
96
32
|
MULTI_SELECT_PROMPT_HELP,
|
|
97
33
|
SELECT_PROMPT_HELP,
|
|
98
|
-
addExistingFilePathsForApi,
|
|
99
34
|
atLeastOneSelection,
|
|
100
35
|
deleteResourcesAndUpdateRootConfig,
|
|
101
36
|
extractApiName,
|
|
102
|
-
getApiRepresentation,
|
|
103
|
-
getCurrentGitBranch,
|
|
104
37
|
getCurrentGitBranchIfGit,
|
|
105
38
|
getFileStructureType,
|
|
106
39
|
getHeadCommit,
|
|
@@ -108,7 +41,6 @@ export {
|
|
|
108
41
|
getMode,
|
|
109
42
|
isCI,
|
|
110
43
|
isGitRepoDirty,
|
|
111
|
-
modeFlagToViewMode,
|
|
112
44
|
modeFlagValuesMap,
|
|
113
45
|
readApiFromDisk,
|
|
114
46
|
readApplicationFromDisk,
|
|
@@ -116,10 +48,8 @@ export {
|
|
|
116
48
|
removeResourceFromDisk,
|
|
117
49
|
sortByKey,
|
|
118
50
|
validateLocalResource,
|
|
119
|
-
writeAppApi,
|
|
120
51
|
writeApplicationToDisk,
|
|
121
52
|
writeResourceToDisk,
|
|
122
|
-
type ApiRepresentation,
|
|
123
53
|
type ModeFlag,
|
|
124
54
|
} from "./version-control.mjs";
|
|
125
55
|
|
|
@@ -130,11 +60,7 @@ export { createDevServer } from "./dev-utils/dev-server.mjs";
|
|
|
130
60
|
|
|
131
61
|
export { TokenManager } from "./dev-utils/token-manager.js";
|
|
132
62
|
|
|
133
|
-
export {
|
|
134
|
-
tryDecodeJwtToken,
|
|
135
|
-
type TokenInfo,
|
|
136
|
-
type JwtPayload,
|
|
137
|
-
} from "./utils/token-utils.mjs";
|
|
63
|
+
export { tryDecodeJwtToken } from "./utils/token-utils.mjs";
|
|
138
64
|
|
|
139
65
|
export { fetchAndWriteApplication } from "./cli-replacement/init.js";
|
|
140
66
|
|
package/src/telemetry/logging.ts
CHANGED
|
@@ -17,27 +17,31 @@ if (process.env.SUPERBLOCKS_IS_CSB === "true") {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
),
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
// Only use console transport for local development (not in cloud sandbox)
|
|
21
|
+
if (process.env.SUPERBLOCKS_CLI_ENV === "local") {
|
|
22
|
+
activeTransports.push(
|
|
23
|
+
new transports.Console({
|
|
24
|
+
format: format.combine(
|
|
25
|
+
format.timestamp({
|
|
26
|
+
format: "HH:mm:ss.SSS",
|
|
27
|
+
}),
|
|
28
|
+
format.printf((props) => {
|
|
29
|
+
const { message, timestamp, error, level } = props;
|
|
30
|
+
const base = `${timestamp} (${process.pid}) ${message}`;
|
|
31
|
+
if (level === "error" && error !== undefined) {
|
|
32
|
+
return `${base} ${(error as ErrorMeta["error"]).message} ${(error as ErrorMeta["error"]).stack}`;
|
|
33
|
+
}
|
|
34
|
+
return base;
|
|
35
|
+
}),
|
|
36
|
+
format.colorize(),
|
|
37
|
+
),
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (activeTransports.length === 0) {
|
|
43
|
+
console.warn("No transports configured for logging");
|
|
44
|
+
}
|
|
41
45
|
|
|
42
46
|
const winstonLogger = createLogger({
|
|
43
47
|
level: "debug",
|
package/src/types/common.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface TokenConfig {
|
|
|
24
24
|
token: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
interface UserInfo {
|
|
28
28
|
userId: string;
|
|
29
29
|
userEmail: string;
|
|
30
30
|
organizationId: string;
|
|
@@ -36,13 +36,12 @@ export interface ApplicationConfig {
|
|
|
36
36
|
branchName: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
extends UserInfo, ApplicationConfig {}
|
|
39
|
+
interface ApplicationConfigWithUserInfo extends UserInfo, ApplicationConfig {}
|
|
41
40
|
|
|
42
41
|
export interface ApplicationConfigWithTokenConfigAndUserInfo
|
|
43
42
|
extends ApplicationConfigWithUserInfo, TokenConfig {}
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
type User = {
|
|
46
45
|
id: string;
|
|
47
46
|
email: string;
|
|
48
47
|
currentOrganizationId: string;
|
|
@@ -56,9 +55,9 @@ export type User = {
|
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
/** Plugin execution versions map - plugin ID to version string */
|
|
59
|
-
|
|
58
|
+
type PluginExecutionVersions = Record<string, string>;
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
interface Organization {
|
|
62
61
|
id: string;
|
|
63
62
|
name: string;
|
|
64
63
|
displayName: string;
|
|
@@ -101,9 +100,9 @@ export enum AgentType {
|
|
|
101
100
|
ONPREMISE = 2,
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
|
|
103
|
+
type AgentTags = Record<string, string[]>;
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
class Profile {
|
|
107
106
|
id: string;
|
|
108
107
|
key: string;
|
|
109
108
|
displayName: string;
|
|
@@ -131,7 +130,7 @@ export class Profile {
|
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
|
|
133
|
+
enum ProfileType {
|
|
135
134
|
RESERVED = "RESERVED",
|
|
136
135
|
CUSTOM = "CUSTOM",
|
|
137
136
|
}
|
|
@@ -173,12 +172,6 @@ export interface DeploymentDto {
|
|
|
173
172
|
deploymentTime: number;
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
export type ViewMode =
|
|
177
|
-
| "export-deployed"
|
|
178
|
-
| "export-latest"
|
|
179
|
-
| "export-live"
|
|
180
|
-
| "export-commit";
|
|
181
|
-
|
|
182
175
|
export interface TokenUpdateEvent {
|
|
183
176
|
token: string;
|
|
184
177
|
}
|
package/src/types/signing.ts
CHANGED
|
@@ -15,33 +15,6 @@ export type GenericResource = {
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
interface PageHash {
|
|
19
|
-
/** The version of the page DSL. */
|
|
20
|
-
version: number;
|
|
21
|
-
/** The SHA-256 hash of the page DSL (i.e. `page.layouts[0].dsl`), in base64. */
|
|
22
|
-
hash: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface ApplicationSettingsHashes {
|
|
26
|
-
/** The SHA-256 hash of all custom components related properties from settings, in base64. */
|
|
27
|
-
components: string;
|
|
28
|
-
/** The SHA-256 hash of settings without the custom components related properties, in base64. */
|
|
29
|
-
rest: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ApplicationSignatureTree {
|
|
33
|
-
/** The version of the signature tree. */
|
|
34
|
-
v: 1;
|
|
35
|
-
settings: ApplicationSettingsHashes;
|
|
36
|
-
page: PageHash;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface ApplicationSignatureTreeSigned {
|
|
40
|
-
/** The SHA-256 hash of `root`, in base64. */
|
|
41
|
-
signature: Signature;
|
|
42
|
-
root: ApplicationSignatureTree;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
18
|
export type AppToSign = {
|
|
46
19
|
rootHash: string;
|
|
47
20
|
};
|
|
@@ -50,12 +23,3 @@ export type AppToVerify = {
|
|
|
50
23
|
rootHash: string;
|
|
51
24
|
signature?: Signature;
|
|
52
25
|
};
|
|
53
|
-
|
|
54
|
-
export type ApiToSign = {
|
|
55
|
-
apiPb: ApiPb;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type ApiToVerify = {
|
|
59
|
-
apiPb: ApiPb;
|
|
60
|
-
signature?: Signature;
|
|
61
|
-
};
|
package/src/types/socket.ts
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
peerAuthorization?: string;
|
|
3
|
-
method: string;
|
|
4
|
-
requestId: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type MethodHandler<Params, Result, PeerMethods, RequestContext> = (
|
|
1
|
+
type MethodHandler<Params, Result, PeerMethods, RequestContext> = (
|
|
8
2
|
params: Params,
|
|
9
3
|
ctx: RequestContext,
|
|
10
4
|
peer: ISocketClient<PeerMethods>,
|
|
11
5
|
next: () => Promise<Result>,
|
|
12
6
|
) => Promise<Result>;
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type GenericMiddleware<PeerMethods, RequestContext> = MethodHandler<
|
|
17
|
-
any,
|
|
18
|
-
any,
|
|
19
|
-
PeerMethods,
|
|
20
|
-
RequestContext
|
|
21
|
-
>;
|
|
22
|
-
|
|
23
|
-
export type NonEmptyArray<T> = [...T[], T];
|
|
8
|
+
type NonEmptyArray<T> = [...T[], T];
|
|
24
9
|
|
|
25
10
|
export type MethodHandlers<Methods, PeerMethods, RequestContext> = {
|
|
26
11
|
[Key in keyof Methods]: Methods[Key] extends (
|
|
@@ -46,24 +31,3 @@ export type ISocketClient<Methods> = {
|
|
|
46
31
|
close: () => void;
|
|
47
32
|
call: ISocketClientMethodCall<Methods>;
|
|
48
33
|
};
|
|
49
|
-
|
|
50
|
-
export type MethodSchema<Params, Response> = (
|
|
51
|
-
params: Params,
|
|
52
|
-
) => Promise<Response>;
|
|
53
|
-
|
|
54
|
-
/** The exception type can be thrown to cause the default error handler to write a raw error response to the socket */
|
|
55
|
-
export class SocketErrorException extends Error {
|
|
56
|
-
readonly code: number;
|
|
57
|
-
readonly message: string;
|
|
58
|
-
|
|
59
|
-
constructor(code: number, message: string) {
|
|
60
|
-
super(message);
|
|
61
|
-
this.code = code;
|
|
62
|
-
this.message = message;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type SocketTimeouts = {
|
|
67
|
-
noResponseTimeoutInSeconds?: number;
|
|
68
|
-
connectionTimeoutInSeconds?: number;
|
|
69
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jwtDecode } from "jwt-decode";
|
|
2
2
|
|
|
3
3
|
// JWT payload interface for token decoding
|
|
4
|
-
|
|
4
|
+
interface JwtPayload {
|
|
5
5
|
user_email: string;
|
|
6
6
|
scope: string;
|
|
7
7
|
exp?: number;
|
|
@@ -23,7 +23,7 @@ interface TokenInfoFailure {
|
|
|
23
23
|
isJwt: false;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
type TokenInfo = TokenInfoSuccess | TokenInfoFailure;
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Utility function to decode and identify JWT tokens vs API keys
|
package/src/utils.ts
CHANGED
package/src/version-control.mts
CHANGED
|
@@ -46,10 +46,10 @@ import type {
|
|
|
46
46
|
} from "@superblocksteam/util";
|
|
47
47
|
import type { SimpleGit, StatusResult } from "simple-git";
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
const LATEST_EDITS_MODE = "latest-edits";
|
|
50
50
|
export const DRAFT_MODE = "draft";
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const MOST_RECENT_COMMIT_MODE = "most-recent-commit";
|
|
52
|
+
const DEPLOYED_MODE = "deployed";
|
|
53
53
|
|
|
54
54
|
export const DEFAULT_BRANCH = "main";
|
|
55
55
|
|
|
@@ -65,7 +65,7 @@ export enum FileStructureType {
|
|
|
65
65
|
MULTI_PAGE = "multi-page",
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
function modeFlagToViewMode(modeFlag: ModeFlag): ExportViewMode {
|
|
69
69
|
switch (modeFlag) {
|
|
70
70
|
case LATEST_EDITS_MODE:
|
|
71
71
|
return ExportViewMode.EXPORT_LIVE;
|
|
@@ -104,7 +104,7 @@ const SPLIT_LARGE_API_STEPS_VERSION = "0.2.0";
|
|
|
104
104
|
const LATEST_FILE_VERSION = SPLIT_LARGE_API_STEPS_VERSION;
|
|
105
105
|
const logger = getLogger();
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
function getApiRepresentation(
|
|
108
108
|
featureFlags: FeatureFlags,
|
|
109
109
|
resourceConfig: SuperblocksResourceConfig,
|
|
110
110
|
): ApiRepresentation {
|
|
@@ -13,9 +13,6 @@ import { getLogger } from "./telemetry/logging.js";
|
|
|
13
13
|
import type { DeleteMeLibraryApi } from "@superblocksteam/library-shared/types";
|
|
14
14
|
import type { Plugin } from "vite";
|
|
15
15
|
|
|
16
|
-
export const scopeFileBaseName = "scope.ts";
|
|
17
|
-
export const apiFileBaseName = "api.yaml";
|
|
18
|
-
|
|
19
16
|
type ApiDependency = {
|
|
20
17
|
apiName: string;
|
|
21
18
|
scopeId: string;
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"importHelpers": true,
|
|
4
3
|
"module": "NodeNext",
|
|
5
4
|
"outDir": "dist",
|
|
6
5
|
"rootDir": "./src",
|
|
7
6
|
"strict": true,
|
|
8
7
|
"target": "es2024",
|
|
9
8
|
"lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Promise"],
|
|
10
|
-
|
|
11
9
|
"sourceMap": true,
|
|
12
10
|
"declaration": true,
|
|
13
11
|
"declarationMap": true,
|
|
@@ -15,8 +13,8 @@
|
|
|
15
13
|
"skipLibCheck": true,
|
|
16
14
|
"incremental": true,
|
|
17
15
|
"resolveJsonModule": true,
|
|
18
|
-
"isolatedModules": true
|
|
16
|
+
"isolatedModules": true,
|
|
19
17
|
},
|
|
20
18
|
"include": ["src/**/*.ts", "src/**/*.mts"],
|
|
21
|
-
"exclude": ["node_modules", "dist"]
|
|
19
|
+
"exclude": ["node_modules", "dist"],
|
|
22
20
|
}
|