zephyr-edge-contract 0.0.2 → 0.0.3

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 (68) hide show
  1. package/.eslintrc.json +25 -0
  2. package/README.md +5 -0
  3. package/jest.config.ts +11 -0
  4. package/package.json +1 -1
  5. package/project.json +34 -0
  6. package/src/index.ts +36 -0
  7. package/src/lib/api-contract-negotiation/get-api-contract.ts +9 -0
  8. package/src/lib/edge-api/ze-envs-request.ts +18 -0
  9. package/src/lib/node-persist/application-configuration.ts +34 -0
  10. package/src/lib/node-persist/storage-keys.ts +6 -0
  11. package/src/lib/node-persist/token.ts +28 -0
  12. package/src/lib/snapshot.ts +44 -0
  13. package/src/lib/utils/create-full-app-name.ts +15 -0
  14. package/src/lib/utils/create-snapshot-id.ts +9 -0
  15. package/src/lib/utils/get-application-configuration.ts +65 -0
  16. package/src/lib/utils/login.ts +125 -0
  17. package/src/lib/utils/websocket.ts +21 -0
  18. package/src/lib/ze-api/app-list.ts +6 -0
  19. package/src/lib/ze-api/app-version.ts +25 -0
  20. package/src/lib/zephyr-edge-contract.ts +37 -0
  21. package/tsconfig.json +22 -0
  22. package/tsconfig.lib.json +10 -0
  23. package/tsconfig.spec.json +14 -0
  24. package/src/index.d.ts +0 -12
  25. package/src/index.js +0 -28
  26. package/src/index.js.map +0 -1
  27. package/src/lib/api-contract-negotiation/get-api-contract.d.ts +0 -7
  28. package/src/lib/api-contract-negotiation/get-api-contract.js +0 -12
  29. package/src/lib/api-contract-negotiation/get-api-contract.js.map +0 -1
  30. package/src/lib/edge-api/ze-envs-request.d.ts +0 -10
  31. package/src/lib/edge-api/ze-envs-request.js +0 -3
  32. package/src/lib/edge-api/ze-envs-request.js.map +0 -1
  33. package/src/lib/node-persist/application-configuration.d.ts +0 -14
  34. package/src/lib/node-persist/application-configuration.js +0 -33
  35. package/src/lib/node-persist/application-configuration.js.map +0 -1
  36. package/src/lib/node-persist/storage-keys.d.ts +0 -5
  37. package/src/lib/node-persist/storage-keys.js +0 -5
  38. package/src/lib/node-persist/storage-keys.js.map +0 -1
  39. package/src/lib/node-persist/token.d.ts +0 -3
  40. package/src/lib/node-persist/token.js +0 -33
  41. package/src/lib/node-persist/token.js.map +0 -1
  42. package/src/lib/snapshot.d.ts +0 -37
  43. package/src/lib/snapshot.js +0 -3
  44. package/src/lib/snapshot.js.map +0 -1
  45. package/src/lib/utils/create-full-app-name.d.ts +0 -5
  46. package/src/lib/utils/create-full-app-name.js +0 -15
  47. package/src/lib/utils/create-full-app-name.js.map +0 -1
  48. package/src/lib/utils/create-snapshot-id.d.ts +0 -11
  49. package/src/lib/utils/create-snapshot-id.js +0 -10
  50. package/src/lib/utils/create-snapshot-id.js.map +0 -1
  51. package/src/lib/utils/get-application-configuration.d.ts +0 -6
  52. package/src/lib/utils/get-application-configuration.js +0 -44
  53. package/src/lib/utils/get-application-configuration.js.map +0 -1
  54. package/src/lib/utils/login.d.ts +0 -23
  55. package/src/lib/utils/login.js +0 -106
  56. package/src/lib/utils/login.js.map +0 -1
  57. package/src/lib/utils/websocket.d.ts +0 -13
  58. package/src/lib/utils/websocket.js +0 -14
  59. package/src/lib/utils/websocket.js.map +0 -1
  60. package/src/lib/ze-api/app-list.d.ts +0 -9
  61. package/src/lib/ze-api/app-list.js +0 -3
  62. package/src/lib/ze-api/app-list.js.map +0 -1
  63. package/src/lib/ze-api/app-version.d.ts +0 -15
  64. package/src/lib/ze-api/app-version.js +0 -3
  65. package/src/lib/ze-api/app-version.js.map +0 -1
  66. package/src/lib/zephyr-edge-contract.d.ts +0 -32
  67. package/src/lib/zephyr-edge-contract.js +0 -3
  68. package/src/lib/zephyr-edge-contract.js.map +0 -1
