@mugwork/mug 0.1.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/LICENSE +21 -0
- package/README.md +251 -0
- package/dist/explorer.js +3 -0
- package/dist/packages/email-template/src/email-template.d.ts +18 -0
- package/dist/packages/email-template/src/email-template.js +74 -0
- package/dist/packages/email-template/src/index.d.ts +1 -0
- package/dist/packages/email-template/src/index.js +1 -0
- package/dist/packages/surface-renderer/src/form-renderer.d.ts +117 -0
- package/dist/packages/surface-renderer/src/form-renderer.js +719 -0
- package/dist/packages/surface-renderer/src/index.d.ts +4 -0
- package/dist/packages/surface-renderer/src/index.js +2 -0
- package/dist/packages/surface-renderer/src/portal-renderer.d.ts +177 -0
- package/dist/packages/surface-renderer/src/portal-renderer.js +1089 -0
- package/dist/packages/surface-renderer/src/workspace-home.d.ts +46 -0
- package/dist/packages/surface-renderer/src/workspace-home.js +345 -0
- package/dist/runtime/agent-types.d.ts +48 -0
- package/dist/runtime/agent-types.js +3 -0
- package/dist/runtime/ai-router.d.ts +32 -0
- package/dist/runtime/ai-router.js +112 -0
- package/dist/runtime/app.d.ts +6 -0
- package/dist/runtime/app.js +399 -0
- package/dist/runtime/chunker.d.ts +6 -0
- package/dist/runtime/chunker.js +30 -0
- package/dist/runtime/context.d.ts +115 -0
- package/dist/runtime/context.js +440 -0
- package/dist/runtime/do/workspace-database.d.ts +10 -0
- package/dist/runtime/do/workspace-database.js +199 -0
- package/dist/runtime/form-types.d.ts +143 -0
- package/dist/runtime/form-types.js +1 -0
- package/dist/runtime/runtime.d.ts +9 -0
- package/dist/runtime/runtime.js +7 -0
- package/dist/runtime/source-types.d.ts +15 -0
- package/dist/runtime/source-types.js +1 -0
- package/dist/runtime/source.d.ts +70 -0
- package/dist/runtime/source.js +21 -0
- package/dist/runtime/sync-runtime.d.ts +10 -0
- package/dist/runtime/sync-runtime.js +185 -0
- package/dist/runtime/types.d.ts +21 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/workflow-entrypoint.d.ts +31 -0
- package/dist/runtime/workflow-entrypoint.js +1297 -0
- package/dist/runtime/workflow.d.ts +285 -0
- package/dist/runtime/workflow.js +1008 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +44116 -0
- package/dist/src/commands/ai-gateway-route.d.ts +24 -0
- package/dist/src/commands/ai-gateway-route.js +192 -0
- package/dist/src/commands/auth.d.ts +1 -0
- package/dist/src/commands/auth.js +42 -0
- package/dist/src/commands/billing.d.ts +6 -0
- package/dist/src/commands/billing.js +76 -0
- package/dist/src/commands/brain.d.ts +1 -0
- package/dist/src/commands/brain.js +194 -0
- package/dist/src/commands/demo.d.ts +12 -0
- package/dist/src/commands/demo.js +147 -0
- package/dist/src/commands/deploy.d.ts +1 -0
- package/dist/src/commands/deploy.js +1052 -0
- package/dist/src/commands/dev.d.ts +14 -0
- package/dist/src/commands/dev.js +2818 -0
- package/dist/src/commands/form.d.ts +8 -0
- package/dist/src/commands/form.js +396 -0
- package/dist/src/commands/init.d.ts +1 -0
- package/dist/src/commands/init.js +139 -0
- package/dist/src/commands/issue.d.ts +7 -0
- package/dist/src/commands/issue.js +191 -0
- package/dist/src/commands/login.d.ts +9 -0
- package/dist/src/commands/login.js +163 -0
- package/dist/src/commands/logs.d.ts +8 -0
- package/dist/src/commands/logs.js +113 -0
- package/dist/src/commands/portal.d.ts +2 -0
- package/dist/src/commands/portal.js +111 -0
- package/dist/src/commands/pull.d.ts +3 -0
- package/dist/src/commands/pull.js +184 -0
- package/dist/src/commands/push.d.ts +4 -0
- package/dist/src/commands/push.js +183 -0
- package/dist/src/commands/run.d.ts +6 -0
- package/dist/src/commands/run.js +91 -0
- package/dist/src/commands/secret.d.ts +7 -0
- package/dist/src/commands/secret.js +105 -0
- package/dist/src/commands/shutdown.d.ts +1 -0
- package/dist/src/commands/shutdown.js +46 -0
- package/dist/src/commands/sql.d.ts +8 -0
- package/dist/src/commands/sql.js +142 -0
- package/dist/src/commands/status.d.ts +5 -0
- package/dist/src/commands/status.js +39 -0
- package/dist/src/commands/sync.d.ts +7 -0
- package/dist/src/commands/sync.js +991 -0
- package/dist/src/commands/usage.d.ts +6 -0
- package/dist/src/commands/usage.js +78 -0
- package/dist/src/commands/webhooks.d.ts +1 -0
- package/dist/src/commands/webhooks.js +102 -0
- package/dist/src/commands/workspace.d.ts +23 -0
- package/dist/src/commands/workspace.js +590 -0
- package/dist/src/connector-migration.d.ts +20 -0
- package/dist/src/connector-migration.js +43 -0
- package/dist/src/connector-parser.d.ts +14 -0
- package/dist/src/connector-parser.js +94 -0
- package/dist/src/connector-service/discover.d.ts +37 -0
- package/dist/src/connector-service/discover.js +79 -0
- package/dist/src/connector-service/gather.d.ts +22 -0
- package/dist/src/connector-service/gather.js +89 -0
- package/dist/src/connector-service/init.d.ts +14 -0
- package/dist/src/connector-service/init.js +109 -0
- package/dist/src/connector-service/scaffold.d.ts +17 -0
- package/dist/src/connector-service/scaffold.js +194 -0
- package/dist/src/connector-service/spec-storage.d.ts +8 -0
- package/dist/src/connector-service/spec-storage.js +48 -0
- package/dist/src/connector-service/types.d.ts +57 -0
- package/dist/src/connector-service/types.js +2 -0
- package/dist/src/connector-service/verify.d.ts +24 -0
- package/dist/src/connector-service/verify.js +575 -0
- package/dist/src/email-template.d.ts +2 -0
- package/dist/src/email-template.js +1 -0
- package/dist/src/manifest.d.ts +31 -0
- package/dist/src/manifest.js +25 -0
- package/dist/src/mug-icon.d.ts +1 -0
- package/dist/src/mug-icon.js +12 -0
- package/dist/src/slack-manifest.d.ts +119 -0
- package/dist/src/slack-manifest.js +163 -0
- package/dist/src/source-migration.d.ts +20 -0
- package/dist/src/source-migration.js +43 -0
- package/dist/src/surface-renderer.d.ts +5 -0
- package/dist/src/surface-renderer.js +3 -0
- package/dist/src/templates.d.ts +3 -0
- package/dist/src/templates.js +48 -0
- package/dist/src/version-check.d.ts +1 -0
- package/dist/src/version-check.js +28 -0
- package/dist/src/workflow-parser.d.ts +95 -0
- package/dist/src/workflow-parser.js +526 -0
- package/dist/worker/src/agent-types.d.ts +27 -0
- package/dist/worker/src/agent-types.js +3 -0
- package/dist/worker/src/source-types.d.ts +14 -0
- package/dist/worker/src/source-types.js +1 -0
- package/package.json +90 -0
- package/src/data/model-capabilities.json +171 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { parse as yamlParse, stringify as yamlStringify } from "yaml";
|
|
4
|
+
function specsDir(workspaceRoot) {
|
|
5
|
+
return join(workspaceRoot, "src", "connectors", ".specs");
|
|
6
|
+
}
|
|
7
|
+
function slugDir(workspaceRoot, slug) {
|
|
8
|
+
return join(specsDir(workspaceRoot), slug);
|
|
9
|
+
}
|
|
10
|
+
export function ensureSpecDir(workspaceRoot, slug) {
|
|
11
|
+
const dir = slugDir(workspaceRoot, slug);
|
|
12
|
+
mkdirSync(dir, { recursive: true });
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
15
|
+
export function readMeta(workspaceRoot, slug) {
|
|
16
|
+
const path = join(slugDir(workspaceRoot, slug), "meta.yaml");
|
|
17
|
+
if (!existsSync(path))
|
|
18
|
+
return null;
|
|
19
|
+
return yamlParse(readFileSync(path, "utf-8"));
|
|
20
|
+
}
|
|
21
|
+
export function writeMeta(workspaceRoot, slug, meta) {
|
|
22
|
+
const dir = ensureSpecDir(workspaceRoot, slug);
|
|
23
|
+
writeFileSync(join(dir, "meta.yaml"), yamlStringify(meta));
|
|
24
|
+
}
|
|
25
|
+
export function readSpec(workspaceRoot, slug) {
|
|
26
|
+
const path = join(slugDir(workspaceRoot, slug), "openapi.yaml");
|
|
27
|
+
if (!existsSync(path))
|
|
28
|
+
return null;
|
|
29
|
+
return yamlParse(readFileSync(path, "utf-8"));
|
|
30
|
+
}
|
|
31
|
+
export function writeSpec(workspaceRoot, slug, spec) {
|
|
32
|
+
const dir = ensureSpecDir(workspaceRoot, slug);
|
|
33
|
+
writeFileSync(join(dir, "openapi.yaml"), yamlStringify(spec));
|
|
34
|
+
}
|
|
35
|
+
export function listSpecs(workspaceRoot) {
|
|
36
|
+
const dir = specsDir(workspaceRoot);
|
|
37
|
+
if (!existsSync(dir))
|
|
38
|
+
return [];
|
|
39
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
40
|
+
.filter((d) => d.isDirectory())
|
|
41
|
+
.map((d) => d.name);
|
|
42
|
+
}
|
|
43
|
+
export function slugify(name) {
|
|
44
|
+
return name
|
|
45
|
+
.toLowerCase()
|
|
46
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
47
|
+
.replace(/^-|-$/g, "");
|
|
48
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface XMugPagination {
|
|
2
|
+
style: "cursor" | "offset" | "page" | "link-header";
|
|
3
|
+
cursorParam?: string;
|
|
4
|
+
cursorPath?: string;
|
|
5
|
+
offsetParam?: string;
|
|
6
|
+
pageParam?: string;
|
|
7
|
+
pageSizeParam?: string;
|
|
8
|
+
defaultPageSize?: number;
|
|
9
|
+
maxPageSize?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface XMugRateLimits {
|
|
12
|
+
requestsPerSecond?: number;
|
|
13
|
+
requestsPerMinute?: number;
|
|
14
|
+
headerLimit?: string;
|
|
15
|
+
headerRemaining?: string;
|
|
16
|
+
headerReset?: string;
|
|
17
|
+
resetFormat?: "unix" | "seconds" | "iso8601";
|
|
18
|
+
retryAfterHeader?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface XMugSync {
|
|
21
|
+
supportsIncrementalSync: boolean;
|
|
22
|
+
filterParam?: string;
|
|
23
|
+
filterFormat?: "iso8601" | "unix" | "epoch_ms";
|
|
24
|
+
sortParam?: string;
|
|
25
|
+
sortValue?: string;
|
|
26
|
+
updatedAtField?: string;
|
|
27
|
+
deletedAtField?: string;
|
|
28
|
+
isDeletedField?: string;
|
|
29
|
+
deletionStrategy?: "soft-delete-field" | "tombstone-endpoint" | "full-sync-only";
|
|
30
|
+
}
|
|
31
|
+
export interface XMugQuirks {
|
|
32
|
+
description: string;
|
|
33
|
+
workaround?: string;
|
|
34
|
+
affectedEndpoints?: string[];
|
|
35
|
+
}
|
|
36
|
+
export type ApiType = "rest" | "graphql" | "soap" | "grpc" | "websocket" | "unknown";
|
|
37
|
+
export type ApiTier = 1 | 2 | 3;
|
|
38
|
+
export interface AuthConfig {
|
|
39
|
+
type: "api-key" | "oauth2" | "bearer" | "basic" | "custom";
|
|
40
|
+
headerName?: string;
|
|
41
|
+
tokenUrl?: string;
|
|
42
|
+
scopes?: string[];
|
|
43
|
+
notes?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ApiMetadata {
|
|
46
|
+
name: string;
|
|
47
|
+
slug: string;
|
|
48
|
+
hasApi: boolean;
|
|
49
|
+
apiType: ApiType;
|
|
50
|
+
docsUrl?: string;
|
|
51
|
+
openapiSpecUrl?: string;
|
|
52
|
+
auth?: AuthConfig;
|
|
53
|
+
tier: ApiTier;
|
|
54
|
+
alternatives?: string[];
|
|
55
|
+
lastVerified?: string;
|
|
56
|
+
notes?: string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ConnectionConfig {
|
|
2
|
+
auth: {
|
|
3
|
+
type: "api-key" | "bearer" | "basic" | "oauth2";
|
|
4
|
+
header?: string;
|
|
5
|
+
prefix?: string;
|
|
6
|
+
value: string;
|
|
7
|
+
tokenUrl?: string;
|
|
8
|
+
refreshToken?: string;
|
|
9
|
+
};
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ProbeResult {
|
|
13
|
+
probe: string;
|
|
14
|
+
status: "pass" | "fail" | "skip" | "partial";
|
|
15
|
+
summary: string;
|
|
16
|
+
details: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface VerifyResult {
|
|
19
|
+
slug: string;
|
|
20
|
+
probes: ProbeResult[];
|
|
21
|
+
enrichedSpecSaved: boolean;
|
|
22
|
+
overallStatus: "pass" | "partial" | "fail";
|
|
23
|
+
}
|
|
24
|
+
export declare function verify(workspaceRoot: string, slug: string, sourceName: string): Promise<VerifyResult>;
|