@dagger.io/dagger 0.13.7 → 0.15.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/{api → src/api}/client.gen.d.ts +304 -370
- package/dist/src/api/client.gen.d.ts.map +1 -0
- package/dist/{api → src/api}/client.gen.js +1385 -3821
- package/dist/src/common/context.d.ts +12 -0
- package/dist/src/common/context.d.ts.map +1 -0
- package/dist/src/common/context.js +22 -0
- package/dist/{common → src/common}/errors/DaggerSDKError.d.ts +1 -1
- package/dist/src/common/errors/DaggerSDKError.d.ts.map +1 -0
- package/dist/src/common/errors/DockerImageRefValidationError.d.ts.map +1 -0
- package/dist/src/common/errors/EngineSessionConnectParamsParseError.d.ts.map +1 -0
- package/dist/src/common/errors/EngineSessionConnectionTimeoutError.d.ts.map +1 -0
- package/dist/src/common/errors/EngineSessionErrorOptions.d.ts.map +1 -0
- package/dist/{common → src/common}/errors/ExecError.d.ts +0 -1
- package/dist/src/common/errors/ExecError.d.ts.map +1 -0
- package/dist/{common → src/common}/errors/ExecError.js +0 -3
- package/dist/src/common/errors/FunctionNotFound.d.ts.map +1 -0
- package/dist/src/common/errors/GraphQLRequestError.d.ts.map +1 -0
- package/dist/src/common/errors/InitEngineSessionBinaryError.d.ts.map +1 -0
- package/dist/src/common/errors/IntrospectionError.d.ts +7 -0
- package/dist/src/common/errors/IntrospectionError.d.ts.map +1 -0
- package/dist/src/common/errors/IntrospectionError.js +9 -0
- package/dist/src/common/errors/NotAwaitedRequestError.d.ts.map +1 -0
- package/dist/src/common/errors/TooManyNestedObjectsError.d.ts.map +1 -0
- package/dist/src/common/errors/UnknownDaggerError.d.ts.map +1 -0
- package/dist/{common → src/common}/errors/errors-codes.d.ts +4 -0
- package/dist/src/common/errors/errors-codes.d.ts.map +1 -0
- package/dist/{common → src/common}/errors/errors-codes.js +4 -0
- package/dist/{common → src/common}/errors/index.d.ts +2 -0
- package/dist/src/common/errors/index.d.ts.map +1 -0
- package/dist/{common → src/common}/errors/index.js +2 -0
- package/dist/src/common/graphql/client.d.ts.map +1 -0
- package/dist/{api/utils.d.ts → src/common/graphql/compute_query.d.ts} +10 -2
- package/dist/src/common/graphql/compute_query.d.ts.map +1 -0
- package/dist/{api/utils.js → src/common/graphql/compute_query.js} +4 -4
- package/dist/src/common/graphql/connect.d.ts +8 -0
- package/dist/src/common/graphql/connect.d.ts.map +1 -0
- package/dist/src/common/graphql/connect.js +22 -0
- package/dist/src/common/graphql/connection.d.ts +14 -0
- package/dist/src/common/graphql/connection.d.ts.map +1 -0
- package/dist/src/common/graphql/connection.js +23 -0
- package/dist/{common → src/common}/utils.d.ts +4 -4
- package/dist/src/common/utils.d.ts.map +1 -0
- package/dist/{connect.d.ts → src/connect.d.ts} +0 -4
- package/dist/src/connect.d.ts.map +1 -0
- package/dist/{connect.js → src/connect.js} +21 -23
- package/dist/src/connectOpts.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +5 -5
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +10 -0
- package/dist/{introspector/decorators → src/module}/decorators.d.ts +3 -3
- package/dist/src/module/decorators.d.ts.map +1 -0
- package/dist/{introspector/decorators → src/module}/decorators.js +1 -1
- package/dist/{entrypoint → src/module/entrypoint}/context.d.ts +1 -1
- package/dist/src/module/entrypoint/context.d.ts.map +1 -0
- package/dist/src/module/entrypoint/entrypoint.d.ts +2 -0
- package/dist/src/module/entrypoint/entrypoint.d.ts.map +1 -0
- package/dist/{entrypoint → src/module/entrypoint}/entrypoint.js +7 -16
- package/dist/{entrypoint → src/module/entrypoint}/invoke.d.ts +2 -2
- package/dist/src/module/entrypoint/invoke.d.ts.map +1 -0
- package/dist/{entrypoint → src/module/entrypoint}/invoke.js +2 -2
- package/dist/{entrypoint → src/module/entrypoint}/load.d.ts +6 -11
- package/dist/src/module/entrypoint/load.d.ts.map +1 -0
- package/dist/{entrypoint → src/module/entrypoint}/load.js +15 -5
- package/dist/src/module/entrypoint/register.d.ts +7 -0
- package/dist/src/module/entrypoint/register.d.ts.map +1 -0
- package/dist/{entrypoint → src/module/entrypoint}/register.js +3 -3
- package/dist/{introspector/executor → src/module}/executor.d.ts +4 -2
- package/dist/src/module/executor.d.ts.map +1 -0
- package/dist/src/module/executor.js +45 -0
- package/dist/src/module/introspector/case_convertor.d.ts +2 -0
- package/dist/src/module/introspector/case_convertor.d.ts.map +1 -0
- package/dist/src/module/introspector/case_convertor.js +17 -0
- package/dist/src/module/introspector/dagger_module/argument.d.ts +47 -0
- package/dist/src/module/introspector/dagger_module/argument.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/argument.js +109 -0
- package/dist/src/module/introspector/dagger_module/constructor.d.ts +18 -0
- package/dist/src/module/introspector/dagger_module/constructor.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/constructor.js +38 -0
- package/dist/src/module/introspector/dagger_module/decorator.d.ts +7 -0
- package/dist/src/module/introspector/dagger_module/decorator.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/decorator.js +6 -0
- package/dist/src/module/introspector/dagger_module/enum.d.ts +37 -0
- package/dist/src/module/introspector/dagger_module/enum.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/enum.js +55 -0
- package/dist/src/module/introspector/dagger_module/enumBase.d.ts +17 -0
- package/dist/src/module/introspector/dagger_module/enumBase.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/enumClass.d.ts +37 -0
- package/dist/src/module/introspector/dagger_module/enumClass.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/enumClass.js +61 -0
- package/dist/src/module/introspector/dagger_module/function.d.ts +35 -0
- package/dist/src/module/introspector/dagger_module/function.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/function.js +86 -0
- package/dist/src/module/introspector/dagger_module/index.d.ts +13 -0
- package/dist/src/module/introspector/dagger_module/index.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/index.js +12 -0
- package/dist/src/module/introspector/dagger_module/module.d.ts +110 -0
- package/dist/src/module/introspector/dagger_module/module.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/module.js +275 -0
- package/dist/src/module/introspector/dagger_module/object.d.ts +29 -0
- package/dist/src/module/introspector/dagger_module/object.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/object.js +91 -0
- package/dist/src/module/introspector/dagger_module/objectBase.d.ts +29 -0
- package/dist/src/module/introspector/dagger_module/objectBase.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/property.d.ts +33 -0
- package/dist/src/module/introspector/dagger_module/property.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/property.js +76 -0
- package/dist/src/module/introspector/dagger_module/reference.d.ts +13 -0
- package/dist/src/module/introspector/dagger_module/reference.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/reference.js +33 -0
- package/dist/src/module/introspector/dagger_module/typeObject.d.ts +25 -0
- package/dist/src/module/introspector/dagger_module/typeObject.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/typeObject.js +58 -0
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts +31 -0
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts.map +1 -0
- package/dist/src/module/introspector/dagger_module/typeObjectProperty.js +54 -0
- package/dist/src/module/introspector/index.d.ts +3 -0
- package/dist/src/module/introspector/index.d.ts.map +1 -0
- package/dist/src/module/introspector/index.js +16 -0
- package/dist/{introspector/scanner/typeDefs.d.ts → src/module/introspector/typedef.d.ts} +1 -1
- package/dist/src/module/introspector/typedef.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/ast.d.ts +42 -0
- package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/ast.js +254 -0
- package/dist/src/module/introspector/typescript_module/declarations.d.ts +15 -0
- package/dist/src/module/introspector/typescript_module/declarations.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/declarations.js +10 -0
- package/dist/src/module/introspector/typescript_module/explorer.d.ts +4 -0
- package/dist/src/module/introspector/typescript_module/explorer.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/explorer.js +16 -0
- package/dist/src/module/introspector/typescript_module/index.d.ts +4 -0
- package/dist/src/module/introspector/typescript_module/index.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/index.js +3 -0
- package/dist/src/module/introspector/typescript_module/typedef_utils.d.ts +5 -0
- package/dist/src/module/introspector/typescript_module/typedef_utils.d.ts.map +1 -0
- package/dist/src/module/introspector/typescript_module/typedef_utils.js +26 -0
- package/dist/src/module/introspector/utils/files.d.ts.map +1 -0
- package/dist/{introspector → src/module/introspector}/utils/files.js +1 -1
- package/dist/src/module/registry.d.ts.map +1 -0
- package/dist/{introspector/registry → src/module}/registry.js +1 -1
- package/dist/src/provisioning/bin.d.ts.map +1 -0
- package/dist/{provisioning → src/provisioning}/bin.js +1 -1
- package/dist/src/provisioning/default.d.ts +2 -0
- package/dist/src/provisioning/default.d.ts.map +1 -0
- package/dist/{provisioning → src/provisioning}/default.js +1 -1
- package/dist/src/provisioning/engineconn.d.ts +30 -0
- package/dist/src/provisioning/engineconn.d.ts.map +1 -0
- package/dist/src/provisioning/engineconn.js +1 -0
- package/dist/src/provisioning/index.d.ts +4 -0
- package/dist/src/provisioning/index.d.ts.map +1 -0
- package/dist/src/provisioning/index.js +14 -0
- package/dist/src/telemetry/index.d.ts.map +1 -0
- package/dist/src/telemetry/init.d.ts.map +1 -0
- package/dist/src/telemetry/telemetry.d.ts.map +1 -0
- package/dist/src/telemetry/tracer.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/api/client.gen.d.ts.map +0 -1
- package/dist/api/utils.d.ts.map +0 -1
- package/dist/common/errors/DaggerSDKError.d.ts.map +0 -1
- package/dist/common/errors/DockerImageRefValidationError.d.ts.map +0 -1
- package/dist/common/errors/EngineSessionConnectParamsParseError.d.ts.map +0 -1
- package/dist/common/errors/EngineSessionConnectionTimeoutError.d.ts.map +0 -1
- package/dist/common/errors/EngineSessionErrorOptions.d.ts.map +0 -1
- package/dist/common/errors/ExecError.d.ts.map +0 -1
- package/dist/common/errors/FunctionNotFound.d.ts.map +0 -1
- package/dist/common/errors/GraphQLRequestError.d.ts.map +0 -1
- package/dist/common/errors/InitEngineSessionBinaryError.d.ts.map +0 -1
- package/dist/common/errors/NotAwaitedRequestError.d.ts.map +0 -1
- package/dist/common/errors/TooManyNestedObjectsError.d.ts.map +0 -1
- package/dist/common/errors/UnknownDaggerError.d.ts.map +0 -1
- package/dist/common/errors/errors-codes.d.ts.map +0 -1
- package/dist/common/errors/index.d.ts.map +0 -1
- package/dist/common/utils.d.ts.map +0 -1
- package/dist/connect.d.ts.map +0 -1
- package/dist/connectOpts.d.ts.map +0 -1
- package/dist/context/builder.d.ts +0 -9
- package/dist/context/builder.d.ts.map +0 -1
- package/dist/context/builder.js +0 -34
- package/dist/context/context.d.ts +0 -40
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/context.js +0 -53
- package/dist/entrypoint/context.d.ts.map +0 -1
- package/dist/entrypoint/entrypoint.d.ts +0 -2
- package/dist/entrypoint/entrypoint.d.ts.map +0 -1
- package/dist/entrypoint/invoke.d.ts.map +0 -1
- package/dist/entrypoint/load.d.ts.map +0 -1
- package/dist/entrypoint/register.d.ts +0 -7
- package/dist/entrypoint/register.d.ts.map +0 -1
- package/dist/graphql/client.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/introspector/decorators/decorators.d.ts.map +0 -1
- package/dist/introspector/executor/executor.d.ts.map +0 -1
- package/dist/introspector/executor/executor.js +0 -32
- package/dist/introspector/registry/registry.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/argument.d.ts +0 -104
- package/dist/introspector/scanner/abtractions/argument.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/argument.js +0 -207
- package/dist/introspector/scanner/abtractions/constructor.d.ts +0 -17
- package/dist/introspector/scanner/abtractions/constructor.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/constructor.js +0 -40
- package/dist/introspector/scanner/abtractions/enum.d.ts +0 -33
- package/dist/introspector/scanner/abtractions/enum.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/enum.js +0 -73
- package/dist/introspector/scanner/abtractions/enumValue.d.ts +0 -24
- package/dist/introspector/scanner/abtractions/enumValue.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/enumValue.js +0 -51
- package/dist/introspector/scanner/abtractions/method.d.ts +0 -67
- package/dist/introspector/scanner/abtractions/method.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/method.js +0 -132
- package/dist/introspector/scanner/abtractions/module.d.ts +0 -26
- package/dist/introspector/scanner/abtractions/module.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/module.js +0 -103
- package/dist/introspector/scanner/abtractions/object.d.ts +0 -52
- package/dist/introspector/scanner/abtractions/object.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/object.js +0 -118
- package/dist/introspector/scanner/abtractions/property.d.ts +0 -55
- package/dist/introspector/scanner/abtractions/property.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/property.js +0 -110
- package/dist/introspector/scanner/abtractions/typeToTypedef.d.ts +0 -8
- package/dist/introspector/scanner/abtractions/typeToTypedef.d.ts.map +0 -1
- package/dist/introspector/scanner/abtractions/typeToTypedef.js +0 -85
- package/dist/introspector/scanner/scan.d.ts +0 -14
- package/dist/introspector/scanner/scan.d.ts.map +0 -1
- package/dist/introspector/scanner/scan.js +0 -26
- package/dist/introspector/scanner/typeDefs.d.ts.map +0 -1
- package/dist/introspector/scanner/utils.d.ts +0 -22
- package/dist/introspector/scanner/utils.d.ts.map +0 -1
- package/dist/introspector/scanner/utils.js +0 -101
- package/dist/introspector/utils/files.d.ts.map +0 -1
- package/dist/provisioning/bin.d.ts.map +0 -1
- package/dist/provisioning/default.d.ts +0 -2
- package/dist/provisioning/default.d.ts.map +0 -1
- package/dist/provisioning/engineconn.d.ts +0 -28
- package/dist/provisioning/engineconn.d.ts.map +0 -1
- package/dist/provisioning/index.d.ts +0 -4
- package/dist/provisioning/index.d.ts.map +0 -1
- package/dist/provisioning/index.js +0 -3
- package/dist/telemetry/attributes.d.ts +0 -2
- package/dist/telemetry/attributes.d.ts.map +0 -1
- package/dist/telemetry/index.d.ts.map +0 -1
- package/dist/telemetry/init.d.ts.map +0 -1
- package/dist/telemetry/telemetry.d.ts.map +0 -1
- package/dist/telemetry/tracer.d.ts.map +0 -1
- /package/dist/{common → src/common}/errors/DaggerSDKError.js +0 -0
- /package/dist/{common → src/common}/errors/DockerImageRefValidationError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/DockerImageRefValidationError.js +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionConnectParamsParseError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionConnectParamsParseError.js +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionConnectionTimeoutError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionConnectionTimeoutError.js +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionErrorOptions.d.ts +0 -0
- /package/dist/{common → src/common}/errors/EngineSessionErrorOptions.js +0 -0
- /package/dist/{common → src/common}/errors/FunctionNotFound.d.ts +0 -0
- /package/dist/{common → src/common}/errors/FunctionNotFound.js +0 -0
- /package/dist/{common → src/common}/errors/GraphQLRequestError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/GraphQLRequestError.js +0 -0
- /package/dist/{common → src/common}/errors/InitEngineSessionBinaryError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/InitEngineSessionBinaryError.js +0 -0
- /package/dist/{common → src/common}/errors/NotAwaitedRequestError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/NotAwaitedRequestError.js +0 -0
- /package/dist/{common → src/common}/errors/TooManyNestedObjectsError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/TooManyNestedObjectsError.js +0 -0
- /package/dist/{common → src/common}/errors/UnknownDaggerError.d.ts +0 -0
- /package/dist/{common → src/common}/errors/UnknownDaggerError.js +0 -0
- /package/dist/{graphql → src/common/graphql}/client.d.ts +0 -0
- /package/dist/{graphql → src/common/graphql}/client.js +0 -0
- /package/dist/{common → src/common}/utils.js +0 -0
- /package/dist/{connectOpts.d.ts → src/connectOpts.d.ts} +0 -0
- /package/dist/{connectOpts.js → src/connectOpts.js} +0 -0
- /package/dist/{entrypoint → src/module/entrypoint}/context.js +0 -0
- /package/dist/{introspector/scanner/typeDefs.js → src/module/introspector/dagger_module/enumBase.js} +0 -0
- /package/dist/{provisioning/engineconn.js → src/module/introspector/dagger_module/objectBase.js} +0 -0
- /package/dist/{telemetry/attributes.js → src/module/introspector/typedef.js} +0 -0
- /package/dist/{introspector → src/module/introspector}/utils/files.d.ts +0 -0
- /package/dist/{introspector/registry → src/module}/registry.d.ts +0 -0
- /package/dist/{provisioning → src/provisioning}/bin.d.ts +0 -0
- /package/dist/{telemetry → src/telemetry}/index.d.ts +0 -0
- /package/dist/{telemetry → src/telemetry}/index.js +0 -0
- /package/dist/{telemetry → src/telemetry}/init.d.ts +0 -0
- /package/dist/{telemetry → src/telemetry}/init.js +0 -0
- /package/dist/{telemetry → src/telemetry}/telemetry.d.ts +0 -0
- /package/dist/{telemetry → src/telemetry}/telemetry.js +0 -0
- /package/dist/{telemetry → src/telemetry}/tracer.d.ts +0 -0
- /package/dist/{telemetry → src/telemetry}/tracer.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../introspector/scanner/abtractions/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAc,WAAW,EAAmB,MAAM,WAAW,CAAA;AACpE,OAAO,EAAgB,aAAa,EAAqB,MAAM,aAAa,CAAA;AAE5E,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAgB;IAE/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IAEhC,IAAI,EAAE,MAAM,CAAA;IAGnB,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAa;gBAGzB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,oBAAK,EACT,KAAK,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE;IAYjC,IAAI,OAAO,IAAI,aAAa,CAE3B;IAED,IAAI,KAAK,IAAI,WAAW,CAEvB;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,MAAM;;;;;;IASN,OAAO,CAAC,WAAW;IAgBnB,OAAO,CAAC,SAAS;IAgBjB,OAAO,CAAC,eAAe;IAkCvB,OAAO,CAAC,YAAY;CAqBrB"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { DaggerEnum, isEnumDecorated } from "./enum.js";
|
|
3
|
-
import { DaggerObject, isObjectDecorated } from "./object.js";
|
|
4
|
-
export class DaggerModule {
|
|
5
|
-
checker;
|
|
6
|
-
files;
|
|
7
|
-
name;
|
|
8
|
-
// Preloaded values.
|
|
9
|
-
_description;
|
|
10
|
-
_objects;
|
|
11
|
-
_enums;
|
|
12
|
-
constructor(checker, name = "", files) {
|
|
13
|
-
this.checker = checker;
|
|
14
|
-
this.files = files.filter((file) => !file.isDeclarationFile);
|
|
15
|
-
this.name = this.toPascalCase(name);
|
|
16
|
-
// Preload values to optimize introspection.
|
|
17
|
-
this._objects = this.loadObjects();
|
|
18
|
-
this._enums = this.loadEnums();
|
|
19
|
-
this._description = this.loadDescription();
|
|
20
|
-
}
|
|
21
|
-
get objects() {
|
|
22
|
-
return this._objects;
|
|
23
|
-
}
|
|
24
|
-
get enums() {
|
|
25
|
-
return this._enums;
|
|
26
|
-
}
|
|
27
|
-
get description() {
|
|
28
|
-
return this._description;
|
|
29
|
-
}
|
|
30
|
-
toJSON() {
|
|
31
|
-
return {
|
|
32
|
-
name: this.name,
|
|
33
|
-
description: this.description,
|
|
34
|
-
objects: this._objects,
|
|
35
|
-
enums: this._enums,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
loadObjects() {
|
|
39
|
-
const objects = {};
|
|
40
|
-
for (const file of this.files) {
|
|
41
|
-
ts.forEachChild(file, (node) => {
|
|
42
|
-
if (ts.isClassDeclaration(node) && isObjectDecorated(node)) {
|
|
43
|
-
const object = new DaggerObject(this.checker, file, node);
|
|
44
|
-
objects[object.name] = object;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return objects;
|
|
49
|
-
}
|
|
50
|
-
loadEnums() {
|
|
51
|
-
const daggerEnums = {};
|
|
52
|
-
for (const file of this.files) {
|
|
53
|
-
ts.forEachChild(file, (node) => {
|
|
54
|
-
if (ts.isClassDeclaration(node) && isEnumDecorated(node)) {
|
|
55
|
-
const daggerEnum = new DaggerEnum(this.checker, file, node);
|
|
56
|
-
daggerEnums[daggerEnum.name] = daggerEnum;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return daggerEnums;
|
|
61
|
-
}
|
|
62
|
-
loadDescription() {
|
|
63
|
-
const mainObject = Object.values(this.objects).find((object) => object.name === this.name);
|
|
64
|
-
if (!mainObject) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
const file = mainObject.file;
|
|
68
|
-
const topLevelStatement = file.statements[0];
|
|
69
|
-
if (!topLevelStatement) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
// Get the range of the top level comment
|
|
73
|
-
const topLevelCommentRanges = ts.getLeadingCommentRanges(file.getFullText(), topLevelStatement.pos);
|
|
74
|
-
if (!topLevelCommentRanges || topLevelCommentRanges.length === 0) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
const topLevelCommentRange = topLevelCommentRanges[0];
|
|
78
|
-
return file
|
|
79
|
-
.getFullText()
|
|
80
|
-
.substring(topLevelCommentRange.pos, topLevelCommentRange.end)
|
|
81
|
-
.split("\n")
|
|
82
|
-
.slice(1, -1) // Remove start and ending comments characters `/** */`
|
|
83
|
-
.map((line) => line.replace("*", "").trim()) // Remove leading * and spaces
|
|
84
|
-
.join("\n");
|
|
85
|
-
}
|
|
86
|
-
toPascalCase(input) {
|
|
87
|
-
const words = input
|
|
88
|
-
.replace(/[^a-zA-Z0-9]/g, " ") // Replace non-alphanumeric characters with spaces
|
|
89
|
-
.split(/\s+/)
|
|
90
|
-
.filter((word) => word.length > 0);
|
|
91
|
-
if (words.length === 0) {
|
|
92
|
-
return ""; // No valid words found
|
|
93
|
-
}
|
|
94
|
-
// It's an edge case when moduleName is already in PascalCase or camelCase
|
|
95
|
-
if (words.length === 1) {
|
|
96
|
-
return words[0].charAt(0).toUpperCase() + words[0].slice(1);
|
|
97
|
-
}
|
|
98
|
-
const pascalCase = words
|
|
99
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
100
|
-
.join("");
|
|
101
|
-
return pascalCase;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { Constructor } from "./constructor.js";
|
|
3
|
-
import { Methods } from "./method.js";
|
|
4
|
-
import { Properties } from "./property.js";
|
|
5
|
-
export declare const OBJECT_DECORATOR: string;
|
|
6
|
-
/**
|
|
7
|
-
* Return true if the given class declaration has the decorator @obj() on
|
|
8
|
-
* top of its declaration.
|
|
9
|
-
* @param object
|
|
10
|
-
*/
|
|
11
|
-
export declare function isObjectDecorated(object: ts.ClassDeclaration): boolean;
|
|
12
|
-
export type DaggerObjects = {
|
|
13
|
-
[name: string]: DaggerObject;
|
|
14
|
-
};
|
|
15
|
-
export declare class DaggerObject {
|
|
16
|
-
private checker;
|
|
17
|
-
private class;
|
|
18
|
-
private symbol;
|
|
19
|
-
file: ts.SourceFile;
|
|
20
|
-
private _name;
|
|
21
|
-
private _description;
|
|
22
|
-
private _classConstructor;
|
|
23
|
-
private _methods;
|
|
24
|
-
private _properties;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param checker The checker to use to introspect the class.
|
|
28
|
-
* @param classDeclaration The class to introspect.
|
|
29
|
-
*
|
|
30
|
-
* @throws UnknownDaggerError If the class doesn't have a name.
|
|
31
|
-
* @throws UnknownDaggerError If the class doesn't have a symbol.
|
|
32
|
-
*/
|
|
33
|
-
constructor(checker: ts.TypeChecker, file: ts.SourceFile, classDeclaration: ts.ClassDeclaration);
|
|
34
|
-
get name(): string;
|
|
35
|
-
get description(): string;
|
|
36
|
-
get _constructor(): Constructor | undefined;
|
|
37
|
-
get methods(): Methods;
|
|
38
|
-
get properties(): Properties;
|
|
39
|
-
toJSON(): {
|
|
40
|
-
name: string;
|
|
41
|
-
description: string;
|
|
42
|
-
constructor: Constructor | undefined;
|
|
43
|
-
methods: Methods;
|
|
44
|
-
properties: Properties;
|
|
45
|
-
};
|
|
46
|
-
private loadName;
|
|
47
|
-
private loadDescription;
|
|
48
|
-
private loadConstructor;
|
|
49
|
-
private loadMethods;
|
|
50
|
-
private loadProperties;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=object.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../../introspector/scanner/abtractions/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAI3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAU,OAAO,EAAqB,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,UAAU,EAAY,MAAM,eAAe,CAAA;AAEpD,eAAO,MAAM,gBAAgB,QAAc,CAAA;AAE3C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,GAAG,OAAO,CAUtE;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,CAAA;AAE5D,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAgB;IAE/B,OAAO,CAAC,KAAK,CAAqB;IAElC,OAAO,CAAC,MAAM,CAAW;IAElB,IAAI,EAAE,EAAE,CAAC,UAAU,CAAA;IAG1B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAY;IAE/B;;;;;;;OAOG;gBAED,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,gBAAgB,EAAE,EAAE,CAAC,gBAAgB;IA+BvC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,YAAY,IAAI,WAAW,GAAG,SAAS,CAE1C;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,MAAM;;;;;;;IAUN,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,cAAc;CAavB"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { UnknownDaggerError } from "../../../common/errors/UnknownDaggerError.js";
|
|
3
|
-
import { object } from "../../decorators/decorators.js";
|
|
4
|
-
import { Constructor } from "./constructor.js";
|
|
5
|
-
import { Method, isMethodDecorated } from "./method.js";
|
|
6
|
-
import { Property } from "./property.js";
|
|
7
|
-
export const OBJECT_DECORATOR = object.name;
|
|
8
|
-
/**
|
|
9
|
-
* Return true if the given class declaration has the decorator @obj() on
|
|
10
|
-
* top of its declaration.
|
|
11
|
-
* @param object
|
|
12
|
-
*/
|
|
13
|
-
export function isObjectDecorated(object) {
|
|
14
|
-
return (ts.getDecorators(object)?.find((d) => {
|
|
15
|
-
if (ts.isCallExpression(d.expression)) {
|
|
16
|
-
return d.expression.expression.getText() === OBJECT_DECORATOR;
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
19
|
-
}) !== undefined);
|
|
20
|
-
}
|
|
21
|
-
export class DaggerObject {
|
|
22
|
-
checker;
|
|
23
|
-
class;
|
|
24
|
-
symbol;
|
|
25
|
-
file;
|
|
26
|
-
// Preloaded values.
|
|
27
|
-
_name;
|
|
28
|
-
_description;
|
|
29
|
-
_classConstructor;
|
|
30
|
-
_methods;
|
|
31
|
-
_properties;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param checker The checker to use to introspect the class.
|
|
35
|
-
* @param classDeclaration The class to introspect.
|
|
36
|
-
*
|
|
37
|
-
* @throws UnknownDaggerError If the class doesn't have a name.
|
|
38
|
-
* @throws UnknownDaggerError If the class doesn't have a symbol.
|
|
39
|
-
*/
|
|
40
|
-
constructor(checker, file, classDeclaration) {
|
|
41
|
-
this.checker = checker;
|
|
42
|
-
this.class = classDeclaration;
|
|
43
|
-
this.file = file;
|
|
44
|
-
if (!classDeclaration.name) {
|
|
45
|
-
throw new UnknownDaggerError(`could not introspect class: ${classDeclaration}`, {});
|
|
46
|
-
}
|
|
47
|
-
const classSymbol = checker.getSymbolAtLocation(classDeclaration.name);
|
|
48
|
-
if (!classSymbol) {
|
|
49
|
-
throw new UnknownDaggerError(`could not get class symbol: ${classDeclaration.name.getText()}`, {});
|
|
50
|
-
}
|
|
51
|
-
this.symbol = classSymbol;
|
|
52
|
-
// Preload values to optimize introspection.
|
|
53
|
-
this._name = this.loadName();
|
|
54
|
-
this._description = this.loadDescription();
|
|
55
|
-
this._classConstructor = this.loadConstructor();
|
|
56
|
-
this._methods = this.loadMethods();
|
|
57
|
-
this._properties = this.loadProperties();
|
|
58
|
-
}
|
|
59
|
-
get name() {
|
|
60
|
-
return this._name;
|
|
61
|
-
}
|
|
62
|
-
get description() {
|
|
63
|
-
return this._description;
|
|
64
|
-
}
|
|
65
|
-
get _constructor() {
|
|
66
|
-
return this._classConstructor;
|
|
67
|
-
}
|
|
68
|
-
get methods() {
|
|
69
|
-
return this._methods;
|
|
70
|
-
}
|
|
71
|
-
get properties() {
|
|
72
|
-
return this._properties;
|
|
73
|
-
}
|
|
74
|
-
toJSON() {
|
|
75
|
-
return {
|
|
76
|
-
name: this.name,
|
|
77
|
-
description: this.description,
|
|
78
|
-
constructor: this._constructor,
|
|
79
|
-
methods: this.methods,
|
|
80
|
-
properties: this.properties,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
loadName() {
|
|
84
|
-
return this.symbol.getName();
|
|
85
|
-
}
|
|
86
|
-
loadDescription() {
|
|
87
|
-
return ts.displayPartsToString(this.symbol.getDocumentationComment(this.checker));
|
|
88
|
-
}
|
|
89
|
-
loadConstructor() {
|
|
90
|
-
const constructor = this.class.members.find((member) => {
|
|
91
|
-
if (ts.isConstructorDeclaration(member)) {
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
if (!constructor) {
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
return new Constructor(this.checker, constructor);
|
|
99
|
-
}
|
|
100
|
-
loadMethods() {
|
|
101
|
-
return this.class.members
|
|
102
|
-
.filter((member) => ts.isMethodDeclaration(member) && isMethodDecorated(member))
|
|
103
|
-
.reduce((acc, member) => {
|
|
104
|
-
const method = new Method(this.checker, member);
|
|
105
|
-
acc[method.alias ?? method.name] = method;
|
|
106
|
-
return acc;
|
|
107
|
-
}, {});
|
|
108
|
-
}
|
|
109
|
-
loadProperties() {
|
|
110
|
-
return this.class.members
|
|
111
|
-
.filter((member) => ts.isPropertyDeclaration(member))
|
|
112
|
-
.reduce((acc, member) => {
|
|
113
|
-
const property = new Property(this.checker, member);
|
|
114
|
-
acc[property.alias ?? property.name] = property;
|
|
115
|
-
return acc;
|
|
116
|
-
}, {});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { TypeDefKind } from "../../../api/client.gen.js";
|
|
3
|
-
import { TypeDef } from "../typeDefs.js";
|
|
4
|
-
export type Properties = {
|
|
5
|
-
[name: string]: Property;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Property is an abstraction of a class property.
|
|
9
|
-
*
|
|
10
|
-
* This aims to simplify and adds clarity to how we analyse the code and using
|
|
11
|
-
* clear accessor.
|
|
12
|
-
*/
|
|
13
|
-
export declare class Property {
|
|
14
|
-
private symbol;
|
|
15
|
-
private checker;
|
|
16
|
-
private property;
|
|
17
|
-
private decorator;
|
|
18
|
-
private _name;
|
|
19
|
-
private _description;
|
|
20
|
-
private _alias;
|
|
21
|
-
private _type;
|
|
22
|
-
private _isExposed;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param checker Checker to use to introspect the property.
|
|
26
|
-
* @param property The property to introspect.
|
|
27
|
-
*
|
|
28
|
-
* @throws UnknownDaggerError If the property doesn't have any symbol.
|
|
29
|
-
*/
|
|
30
|
-
constructor(checker: ts.TypeChecker, property: ts.PropertyDeclaration);
|
|
31
|
-
get name(): string;
|
|
32
|
-
get description(): string;
|
|
33
|
-
/**
|
|
34
|
-
* Return the alias of the property if it has one.
|
|
35
|
-
*/
|
|
36
|
-
get alias(): string | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Return the type of the property in a Dagger TypeDef format.
|
|
39
|
-
*/
|
|
40
|
-
get type(): TypeDef<TypeDefKind>;
|
|
41
|
-
get isExposed(): boolean;
|
|
42
|
-
toJSON(): {
|
|
43
|
-
name: string;
|
|
44
|
-
description: string;
|
|
45
|
-
alias: string | undefined;
|
|
46
|
-
type: TypeDef<TypeDefKind>;
|
|
47
|
-
isExposed: boolean;
|
|
48
|
-
};
|
|
49
|
-
private loadName;
|
|
50
|
-
private loadDescription;
|
|
51
|
-
private loadAlias;
|
|
52
|
-
private loadType;
|
|
53
|
-
private loadIsExposed;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=property.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../../../introspector/scanner/abtractions/property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAMxC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,CAAA;AAErD;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAW;IAEzB,OAAO,CAAC,OAAO,CAAgB;IAE/B,OAAO,CAAC,QAAQ,CAAwB;IAExC,OAAO,CAAC,SAAS,CAA0B;IAG3C,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;;OAMG;gBACS,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,mBAAmB;IAiCrE,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,CAE/B;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,MAAM;;;;;;;IAUN,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,QAAQ;IAgBhB,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { UnknownDaggerError } from "../../../common/errors/UnknownDaggerError.js";
|
|
3
|
-
import { field, func } from "../../decorators/decorators.js";
|
|
4
|
-
import { typeToTypedef } from "./typeToTypedef.js";
|
|
5
|
-
const DEPRECATED_PROPERTY_DECORATOR = field.name;
|
|
6
|
-
const PROPERTY_DECORATOR = func.name;
|
|
7
|
-
/**
|
|
8
|
-
* Property is an abstraction of a class property.
|
|
9
|
-
*
|
|
10
|
-
* This aims to simplify and adds clarity to how we analyse the code and using
|
|
11
|
-
* clear accessor.
|
|
12
|
-
*/
|
|
13
|
-
export class Property {
|
|
14
|
-
symbol;
|
|
15
|
-
checker;
|
|
16
|
-
property;
|
|
17
|
-
decorator;
|
|
18
|
-
// Preloaded values.
|
|
19
|
-
_name;
|
|
20
|
-
_description;
|
|
21
|
-
_alias;
|
|
22
|
-
_type;
|
|
23
|
-
_isExposed;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param checker Checker to use to introspect the property.
|
|
27
|
-
* @param property The property to introspect.
|
|
28
|
-
*
|
|
29
|
-
* @throws UnknownDaggerError If the property doesn't have any symbol.
|
|
30
|
-
*/
|
|
31
|
-
constructor(checker, property) {
|
|
32
|
-
this.checker = checker;
|
|
33
|
-
this.property = property;
|
|
34
|
-
const propertySymbol = checker.getSymbolAtLocation(property.name);
|
|
35
|
-
if (!propertySymbol) {
|
|
36
|
-
throw new UnknownDaggerError(`could not get property symbol: ${property.name.getText()}`, {});
|
|
37
|
-
}
|
|
38
|
-
this.symbol = propertySymbol;
|
|
39
|
-
this.decorator = ts.getDecorators(property)?.find((d) => {
|
|
40
|
-
if (ts.isCallExpression(d.expression)) {
|
|
41
|
-
return (d.expression.expression.getText() === PROPERTY_DECORATOR ||
|
|
42
|
-
d.expression.expression.getText() === DEPRECATED_PROPERTY_DECORATOR);
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
});
|
|
46
|
-
// Preload values to optimize introspection
|
|
47
|
-
this._name = this.loadName();
|
|
48
|
-
this._description = this.loadDescription();
|
|
49
|
-
this._alias = this.loadAlias();
|
|
50
|
-
this._type = this.loadType();
|
|
51
|
-
this._isExposed = this.loadIsExposed();
|
|
52
|
-
}
|
|
53
|
-
get name() {
|
|
54
|
-
return this._name;
|
|
55
|
-
}
|
|
56
|
-
get description() {
|
|
57
|
-
return this._description;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Return the alias of the property if it has one.
|
|
61
|
-
*/
|
|
62
|
-
get alias() {
|
|
63
|
-
return this._alias;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Return the type of the property in a Dagger TypeDef format.
|
|
67
|
-
*/
|
|
68
|
-
get type() {
|
|
69
|
-
return this._type;
|
|
70
|
-
}
|
|
71
|
-
get isExposed() {
|
|
72
|
-
return this._isExposed;
|
|
73
|
-
}
|
|
74
|
-
toJSON() {
|
|
75
|
-
return {
|
|
76
|
-
name: this.name,
|
|
77
|
-
description: this.description,
|
|
78
|
-
alias: this.alias,
|
|
79
|
-
type: this.type,
|
|
80
|
-
isExposed: this.isExposed,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
loadName() {
|
|
84
|
-
return this.symbol.getName();
|
|
85
|
-
}
|
|
86
|
-
loadDescription() {
|
|
87
|
-
return ts.displayPartsToString(this.symbol.getDocumentationComment(this.checker));
|
|
88
|
-
}
|
|
89
|
-
loadAlias() {
|
|
90
|
-
if (!this.decorator) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
const expression = this.decorator.expression;
|
|
94
|
-
const aliasArg = expression.arguments[0];
|
|
95
|
-
if (!aliasArg) {
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
return JSON.parse(aliasArg.getText().replace(/'/g, '"'));
|
|
99
|
-
}
|
|
100
|
-
loadType() {
|
|
101
|
-
if (!this.symbol.valueDeclaration) {
|
|
102
|
-
throw new UnknownDaggerError("could not find symbol value declaration", {});
|
|
103
|
-
}
|
|
104
|
-
const type = this.checker.getTypeOfSymbolAtLocation(this.symbol, this.symbol.valueDeclaration);
|
|
105
|
-
return typeToTypedef(this.checker, type);
|
|
106
|
-
}
|
|
107
|
-
loadIsExposed() {
|
|
108
|
-
return this.decorator !== undefined;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { TypeDefKind } from "../../../api/client.gen.js";
|
|
3
|
-
import { TypeDef } from "../typeDefs.js";
|
|
4
|
-
/**
|
|
5
|
-
* Convert a type into a Dagger Typedef using dynamic typing.
|
|
6
|
-
*/
|
|
7
|
-
export declare function typeToTypedef(checker: ts.TypeChecker, type: ts.Type): TypeDef<TypeDefKind>;
|
|
8
|
-
//# sourceMappingURL=typeToTypedef.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeToTypedef.d.ts","sourceRoot":"","sources":["../../../../introspector/scanner/abtractions/typeToTypedef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAGxC;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAiGtB"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { TypeDefKind } from "../../../api/client.gen.js";
|
|
3
|
-
import { isEnumDecorated } from "./enum.js";
|
|
4
|
-
/**
|
|
5
|
-
* Convert a type into a Dagger Typedef using dynamic typing.
|
|
6
|
-
*/
|
|
7
|
-
export function typeToTypedef(checker, type) {
|
|
8
|
-
const symbol = type.getSymbol();
|
|
9
|
-
const symbolName = symbol?.name;
|
|
10
|
-
const symbolDeclaration = symbol?.valueDeclaration;
|
|
11
|
-
if (symbolName === "Promise") {
|
|
12
|
-
const typeArgs = checker.getTypeArguments(type);
|
|
13
|
-
if (typeArgs.length > 0) {
|
|
14
|
-
return typeToTypedef(checker, typeArgs[0]);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (symbolName === "Array") {
|
|
18
|
-
const typeArgs = checker.getTypeArguments(type);
|
|
19
|
-
if (typeArgs.length === 0) {
|
|
20
|
-
throw new Error("Generic array not supported");
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
kind: TypeDefKind.ListKind,
|
|
24
|
-
typeDef: typeToTypedef(checker, typeArgs[0]),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const strType = checker.typeToString(type);
|
|
28
|
-
switch (strType) {
|
|
29
|
-
case "string":
|
|
30
|
-
return { kind: TypeDefKind.StringKind };
|
|
31
|
-
case "number":
|
|
32
|
-
return { kind: TypeDefKind.IntegerKind };
|
|
33
|
-
case "boolean":
|
|
34
|
-
return { kind: TypeDefKind.BooleanKind };
|
|
35
|
-
case "void":
|
|
36
|
-
return { kind: TypeDefKind.VoidKind };
|
|
37
|
-
// Intercept primitive types and throw error in this case
|
|
38
|
-
case "String":
|
|
39
|
-
throw new Error("Use of primitive String type detected, did you mean string?");
|
|
40
|
-
case "Number":
|
|
41
|
-
throw new Error("Use of primitive Number type detected, did you mean number?");
|
|
42
|
-
case "Boolean":
|
|
43
|
-
throw new Error("Use of primitive Boolean type detected, did you mean boolean?");
|
|
44
|
-
default:
|
|
45
|
-
if (symbolName &&
|
|
46
|
-
type.isClassOrInterface() &&
|
|
47
|
-
symbolDeclaration &&
|
|
48
|
-
ts.isClassDeclaration(symbolDeclaration)) {
|
|
49
|
-
if (isEnumDecorated(symbolDeclaration)) {
|
|
50
|
-
return {
|
|
51
|
-
kind: TypeDefKind.EnumKind,
|
|
52
|
-
name: symbolName,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
kind: TypeDefKind.ObjectKind,
|
|
57
|
-
name: symbolName,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (symbol?.getFlags() !== undefined &&
|
|
61
|
-
(symbol.getFlags() & ts.SymbolFlags.Enum) !== 0) {
|
|
62
|
-
return {
|
|
63
|
-
kind: TypeDefKind.EnumKind,
|
|
64
|
-
name: strType,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
// If it's a union, then it's a scalar type
|
|
68
|
-
if (type.isUnionOrIntersection()) {
|
|
69
|
-
return {
|
|
70
|
-
kind: TypeDefKind.ScalarKind,
|
|
71
|
-
name: strType,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// If we cannot resolve the symbol, we check for the alias symbol.
|
|
75
|
-
// This should mostly lead to a failure since external types are not supported by
|
|
76
|
-
// dagger yet.
|
|
77
|
-
if (type.aliasSymbol && type.aliasSymbol.flags & ts.TypeFlags.Object) {
|
|
78
|
-
return {
|
|
79
|
-
kind: TypeDefKind.ObjectKind,
|
|
80
|
-
name: type.aliasSymbol.escapedName.toString(),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
throw new Error(`Unsupported type ${strType}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DaggerModule } from "./abtractions/module.js";
|
|
2
|
-
/**
|
|
3
|
-
* Scan the list of TypeScript File using the TypeScript compiler API.
|
|
4
|
-
*
|
|
5
|
-
* This function introspect files and returns metadata of their class and
|
|
6
|
-
* functions that should be exposed to the Dagger API.
|
|
7
|
-
*
|
|
8
|
-
* WARNING(28/11/23): This does NOT include arrow style function.
|
|
9
|
-
*
|
|
10
|
-
* @param files List of TypeScript files to introspect.
|
|
11
|
-
* @param moduleName The name of the module to introspect.
|
|
12
|
-
*/
|
|
13
|
-
export declare function scan(files: string[], moduleName?: string): DaggerModule;
|
|
14
|
-
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/scan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,SAAK,GAAG,YAAY,CAenE"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { DaggerModule } from "./abtractions/module.js";
|
|
3
|
-
/**
|
|
4
|
-
* Scan the list of TypeScript File using the TypeScript compiler API.
|
|
5
|
-
*
|
|
6
|
-
* This function introspect files and returns metadata of their class and
|
|
7
|
-
* functions that should be exposed to the Dagger API.
|
|
8
|
-
*
|
|
9
|
-
* WARNING(28/11/23): This does NOT include arrow style function.
|
|
10
|
-
*
|
|
11
|
-
* @param files List of TypeScript files to introspect.
|
|
12
|
-
* @param moduleName The name of the module to introspect.
|
|
13
|
-
*/
|
|
14
|
-
export function scan(files, moduleName = "") {
|
|
15
|
-
if (files.length === 0) {
|
|
16
|
-
throw new Error("no files to introspect found");
|
|
17
|
-
}
|
|
18
|
-
// Interpret the given typescript source files.
|
|
19
|
-
const program = ts.createProgram(files, { experimentalDecorators: true });
|
|
20
|
-
const checker = program.getTypeChecker();
|
|
21
|
-
const module = new DaggerModule(checker, moduleName, program.getSourceFiles());
|
|
22
|
-
if (Object.keys(module.objects).length === 0) {
|
|
23
|
-
throw new Error("no objects found in the module");
|
|
24
|
-
}
|
|
25
|
-
return module;
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeDefs.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/typeDefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,WAAW,CAAC,UAAU,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG;IACxC,IAAI,EAAE,WAAW,CAAC,UAAU,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IACtC,IAAI,EAAE,WAAW,CAAC,QAAQ,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAC9B,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,IAC/C,CAAC,SAAS,WAAW,CAAC,UAAU,GAC5B,aAAa,GACb,CAAC,SAAS,WAAW,CAAC,UAAU,GAC9B,aAAa,GACb,CAAC,SAAS,WAAW,CAAC,QAAQ,GAC5B,WAAW,GACX,CAAC,SAAS,WAAW,CAAC,QAAQ,GAC5B,WAAW,GACX,WAAW,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { TypeDefKind } from "../../api/client.gen.js";
|
|
3
|
-
import { TypeDef } from "./typeDefs.js";
|
|
4
|
-
/**
|
|
5
|
-
* Return true if the given class declaration has the decorator @obj() on
|
|
6
|
-
* top of its declaration.
|
|
7
|
-
* @param object
|
|
8
|
-
*/
|
|
9
|
-
export declare function isObject(object: ts.ClassDeclaration): boolean;
|
|
10
|
-
export declare function toPascalCase(input: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Return true if the given method has the decorator @func() on top
|
|
13
|
-
* of its declaration.
|
|
14
|
-
*
|
|
15
|
-
* @param method The method to check
|
|
16
|
-
*/
|
|
17
|
-
export declare function isFunction(method: ts.MethodDeclaration): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Convert a type into a Dagger Typedef using dynamic typing.
|
|
20
|
-
*/
|
|
21
|
-
export declare function typeToTypedef(checker: ts.TypeChecker, type: ts.Type): TypeDef<TypeDefKind>;
|
|
22
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../introspector/scanner/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,GAAG,OAAO,CAU7D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoBlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,GAAG,OAAO,CAUhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CA8DtB"}
|