@graphprotocol/hypergraph 0.2.0 → 0.4.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/dist/cli/Cli.d.ts +2 -0
- package/dist/cli/Cli.d.ts.map +1 -0
- package/dist/cli/Cli.js +8 -0
- package/dist/cli/Cli.js.map +1 -0
- package/dist/cli/Logger.d.ts +3 -0
- package/dist/cli/Logger.d.ts.map +1 -0
- package/dist/cli/Logger.js +20 -0
- package/dist/cli/Logger.js.map +1 -0
- package/dist/cli/bin.d.ts +3 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/bun.d.ts +3 -0
- package/dist/cli/bun.d.ts.map +1 -0
- package/dist/cli/bun.js +3 -0
- package/dist/cli/bun.js.map +1 -0
- package/dist/cli/services/Typesync.d.ts +21 -0
- package/dist/cli/services/Typesync.d.ts.map +1 -0
- package/dist/cli/services/Typesync.js +137 -0
- package/dist/cli/services/Typesync.js.map +1 -0
- package/dist/cli/services/Utils.d.ts +10 -0
- package/dist/cli/services/Utils.d.ts.map +1 -0
- package/dist/cli/services/Utils.js +154 -0
- package/dist/cli/services/Utils.js.map +1 -0
- package/dist/cli/subcommands/typesync.d.ts +7 -0
- package/dist/cli/subcommands/typesync.d.ts.map +1 -0
- package/dist/cli/subcommands/typesync.js +38 -0
- package/dist/cli/subcommands/typesync.js.map +1 -0
- package/dist/entity/findMany.js.map +1 -1
- package/dist/entity/types.d.ts +4 -4
- package/dist/entity/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/mapping/Mapping.d.ts +51 -39
- package/dist/mapping/Mapping.d.ts.map +1 -1
- package/dist/mapping/Mapping.js +49 -27
- package/dist/mapping/Mapping.js.map +1 -1
- package/dist/type/type.d.ts +3 -2
- package/dist/type/type.d.ts.map +1 -1
- package/dist/type/type.js +5 -2
- package/dist/type/type.js.map +1 -1
- package/dist/type-utils/type-utils.d.ts +7 -0
- package/dist/type-utils/type-utils.d.ts.map +1 -0
- package/dist/type-utils/type-utils.js +41 -0
- package/dist/type-utils/type-utils.js.map +1 -0
- package/package.json +7 -3
- package/src/cli/Cli.ts +15 -0
- package/src/cli/Logger.ts +20 -0
- package/src/cli/bin.ts +33 -0
- package/src/cli/bun.ts +3 -0
- package/src/cli/services/Typesync.ts +189 -0
- package/src/cli/services/Utils.ts +187 -0
- package/src/cli/subcommands/typesync.ts +93 -0
- package/src/entity/findMany.ts +4 -4
- package/src/entity/types.ts +4 -4
- package/src/index.ts +2 -0
- package/src/mapping/Mapping.ts +65 -43
- package/src/type/type.ts +6 -2
- package/src/type-utils/type-utils.ts +46 -0
- package/dist/Entity.d.ts +0 -69
- package/dist/Entity.d.ts.map +0 -1
- package/dist/Entity.js +0 -174
- package/dist/Entity.js.map +0 -1
- package/dist/identity/create-identity-keys.d.ts +0 -3
- package/dist/identity/create-identity-keys.d.ts.map +0 -1
- package/dist/identity/create-identity-keys.js +0 -20
- package/dist/identity/create-identity-keys.js.map +0 -1
- package/dist/identity/login.d.ts +0 -38
- package/dist/identity/login.d.ts.map +0 -1
- package/dist/identity/login.js +0 -241
- package/dist/identity/login.js.map +0 -1
- package/dist/utils/hasArrayField.d.ts +0 -2
- package/dist/utils/hasArrayField.d.ts.map +0 -1
- package/dist/utils/hasArrayField.js +0 -5
- package/dist/utils/hasArrayField.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const run: (args: ReadonlyArray<string>) => import("effect/Effect").Effect<void, import("@effect/platform/HttpServerError").ServeError | import("@effect/cli/ValidationError").ValidationError, import("@effect/cli/CliApp").CliApp.Environment>;
|
|
2
|
+
//# sourceMappingURL=Cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cli.d.ts","sourceRoot":"","sources":["../../src/cli/Cli.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,GAAG,uOAGd,CAAC"}
|
package/dist/cli/Cli.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Command from '@effect/cli/Command';
|
|
2
|
+
import { typesync } from './subcommands/typesync.js';
|
|
3
|
+
const hypergraph = /*#__PURE__*/Command.make('hypergraph').pipe(/*#__PURE__*/Command.withDescription('Hypergraph command line interface for building and interacting with @graphprotocol/hypergraph schemas'), /*#__PURE__*/Command.withSubcommands([typesync]));
|
|
4
|
+
export const run = /*#__PURE__*/Command.run(hypergraph, {
|
|
5
|
+
name: 'hypergraph',
|
|
6
|
+
version: '0.3.0'
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=Cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cli.js","names":["Command","typesync","hypergraph","make","pipe","withDescription","withSubcommands","run","name","version"],"sources":["../../src/cli/Cli.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,OAAO,MAAM,qBAAqB;AAE9C,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,MAAMC,UAAU,gBAAGF,OAAO,CAACG,IAAI,CAAC,YAAY,CAAC,CAACC,IAAI,cAChDJ,OAAO,CAACK,eAAe,CACrB,uGAAuG,CACxG,eACDL,OAAO,CAACM,eAAe,CAAC,CAACL,QAAQ,CAAC,CAAC,CACpC;AAED,OAAO,MAAMM,GAAG,gBAAGP,OAAO,CAACO,GAAG,CAACL,UAAU,EAAE;EACzCM,IAAI,EAAE,YAAY;EAClBC,OAAO,EAAE;CACV,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/cli/Logger.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,aAAa,8BAcxB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Ansi from '@effect/printer-ansi/Ansi';
|
|
2
|
+
import * as AnsiDoc from '@effect/printer-ansi/AnsiDoc';
|
|
3
|
+
import * as EffectArray from 'effect/Array';
|
|
4
|
+
import * as Logger from 'effect/Logger';
|
|
5
|
+
export const AnsiDocLogger = /*#__PURE__*/Logger.make(({
|
|
6
|
+
message
|
|
7
|
+
}) => {
|
|
8
|
+
const messageArr = EffectArray.ensure(message);
|
|
9
|
+
for (let i = 0; i < messageArr.length; i++) {
|
|
10
|
+
const currentMessage = messageArr[i];
|
|
11
|
+
if (AnsiDoc.isDoc(currentMessage)) {
|
|
12
|
+
const prefix = AnsiDoc.text('hypergraph-cli').pipe(AnsiDoc.annotate(Ansi.cyan), AnsiDoc.squareBracketed, AnsiDoc.cat(AnsiDoc.colon));
|
|
13
|
+
const document = AnsiDoc.catWithSpace(prefix, currentMessage);
|
|
14
|
+
globalThis.console.log(AnsiDoc.render(document, {
|
|
15
|
+
style: 'pretty'
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","names":["Ansi","AnsiDoc","EffectArray","Logger","AnsiDocLogger","make","message","messageArr","ensure","i","length","currentMessage","isDoc","prefix","text","pipe","annotate","cyan","squareBracketed","cat","colon","document","catWithSpace","globalThis","console","log","render","style"],"sources":["../../src/cli/Logger.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,2BAA2B;AACjD,OAAO,KAAKC,OAAO,MAAM,8BAA8B;AACvD,OAAO,KAAKC,WAAW,MAAM,cAAc;AAC3C,OAAO,KAAKC,MAAM,MAAM,eAAe;AAEvC,OAAO,MAAMC,aAAa,gBAAGD,MAAM,CAACE,IAAI,CAAC,CAAC;EAAEC;AAAO,CAAE,KAAI;EACvD,MAAMC,UAAU,GAAGL,WAAW,CAACM,MAAM,CAACF,OAAO,CAAC;EAC9C,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,UAAU,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IAC1C,MAAME,cAAc,GAAGJ,UAAU,CAACE,CAAC,CAAC;IACpC,IAAIR,OAAO,CAACW,KAAK,CAACD,cAAc,CAAC,EAAE;MACjC,MAAME,MAAM,GAAGZ,OAAO,CAACa,IAAI,CAAC,gBAAgB,CAAC,CAACC,IAAI,CAChDd,OAAO,CAACe,QAAQ,CAAChB,IAAI,CAACiB,IAAI,CAAC,EAC3BhB,OAAO,CAACiB,eAAe,EACvBjB,OAAO,CAACkB,GAAG,CAAClB,OAAO,CAACmB,KAAK,CAAC,CAC3B;MACD,MAAMC,QAAQ,GAAGpB,OAAO,CAACqB,YAAY,CAACT,MAAM,EAAEF,cAAiC,CAAC;MAChFY,UAAU,CAACC,OAAO,CAACC,GAAG,CAACxB,OAAO,CAACyB,MAAM,CAACL,QAAQ,EAAE;QAAEM,KAAK,EAAE;MAAQ,CAAE,CAAC,CAAC;IACvE;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":""}
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { NodeContext, NodeFileSystem, NodeRuntime } from '@effect/platform-node';
|
|
3
|
+
import * as Ansi from '@effect/printer-ansi/Ansi';
|
|
4
|
+
import * as AnsiDoc from '@effect/printer-ansi/AnsiDoc';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Logger from 'effect/Logger';
|
|
7
|
+
import * as LogLevel from 'effect/LogLevel';
|
|
8
|
+
import { run } from './Cli.js';
|
|
9
|
+
import { AnsiDocLogger } from './Logger.js';
|
|
10
|
+
const runnable = /*#__PURE__*/Effect.suspend(() => run(process.argv)).pipe(/*#__PURE__*/Effect.provide(NodeFileSystem.layer), /*#__PURE__*/Effect.provide(NodeContext.layer));
|
|
11
|
+
runnable.pipe(Effect.catchAllDefect(defect => Effect.gen(function* () {
|
|
12
|
+
if (defect && typeof defect === 'object' && 'name' in defect && defect.name === 'QuitException') {
|
|
13
|
+
return yield* Effect.logError(AnsiDoc.cat(AnsiDoc.hardLine, AnsiDoc.text('Exiting...').pipe(AnsiDoc.annotate(Ansi.red))));
|
|
14
|
+
}
|
|
15
|
+
return Effect.die(defect);
|
|
16
|
+
})), Effect.provide(Logger.replace(Logger.defaultLogger, AnsiDocLogger)), Logger.withMinimumLogLevel(LogLevel.Debug), Effect.orDie, NodeRuntime.runMain({
|
|
17
|
+
disableErrorReporting: process.env.NODE_ENV === 'prod',
|
|
18
|
+
disablePrettyLogger: true
|
|
19
|
+
}));
|
|
20
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","names":["NodeContext","NodeFileSystem","NodeRuntime","Ansi","AnsiDoc","Effect","Logger","LogLevel","run","AnsiDocLogger","runnable","suspend","process","argv","pipe","provide","layer","catchAllDefect","defect","gen","name","logError","cat","hardLine","text","annotate","red","die","replace","defaultLogger","withMinimumLogLevel","Debug","orDie","runMain","disableErrorReporting","env","NODE_ENV","disablePrettyLogger"],"sources":["../../src/cli/bin.ts"],"sourcesContent":[null],"mappings":";AAEA,SAASA,WAAW,EAAEC,cAAc,EAAEC,WAAW,QAAQ,uBAAuB;AAChF,OAAO,KAAKC,IAAI,MAAM,2BAA2B;AACjD,OAAO,KAAKC,OAAO,MAAM,8BAA8B;AACvD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,QAAQ,MAAM,iBAAiB;AAE3C,SAASC,GAAG,QAAQ,UAAU;AAC9B,SAASC,aAAa,QAAQ,aA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":";AAEA,OAAO,UAAU,CAAC"}
|
package/dist/cli/bun.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.js","names":[],"sources":["../../src/cli/bun.ts"],"sourcesContent":[null],"mappings":";AAEA,OAAO,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FileSystem, Path } from '@effect/platform';
|
|
2
|
+
import { Cause, Effect, Stream } from 'effect';
|
|
3
|
+
declare const TypesyncSchemaStreamBuilder_base: Effect.Service.Class<TypesyncSchemaStreamBuilder, "/Hypergraph/cli/services/TypesyncSchemaStreamBuilder", {
|
|
4
|
+
readonly dependencies: readonly [import("effect/Layer").Layer<FileSystem.FileSystem, never, never>];
|
|
5
|
+
readonly effect: Effect.Effect<{
|
|
6
|
+
readonly hypergraphSchemaStream: (cwd?: string) => Effect.Effect<Stream.Stream<Uint8Array<ArrayBufferLike>, never, never>, never, never>;
|
|
7
|
+
}, never, FileSystem.FileSystem | Path.Path>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class TypesyncSchemaStreamBuilder extends TypesyncSchemaStreamBuilder_base {
|
|
10
|
+
}
|
|
11
|
+
export declare const layer: import("effect/Layer").Layer<TypesyncSchemaStreamBuilder, never, Path.Path>;
|
|
12
|
+
declare const MappingLoaderError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
|
|
13
|
+
readonly _tag: "/Hypergraph/cli/errors/MappingLoaderError";
|
|
14
|
+
} & Readonly<A>;
|
|
15
|
+
export declare class MappingLoaderError extends MappingLoaderError_base<{
|
|
16
|
+
readonly cause: unknown;
|
|
17
|
+
readonly message?: string;
|
|
18
|
+
}> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=Typesync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typesync.d.ts","sourceRoot":"","sources":["../../../src/cli/services/Typesync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,KAAK,EAAQ,MAAM,EAAgC,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;AAKnF,qBAAa,2BAA4B,SAAQ,gCA8KhD;CAAG;AACJ,eAAO,MAAM,KAAK,6EAAsC,CAAC;;;;AAEzD,qBAAa,kBAAmB,SAAQ,wBAA8D;IACpG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;CAAG"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { FileSystem, Path } from '@effect/platform';
|
|
2
|
+
import { NodeFileSystem } from '@effect/platform-node';
|
|
3
|
+
import { AnsiDoc } from '@effect/printer-ansi';
|
|
4
|
+
import { Cause, Data, Effect, Array as EffectArray, Option, Stream } from 'effect';
|
|
5
|
+
import { parseHypergraphMapping, parseSchema } from './Utils.js';
|
|
6
|
+
export class TypesyncSchemaStreamBuilder extends /*#__PURE__*/Effect.Service()('/Hypergraph/cli/services/TypesyncSchemaStreamBuilder', {
|
|
7
|
+
dependencies: [NodeFileSystem.layer],
|
|
8
|
+
effect: /*#__PURE__*/Effect.gen(function* () {
|
|
9
|
+
const fs = yield* FileSystem.FileSystem;
|
|
10
|
+
const path = yield* Path.Path;
|
|
11
|
+
const encoder = new TextEncoder();
|
|
12
|
+
const schemaCandidates = (cwd = '.') => EffectArray.make(path.resolve(cwd, 'schema.ts'), path.resolve(cwd, 'src/schema.ts'), path.resolve(cwd, 'app/schema.ts'), path.resolve(cwd, 'src/app/schema.ts'));
|
|
13
|
+
const mappingCandidates = (cwd = '.') => EffectArray.make(path.resolve(cwd, 'mapping.ts'), path.resolve(cwd, 'src/mapping.ts'), path.resolve(cwd, 'app/mapping.ts'), path.resolve(cwd, 'src/app/mapping.ts'));
|
|
14
|
+
const jiti = yield* Effect.tryPromise({
|
|
15
|
+
async try() {
|
|
16
|
+
const {
|
|
17
|
+
createJiti
|
|
18
|
+
} = await import('jiti');
|
|
19
|
+
return createJiti(import.meta.url, {
|
|
20
|
+
moduleCache: false,
|
|
21
|
+
tryNative: false
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
catch(cause) {
|
|
25
|
+
return new MappingLoaderError({
|
|
26
|
+
cause
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}).pipe(Effect.cached);
|
|
30
|
+
const loadMapping = Effect.fnUntraced(function* (mappingFilePath) {
|
|
31
|
+
return yield* Effect.tryMapPromise(jiti, {
|
|
32
|
+
try(instance) {
|
|
33
|
+
return instance.import(mappingFilePath);
|
|
34
|
+
},
|
|
35
|
+
catch(cause) {
|
|
36
|
+
return cause;
|
|
37
|
+
}
|
|
38
|
+
}).pipe(Effect.map(parseHypergraphMapping), Effect.mapError(cause => new MappingLoaderError({
|
|
39
|
+
cause,
|
|
40
|
+
message: `Failed to load mapping file ${mappingFilePath}`
|
|
41
|
+
})), Effect.tapErrorCause(cause => Effect.logWarning(AnsiDoc.cats([AnsiDoc.text('Failure loading mapping'), AnsiDoc.text(Cause.pretty(cause))]))), Effect.orElseSucceed(() => ({})));
|
|
42
|
+
});
|
|
43
|
+
const findHypergraphSchema = Effect.fnUntraced(function* (candidates) {
|
|
44
|
+
return yield* Effect.findFirst(candidates, _ => fs.exists(_).pipe(Effect.orElseSucceed(() => false)));
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Reads the schema.ts file, and maybe reads the mapping.ts file (if exists).
|
|
48
|
+
* Parses the schema and from it, plus the loaded mapping, creates a Stream of the Hypergraph [Schema](../../mapping/Mapping.ts).
|
|
49
|
+
* This represents the state of the schema when the user hits the schema stream endpoint
|
|
50
|
+
*
|
|
51
|
+
* @param schemaFilePath path of the schema.ts file
|
|
52
|
+
* @param mappingFilePath [Optional] path of the mapping.ts file
|
|
53
|
+
* @returns A stream of [Schema](../../mapping/Mapping.ts) pared from the schema.ts file
|
|
54
|
+
*/
|
|
55
|
+
const currentSchemaStream = (schemaFilePath, mappingFilePath) => Stream.fromEffect(Effect.gen(function* () {
|
|
56
|
+
const schema = yield* Option.match(schemaFilePath, {
|
|
57
|
+
onNone: () => Effect.succeed(''),
|
|
58
|
+
onSome: fs.readFileString
|
|
59
|
+
});
|
|
60
|
+
const mapping = yield* Option.match(mappingFilePath, {
|
|
61
|
+
onNone: () => Effect.succeed({}),
|
|
62
|
+
onSome: loadMapping
|
|
63
|
+
});
|
|
64
|
+
return yield* parseSchema(schema, mapping);
|
|
65
|
+
})).pipe(Stream.tapErrorCause(cause => Effect.logError(AnsiDoc.text('Failure parsing current schema into types'), AnsiDoc.text(Cause.pretty(cause)))),
|
|
66
|
+
// if failure, don't bubble to return and just return empty schema
|
|
67
|
+
Stream.orElseSucceed(() => ({
|
|
68
|
+
types: []
|
|
69
|
+
})));
|
|
70
|
+
/**
|
|
71
|
+
* Reads the schema.ts file, and maybe reads the mapping.ts file (if exists).
|
|
72
|
+
* Parses the schema and from it, plus the loaded mapping, creates a Stream of the Hypergraph [Schema](../../mapping/Mapping.ts).
|
|
73
|
+
* This stream watches for changes in both the schema.ts file and (if provided) the mapping.ts file.
|
|
74
|
+
* This way, if the user updates either, this will emit an event on the stream of the updated schema.
|
|
75
|
+
*
|
|
76
|
+
* @param schemaFilePath path of the schema.ts file
|
|
77
|
+
* @param mappingFilePath [Optional] path of the mapping.ts file
|
|
78
|
+
* @returns A stream of [Schema](../../mapping/Mapping.ts) pared from the schema.ts file
|
|
79
|
+
*/
|
|
80
|
+
const watchSchemaStream = (schemaFilePath, mappingFilePath) => {
|
|
81
|
+
const schemaWatch = Option.match(schemaFilePath, {
|
|
82
|
+
// @todo watch the root here so if a schema is created, it will get picked up
|
|
83
|
+
onNone: () => Stream.empty,
|
|
84
|
+
onSome: fs.watch
|
|
85
|
+
});
|
|
86
|
+
const mappingWatch = Option.match(mappingFilePath, {
|
|
87
|
+
onNone: () => Stream.empty,
|
|
88
|
+
onSome: fs.watch
|
|
89
|
+
});
|
|
90
|
+
return Stream.mergeAll([schemaWatch, mappingWatch], {
|
|
91
|
+
concurrency: 2
|
|
92
|
+
}).pipe(Stream.buffer({
|
|
93
|
+
capacity: 1,
|
|
94
|
+
strategy: 'sliding'
|
|
95
|
+
}), Stream.mapEffect(() => Effect.gen(function* () {
|
|
96
|
+
const schema = yield* Option.match(schemaFilePath, {
|
|
97
|
+
onNone: () => Effect.succeed(''),
|
|
98
|
+
onSome: fs.readFileString
|
|
99
|
+
});
|
|
100
|
+
const mapping = yield* Option.match(mappingFilePath, {
|
|
101
|
+
onNone: () => Effect.succeed({}),
|
|
102
|
+
onSome: loadMapping
|
|
103
|
+
});
|
|
104
|
+
return yield* parseSchema(schema, mapping);
|
|
105
|
+
})), Stream.tapErrorCause(cause => Effect.logError(AnsiDoc.text('Failure parsing schema changes into types'), {
|
|
106
|
+
cause: Cause.pretty(cause)
|
|
107
|
+
})),
|
|
108
|
+
// if failure, don't bubble to return and just return empty schema
|
|
109
|
+
Stream.orElseSucceed(() => ({
|
|
110
|
+
types: []
|
|
111
|
+
})));
|
|
112
|
+
};
|
|
113
|
+
const hypergraphSchemaStream = (cwd = '.') => Effect.gen(function* () {
|
|
114
|
+
const schemaFileCandidates = schemaCandidates(cwd);
|
|
115
|
+
// Fetch the Schema definition from any schema.ts in the directory.
|
|
116
|
+
// If exists, use it to parse the Hypergraph schema
|
|
117
|
+
const schemaFilePath = yield* findHypergraphSchema(schemaFileCandidates);
|
|
118
|
+
if (Option.isNone(schemaFilePath)) {
|
|
119
|
+
yield* Effect.logDebug(AnsiDoc.text('No Hypergraph schema file found. Searched:'), AnsiDoc.cats(schemaFileCandidates.map(candidate => AnsiDoc.text(candidate))));
|
|
120
|
+
}
|
|
121
|
+
// Fetch the Mapping definition from any mapping.ts in the directory.
|
|
122
|
+
// If exists, use it to get the knowledgeGraphId for each type/property in the parsed schema
|
|
123
|
+
const mappingFilePath = yield* findHypergraphSchema(mappingCandidates(cwd));
|
|
124
|
+
return currentSchemaStream(schemaFilePath, mappingFilePath).pipe(Stream.concat(watchSchemaStream(schemaFilePath, mappingFilePath)), Stream.map(stream => {
|
|
125
|
+
const jsonData = JSON.stringify(stream);
|
|
126
|
+
const sseData = `data: ${jsonData}\n\n`;
|
|
127
|
+
return encoder.encode(sseData);
|
|
128
|
+
}));
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
hypergraphSchemaStream
|
|
132
|
+
};
|
|
133
|
+
})
|
|
134
|
+
}) {}
|
|
135
|
+
export const layer = TypesyncSchemaStreamBuilder.Default;
|
|
136
|
+
export class MappingLoaderError extends /*#__PURE__*/Data.TaggedError('/Hypergraph/cli/errors/MappingLoaderError') {}
|
|
137
|
+
//# sourceMappingURL=Typesync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typesync.js","names":["FileSystem","Path","NodeFileSystem","AnsiDoc","Cause","Data","Effect","Array","EffectArray","Option","Stream","parseHypergraphMapping","parseSchema","TypesyncSchemaStreamBuilder","Service","dependencies","layer","effect","gen","fs","path","encoder","TextEncoder","schemaCandidates","cwd","make","resolve","mappingCandidates","jiti","tryPromise","try","createJiti","import","meta","url","moduleCache","tryNative","catch","cause","MappingLoaderError","pipe","cached","loadMapping","fnUntraced","mappingFilePath","tryMapPromise","instance","map","mapError","message","tapErrorCause","logWarning","cats","text","pretty","orElseSucceed","findHypergraphSchema","candidates","findFirst","_","exists","currentSchemaStream","schemaFilePath","fromEffect","schema","match","onNone","succeed","onSome","readFileString","mapping","logError","types","watchSchemaStream","schemaWatch","empty","watch","mappingWatch","mergeAll","concurrency","buffer","capacity","strategy","mapEffect","hypergraphSchemaStream","schemaFileCandidates","isNone","logDebug","candidate","concat","stream","jsonData","JSON","stringify","sseData","encode","Default","TaggedError"],"sources":["../../../src/cli/services/Typesync.ts"],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IACH,CAAC,CAAC;IAEJ,OAAO;MAAEV;IAAsB,CAAW;EAC5C,CAAC;CACF,CACF;AACD,OAAO,MAAMpE,KAAK,GAAGH,2BAA2B,CAACmF,OAAO;AAExD,OAAM,MAAOzD,kBAAmB,sBAAQlC,IAAI,CAAC4F,WAAW,CAAC,2CAA2C,CAGlG","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const SchemaParserFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "/Hypergraph/cli/errors/SchemaParserFailure";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
export declare class SchemaParserFailure extends SchemaParserFailure_base<{
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly cause: unknown;
|
|
7
|
+
}> {
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/cli/services/Utils.ts"],"names":[],"mappings":";;;AA2HA,qBAAa,mBAAoB,SAAQ,yBAA+D;IACtG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Data, Effect, Array as EffectArray } from 'effect';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
import * as Mapping from '../../mapping/Mapping.js';
|
|
4
|
+
import * as Utils from '../../mapping/Utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Takes a parsed schema.ts file and maps it to a the Mapping.Schema type.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*
|
|
10
|
+
* @param sourceCode the read schema.ts file
|
|
11
|
+
* @param mapping the parsed mappint.ts file
|
|
12
|
+
* @returns the parsed Schema instance
|
|
13
|
+
*/
|
|
14
|
+
export const parseSchema = (sourceCode, mapping) => Effect.try({
|
|
15
|
+
try() {
|
|
16
|
+
const sourceFile = ts.createSourceFile('schema.ts', sourceCode, ts.ScriptTarget.Latest, true);
|
|
17
|
+
const entities = [];
|
|
18
|
+
const visit = node => {
|
|
19
|
+
if (ts.isClassDeclaration(node) && node.name) {
|
|
20
|
+
const className = node.name.text;
|
|
21
|
+
const properties = [];
|
|
22
|
+
// Find the Entity.Class call
|
|
23
|
+
if (node.heritageClauses) {
|
|
24
|
+
for (const clause of node.heritageClauses) {
|
|
25
|
+
for (const type of clause.types) {
|
|
26
|
+
if (ts.isCallExpression(type.expression)) {
|
|
27
|
+
const callExpr = type.expression;
|
|
28
|
+
// Look for the object literal with properties
|
|
29
|
+
if (callExpr.arguments.length > 0) {
|
|
30
|
+
const arg = callExpr.arguments[0];
|
|
31
|
+
if (ts.isObjectLiteralExpression(arg)) {
|
|
32
|
+
for (const prop of arg.properties) {
|
|
33
|
+
if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
|
|
34
|
+
const propName = prop.name.text;
|
|
35
|
+
let dataType = 'String';
|
|
36
|
+
let relationType;
|
|
37
|
+
const mappingEntry = mapping[className];
|
|
38
|
+
const camelCasePropName = Utils.toCamelCase(propName);
|
|
39
|
+
// Extract the type
|
|
40
|
+
if (ts.isPropertyAccessExpression(prop.initializer)) {
|
|
41
|
+
// Simple types like Type.Text
|
|
42
|
+
dataType = Mapping.getDataType(prop.initializer.name.text);
|
|
43
|
+
// Look up the property's knowledgeGraphId from the mapping
|
|
44
|
+
const propKnowledgeGraphId = mappingEntry?.properties?.[camelCasePropName] || null;
|
|
45
|
+
// push to type properties as primitive property
|
|
46
|
+
properties.push({
|
|
47
|
+
name: propName,
|
|
48
|
+
dataType: dataType,
|
|
49
|
+
knowledgeGraphId: propKnowledgeGraphId
|
|
50
|
+
});
|
|
51
|
+
} else if (ts.isCallExpression(prop.initializer)) {
|
|
52
|
+
// Relation types like Type.Relation(User)
|
|
53
|
+
const callNode = prop.initializer;
|
|
54
|
+
if (ts.isPropertyAccessExpression(callNode.expression)) {
|
|
55
|
+
const typeName = callNode.expression.name.text;
|
|
56
|
+
if (typeName === 'Relation' && callNode.arguments.length > 0) {
|
|
57
|
+
const relationArg = callNode.arguments[0];
|
|
58
|
+
if (ts.isIdentifier(relationArg)) {
|
|
59
|
+
relationType = relationArg.text;
|
|
60
|
+
dataType = `Relation(${relationType})`;
|
|
61
|
+
// Look up the relation property's knowledgeGraphId from the mapping
|
|
62
|
+
const relKnowledgeGraphId = mappingEntry?.relations?.[camelCasePropName] || null;
|
|
63
|
+
// push to type properties as relation property
|
|
64
|
+
properties.push({
|
|
65
|
+
name: propName,
|
|
66
|
+
dataType,
|
|
67
|
+
relationType,
|
|
68
|
+
knowledgeGraphId: relKnowledgeGraphId
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Look up the type's knowledgeGraphId from the mapping
|
|
83
|
+
const mappingEntry = mapping[Utils.toPascalCase(className)];
|
|
84
|
+
const typeKnowledgeGraphId = mappingEntry?.typeIds?.[0] ? mappingEntry.typeIds[0] : null;
|
|
85
|
+
entities.push({
|
|
86
|
+
name: className,
|
|
87
|
+
knowledgeGraphId: typeKnowledgeGraphId,
|
|
88
|
+
properties
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
ts.forEachChild(node, visit);
|
|
92
|
+
};
|
|
93
|
+
visit(sourceFile);
|
|
94
|
+
return {
|
|
95
|
+
types: entities
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
catch(error) {
|
|
99
|
+
return new SchemaParserFailure({
|
|
100
|
+
message: `Failed to parse schema: ${error}`,
|
|
101
|
+
cause: error
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export class SchemaParserFailure extends /*#__PURE__*/Data.TaggedError('/Hypergraph/cli/errors/SchemaParserFailure') {}
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
*
|
|
109
|
+
* Runtime check to see if a value looks like a Mapping
|
|
110
|
+
*/
|
|
111
|
+
function isMappingLike(value) {
|
|
112
|
+
if (!value || typeof value !== 'object') return false;
|
|
113
|
+
return Object.values(value).every(entry => entry && typeof entry === 'object' && 'typeIds' in entry &&
|
|
114
|
+
// biome-ignore lint/suspicious/noExplicitAny: parsing so type unknown
|
|
115
|
+
EffectArray.isArray(entry.typeIds));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
*
|
|
120
|
+
* Look at the exported object from the mapping.ts file loaded via jiti and try to pull out the hypergraph mapping.
|
|
121
|
+
* Default should be:
|
|
122
|
+
* ```typescript
|
|
123
|
+
* export const mapping: Mapping
|
|
124
|
+
* ```
|
|
125
|
+
* But this is not guaranteed. This function looks through the file to try to find it using some logical defaults/checks.
|
|
126
|
+
*
|
|
127
|
+
* @param moduleExport the object imported from jiti from the mapping.ts file
|
|
128
|
+
*/
|
|
129
|
+
// biome-ignore lint/suspicious/noExplicitAny: type should be import object from jiti
|
|
130
|
+
export function parseHypergraphMapping(moduleExport) {
|
|
131
|
+
// Handle null/undefined inputs
|
|
132
|
+
if (!moduleExport || typeof moduleExport !== 'object') {
|
|
133
|
+
return {};
|
|
134
|
+
}
|
|
135
|
+
// Find all exports that look like Mapping objects
|
|
136
|
+
const mappingCandidates = Object.entries(moduleExport).filter(([, value]) => isMappingLike(value));
|
|
137
|
+
if (mappingCandidates.length === 0) {
|
|
138
|
+
return {};
|
|
139
|
+
}
|
|
140
|
+
if (mappingCandidates.length === 1) {
|
|
141
|
+
return mappingCandidates[0][1];
|
|
142
|
+
}
|
|
143
|
+
// Multiple candidates - prefer common names
|
|
144
|
+
const preferredNames = ['mapping', 'default', 'config'];
|
|
145
|
+
for (const preferredName of preferredNames) {
|
|
146
|
+
const found = mappingCandidates.find(([name]) => name === preferredName);
|
|
147
|
+
if (found) {
|
|
148
|
+
return found[1];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// If no preferred names found, use the first one
|
|
152
|
+
return mappingCandidates[0][1];
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","names":["Data","Effect","Array","EffectArray","ts","Mapping","Utils","parseSchema","sourceCode","mapping","try","sourceFile","createSourceFile","ScriptTarget","Latest","entities","visit","node","isClassDeclaration","name","className","text","properties","heritageClauses","clause","type","types","isCallExpression","expression","callExpr","arguments","length","arg","isObjectLiteralExpression","prop","isPropertyAssignment","isIdentifier","propName","dataType","relationType","mappingEntry","camelCasePropName","toCamelCase","isPropertyAccessExpression","initializer","getDataType","propKnowledgeGraphId","push","knowledgeGraphId","callNode","typeName","relationArg","relKnowledgeGraphId","relations","toPascalCase","typeKnowledgeGraphId","typeIds","forEachChild","catch","error","SchemaParserFailure","message","cause","TaggedError","isMappingLike","value","Object","values","every","entry","isArray","parseHypergraphMapping","moduleExport","mappingCandidates","entries","filter","preferredNames","preferredName","found","find"],"sources":["../../../src/cli/services/Utils.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,IAAI,EAAEC,MAAM,EAAEC,KAAK,IAAIC,WAAW,QAAQ,QAAQ;AAC3D,OAAOC,EAAE,MAAM,YAAY;AAE3B,OAAO,KAAKC,OAAO,MAAM,0BAA0B;AACnD,OAAO,KAAKC,KAAK,MAAM,wBAAwB;AAE/C;;;;;;;;;AASA,OAAO,MAAMC,WAAW,GAAGA,CACzBC,UAAkB,EAClBC,OAAwB,KAExBR,MAAM,CAACS,GAAG,CAAC;EACTA,GAAGA,CAAA;IAC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AsBA,CAACC,YAAiB;EACtD;EACA,IAAI,CAACA,YAAY,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;IACrD,OAAO,EAAqB;EAC9B;EAEA;EACA,MAAMC,iBAAiB,GAAGP,MAAM,CAACQ,OAAO,CAACF,YAAY,CAAC,CAACG,MAAM,CAAC,CAAC,GAAGV,KAAK,CAAC,KAAKD,aAAa,CAACC,KAAK,CAAC,CAAC;EAElG,IAAIQ,iBAAiB,CAAC1C,MAAM,KAAK,CAAC,EAAE;IAClC,OAAO,EAAqB;EAC9B;EAEA,IAAI0C,iBAAiB,CAAC1C,MAAM,KAAK,CAAC,EAAE;IAClC,OAAO0C,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAoB;EACnD;EAEA;EACA,MAAMG,cAAc,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;EACvD,KAAK,MAAMC,aAAa,IAAID,cAAc,EAAE;IAC1C,MAAME,KAAK,GAAGL,iBAAiB,CAACM,IAAI,CAAC,CAAC,CAAC5D,IAAI,CAAC,KAAKA,IAAI,KAAK0D,aAAa,CAAC;IACxE,IAAIC,KAAK,EAAE;MACT,OAAOA,KAAK,CAAC,CAAC,CAAoB;IACpC;EACF;EAEA;EACA,OAAOL,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAoB;AACnD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesync.d.ts","sourceRoot":"","sources":["../../../src/cli/subcommands/typesync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAW,MAAM,aAAa,CAAC;AAmE/C,eAAO,MAAM,QAAQ;;;;EAwBpB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { Command, Options } from '@effect/cli';
|
|
3
|
+
import { HttpApi, HttpApiBuilder, HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiSchema, HttpMiddleware, HttpServer, HttpServerResponse } from '@effect/platform';
|
|
4
|
+
import { NodeHttpServer } from '@effect/platform-node';
|
|
5
|
+
import { AnsiDoc } from '@effect/printer-ansi';
|
|
6
|
+
import { Effect, Layer, Schema } from 'effect';
|
|
7
|
+
import * as Typesync from '../services/Typesync.js';
|
|
8
|
+
const hypergraphTypeSyncApi = /*#__PURE__*/HttpApi.make('HypergraphTypeSyncApi').add(HttpApiGroup.make('SchemaStreamGroup').add(
|
|
9
|
+
// exposes an api endpoint at /api/vX/schema/events that is a stream of the current Schema parsed from the directory the hypergraph-cli tool is running in
|
|
10
|
+
HttpApiEndpoint.get('HypergraphSchemaEventStream')`/schema/events`.addError(HttpApiError.InternalServerError).addSuccess(Schema.String.pipe(HttpApiSchema.withEncoding({
|
|
11
|
+
kind: 'Json',
|
|
12
|
+
contentType: 'text/event-stream'
|
|
13
|
+
})))).prefix('/v1')).prefix('/api');
|
|
14
|
+
const hypergraphTypeSyncApiLive = /*#__PURE__*/HttpApiBuilder.group(hypergraphTypeSyncApi, 'SchemaStreamGroup', handlers => handlers.handle('HypergraphSchemaEventStream', () => Effect.gen(function* () {
|
|
15
|
+
const schemaStream = yield* Typesync.TypesyncSchemaStreamBuilder;
|
|
16
|
+
const stream = yield* schemaStream.hypergraphSchemaStream().pipe(Effect.catchAll(() => new HttpApiError.InternalServerError()));
|
|
17
|
+
return yield* HttpServerResponse.stream(stream, {
|
|
18
|
+
contentType: 'text/event-stream'
|
|
19
|
+
}).pipe(HttpServerResponse.setHeaders({
|
|
20
|
+
'Content-Type': 'text/event-stream',
|
|
21
|
+
'Cache-Control': 'no-cache',
|
|
22
|
+
Connection: 'keep-alive'
|
|
23
|
+
}));
|
|
24
|
+
})));
|
|
25
|
+
const HypergraphTypeSyncApiLive = /*#__PURE__*/HttpApiBuilder.api(hypergraphTypeSyncApi).pipe(/*#__PURE__*/Layer.provide(hypergraphTypeSyncApiLive), /*#__PURE__*/Layer.provide(Typesync.layer));
|
|
26
|
+
const HypergraphTypeSyncApiLayer = /*#__PURE__*/HttpApiBuilder.serve(HttpMiddleware.logger).pipe(/*#__PURE__*/Layer.provide(/*#__PURE__*/HttpApiBuilder.middlewareCors()), /*#__PURE__*/Layer.provide(HypergraphTypeSyncApiLive));
|
|
27
|
+
export const typesync = /*#__PURE__*/Command.make('typesync', {
|
|
28
|
+
args: {
|
|
29
|
+
port: Options.integer('port').pipe(Options.withAlias('p'), Options.withDefault(3000), Options.withDescription('The port to run the Hypergraph TypeSync studio server on. Default 3000'))
|
|
30
|
+
}
|
|
31
|
+
}).pipe(/*#__PURE__*/Command.withDescription('Opens the TypeSync studio to help users build and publish their Hypergraph application schema'), /*#__PURE__*/Command.withHandler(({
|
|
32
|
+
args
|
|
33
|
+
}) => Effect.gen(function* () {
|
|
34
|
+
yield* HypergraphTypeSyncApiLayer.pipe(HttpServer.withLogAddress, Layer.provide(NodeHttpServer.layer(createServer, {
|
|
35
|
+
port: args.port
|
|
36
|
+
})), Layer.tap(() => Effect.logInfo(AnsiDoc.text(`🎉 TypeSync studio started and running at http://localhost:${args.port}`))), Layer.launch);
|
|
37
|
+
})));
|
|
38
|
+
//# sourceMappingURL=typesync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesync.js","names":["createServer","Command","Options","HttpApi","HttpApiBuilder","HttpApiEndpoint","HttpApiError","HttpApiGroup","HttpApiSchema","HttpMiddleware","HttpServer","HttpServerResponse","NodeHttpServer","AnsiDoc","Effect","Layer","Schema","Typesync","hypergraphTypeSyncApi","make","add","get","addError","InternalServerError","addSuccess","String","pipe","withEncoding","kind","contentType","prefix","hypergraphTypeSyncApiLive","group","handlers","handle","gen","schemaStream","TypesyncSchemaStreamBuilder","stream","hypergraphSchemaStream","catchAll","setHeaders","Connection","HypergraphTypeSyncApiLive","api","provide","layer","HypergraphTypeSyncApiLayer","serve","logger","middlewareCors","typesync","args","port","integer","withAlias","withDefault","withDescription","withHandler","withLogAddress","tap","logInfo","text","launch"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