package/.eslintrc.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": ["../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.json"],
19
+ "parser": "jsonc-eslint-parser",
20
+ "rules": {
21
+ "@nx/dependency-checks": "error"
22
+ }
23
+ }
24
+ ]
25
+ }
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # zephyr-edge-contract
2
+
3
+ check [zephyr-webpack-plugin](https://www.npmjs.com/package/zephyr-webpack-plugin) for docs
4
+
5
+ this is a set API types and reusable functions for zephyr build plugins
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'zephyr-edge-contract',
4
+ preset: '../../jest.preset.js',
5
+ testEnvironment: 'node',
6
+ transform: {
7
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
8
+ },
9
+ moduleFileExtensions: ['ts', 'js', 'html'],
10
+ coverageDirectory: '../../coverage/libs/zephyr-edge-contract',
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-edge-contract",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "license": "Apache-2.0",
5
5
  "dependencies": {
6
6
  "jose": "^5.2.4",
package/project.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "zephyr-edge-contract",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "libs/zephyr-edge-contract/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/js:tsc",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/libs/zephyr-edge-contract",
12
+ "main": "libs/zephyr-edge-contract/src/index.ts",
13
+ "tsConfig": "libs/zephyr-edge-contract/tsconfig.lib.json",
14
+ "assets": ["libs/zephyr-edge-contract/*.md"]
15
+ }
16
+ },
17
+ "publish": {
18
+ "command": "node tools/scripts/publish.mjs zephyr-edge-contract {args.ver} {args.tag}",
19
+ "dependsOn": ["build"]
20
+ },
21
+ "lint": {
22
+ "executor": "@nx/eslint:lint",
23
+ "outputs": ["{options.outputFile}"]
24
+ },
25
+ "test": {
26
+ "executor": "@nx/jest:jest",
27
+ "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
28
+ "options": {
29
+ "jestConfig": "libs/zephyr-edge-contract/jest.config.ts"
30
+ }
31
+ }
32
+ },
33
+ "tags": []
34
+ }
package/src/index.ts ADDED
@@ -0,0 +1,36 @@
1
+ export { createFullAppName } from './lib/utils/create-full-app-name';
2
+ export { createSnapshotId } from './lib/utils/create-snapshot-id';
3
+ export { ZeAppVersion, ZeAppVersionResponse } from './lib/ze-api/app-version';
4
+
5
+ export { ZeApplicationList } from './lib/ze-api/app-list';
6
+
7
+ export { Snapshot, SnapshotAsset } from './lib/snapshot';
8
+ export { ZeEnvs, ZeUploadBuildStats } from './lib/edge-api/ze-envs-request';
9
+ export * from './lib/zephyr-edge-contract';
10
+
11
+ export {
12
+ type GetPersonalAccessTokenFromWebsocketOptions,
13
+ type AuthOptions,
14
+ getPersonalAccessTokenFromWebsocket,
15
+ getAuthenticationURL,
16
+ checkAuth,
17
+ isTokenStillValid,
18
+ } from './lib/utils/login';
19
+ export {
20
+ saveToken,
21
+ getToken,
22
+ removeToken,
23
+ cleanTokens,
24
+ } from './lib/node-persist/token';
25
+ export {
26
+ ZEPHYR_API_ENDPOINT,
27
+ v2_api_paths,
28
+ } from './lib/api-contract-negotiation/get-api-contract';
29
+
30
+ export { getApplicationConfiguration } from './lib/utils/get-application-configuration';
31
+ export {
32
+ ZeApplicationConfig,
33
+ getAppConfig,
34
+ remoteAppConfig,
35
+ saveAppConfig,
36
+ } from './lib/node-persist/application-configuration';
@@ -0,0 +1,9 @@
1
+ export const ZEPHYR_API_ENDPOINT =
2
+ process.env['ZE_API'] ?? 'https://api.zephyr-cloud.io';
3
+
4
+ export const v2_api_paths = {
5
+ dashboard_path: '/v2/builder-packages-api/upload-from-dashboard-plugin',
6
+ resolve_dependency_path: '/v2/builder-public-api/resolve',
7
+ authorize_link: '/v2/authorize-link',
8
+ application_configuration: '/v2/builder-packages-api/application-config',
9
+ };
@@ -0,0 +1,18 @@
1
+ export interface ZeUploadBuildStats {
2
+ app_version: {
3
+ application_uid: string;
4
+ // version.app.repo.org - response from post-upload-snapshot
5
+ snapshot_id: string;
6
+ };
7
+
8
+ // this is a key for wildcard serving of snapshot, it could be:
9
+ // default url is `version.app.repo.org
10
+ // tag: t_tag_name.app.repo.org - optional
11
+ // env: e_env_name.app.repo.org - optional
12
+ // cname: cname_value - optional
13
+ urls: string[];
14
+ url_ids: string[];
15
+ jwt: string;
16
+ }
17
+
18
+ export type ZeEnvs = ZeUploadBuildStats;
@@ -0,0 +1,34 @@
1
+ import { getItem, init, setItem, removeItem } from 'node-persist';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { StorageKeys, ZE_PATH } from './storage-keys';
5
+
6
+ export interface ZeApplicationConfig {
7
+ user_uuid: string;
8
+ username: string;
9
+ email: string;
10
+ AUTH0_CLIENT_ID: string;
11
+ AUTH0_DOMAIN: string;
12
+ BUILD_ID_ENDPOINT: string;
13
+ EDGE_URL: string;
14
+ jwt: string;
15
+ }
16
+
17
+ const storage = init({
18
+ dir: join(homedir(), ZE_PATH),
19
+ });
20
+
21
+ export async function saveAppConfig(json: ZeApplicationConfig): Promise<void> {
22
+ await storage;
23
+ void (await setItem(StorageKeys.ze_app_config_token, json));
24
+ }
25
+
26
+ export async function getAppConfig(): Promise<ZeApplicationConfig | undefined> {
27
+ await storage;
28
+ return getItem(StorageKeys.ze_app_config_token);
29
+ }
30
+
31
+ export async function remoteAppConfig(): Promise<void> {
32
+ await storage;
33
+ await removeItem(StorageKeys.ze_app_config_token);
34
+ }
@@ -0,0 +1,6 @@
1
+ export const ZE_PATH = `.zephyr`;
2
+
3
+ export const enum StorageKeys {
4
+ ze_app_config_token = 'ze-application-configuration',
5
+ zetoken = 'ze-token',
6
+ }
@@ -0,0 +1,28 @@
1
+ import { getItem, init, setItem, removeItem, clear } from 'node-persist';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { StorageKeys, ZE_PATH } from './storage-keys';
5
+
6
+ const storage = init({
7
+ dir: join(homedir(), ZE_PATH),
8
+ });
9
+
10
+ export async function saveToken(token: string): Promise<void> {
11
+ await storage;
12
+ void (await setItem(StorageKeys.zetoken, token));
13
+ }
14
+
15
+ export async function getToken(): Promise<string | undefined> {
16
+ await storage;
17
+ return getItem(StorageKeys.zetoken);
18
+ }
19
+
20
+ export async function removeToken(): Promise<void> {
21
+ await storage;
22
+ await removeItem(StorageKeys.zetoken);
23
+ }
24
+
25
+ export async function cleanTokens(): Promise<void> {
26
+ await storage;
27
+ await clear();
28
+ }
@@ -0,0 +1,44 @@
1
+ export interface Snapshot {
2
+ // app.repo.org
3
+ application_uid: string;
4
+ // package.json version + descriptor `.(user-(ci|ui?)-user_build_counter)`
5
+ version: string;
6
+ // version.app.repo.org
7
+ snapshot_id: string;
8
+ // default domain url
9
+ domain: string;
10
+ uid: {
11
+ build: string;
12
+ app_name: string;
13
+ repo: string;
14
+ org: string;
15
+ };
16
+ git: {
17
+ name: string;
18
+ email: string;
19
+ branch: string;
20
+ commit: string;
21
+ };
22
+ // zephyr user
23
+ creator: {
24
+ name: string;
25
+ email: string;
26
+ };
27
+ createdAt: number;
28
+ mfConfig?: {
29
+ name: string;
30
+ filename: string;
31
+ exposes?: Record<string, string>
32
+ remotes?: Record<string, string>;
33
+ shared?: Record<string, unknown>
34
+ };
35
+ // list of files, where key is file path
36
+ assets: Record<string, SnapshotAsset>;
37
+ }
38
+
39
+ export interface SnapshotAsset {
40
+ path: string;
41
+ extname: string;
42
+ hash: string;
43
+ size: number;
44
+ }
@@ -0,0 +1,15 @@
1
+ function replacer(str: string): string {
2
+ return str.replace(/[^a-zA-Z0-9-_]/gi, '_');
3
+ // return str.replace(/\W/gi, '_');
4
+ }
5
+
6
+ export function createFullAppName(options: {
7
+ org: string;
8
+ project: string;
9
+ name: string;
10
+ }): string {
11
+ const git_org = replacer(options.org);
12
+ const git_repo = replacer(options.project);
13
+ const app_name = replacer(options.name);
14
+ return [app_name, git_repo, git_org].join('.');
15
+ }
@@ -0,0 +1,9 @@
1
+ import { createFullAppName } from './create-full-app-name';
2
+
3
+ export function createSnapshotId(options: {
4
+ app: { org: string; project: string; name: string };
5
+ zeConfig: { user: string; buildId: string | undefined };
6
+ }): string {
7
+ const build_id = [options.zeConfig.user, options.zeConfig.buildId].join('_');
8
+ return [build_id, createFullAppName(options.app)].join('.');
9
+ }
@@ -0,0 +1,65 @@
1
+ import * as jose from 'jose';
2
+ import { cleanTokens, getToken } from '../node-persist/token';
3
+ import {
4
+ v2_api_paths,
5
+ ZEPHYR_API_ENDPOINT,
6
+ } from '../api-contract-negotiation/get-api-contract';
7
+ import {
8
+ getAppConfig,
9
+ saveAppConfig,
10
+ ZeApplicationConfig,
11
+ } from '../node-persist/application-configuration';
12
+ import { isTokenStillValid } from './login';
13
+
14
+ interface GetApplicationConfigurationProps {
15
+ application_uid: string | undefined;
16
+ }
17
+
18
+ async function loadApplicationConfiguration({
19
+ application_uid,
20
+ }: GetApplicationConfigurationProps): Promise<ZeApplicationConfig> {
21
+ if (!application_uid) {
22
+ throw new Error(`[zephyr] Critical error: application_uid is missing`);
23
+ }
24
+ const token = await getToken();
25
+ const application_config_url = new URL(
26
+ v2_api_paths.application_configuration,
27
+ ZEPHYR_API_ENDPOINT
28
+ );
29
+ application_config_url.searchParams.append(
30
+ 'application-uid',
31
+ application_uid
32
+ );
33
+
34
+ const req = fetch(application_config_url, {
35
+ headers: { Authorization: 'Bearer ' + token },
36
+ });
37
+ req.catch((v) => console.error(v));
38
+ const response = await req;
39
+ if (!response.ok && response.status !== 200) {
40
+ await cleanTokens();
41
+ const err = new Error('[zephyr]: auth error, please try to build again');
42
+ err.stack = void 0;
43
+ throw err;
44
+ }
45
+
46
+ const result = await response.json();
47
+ return Object.assign({}, result.value, {
48
+ jwt_decode: jose.decodeJwt(result.value.jwt),
49
+ });
50
+ }
51
+
52
+ export async function getApplicationConfiguration({
53
+ application_uid,
54
+ }: GetApplicationConfigurationProps): Promise<ZeApplicationConfig> {
55
+ const storedAppConfig = await getAppConfig();
56
+ if (storedAppConfig && isTokenStillValid(storedAppConfig.jwt)) {
57
+ return storedAppConfig;
58
+ }
59
+
60
+ const loadedAppConfig = await loadApplicationConfiguration({
61
+ application_uid,
62
+ });
63
+ await saveAppConfig(loadedAppConfig);
64
+ return loadedAppConfig;
65
+ }
@@ -0,0 +1,125 @@
1
+ import * as open from 'open';
2
+ import * as jose from 'jose';
3
+ import { v4 as uuidv4 } from 'uuid';
4
+
5
+ import { createSocket, disposeSocket } from './websocket';
6
+ import { removeToken, getToken, saveToken } from '../node-persist/token';
7
+ import {
8
+ v2_api_paths,
9
+ ZEPHYR_API_ENDPOINT,
10
+ } from '../api-contract-negotiation/get-api-contract';
11
+
12
+ export function generateSessionKey(): string {
13
+ return uuidv4().replace(/-/g, '');
14
+ }
15
+
16
+ export interface GetPersonalAccessTokenFromWebsocketOptions {
17
+ openBrowser?: boolean;
18
+ }
19
+
20
+ export async function getPersonalAccessTokenFromWebsocket(
21
+ { openBrowser }: GetPersonalAccessTokenFromWebsocketOptions = {
22
+ openBrowser: true,
23
+ },
24
+ ): Promise<string> {
25
+ const sessionKey = generateSessionKey();
26
+ if (openBrowser) {
27
+ const authUrl = await getAuthenticationURL({ state: sessionKey });
28
+ await open(authUrl);
29
+ }
30
+ return await subscribeToWsEvents(sessionKey);
31
+ }
32
+
33
+ export interface AuthOptions {
34
+ state: string;
35
+ responseType?: string;
36
+ scope?: string;
37
+ }
38
+
39
+ export async function getAuthenticationURL(
40
+ options: AuthOptions,
41
+ ): Promise<string> {
42
+ const { state } = options;
43
+ const loginUrl = new URL(v2_api_paths.authorize_link, ZEPHYR_API_ENDPOINT);
44
+ loginUrl.searchParams.append('state', state);
45
+
46
+ return fetch(loginUrl.href).then((res) => res.text());
47
+ }
48
+
49
+ /**
50
+ * Check if the user is already authenticated. If not, open a browser window to authenticate.
51
+ * Display a message to the console.
52
+ * @return The token as a string.
53
+ */
54
+ export async function checkAuth(): Promise<string> {
55
+ const token = await getToken();
56
+
57
+ if (token) {
58
+ // Check if the token has a valid expiration date.
59
+ if (isTokenStillValid(token)) {
60
+ console.log('[zephyr] You are already logged in');
61
+ return token;
62
+ }
63
+ await removeToken();
64
+ }
65
+
66
+ // No valid token found; initiate authentication.
67
+ const newToken = await authenticateUser();
68
+ console.log('[zephyr] You are logged in');
69
+
70
+ return newToken;
71
+ }
72
+
73
+ /**
74
+ * Decides whether the token is still valid based on its expiration time.
75
+ * @param token The token to check.
76
+ * @return boolean indicating if the token is still valid.
77
+ */
78
+ export function isTokenStillValid(token: string): boolean {
79
+ const decodedToken = jose.decodeJwt(token);
80
+
81
+ if (!decodedToken.exp) {
82
+ return false;
83
+ }
84
+
85
+ return new Date(decodedToken.exp * 1000) > new Date();
86
+ }
87
+
88
+ /**
89
+ * Initiates user authentication and handles token storage.
90
+ * @return The new token as a string.
91
+ */
92
+ async function authenticateUser(): Promise<string> {
93
+ const token = await getPersonalAccessTokenFromWebsocket();
94
+ await saveToken(token);
95
+ return token;
96
+ }
97
+
98
+ function subscribeToWsEvents(sessionKey: string): Promise<string> {
99
+ return new Promise<string>((resolve, reject) => {
100
+ const socket = createSocket(ZEPHYR_API_ENDPOINT);
101
+
102
+ const cleanup = () => disposeSocket(socket);
103
+
104
+ socket.on('connect', () => {
105
+ // console.debug('WS Connected');
106
+ });
107
+
108
+ socket.on('disconnect', () => cleanup());
109
+
110
+ const roomSocket = socket.emit('joinAccessTokenRoom', {
111
+ state: sessionKey,
112
+ });
113
+
114
+ roomSocket.on('access-token', (token) => {
115
+ cleanup();
116
+ resolve(token);
117
+ });
118
+
119
+ roomSocket.on('access-token-error', (msg) => {
120
+ console.error('ERROR:', msg);
121
+ cleanup();
122
+ reject(new Error(msg));
123
+ });
124
+ });
125
+ }
@@ -0,0 +1,21 @@
1
+ import { io as socketio, Socket } from 'socket.io-client';
2
+
3
+ interface ClientToServerEvents {
4
+ joinAccessTokenRoom: (props: { state: string }) => void;
5
+ }
6
+
7
+ interface ServerToClientEvents {
8
+ 'access-token': (token: string) => void;
9
+ 'access-token-error': (msg: string) => void;
10
+ }
11
+
12
+ export function createSocket(
13
+ endpoint: string,
14
+ ): Socket<ServerToClientEvents, ClientToServerEvents> {
15
+ return socketio(endpoint);
16
+ }
17
+
18
+ export function disposeSocket(socket: Socket): void {
19
+ socket.disconnect();
20
+ socket.close();
21
+ }
@@ -0,0 +1,6 @@
1
+ export interface ZeApplicationList {
2
+ list: { name: string; url: string }[];
3
+ origin: string;
4
+ domain: string;
5
+ cursor: string;
6
+ }
@@ -0,0 +1,25 @@
1
+ export interface ZeAppVersion {
2
+ application_uid: string;
3
+ snapshot_id: string;
4
+ // npm-like version
5
+ version: string;
6
+
7
+ remote_entry_url: string;
8
+ remote_host: string;
9
+
10
+ // application name
11
+ name: string;
12
+ // tag name
13
+ tag?: string;
14
+ // env name
15
+ env?: string;
16
+
17
+ createdAt: string;
18
+ author: string;
19
+ }
20
+
21
+ // api: app_version response type
22
+ export interface ZeAppVersionResponse extends ZeAppVersion {
23
+ // remote versions resolved at build time (versions) or read time (tags, envs)
24
+ remotes?: ZeAppVersion[];
25
+ }
@@ -0,0 +1,37 @@
1
+ import { Asset } from 'webpack';
2
+
3
+ export type Source = Asset['source'];
4
+
5
+ export interface UploadableAsset {
6
+ path: string;
7
+ extname: string;
8
+ hash: string;
9
+ size: number;
10
+ buffer: Buffer | string;
11
+ }
12
+
13
+ export interface ZeUploadAssetsOptions {
14
+ missingAssets: SnapshotUploadRes | undefined;
15
+ count: number;
16
+ assetsMap: {
17
+ [key: string]: ZeBuildAsset;
18
+ };
19
+ }
20
+
21
+ export interface ZeBuildAsset {
22
+ path: string;
23
+ extname: string;
24
+ hash: string;
25
+ size: number;
26
+ buffer: Buffer | string;
27
+ }
28
+
29
+ export interface ZeBuildAssetsMap {
30
+ [key: string]: ZeBuildAsset;
31
+ }
32
+
33
+ export interface SnapshotUploadRes {
34
+ id: string;
35
+ assets: ZeBuildAsset[];
36
+ message: string;
37
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true
11
+ },
12
+ "files": [],
13
+ "include": [],
14
+ "references": [
15
+ {
16
+ "path": "./tsconfig.lib.json"
17
+ },
18
+ {
19
+ "path": "./tsconfig.spec.json"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"]
7
+ },
8
+ "include": ["src/**/*.ts"],
9
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "jest.config.ts",
10
+ "src/**/*.test.ts",
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }
package/src/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export { createFullAppName } from './lib/utils/create-full-app-name';
2
- export { createSnapshotId } from './lib/utils/create-snapshot-id';
3
- export { ZeAppVersion, ZeAppVersionResponse } from './lib/ze-api/app-version';
4
- export { ZeApplicationList } from './lib/ze-api/app-list';
5
- export { Snapshot, SnapshotAsset } from './lib/snapshot';
6
- export { ZeEnvs, ZeUploadBuildStats } from './lib/edge-api/ze-envs-request';
7
- export * from './lib/zephyr-edge-contract';
8
- export { type GetPersonalAccessTokenFromWebsocketOptions, type AuthOptions, getPersonalAccessTokenFromWebsocket, getAuthenticationURL, checkAuth, isTokenStillValid, } from './lib/utils/login';
9
- export { saveToken, getToken, removeToken } from './lib/node-persist/token';
10
- export { ZEPHYR_API_ENDPOINT, v2_api_paths, } from './lib/api-contract-negotiation/get-api-contract';
11
- export { getApplicationConfiguration } from './lib/utils/get-application-configuration';
12
- export { ZeApplicationConfig, getAppConfig, remoteAppConfig, saveAppConfig, } from './lib/node-persist/application-configuration';