@positronic/cli 0.0.2
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/dist/src/cli.js +739 -0
- package/dist/src/commands/backend.js +199 -0
- package/dist/src/commands/brain.js +446 -0
- package/dist/src/commands/brain.test.js +2936 -0
- package/dist/src/commands/helpers.js +1315 -0
- package/dist/src/commands/helpers.test.js +832 -0
- package/dist/src/commands/project-config-manager.js +197 -0
- package/dist/src/commands/project.js +130 -0
- package/dist/src/commands/project.test.js +1201 -0
- package/dist/src/commands/resources.js +272 -0
- package/dist/src/commands/resources.test.js +2511 -0
- package/dist/src/commands/schedule.js +73 -0
- package/dist/src/commands/schedule.test.js +1235 -0
- package/dist/src/commands/secret.js +87 -0
- package/dist/src/commands/secret.test.d.js +1 -0
- package/dist/src/commands/secret.test.js +761 -0
- package/dist/src/commands/server.js +816 -0
- package/dist/src/commands/server.test.js +1237 -0
- package/dist/src/commands/test-utils.js +737 -0
- package/dist/src/components/brain-history.js +169 -0
- package/dist/src/components/brain-list.js +108 -0
- package/dist/src/components/brain-rerun.js +313 -0
- package/dist/src/components/brain-show.js +65 -0
- package/dist/src/components/error.js +19 -0
- package/dist/src/components/project-add.js +95 -0
- package/dist/src/components/project-create.js +276 -0
- package/dist/src/components/project-list.js +88 -0
- package/dist/src/components/project-remove.js +91 -0
- package/dist/src/components/project-select.js +224 -0
- package/dist/src/components/project-show.js +41 -0
- package/dist/src/components/resource-clear.js +152 -0
- package/dist/src/components/resource-delete.js +189 -0
- package/dist/src/components/resource-list.js +174 -0
- package/dist/src/components/resource-sync.js +386 -0
- package/dist/src/components/resource-types.js +243 -0
- package/dist/src/components/resource-upload.js +366 -0
- package/dist/src/components/schedule-create.js +259 -0
- package/dist/src/components/schedule-delete.js +161 -0
- package/dist/src/components/schedule-list.js +176 -0
- package/dist/src/components/schedule-runs.js +103 -0
- package/dist/src/components/secret-bulk.js +262 -0
- package/dist/src/components/secret-create.js +199 -0
- package/dist/src/components/secret-delete.js +190 -0
- package/dist/src/components/secret-list.js +190 -0
- package/dist/src/components/secret-sync.js +303 -0
- package/dist/src/components/watch.js +184 -0
- package/dist/src/hooks/useApi.js +512 -0
- package/dist/src/positronic.js +33 -0
- package/dist/src/test/mock-api-client.js +371 -0
- package/dist/src/test/test-dev-server.js +1376 -0
- package/dist/types/cli.d.ts +9 -0
- package/dist/types/cli.d.ts.map +1 -0
- package/dist/types/commands/backend.d.ts +6 -0
- package/dist/types/commands/backend.d.ts.map +1 -0
- package/dist/types/commands/brain.d.ts +35 -0
- package/dist/types/commands/brain.d.ts.map +1 -0
- package/dist/types/commands/helpers.d.ts +55 -0
- package/dist/types/commands/helpers.d.ts.map +1 -0
- package/dist/types/commands/project-config-manager.d.ts +37 -0
- package/dist/types/commands/project-config-manager.d.ts.map +1 -0
- package/dist/types/commands/project.d.ts +55 -0
- package/dist/types/commands/project.d.ts.map +1 -0
- package/dist/types/commands/resources.d.ts +13 -0
- package/dist/types/commands/resources.d.ts.map +1 -0
- package/dist/types/commands/schedule.d.ts +27 -0
- package/dist/types/commands/schedule.d.ts.map +1 -0
- package/dist/types/commands/secret.d.ts +23 -0
- package/dist/types/commands/secret.d.ts.map +1 -0
- package/dist/types/commands/server.d.ts +12 -0
- package/dist/types/commands/server.d.ts.map +1 -0
- package/dist/types/commands/test-utils.d.ts +45 -0
- package/dist/types/commands/test-utils.d.ts.map +1 -0
- package/dist/types/components/brain-history.d.ts +7 -0
- package/dist/types/components/brain-history.d.ts.map +1 -0
- package/dist/types/components/brain-list.d.ts +2 -0
- package/dist/types/components/brain-list.d.ts.map +1 -0
- package/dist/types/components/brain-rerun.d.ts +9 -0
- package/dist/types/components/brain-rerun.d.ts.map +1 -0
- package/dist/types/components/brain-show.d.ts +6 -0
- package/dist/types/components/brain-show.d.ts.map +1 -0
- package/dist/types/components/error.d.ts +10 -0
- package/dist/types/components/error.d.ts.map +1 -0
- package/dist/types/components/project-add.d.ts +9 -0
- package/dist/types/components/project-add.d.ts.map +1 -0
- package/dist/types/components/project-create.d.ts +6 -0
- package/dist/types/components/project-create.d.ts.map +1 -0
- package/dist/types/components/project-list.d.ts +7 -0
- package/dist/types/components/project-list.d.ts.map +1 -0
- package/dist/types/components/project-remove.d.ts +8 -0
- package/dist/types/components/project-remove.d.ts.map +1 -0
- package/dist/types/components/project-select.d.ts +8 -0
- package/dist/types/components/project-select.d.ts.map +1 -0
- package/dist/types/components/project-show.d.ts +7 -0
- package/dist/types/components/project-show.d.ts.map +1 -0
- package/dist/types/components/resource-clear.d.ts +2 -0
- package/dist/types/components/resource-clear.d.ts.map +1 -0
- package/dist/types/components/resource-delete.d.ts +9 -0
- package/dist/types/components/resource-delete.d.ts.map +1 -0
- package/dist/types/components/resource-list.d.ts +2 -0
- package/dist/types/components/resource-list.d.ts.map +1 -0
- package/dist/types/components/resource-sync.d.ts +8 -0
- package/dist/types/components/resource-sync.d.ts.map +1 -0
- package/dist/types/components/resource-types.d.ts +7 -0
- package/dist/types/components/resource-types.d.ts.map +1 -0
- package/dist/types/components/resource-upload.d.ts +8 -0
- package/dist/types/components/resource-upload.d.ts.map +1 -0
- package/dist/types/components/schedule-create.d.ts +7 -0
- package/dist/types/components/schedule-create.d.ts.map +1 -0
- package/dist/types/components/schedule-delete.d.ts +7 -0
- package/dist/types/components/schedule-delete.d.ts.map +1 -0
- package/dist/types/components/schedule-list.d.ts +6 -0
- package/dist/types/components/schedule-list.d.ts.map +1 -0
- package/dist/types/components/schedule-runs.d.ts +8 -0
- package/dist/types/components/schedule-runs.d.ts.map +1 -0
- package/dist/types/components/secret-bulk.d.ts +8 -0
- package/dist/types/components/secret-bulk.d.ts.map +1 -0
- package/dist/types/components/secret-create.d.ts +9 -0
- package/dist/types/components/secret-create.d.ts.map +1 -0
- package/dist/types/components/secret-delete.d.ts +8 -0
- package/dist/types/components/secret-delete.d.ts.map +1 -0
- package/dist/types/components/secret-list.d.ts +7 -0
- package/dist/types/components/secret-list.d.ts.map +1 -0
- package/dist/types/components/secret-sync.d.ts +9 -0
- package/dist/types/components/secret-sync.d.ts.map +1 -0
- package/dist/types/components/watch.d.ts +7 -0
- package/dist/types/components/watch.d.ts.map +1 -0
- package/dist/types/hooks/useApi.d.ts +29 -0
- package/dist/types/hooks/useApi.d.ts.map +1 -0
- package/dist/types/positronic.d.ts +3 -0
- package/dist/types/positronic.d.ts.map +1 -0
- package/dist/types/test/mock-api-client.d.ts +25 -0
- package/dist/types/test/mock-api-client.d.ts.map +1 -0
- package/dist/types/test/test-dev-server.d.ts +129 -0
- package/dist/types/test/test-dev-server.d.ts.map +1 -0
- package/package.json +37 -0
- package/src/cli.ts +981 -0
- package/src/commands/backend.ts +63 -0
- package/src/commands/brain.test.ts +1004 -0
- package/src/commands/brain.ts +215 -0
- package/src/commands/helpers.test.ts +487 -0
- package/src/commands/helpers.ts +870 -0
- package/src/commands/project-config-manager.ts +152 -0
- package/src/commands/project.test.ts +502 -0
- package/src/commands/project.ts +109 -0
- package/src/commands/resources.test.ts +1052 -0
- package/src/commands/resources.ts +97 -0
- package/src/commands/schedule.test.ts +481 -0
- package/src/commands/schedule.ts +65 -0
- package/src/commands/secret.test.ts +210 -0
- package/src/commands/secret.ts +50 -0
- package/src/commands/server.test.ts +493 -0
- package/src/commands/server.ts +353 -0
- package/src/commands/test-utils.ts +324 -0
- package/src/components/brain-history.tsx +198 -0
- package/src/components/brain-list.tsx +105 -0
- package/src/components/brain-rerun.tsx +111 -0
- package/src/components/brain-show.tsx +92 -0
- package/src/components/error.tsx +24 -0
- package/src/components/project-add.tsx +59 -0
- package/src/components/project-create.tsx +83 -0
- package/src/components/project-list.tsx +83 -0
- package/src/components/project-remove.tsx +55 -0
- package/src/components/project-select.tsx +200 -0
- package/src/components/project-show.tsx +58 -0
- package/src/components/resource-clear.tsx +127 -0
- package/src/components/resource-delete.tsx +160 -0
- package/src/components/resource-list.tsx +177 -0
- package/src/components/resource-sync.tsx +170 -0
- package/src/components/resource-types.tsx +55 -0
- package/src/components/resource-upload.tsx +182 -0
- package/src/components/schedule-create.tsx +90 -0
- package/src/components/schedule-delete.tsx +116 -0
- package/src/components/schedule-list.tsx +186 -0
- package/src/components/schedule-runs.tsx +151 -0
- package/src/components/secret-bulk.tsx +79 -0
- package/src/components/secret-create.tsx +49 -0
- package/src/components/secret-delete.tsx +41 -0
- package/src/components/secret-list.tsx +41 -0
- package/src/components/watch.tsx +155 -0
- package/src/hooks/useApi.ts +183 -0
- package/src/positronic.ts +40 -0
- package/src/test/data/resources/config.json +1 -0
- package/src/test/data/resources/data/config.json +1 -0
- package/src/test/data/resources/data/logo.png +2 -0
- package/src/test/data/resources/docs/api.md +3 -0
- package/src/test/data/resources/docs/readme.md +3 -0
- package/src/test/data/resources/example.md +3 -0
- package/src/test/data/resources/file with spaces.txt +1 -0
- package/src/test/data/resources/readme.md +3 -0
- package/src/test/data/resources/test.txt +1 -0
- package/src/test/mock-api-client.ts +145 -0
- package/src/test/test-dev-server.ts +1003 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-list.d.ts","sourceRoot":"","sources":["../../../src/components/schedule-list.tsx"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsDD,eAAO,MAAM,YAAY,GAAI,iBAAiB,iBAAiB,4CA4H9D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ScheduleRunsProps {
|
|
2
|
+
scheduleId?: string;
|
|
3
|
+
limit: number;
|
|
4
|
+
status?: 'triggered' | 'failed' | 'complete';
|
|
5
|
+
}
|
|
6
|
+
export declare const ScheduleRuns: ({ scheduleId, limit, status }: ScheduleRunsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=schedule-runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-runs.d.ts","sourceRoot":"","sources":["../../../src/components/schedule-runs.tsx"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC9C;AAyCD,eAAO,MAAM,YAAY,GAAI,+BAA+B,iBAAiB,4CA+F5E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PositronicDevServer } from '@positronic/spec';
|
|
2
|
+
interface SecretBulkProps {
|
|
3
|
+
file?: string;
|
|
4
|
+
server?: PositronicDevServer;
|
|
5
|
+
}
|
|
6
|
+
export declare const SecretBulk: ({ file, server }: SecretBulkProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=secret-bulk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-bulk.d.ts","sourceRoot":"","sources":["../../../src/components/secret-bulk.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI5D,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,GAAI,kBAA2B,eAAe,mDAmEpE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PositronicDevServer } from '@positronic/spec';
|
|
2
|
+
interface SecretCreateProps {
|
|
3
|
+
name: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
server?: PositronicDevServer;
|
|
6
|
+
}
|
|
7
|
+
export declare const SecretCreate: ({ name, value: providedValue, server }: SecretCreateProps) => null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=secret-create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-create.d.ts","sourceRoot":"","sources":["../../../src/components/secret-create.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,GAAI,wCAAwC,iBAAiB,SAsCrF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PositronicDevServer } from '@positronic/spec';
|
|
2
|
+
interface SecretDeleteProps {
|
|
3
|
+
name: string;
|
|
4
|
+
server?: PositronicDevServer;
|
|
5
|
+
}
|
|
6
|
+
export declare const SecretDelete: ({ name, server }: SecretDeleteProps) => null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=secret-delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-delete.d.ts","sourceRoot":"","sources":["../../../src/components/secret-delete.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,GAAI,kBAAkB,iBAAiB,SA+B/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-list.d.ts","sourceRoot":"","sources":["../../../src/components/secret-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,GAAI,YAAY,eAAe,SAgCrD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PositronicDevServer } from '@positronic/spec';
|
|
2
|
+
interface SecretSyncProps {
|
|
3
|
+
file?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
server?: PositronicDevServer;
|
|
6
|
+
}
|
|
7
|
+
export declare const SecretSync: ({ file, dryRun, server }: SecretSyncProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=secret-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-sync.d.ts","sourceRoot":"","sources":["../../../src/components/secret-sync.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AASD,eAAO,MAAM,UAAU,GAAI,0BAA2C,eAAe,mDA+FpF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/components/watch.tsx"],"names":[],"mappings":"AA6DA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,KAAK,GAAI,iBAAiB,UAAU,4CAwFhD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare function useApiGet<T>(endpoint: string, options?: any): {
|
|
2
|
+
data: T | null;
|
|
3
|
+
loading: boolean;
|
|
4
|
+
error: {
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
details?: string;
|
|
8
|
+
} | null;
|
|
9
|
+
};
|
|
10
|
+
export declare function useApiPost<T>(endpoint: string, defaultOptions?: any): {
|
|
11
|
+
data: T | null;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: {
|
|
14
|
+
title: string;
|
|
15
|
+
message: string;
|
|
16
|
+
details?: string;
|
|
17
|
+
} | null;
|
|
18
|
+
execute: (body?: any, options?: any) => Promise<T>;
|
|
19
|
+
};
|
|
20
|
+
export declare function useApiDelete(resourceType: string): {
|
|
21
|
+
loading: boolean;
|
|
22
|
+
error: {
|
|
23
|
+
title: string;
|
|
24
|
+
message: string;
|
|
25
|
+
details?: string;
|
|
26
|
+
} | null;
|
|
27
|
+
execute: (endpoint: string, options?: any) => Promise<boolean>;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApi.d.ts","sourceRoot":"","sources":["../../../src/hooks/useApi.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;;;;eAIjD,MAAM;iBACJ,MAAM;kBACL,MAAM;;EA8CnB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,GAAG;;;;eAIzD,MAAM;iBACJ,MAAM;kBACL,MAAM;;qBAIF,GAAG,YAAY,GAAG;EAsDnC;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM;;;eAGtC,MAAM;iBACJ,MAAM;kBACL,MAAM;;wBAIC,MAAM,YAAY,GAAG;EAkDzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positronic.d.ts","sourceRoot":"","sources":["../../src/positronic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ApiClient } from '../commands/helpers.js';
|
|
2
|
+
interface MockResource {
|
|
3
|
+
key: string;
|
|
4
|
+
type: 'text' | 'binary';
|
|
5
|
+
path?: string;
|
|
6
|
+
size: number;
|
|
7
|
+
lastModified: string;
|
|
8
|
+
local: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class MockApiClient implements ApiClient {
|
|
11
|
+
private resources;
|
|
12
|
+
private brainRuns;
|
|
13
|
+
calls: Array<{
|
|
14
|
+
path: string;
|
|
15
|
+
options?: RequestInit;
|
|
16
|
+
}>;
|
|
17
|
+
fetch(path: string, options?: RequestInit): Promise<Response>;
|
|
18
|
+
addResource(resource: MockResource): void;
|
|
19
|
+
clearResources(): void;
|
|
20
|
+
getResources(): MockResource[];
|
|
21
|
+
reset(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function createMockApiClient(initialResources?: MockResource[]): MockApiClient;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=mock-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-api-client.d.ts","sourceRoot":"","sources":["../../../src/test/mock-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,UAAU,YAAY;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,SAAS,CAA+B;IAGzC,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC,CAAM;IAE5D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkGnE,WAAW,CAAC,QAAQ,EAAE,YAAY;IAIlC,cAAc;IAId,YAAY;IAIZ,KAAK;CAKN;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,CAAC,EAAE,YAAY,EAAE,GAChC,aAAa,CAMf"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { PositronicDevServer, ServerHandle } from '@positronic/spec';
|
|
2
|
+
interface MockResource {
|
|
3
|
+
key: string;
|
|
4
|
+
type: 'text' | 'binary';
|
|
5
|
+
size: number;
|
|
6
|
+
lastModified: string;
|
|
7
|
+
local?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface MethodCall {
|
|
10
|
+
method: string;
|
|
11
|
+
args: any[];
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Extended ServerHandle interface for testing that includes test-specific methods
|
|
16
|
+
*/
|
|
17
|
+
export interface TestServerHandle extends ServerHandle {
|
|
18
|
+
/**
|
|
19
|
+
* Get the method call logs
|
|
20
|
+
*/
|
|
21
|
+
getLogs(): MethodCall[];
|
|
22
|
+
/**
|
|
23
|
+
* Clear the method call logs
|
|
24
|
+
*/
|
|
25
|
+
clearLogs(): void;
|
|
26
|
+
}
|
|
27
|
+
interface MockSchedule {
|
|
28
|
+
id: string;
|
|
29
|
+
brainName: string;
|
|
30
|
+
cronExpression: string;
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
createdAt: number;
|
|
33
|
+
nextRunAt?: number;
|
|
34
|
+
}
|
|
35
|
+
interface MockScheduleRun {
|
|
36
|
+
id: string;
|
|
37
|
+
scheduleId: string;
|
|
38
|
+
status: 'triggered' | 'failed';
|
|
39
|
+
ranAt: number;
|
|
40
|
+
brainRunId?: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
}
|
|
43
|
+
interface MockBrain {
|
|
44
|
+
name: string;
|
|
45
|
+
title: string;
|
|
46
|
+
description: string;
|
|
47
|
+
createdAt?: number;
|
|
48
|
+
lastModified?: number;
|
|
49
|
+
steps?: Array<{
|
|
50
|
+
type: 'step' | 'brain';
|
|
51
|
+
title: string;
|
|
52
|
+
innerBrain?: {
|
|
53
|
+
title: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
steps: any[];
|
|
56
|
+
};
|
|
57
|
+
}>;
|
|
58
|
+
}
|
|
59
|
+
interface MockBrainRun {
|
|
60
|
+
brainRunId: string;
|
|
61
|
+
brainTitle: string;
|
|
62
|
+
brainDescription?: string;
|
|
63
|
+
type: string;
|
|
64
|
+
status: 'PENDING' | 'RUNNING' | 'COMPLETE' | 'ERROR';
|
|
65
|
+
options?: any;
|
|
66
|
+
error?: any;
|
|
67
|
+
createdAt: number;
|
|
68
|
+
startedAt?: number;
|
|
69
|
+
completedAt?: number;
|
|
70
|
+
}
|
|
71
|
+
interface MockSecret {
|
|
72
|
+
name: string;
|
|
73
|
+
value: string;
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
export declare class TestDevServer implements PositronicDevServer {
|
|
78
|
+
projectRootDir: string;
|
|
79
|
+
private resources;
|
|
80
|
+
private schedules;
|
|
81
|
+
private scheduleRuns;
|
|
82
|
+
private brains;
|
|
83
|
+
private brainRuns;
|
|
84
|
+
private secrets;
|
|
85
|
+
port: number;
|
|
86
|
+
private callLog;
|
|
87
|
+
private nockScope;
|
|
88
|
+
private logCallbacks;
|
|
89
|
+
private errorCallbacks;
|
|
90
|
+
private warningCallbacks;
|
|
91
|
+
constructor(projectRootDir?: string);
|
|
92
|
+
private logCall;
|
|
93
|
+
deploy(config?: any): Promise<void>;
|
|
94
|
+
setup(force?: boolean): Promise<void>;
|
|
95
|
+
getLogs(): MethodCall[];
|
|
96
|
+
start(port?: number): Promise<TestServerHandle>;
|
|
97
|
+
watch(event: 'add' | 'change' | 'unlink'): Promise<void>;
|
|
98
|
+
addResource(resource: MockResource): void;
|
|
99
|
+
clearResources(): void;
|
|
100
|
+
getResources(): MockResource[];
|
|
101
|
+
addSchedule(schedule: MockSchedule): void;
|
|
102
|
+
clearSchedules(): void;
|
|
103
|
+
addScheduleRun(run: MockScheduleRun): void;
|
|
104
|
+
clearScheduleRuns(): void;
|
|
105
|
+
getSchedules(): MockSchedule[];
|
|
106
|
+
addSecret(name: string, value: string): void;
|
|
107
|
+
clearSecrets(): void;
|
|
108
|
+
getSecrets(): MockSecret[];
|
|
109
|
+
getSecret(name: string): MockSecret | undefined;
|
|
110
|
+
addBrain(brain: MockBrain): void;
|
|
111
|
+
addBrainRun(run: MockBrainRun): void;
|
|
112
|
+
clearBrainRuns(): void;
|
|
113
|
+
clearBrains(): void;
|
|
114
|
+
getBrains(): MockBrain[];
|
|
115
|
+
stop(): void;
|
|
116
|
+
onLog(callback: (message: string) => void): void;
|
|
117
|
+
onError(callback: (message: string) => void): void;
|
|
118
|
+
onWarning(callback: (message: string) => void): void;
|
|
119
|
+
listSecrets(): Promise<Array<{
|
|
120
|
+
name: string;
|
|
121
|
+
createdAt?: Date;
|
|
122
|
+
updatedAt?: Date;
|
|
123
|
+
}>>;
|
|
124
|
+
setSecret(name: string, value: string): Promise<void>;
|
|
125
|
+
deleteSecret(name: string): Promise<boolean>;
|
|
126
|
+
bulkSecrets(filePath: string): Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=test-dev-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-dev-server.d.ts","sourceRoot":"","sources":["../../../src/test/test-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAK1E,UAAU,YAAY;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;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
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"positronic": "./dist/src/positronic.js",
|
|
9
|
+
"px": "./dist/src/positronic.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"tsc": "tsc --project tsconfig.json",
|
|
13
|
+
"swc": "swc src -d dist",
|
|
14
|
+
"build": "npm run tsc && npm run swc",
|
|
15
|
+
"postbuild": "chmod +x ./dist/src/positronic.js",
|
|
16
|
+
"clean": "rm -rf tsconfig.tsbuildinfo dist node_modules"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@positronic/core": "^0.0.1",
|
|
20
|
+
"@positronic/spec": "^0.0.1",
|
|
21
|
+
"@positronic/template-new-project": "^0.0.1",
|
|
22
|
+
"caz": "^2.0.0",
|
|
23
|
+
"chokidar": "^3.6.0",
|
|
24
|
+
"eventsource": "^3.0.6",
|
|
25
|
+
"ink": "^5.2.1",
|
|
26
|
+
"istextorbinary": "^9.5.0",
|
|
27
|
+
"node-fetch": "^3.3.2",
|
|
28
|
+
"react": "^18.3.1",
|
|
29
|
+
"yargs": "^17.7.2"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/react": "^19.1.3",
|
|
33
|
+
"@types/yargs": "^17.0.33",
|
|
34
|
+
"ink-testing-library": "^4.0.0",
|
|
35
|
+
"nock": "^14.0.5"
|
|
36
|
+
}
|
|
37
|
+
}
|