@datalayer/core 0.0.20 → 0.0.21
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/lib/api/iam/datasources.d.ts +86 -0
- package/lib/api/iam/datasources.js +185 -0
- package/lib/api/iam/index.d.ts +2 -0
- package/lib/api/iam/index.js +2 -0
- package/lib/api/iam/secrets.d.ts +85 -0
- package/lib/api/iam/secrets.js +196 -0
- package/lib/client/auth/storage.js +17 -62
- package/lib/client/base.d.ts +3 -0
- package/lib/client/base.js +2 -2
- package/lib/client/index.d.ts +82 -3
- package/lib/client/index.js +5 -1
- package/lib/client/mixins/IAMMixin.d.ts +62 -0
- package/lib/client/mixins/IAMMixin.js +116 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +1 -2
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +1 -1
- package/lib/collaboration/DatalayerCollaborationProvider.js +1 -1
- package/lib/hooks/useBackdrop.d.ts +2 -3
- package/lib/hooks/useBackdropJupyterLab.d.ts +2 -2
- package/lib/hooks/useCache.d.ts +3 -3
- package/lib/hooks/useScreenshot.d.ts +2 -3
- package/lib/hooks/useWindowSize.d.ts +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/models/Datasource.d.ts +170 -0
- package/lib/models/Datasource.js +140 -0
- package/lib/models/Runtime.d.ts +1 -1
- package/lib/models/RuntimeSnapshotDTO.d.ts +1 -1
- package/lib/models/RuntimeSnapshotDTO.js +1 -1
- package/lib/models/Secret.d.ts +159 -0
- package/lib/models/Secret.js +135 -0
- package/lib/models/SpaceDTO.d.ts +0 -11
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/LayoutState.d.ts +2 -2
- package/lib/state/substates/NbformatState.d.ts +1 -1
- package/lib/utils/File.d.ts +1 -1
- package/lib/utils/File.js +1 -1
- package/lib/utils/Notebook.d.ts +5 -3
- package/lib/utils/Notebook.js +5 -3
- package/package.json +7 -5
- package/patches/.gitkeep +1 -0
- package/patches/@datalayer+jupyter-lexical+1.0.7.patch +5491 -0
- package/patches/@datalayer+jupyter-react+2.0.1.patch +2674 -0
- package/scripts/apply-patches.sh +44 -0
- package/scripts/create-patches.sh +40 -0
- package/scripts/fix-esm-imports.cjs +124 -0
- package/scripts/sync-jupyter.sh +121 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
type BackdropContextType = {
|
|
3
|
+
export type BackdropContextType = {
|
|
4
4
|
closeBackdrop: () => void;
|
|
5
5
|
displayBackdrop: (nextBackdrop: any) => void;
|
|
6
6
|
};
|
|
@@ -10,7 +10,7 @@ export declare function useBackdrop(): BackdropContextType;
|
|
|
10
10
|
* The type for the Backdrop context provider.
|
|
11
11
|
*/
|
|
12
12
|
export declare const BackdropContextProvider: import("react").Provider<BackdropContextType>;
|
|
13
|
-
type IBackdropProviderProps = {
|
|
13
|
+
export type IBackdropProviderProps = {
|
|
14
14
|
children?: ReactNode;
|
|
15
15
|
zIndex?: number;
|
|
16
16
|
disableDarken?: boolean;
|
|
@@ -25,4 +25,3 @@ export declare namespace BackdropProvider {
|
|
|
25
25
|
backdropSurface: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export {};
|
|
@@ -4,9 +4,9 @@ type JupyterLabBackdropType = {
|
|
|
4
4
|
};
|
|
5
5
|
declare function JupyterLabBackdrop({ open, element }: JupyterLabBackdropType): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default JupyterLabBackdrop;
|
|
7
|
-
interface JupyterLabBackdropProps {
|
|
7
|
+
export interface JupyterLabBackdropProps {
|
|
8
8
|
}
|
|
9
|
-
type UseJupyterLabBackdropProps = {
|
|
9
|
+
export type UseJupyterLabBackdropProps = {
|
|
10
10
|
openBackdrop: (element: JSX.Element) => void;
|
|
11
11
|
closeBackdrop: () => void;
|
|
12
12
|
};
|
package/lib/hooks/useCache.d.ts
CHANGED
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
38
38
|
import { IAnyOrganization, IAnySpace, IAssignment, ICell, IContact, ICourse, IDataset, IDatasource, IDocument, IEnvironment, IExercise, IIAMToken, ILesson, INotebook, IOrganization, IPage, ISchool, ISecret, ITeam, IUser, IUserOnboarding, IUserSettings } from '../models';
|
|
39
|
-
type CacheProps = {
|
|
39
|
+
export type CacheProps = {
|
|
40
40
|
loginRoute?: string;
|
|
41
41
|
};
|
|
42
|
-
type ISearchOpts = {
|
|
42
|
+
export type ISearchOpts = {
|
|
43
43
|
q: string;
|
|
44
44
|
types: string[];
|
|
45
45
|
max: number;
|
|
@@ -665,7 +665,7 @@ export declare const useCache: ({ loginRoute }?: CacheProps) => {
|
|
|
665
665
|
useTokens: () => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
666
666
|
useCreateToken: () => import("@tanstack/react-query").UseMutationResult<any, Error, Omit<IIAMToken, "id" | "value">, unknown>;
|
|
667
667
|
useUpdateToken: () => import("@tanstack/react-query").UseMutationResult<any, Error, IIAMToken, unknown>;
|
|
668
|
-
useInvite: (token: string) => import("@tanstack/react-query").UseQueryResult<import("
|
|
668
|
+
useInvite: (token: string) => import("@tanstack/react-query").UseQueryResult<import("..").IInvite | undefined, Error>;
|
|
669
669
|
useInvitesByUser: (accountId: string) => import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
670
670
|
usePutInvite: () => import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
671
671
|
useRequestInvite: (options?: UseMutationOptions<unknown, Error, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
type ScreenshotContextType = {
|
|
2
|
+
export type ScreenshotContextType = {
|
|
3
3
|
closeScreenshot: () => void;
|
|
4
4
|
displayScreenshot: (nextScreenshot: any) => void;
|
|
5
5
|
};
|
|
@@ -9,11 +9,10 @@ export declare function useScreenshot(): ScreenshotContextType;
|
|
|
9
9
|
* The type for the Screenshot context provider.
|
|
10
10
|
*/
|
|
11
11
|
export declare const ScreenshotContextProvider: import("react").Provider<ScreenshotContextType>;
|
|
12
|
-
type IScreenshotProviderProps = {
|
|
12
|
+
export type IScreenshotProviderProps = {
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
zIndex?: number;
|
|
15
15
|
disableDarken?: boolean;
|
|
16
16
|
screenshotSurface?: (qfds: any) => JSX.Element;
|
|
17
17
|
};
|
|
18
18
|
export declare function ScreenshotProvider({ children, zIndex, disableDarken, screenshotSurface, }: IScreenshotProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export {};
|
|
@@ -6,7 +6,7 @@ export declare enum BreakpointSize {
|
|
|
6
6
|
XLARGE = "xlarge",
|
|
7
7
|
XXLARGE = "xxlarge"
|
|
8
8
|
}
|
|
9
|
-
type WindowSize = {
|
|
9
|
+
export type WindowSize = {
|
|
10
10
|
width?: number;
|
|
11
11
|
height?: number;
|
|
12
12
|
isXSmall?: boolean;
|
|
@@ -18,4 +18,3 @@ type WindowSize = {
|
|
|
18
18
|
currentBreakpointSize?: BreakpointSize;
|
|
19
19
|
};
|
|
20
20
|
export declare function useWindowSize(): WindowSize;
|
|
21
|
-
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export { API_BASE_PATHS } from './api/constants';
|
|
|
12
12
|
export * as runtimesApi from './api/runtimes';
|
|
13
13
|
export * as iamApi from './api/iam';
|
|
14
14
|
export * as spacerApi from './api/spacer';
|
|
15
|
-
export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, } from './client';
|
|
15
|
+
export { DatalayerClient, type DatalayerClientConfig, type SDKHandlers, User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Secret, Credits, Item, type RuntimeJSON, type EnvironmentJSON, type UserJSON, type RuntimeData, type EnvironmentData, type UserData, type SpaceData, type SpaceItem, type NotebookData, type LexicalData, type RuntimeSnapshotData, type CreditsInfo, type CreditReservation, type CreateRuntimeRequest, type CreateRuntimeResponse, type ListRuntimesResponse, type ListEnvironmentsResponse, type CreateRuntimeSnapshotRequest, type CreateRuntimeSnapshotResponse, type GetRuntimeSnapshotResponse, type ListRuntimeSnapshotsResponse, type CreateSpaceRequest, type CreateSpaceResponse, type SpacesForUserResponse, type CollaborationSessionResponse, type DeleteSpaceItemResponse, type GetSpaceItemResponse, type GetSpaceItemsResponse, type CreateNotebookRequest, type CreateNotebookResponse, type GetNotebookResponse, type UpdateNotebookRequest, type UpdateNotebookResponse, type CreateLexicalRequest, type CreateLexicalResponse, type GetLexicalResponse, type UpdateLexicalRequest, type UpdateLexicalResponse, type CreditsResponse, type CreateDatasourceResponse, type GetDatasourceResponse, type ListDatasourcesResponse, type UpdateDatasourceResponse, type CreateSecretRequest, type CreateSecretResponse, type GetSecretResponse, type ListSecretsResponse, type UpdateSecretRequest, type UpdateSecretResponse, type SpaceJSON, type NotebookJSON, type LexicalJSON, type RuntimeSnapshotJSON, HealthCheck, type HealthCheckJSON, type LoginRequest, type LoginResponse, type UserMeResponse, type MembershipsResponse, type WhoAmIResponse, type HealthzPingResponse, AuthenticationManager, type IUser, type IBaseUser, type ICell, type IDatasource, type IDatasourceVariant, type ICredits, type ICreditsReservation, type ISpaceItem, type ISurvey, type ISpace, type IBaseSpace, type IAnySpace, type ISpaceVariant, type IBaseTeam, type IAnyTeam, type IOrganization, type IAnyOrganization, type IBaseOrganization, type IRuntimeModel, type IRuntimePod, type IRuntimeType, type IRuntimeLocation, type IRuntimeCapabilities, type IRuntimeSnapshot, type IDatalayerEnvironment, type IResources, type ISnippet, type IRole, type IAssignment, type IContact, type ICourse, type IOrganizationMember, type IPage, type PageTagName, type PageTheme, type PageVariant, type ISecret, type ISecretVariant, type SecretData, type SecretJSON, type DatasourceData, type DatasourceJSON, type DatasourceType, type CreateDatasourceRequest, type UpdateDatasourceRequest, Datasource, type IIAMToken, type IIAMTokenVariant, type IDocument, type IBaseDocument, type IEnvironment, type IExercise, type ICode, type IHelp, type IInvite, type ILesson, type INotebook, type IBaseNotebook, type ISchool, type ITeam, type TeamMember, type IUserOnboarding, type IClient, type IOnboardingPosition, type IOnboardingTours, type ITour, type ITourStatus, type IUserSettings, type IDataset, type IUsage, type IItem, type IItemType, type Member, type Profile, type SpaceMember, type IContactEvent, type IContactIAMProvider, type IStudentItem, type Instructor, type IStudent, type IDean, type IUserEvent, type IIAMProviderLinked, type IContent, type AuthResult, type TokenValidationResult, type AuthOptions, type TokenStorage, type IRuntimeOptions, type IMultiServiceManager, type IRemoteServicesManager, type IEnvironmentsManager, type IRemoteRuntimesManager, type NavigationLinkProps, type IDatalayerCoreConfig, type IRuntimesConfiguration, type IIAMProviderName, } from './client';
|
|
16
16
|
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,8 @@ export {
|
|
|
23
23
|
// Export client and config types
|
|
24
24
|
DatalayerClient,
|
|
25
25
|
// Export domain models
|
|
26
|
-
User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Credits, Item,
|
|
26
|
+
User, Runtime, Environment, Snapshot, Space, Notebook, LexicalDTO, Secret, Credits, Item, HealthCheck,
|
|
27
|
+
// Export auth
|
|
28
|
+
AuthenticationManager, Datasource, } from './client';
|
|
27
29
|
// Export commonly used functions directly for convenience
|
|
28
30
|
export { getEnvironments, createRuntime, getRuntimes, deleteRuntime, snapshotRuntime, getRuntimeSnapshots, loadRuntimeSnapshot, } from './stateful/runtimes/actions';
|
|
@@ -9,3 +9,173 @@ export type IDatasource = {
|
|
|
9
9
|
outputBucket: string;
|
|
10
10
|
};
|
|
11
11
|
export default IDatasource;
|
|
12
|
+
import type { DatalayerClient } from '../client';
|
|
13
|
+
/**
|
|
14
|
+
* Datasource type matching UI and API.
|
|
15
|
+
*/
|
|
16
|
+
export type DatasourceType = 'Amazon Athena' | 'Google BigQuery' | 'Microsoft Sentinel' | 'Splunk';
|
|
17
|
+
/**
|
|
18
|
+
* Raw datasource data from API (snake_case with suffixes).
|
|
19
|
+
*/
|
|
20
|
+
export interface DatasourceData {
|
|
21
|
+
/** Unique identifier (ULID) */
|
|
22
|
+
uid: string;
|
|
23
|
+
/** Datasource type */
|
|
24
|
+
type_s: DatasourceType;
|
|
25
|
+
/** Datasource name */
|
|
26
|
+
name_s: string;
|
|
27
|
+
/** Datasource description */
|
|
28
|
+
description_t: string;
|
|
29
|
+
/** Datasource variant (athena, bigquery, mssentinel, splunk) */
|
|
30
|
+
variant_s?: string;
|
|
31
|
+
/** Optional: Database name (required for Amazon Athena) */
|
|
32
|
+
database_s?: string;
|
|
33
|
+
/** Optional: S3 output bucket (required for Amazon Athena) */
|
|
34
|
+
output_bucket_s?: string;
|
|
35
|
+
/** Creation timestamp */
|
|
36
|
+
created_at?: string;
|
|
37
|
+
/** Last update timestamp */
|
|
38
|
+
updated_at?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Public JSON interface for Datasource (camelCase).
|
|
42
|
+
*/
|
|
43
|
+
export interface DatasourceJSON {
|
|
44
|
+
/** Unique identifier */
|
|
45
|
+
uid: string;
|
|
46
|
+
/** Datasource type */
|
|
47
|
+
type: DatasourceType;
|
|
48
|
+
/** Datasource name */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Datasource description */
|
|
51
|
+
description: string;
|
|
52
|
+
/** Optional: Database name */
|
|
53
|
+
database?: string;
|
|
54
|
+
/** Optional: S3 output bucket */
|
|
55
|
+
outputBucket?: string;
|
|
56
|
+
/** Creation timestamp */
|
|
57
|
+
createdAt?: Date;
|
|
58
|
+
/** Last update timestamp */
|
|
59
|
+
updatedAt?: Date;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Request data for creating a new datasource.
|
|
63
|
+
*/
|
|
64
|
+
export interface CreateDatasourceRequest {
|
|
65
|
+
/** Datasource type */
|
|
66
|
+
type: DatasourceType;
|
|
67
|
+
/** Datasource name (unique identifier) */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Human-readable description */
|
|
70
|
+
description?: string;
|
|
71
|
+
/** Optional: Database name (required for Amazon Athena) */
|
|
72
|
+
database?: string;
|
|
73
|
+
/** Optional: S3 output bucket (required for Amazon Athena) */
|
|
74
|
+
output_bucket?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Request data for updating a datasource.
|
|
78
|
+
*/
|
|
79
|
+
export interface UpdateDatasourceRequest {
|
|
80
|
+
/** Optional: update type */
|
|
81
|
+
type?: DatasourceType;
|
|
82
|
+
/** Optional: update name */
|
|
83
|
+
name?: string;
|
|
84
|
+
/** Optional: update description */
|
|
85
|
+
description?: string;
|
|
86
|
+
/** Optional: update database */
|
|
87
|
+
database?: string;
|
|
88
|
+
/** Optional: update output bucket */
|
|
89
|
+
output_bucket?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Response from creating a datasource.
|
|
93
|
+
*/
|
|
94
|
+
export interface CreateDatasourceResponse {
|
|
95
|
+
success: boolean;
|
|
96
|
+
message: string;
|
|
97
|
+
datasource: DatasourceData;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Response from getting a datasource.
|
|
101
|
+
*/
|
|
102
|
+
export interface GetDatasourceResponse {
|
|
103
|
+
success: boolean;
|
|
104
|
+
message: string;
|
|
105
|
+
datasource: DatasourceData;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Response from listing datasources.
|
|
109
|
+
*/
|
|
110
|
+
export interface ListDatasourcesResponse {
|
|
111
|
+
success: boolean;
|
|
112
|
+
message: string;
|
|
113
|
+
datasources: DatasourceData[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Response from updating a datasource.
|
|
117
|
+
*/
|
|
118
|
+
export interface UpdateDatasourceResponse {
|
|
119
|
+
success: boolean;
|
|
120
|
+
message: string;
|
|
121
|
+
datasource: DatasourceData;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Datasource domain model for the Datalayer SDK.
|
|
125
|
+
* Provides state management and operations for datasources.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const datasource = await sdk.createDatasource({
|
|
130
|
+
* type: 'Amazon Athena',
|
|
131
|
+
* name: 'my-athena-datasource',
|
|
132
|
+
* description: 'Production Athena datasource',
|
|
133
|
+
* database: 'my_database',
|
|
134
|
+
* output_bucket: 's3://my-bucket/output/'
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* await datasource.update({ description: 'Updated description' });
|
|
138
|
+
* await datasource.delete();
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare class DatasourceDTO {
|
|
142
|
+
/** @internal */
|
|
143
|
+
_data: DatasourceData;
|
|
144
|
+
private _sdk;
|
|
145
|
+
private _deleted;
|
|
146
|
+
/**
|
|
147
|
+
* Create a Datasource instance.
|
|
148
|
+
* @param data - Datasource data from API
|
|
149
|
+
* @param sdk - SDK instance
|
|
150
|
+
*/
|
|
151
|
+
constructor(data: DatasourceData, sdk: DatalayerClient);
|
|
152
|
+
private _checkDeleted;
|
|
153
|
+
get uid(): string;
|
|
154
|
+
get type(): DatasourceType;
|
|
155
|
+
get variant(): string | undefined;
|
|
156
|
+
get name(): string;
|
|
157
|
+
get description(): string;
|
|
158
|
+
get database(): string | undefined;
|
|
159
|
+
get outputBucket(): string | undefined;
|
|
160
|
+
get createdAt(): Date | undefined;
|
|
161
|
+
get updatedAt(): Date | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Update this datasource.
|
|
164
|
+
* @param updates - Fields to update
|
|
165
|
+
* @returns Updated Datasource instance
|
|
166
|
+
*/
|
|
167
|
+
update(updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
168
|
+
/**
|
|
169
|
+
* Delete this datasource permanently.
|
|
170
|
+
*/
|
|
171
|
+
delete(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Get datasource data in camelCase format.
|
|
174
|
+
*/
|
|
175
|
+
toJSON(): DatasourceJSON;
|
|
176
|
+
/**
|
|
177
|
+
* Get raw datasource data exactly as received from API.
|
|
178
|
+
*/
|
|
179
|
+
rawData(): DatasourceData;
|
|
180
|
+
toString(): string;
|
|
181
|
+
}
|
package/lib/models/Datasource.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// OLD API - Kept for backward compatibility
|
|
7
|
+
// ============================================================================
|
|
5
8
|
export const asDatasource = (s) => {
|
|
6
9
|
return {
|
|
7
10
|
id: s.uid,
|
|
@@ -12,3 +15,140 @@ export const asDatasource = (s) => {
|
|
|
12
15
|
outputBucket: s.output_bucket_s,
|
|
13
16
|
};
|
|
14
17
|
};
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// New API Types and DTO
|
|
20
|
+
// ============================================================================
|
|
21
|
+
import { validateJSON } from '../api/utils/validation';
|
|
22
|
+
/**
|
|
23
|
+
* Datasource domain model for the Datalayer SDK.
|
|
24
|
+
* Provides state management and operations for datasources.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const datasource = await sdk.createDatasource({
|
|
29
|
+
* type: 'Amazon Athena',
|
|
30
|
+
* name: 'my-athena-datasource',
|
|
31
|
+
* description: 'Production Athena datasource',
|
|
32
|
+
* database: 'my_database',
|
|
33
|
+
* output_bucket: 's3://my-bucket/output/'
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* await datasource.update({ description: 'Updated description' });
|
|
37
|
+
* await datasource.delete();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class DatasourceDTO {
|
|
41
|
+
/** @internal */
|
|
42
|
+
_data;
|
|
43
|
+
_sdk;
|
|
44
|
+
_deleted = false;
|
|
45
|
+
/**
|
|
46
|
+
* Create a Datasource instance.
|
|
47
|
+
* @param data - Datasource data from API
|
|
48
|
+
* @param sdk - SDK instance
|
|
49
|
+
*/
|
|
50
|
+
constructor(data, sdk) {
|
|
51
|
+
this._data = data;
|
|
52
|
+
this._sdk = sdk;
|
|
53
|
+
}
|
|
54
|
+
// ========================================================================
|
|
55
|
+
// Helper Methods
|
|
56
|
+
// ========================================================================
|
|
57
|
+
_checkDeleted() {
|
|
58
|
+
if (this._deleted) {
|
|
59
|
+
throw new Error(`Datasource ${this._data.name_s} has been deleted and no longer exists`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// ========================================================================
|
|
63
|
+
// Properties
|
|
64
|
+
// ========================================================================
|
|
65
|
+
get uid() {
|
|
66
|
+
this._checkDeleted();
|
|
67
|
+
return this._data.uid;
|
|
68
|
+
}
|
|
69
|
+
get type() {
|
|
70
|
+
this._checkDeleted();
|
|
71
|
+
return this._data.type_s;
|
|
72
|
+
}
|
|
73
|
+
get variant() {
|
|
74
|
+
this._checkDeleted();
|
|
75
|
+
return this._data.variant_s;
|
|
76
|
+
}
|
|
77
|
+
get name() {
|
|
78
|
+
this._checkDeleted();
|
|
79
|
+
return this._data.name_s;
|
|
80
|
+
}
|
|
81
|
+
get description() {
|
|
82
|
+
this._checkDeleted();
|
|
83
|
+
return this._data.description_t;
|
|
84
|
+
}
|
|
85
|
+
get database() {
|
|
86
|
+
this._checkDeleted();
|
|
87
|
+
return this._data.database_s;
|
|
88
|
+
}
|
|
89
|
+
get outputBucket() {
|
|
90
|
+
this._checkDeleted();
|
|
91
|
+
return this._data.output_bucket_s;
|
|
92
|
+
}
|
|
93
|
+
get createdAt() {
|
|
94
|
+
this._checkDeleted();
|
|
95
|
+
return this._data.created_at ? new Date(this._data.created_at) : undefined;
|
|
96
|
+
}
|
|
97
|
+
get updatedAt() {
|
|
98
|
+
this._checkDeleted();
|
|
99
|
+
return this._data.updated_at ? new Date(this._data.updated_at) : undefined;
|
|
100
|
+
}
|
|
101
|
+
// ========================================================================
|
|
102
|
+
// Action Methods
|
|
103
|
+
// ========================================================================
|
|
104
|
+
/**
|
|
105
|
+
* Update this datasource.
|
|
106
|
+
* @param updates - Fields to update
|
|
107
|
+
* @returns Updated Datasource instance
|
|
108
|
+
*/
|
|
109
|
+
async update(updates) {
|
|
110
|
+
this._checkDeleted();
|
|
111
|
+
const updated = await this._sdk.updateDatasource(this.uid, updates);
|
|
112
|
+
return updated;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Delete this datasource permanently.
|
|
116
|
+
*/
|
|
117
|
+
async delete() {
|
|
118
|
+
this._checkDeleted();
|
|
119
|
+
await this._sdk.deleteDatasource(this.uid);
|
|
120
|
+
this._deleted = true;
|
|
121
|
+
}
|
|
122
|
+
// ========================================================================
|
|
123
|
+
// Utility Methods
|
|
124
|
+
// ========================================================================
|
|
125
|
+
/**
|
|
126
|
+
* Get datasource data in camelCase format.
|
|
127
|
+
*/
|
|
128
|
+
toJSON() {
|
|
129
|
+
this._checkDeleted();
|
|
130
|
+
const obj = {
|
|
131
|
+
uid: this.uid,
|
|
132
|
+
type: this.type,
|
|
133
|
+
name: this.name,
|
|
134
|
+
description: this.description,
|
|
135
|
+
database: this.database,
|
|
136
|
+
outputBucket: this.outputBucket,
|
|
137
|
+
createdAt: this.createdAt,
|
|
138
|
+
updatedAt: this.updatedAt,
|
|
139
|
+
};
|
|
140
|
+
validateJSON(obj, 'Datasource');
|
|
141
|
+
return obj;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get raw datasource data exactly as received from API.
|
|
145
|
+
*/
|
|
146
|
+
rawData() {
|
|
147
|
+
this._checkDeleted();
|
|
148
|
+
return this._data;
|
|
149
|
+
}
|
|
150
|
+
toString() {
|
|
151
|
+
this._checkDeleted();
|
|
152
|
+
return `Datasource(${this.name}, ${this.type})`;
|
|
153
|
+
}
|
|
154
|
+
}
|
package/lib/models/Runtime.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ export declare class RuntimeSnapshotDTO {
|
|
|
148
148
|
/**
|
|
149
149
|
* Create a runtime from this snapshot (restore functionality).
|
|
150
150
|
*
|
|
151
|
-
* @param
|
|
151
|
+
* @param minutesLimit - Time limit in minutes for the restored runtime
|
|
152
152
|
* @returns Created Runtime instance
|
|
153
153
|
*/
|
|
154
154
|
restore(minutesLimit: number): Promise<RuntimeDTO>;
|
|
@@ -85,7 +85,7 @@ export class RuntimeSnapshotDTO {
|
|
|
85
85
|
/**
|
|
86
86
|
* Create a runtime from this snapshot (restore functionality).
|
|
87
87
|
*
|
|
88
|
-
* @param
|
|
88
|
+
* @param minutesLimit - Time limit in minutes for the restored runtime
|
|
89
89
|
* @returns Created Runtime instance
|
|
90
90
|
*/
|
|
91
91
|
async restore(minutesLimit) {
|
package/lib/models/Secret.d.ts
CHANGED
|
@@ -8,3 +8,162 @@ export type ISecret = {
|
|
|
8
8
|
value: string;
|
|
9
9
|
};
|
|
10
10
|
export default ISecret;
|
|
11
|
+
import type { DatalayerClient } from '../client';
|
|
12
|
+
/**
|
|
13
|
+
* Raw secret data from API (snake_case with suffixes).
|
|
14
|
+
*/
|
|
15
|
+
export interface SecretData {
|
|
16
|
+
/** Unique identifier (ULID) */
|
|
17
|
+
uid: string;
|
|
18
|
+
/** Secret variant/type */
|
|
19
|
+
variant_s: ISecretVariant;
|
|
20
|
+
/** Secret name */
|
|
21
|
+
name_s: string;
|
|
22
|
+
/** Secret description */
|
|
23
|
+
description_t: string;
|
|
24
|
+
/** Base64-encoded secret value */
|
|
25
|
+
value_s: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Public JSON interface for Secret (camelCase).
|
|
29
|
+
*/
|
|
30
|
+
export interface SecretJSON {
|
|
31
|
+
/** Unique identifier */
|
|
32
|
+
uid: string;
|
|
33
|
+
/** Secret type */
|
|
34
|
+
variant: ISecretVariant;
|
|
35
|
+
/** Secret name */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Secret description */
|
|
38
|
+
description: string;
|
|
39
|
+
/** Decoded secret value (plain text) */
|
|
40
|
+
value: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Request data for creating a new secret.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export interface CreateSecretRequest {
|
|
47
|
+
/** Secret type/variant (defaults to 'generic' if not provided) */
|
|
48
|
+
variant?: ISecretVariant;
|
|
49
|
+
/** Secret name (unique identifier) */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Human-readable description */
|
|
52
|
+
description?: string;
|
|
53
|
+
/** Plain text value (will be Base64 encoded by SDK) */
|
|
54
|
+
value: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Request data for updating a secret.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export interface UpdateSecretRequest {
|
|
61
|
+
/** Optional: update variant */
|
|
62
|
+
variant?: ISecretVariant;
|
|
63
|
+
/** Optional: update name */
|
|
64
|
+
name?: string;
|
|
65
|
+
/** Optional: update description */
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Optional: update value (plain text, will be Base64 encoded) */
|
|
68
|
+
value?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Response from creating a secret.
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export interface CreateSecretResponse {
|
|
75
|
+
success: boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
secret: SecretData;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Response from getting a secret.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export interface GetSecretResponse {
|
|
84
|
+
success: boolean;
|
|
85
|
+
message: string;
|
|
86
|
+
secret: SecretData;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Response from listing secrets.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export interface ListSecretsResponse {
|
|
93
|
+
success: boolean;
|
|
94
|
+
message: string;
|
|
95
|
+
secrets: SecretData[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Response from updating a secret.
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export interface UpdateSecretResponse {
|
|
102
|
+
success: boolean;
|
|
103
|
+
message: string;
|
|
104
|
+
secret: SecretData;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Response from deleting a secret.
|
|
108
|
+
*/
|
|
109
|
+
export interface DeleteSecretResponse {
|
|
110
|
+
success: boolean;
|
|
111
|
+
message: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Secret domain model for the Datalayer SDK.
|
|
115
|
+
* Provides state management and operations for user secrets.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const secret = await sdk.createSecret({
|
|
120
|
+
* variant: 'password',
|
|
121
|
+
* name: 'db_password',
|
|
122
|
+
* description: 'Production DB password',
|
|
123
|
+
* value: 'my-secure-password'
|
|
124
|
+
* });
|
|
125
|
+
*
|
|
126
|
+
* await secret.update({ description: 'Updated description' });
|
|
127
|
+
* await secret.delete();
|
|
128
|
+
* ```
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
export declare class SecretDTO {
|
|
132
|
+
/** @internal */
|
|
133
|
+
_data: SecretData;
|
|
134
|
+
private _sdk;
|
|
135
|
+
private _deleted;
|
|
136
|
+
/**
|
|
137
|
+
* Create a Secret instance.
|
|
138
|
+
* @param data - Secret data from API
|
|
139
|
+
* @param sdk - SDK instance
|
|
140
|
+
*/
|
|
141
|
+
constructor(data: SecretData, sdk: DatalayerClient);
|
|
142
|
+
private _checkDeleted;
|
|
143
|
+
private _decodeValue;
|
|
144
|
+
get uid(): string;
|
|
145
|
+
get variant(): ISecretVariant;
|
|
146
|
+
get name(): string;
|
|
147
|
+
get description(): string;
|
|
148
|
+
/** Returns decoded (plain text) secret value */
|
|
149
|
+
get value(): string;
|
|
150
|
+
/**
|
|
151
|
+
* Update this secret.
|
|
152
|
+
* @param updates - Fields to update
|
|
153
|
+
* @returns Updated Secret instance
|
|
154
|
+
*/
|
|
155
|
+
update(updates: UpdateSecretRequest): Promise<SecretDTO>;
|
|
156
|
+
/**
|
|
157
|
+
* Delete this secret permanently.
|
|
158
|
+
*/
|
|
159
|
+
delete(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Get secret data in camelCase format.
|
|
162
|
+
*/
|
|
163
|
+
toJSON(): SecretJSON;
|
|
164
|
+
/**
|
|
165
|
+
* Get raw secret data exactly as received from API.
|
|
166
|
+
*/
|
|
167
|
+
rawData(): SecretData;
|
|
168
|
+
toString(): string;
|
|
169
|
+
}
|