@conduit-client/generator-ts 2.0.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/main/index.js +6 -0
- package/dist/main/index.js.map +1 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/v1/__tests__/api-module-generator-service.spec.d.ts +1 -0
- package/dist/types/v1/__tests__/test-utils/additional-properties-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/all-of-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/any-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/array-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/base-api.d.ts +9 -0
- package/dist/types/v1/__tests__/test-utils/datetime-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/discriminator-api.d.ts +9 -0
- package/dist/types/v1/__tests__/test-utils/enum-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/index.d.ts +31 -0
- package/dist/types/v1/__tests__/test-utils/object-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/oneof-api.d.ts +8 -0
- package/dist/types/v1/__tests__/test-utils/scalar-api.d.ts +9 -0
- package/dist/types/v1/__tests__/utils.spec.d.ts +1 -0
- package/dist/types/v1/api-module-generator-service.d.ts +18 -0
- package/dist/types/v1/files/__tests__/code.spec.d.ts +1 -0
- package/dist/types/v1/files/__tests__/file.spec.d.ts +1 -0
- package/dist/types/v1/files/__tests__/write-files.spec.d.ts +1 -0
- package/dist/types/v1/files/code.d.ts +86 -0
- package/dist/types/v1/files/file.d.ts +79 -0
- package/dist/types/v1/files/index.d.ts +3 -0
- package/dist/types/v1/files/write-files.d.ts +12 -0
- package/dist/types/v1/generators/__tests__/api-family-module-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/aura-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/aura-graphql-normalized-cache-control-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/aura-normalized-cache-control-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/aura-resource-cache-control-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/base-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/bindings-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/built-test-model.d.ts +10 -0
- package/dist/types/v1/generators/__tests__/cache-control-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/command-config-builder.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/http-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/http-normalized-cache-control-command-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/imperative-binding-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/imperative-legacy-binding-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/normalized-cache-control-generator-mixin.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/utils.spec.d.ts +1 -0
- package/dist/types/v1/generators/__tests__/wire-binding-generator.spec.d.ts +1 -0
- package/dist/types/v1/generators/api-family-module-generator.d.ts +54 -0
- package/dist/types/v1/generators/aura-command-generator.d.ts +46 -0
- package/dist/types/v1/generators/aura-graphql-normalized-cache-control-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/aura-normalized-cache-control-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/aura-resource-cache-control-command-generator.d.ts +39 -0
- package/dist/types/v1/generators/base-command-generator.d.ts +88 -0
- package/dist/types/v1/generators/bindings-generator.d.ts +69 -0
- package/dist/types/v1/generators/cache-control-generator.d.ts +2 -0
- package/dist/types/v1/generators/command-config-builder.d.ts +28 -0
- package/dist/types/v1/generators/graphql-imperative-binding-generator.d.ts +23 -0
- package/dist/types/v1/generators/graphql-imperative-legacy-binding-generator.d.ts +18 -0
- package/dist/types/v1/generators/graphql-mutation-binding-generator.d.ts +21 -0
- package/dist/types/v1/generators/graphql-normalized-cache-control-generator-mixin.d.ts +13 -0
- package/dist/types/v1/generators/graphql-root-variable-names.d.ts +2 -0
- package/dist/types/v1/generators/graphql-wire-binding-generator.d.ts +18 -0
- package/dist/types/v1/generators/http-command-generator.d.ts +67 -0
- package/dist/types/v1/generators/http-graphql-normalized-cache-control-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/http-normalized-cache-control-command-generator.d.ts +1 -0
- package/dist/types/v1/generators/imperative-binding-generator.d.ts +24 -0
- package/dist/types/v1/generators/imperative-legacy-binding-generator.d.ts +18 -0
- package/dist/types/v1/generators/index.d.ts +9 -0
- package/dist/types/v1/generators/normalized-cache-control-generator-mixin.d.ts +15 -0
- package/dist/types/v1/generators/utils.d.ts +17 -0
- package/dist/types/v1/generators/wire-binding-generator.d.ts +19 -0
- package/dist/types/v1/index.d.ts +4 -0
- package/dist/types/v1/model/__tests__/aura-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/aura-graphql-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/aura-normalized-caching-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/aura-resource-caching-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/base-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/graphql-schema-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/graphql-utils.d.ts +17 -0
- package/dist/types/v1/model/__tests__/http-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/__tests__/http-normalized-caching-command-model.spec.d.ts +1 -0
- package/dist/types/v1/model/aura-command-model.d.ts +34 -0
- package/dist/types/v1/model/aura-graphql-command-model.d.ts +10 -0
- package/dist/types/v1/model/aura-normalized-caching-command-model.d.ts +8 -0
- package/dist/types/v1/model/aura-resource-caching-command-model.d.ts +13 -0
- package/dist/types/v1/model/base-command-model.d.ts +186 -0
- package/dist/types/v1/model/graphql-command-model-interface.d.ts +12 -0
- package/dist/types/v1/model/graphql-schema-model.d.ts +104 -0
- package/dist/types/v1/model/http-command-model.d.ts +32 -0
- package/dist/types/v1/model/http-graphql-command-model.d.ts +16 -0
- package/dist/types/v1/model/http-normalized-caching-command-model.d.ts +14 -0
- package/dist/types/v1/normalization/__tests__/graphql-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/graphql-type-registry-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/identifiable-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/integration.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/normalized-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/type-registry-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/unidentifiable-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/__tests__/utils.d.ts +3 -0
- package/dist/types/v1/normalization/graphql/__tests__/cursor-connection-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/graphql/__tests__/identifiable-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/graphql/__tests__/interface-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/graphql/__tests__/unidentifiable-type-generator.spec.d.ts +1 -0
- package/dist/types/v1/normalization/graphql/base-type-generator.d.ts +76 -0
- package/dist/types/v1/normalization/graphql/cursor-connection-type-generator.d.ts +17 -0
- package/dist/types/v1/normalization/graphql/document-root-type-generator.d.ts +13 -0
- package/dist/types/v1/normalization/graphql/identifiable-type-generator.d.ts +13 -0
- package/dist/types/v1/normalization/graphql/interface-type-generator.d.ts +10 -0
- package/dist/types/v1/normalization/graphql/unidentifiable-type-generator.d.ts +13 -0
- package/dist/types/v1/normalization/graphql/union-type-generator.d.ts +10 -0
- package/dist/types/v1/normalization/graphql-type-generator.d.ts +47 -0
- package/dist/types/v1/normalization/graphql-type-registry-generator.d.ts +59 -0
- package/dist/types/v1/normalization/identifiable-type-generator.d.ts +19 -0
- package/dist/types/v1/normalization/index.d.ts +28 -0
- package/dist/types/v1/normalization/normalize-code-gen/__tests__/normalize-generator-service.spec.d.ts +1 -0
- package/dist/types/v1/normalization/normalize-code-gen/__tests__/utils.d.ts +15 -0
- package/dist/types/v1/normalization/normalize-code-gen/normalize-generator-service.d.ts +65 -0
- package/dist/types/v1/normalization/normalized-type-generator.d.ts +52 -0
- package/dist/types/v1/normalization/type-registry-generator.d.ts +68 -0
- package/dist/types/v1/normalization/unidentifiable-type-generator.d.ts +17 -0
- package/dist/types/v1/normalization/utils.d.ts +23 -0
- package/dist/types/v1/types/__tests__/json-schema-declarations.spec.d.ts +1 -0
- package/dist/types/v1/types/__tests__/json-schema.spec.d.ts +3 -0
- package/dist/types/v1/types/__tests__/normalized-type-definition.spec.d.ts +1 -0
- package/dist/types/v1/types/__tests__/resolve-all-of-type.spec.d.ts +1 -0
- package/dist/types/v1/types/__tests__/type-definition.spec.d.ts +1 -0
- package/dist/types/v1/types/index.d.ts +4 -0
- package/dist/types/v1/types/json-schema-declarations.d.ts +29 -0
- package/dist/types/v1/types/json-schema.d.ts +15 -0
- package/dist/types/v1/types/normalized-type-definition.d.ts +25 -0
- package/dist/types/v1/types/resolve-all-of-type.d.ts +16 -0
- package/dist/types/v1/types/type-definition.d.ts +35 -0
- package/dist/types/v1/utils.d.ts +30 -0
- package/dist/v1/index.js +11074 -0
- package/dist/v1/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class AdditionalPropertiesAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class AllOfAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class AnyAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class ArrayAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { API, ReadOnlyTypeRegistry } from '@conduit-client/model/v1';
|
|
2
|
+
export declare class BaseAPI implements API {
|
|
3
|
+
basePath: string;
|
|
4
|
+
get endpoints(): never[];
|
|
5
|
+
get servers(): never[];
|
|
6
|
+
get types(): ReadOnlyTypeRegistry;
|
|
7
|
+
get defaults(): API['defaults'];
|
|
8
|
+
get namespace(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class DateTimeAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class DiscriminatorAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
buildDiscriminatedType(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class EnumAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Type, Property, RefType, TypeExtensions, API } from '@conduit-client/model/v1';
|
|
2
|
+
export declare function buildProperty(type: Type, required?: boolean): Property;
|
|
3
|
+
export declare function buildObjectType(overrides: Partial<Type>, extensions?: TypeExtensions): Type & {
|
|
4
|
+
type: 'object';
|
|
5
|
+
};
|
|
6
|
+
export declare function buildIdentifiableExtension(key: Record<string, string>): TypeExtensions;
|
|
7
|
+
export declare function buildDiscriminatedObjectType(overrides: Partial<Type>, baseOverrides: Partial<Type>): Type & {
|
|
8
|
+
type: 'discriminatedObject';
|
|
9
|
+
};
|
|
10
|
+
export declare function buildRefTypeFor(target: Type): RefType;
|
|
11
|
+
export declare function buildAllOf(...allOf: Type[]): Type & {
|
|
12
|
+
type: 'allOf';
|
|
13
|
+
};
|
|
14
|
+
export type TypeTestCase = {
|
|
15
|
+
testCaseName: string;
|
|
16
|
+
typeName: string;
|
|
17
|
+
expectedRawType: string;
|
|
18
|
+
expectedExportedType: string;
|
|
19
|
+
api: API;
|
|
20
|
+
expectedExportedSymbol?: string;
|
|
21
|
+
expectedTypeDeclaration?: string;
|
|
22
|
+
};
|
|
23
|
+
export * from './array-api';
|
|
24
|
+
export * from './datetime-api';
|
|
25
|
+
export * from './discriminator-api';
|
|
26
|
+
export * from './enum-api';
|
|
27
|
+
export * from './object-api';
|
|
28
|
+
export * from './additional-properties-api';
|
|
29
|
+
export * from './scalar-api';
|
|
30
|
+
export * from './oneof-api';
|
|
31
|
+
export * from './any-api';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class ObjectAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class OneOfAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry?: TypeRegistry;
|
|
5
|
+
get endpoints(): never[];
|
|
6
|
+
get servers(): never[];
|
|
7
|
+
get types(): ReadOnlyTypeRegistry;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseAPI } from './base-api';
|
|
2
|
+
import type { API, ReadOnlyTypeRegistry, TypeRegistry } from '@conduit-client/model/v1';
|
|
3
|
+
export declare class ScalarAPI extends BaseAPI implements API {
|
|
4
|
+
typeRegistry: TypeRegistry;
|
|
5
|
+
constructor();
|
|
6
|
+
get endpoints(): never[];
|
|
7
|
+
get servers(): never[];
|
|
8
|
+
get types(): ReadOnlyTypeRegistry;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiFamilyModuleGenerator, IApiFamilyModuleGenerator } from './generators';
|
|
2
|
+
import type { NamedLoggerService } from '@conduit-client/utils';
|
|
3
|
+
import type { NamedFileService } from './files';
|
|
4
|
+
import type { NamedAPIService } from '@conduit-client/model/v1';
|
|
5
|
+
import type { NamedJSONSchemaDeclarationService, NamedTypeDefinitionService } from './types';
|
|
6
|
+
import type { NamedTypeRegistryGeneratorService } from './normalization/type-registry-generator';
|
|
7
|
+
import type { NamedGraphQLTypeRegistryGeneratorService } from './normalization/graphql-type-registry-generator';
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new instance of ModuleGenerator using a composite service object.
|
|
10
|
+
*
|
|
11
|
+
* This function takes an object that aggregates several named services essential for module generation.
|
|
12
|
+
* It constructs and returns a new `ModuleGenerator` instance initialized with these services.
|
|
13
|
+
*
|
|
14
|
+
* @param {NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedLoggerService & NamedJSONSchemaDeclarationService} services - An object that must implement the required services
|
|
15
|
+
* @returns {ModuleGenerator} A new `ModuleGenerator` instance configured with the provided services.
|
|
16
|
+
*/
|
|
17
|
+
export declare function apiFamilyModuleGeneratorService(services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedLoggerService & NamedJSONSchemaDeclarationService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService): ApiFamilyModuleGenerator;
|
|
18
|
+
export type { IApiFamilyModuleGenerator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export type ImportableReference = ({
|
|
2
|
+
filename: string;
|
|
3
|
+
} | {
|
|
4
|
+
module: string;
|
|
5
|
+
}) & {
|
|
6
|
+
exportedSymbol?: string;
|
|
7
|
+
isType: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ImportableTypeReference = ImportableReference & {
|
|
10
|
+
isType: true;
|
|
11
|
+
};
|
|
12
|
+
export type ImportableValueReference = ImportableReference & {
|
|
13
|
+
isType: false;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Indicates if a value is an ImportableReference.
|
|
17
|
+
*
|
|
18
|
+
* @param x value to test
|
|
19
|
+
* @returns true if x is an ImportableReference; false if not
|
|
20
|
+
*/
|
|
21
|
+
export declare function isImportableReference(x: any): x is ImportableReference;
|
|
22
|
+
/**
|
|
23
|
+
* A Code instance holds a collection of TypeScript code.
|
|
24
|
+
*/
|
|
25
|
+
export declare class Code {
|
|
26
|
+
chunks: Array<string | ImportableReference>;
|
|
27
|
+
/**
|
|
28
|
+
* Constructor.
|
|
29
|
+
*
|
|
30
|
+
* @param chunks initial bits of code to include
|
|
31
|
+
*/
|
|
32
|
+
constructor(...chunks: Array<string | ImportableReference>);
|
|
33
|
+
/**
|
|
34
|
+
* Concatenates a set of Codes with an optional separator between them.
|
|
35
|
+
*
|
|
36
|
+
* @param codes Codes to be concatenated
|
|
37
|
+
* @param separator separator to be inserted between the Codes
|
|
38
|
+
* @returns concatenated Codes/separators
|
|
39
|
+
*/
|
|
40
|
+
static join(codes: any[], separator?: string): Code;
|
|
41
|
+
/**
|
|
42
|
+
* Appends new chunks of code to this list. Parameters are handled as follows:
|
|
43
|
+
*
|
|
44
|
+
* - undefined, null, '' - ignored
|
|
45
|
+
* - string, ImportableReference - appended to this.chunks
|
|
46
|
+
* - Code - chunks from the other Code are appended to this Code
|
|
47
|
+
* - [] - desructured & individual elements processed
|
|
48
|
+
* - al others - converted to a string & appended to this.chunks
|
|
49
|
+
*
|
|
50
|
+
* In the case of recursive values (Code & arrays), processing is done
|
|
51
|
+
* depth-first.
|
|
52
|
+
*
|
|
53
|
+
* @param newChunks code to be appended
|
|
54
|
+
* @returns this
|
|
55
|
+
*/
|
|
56
|
+
push(...newChunks: any[]): this;
|
|
57
|
+
/**
|
|
58
|
+
* Compares to another Code object to check
|
|
59
|
+
* equivalence (i.e., chunks properties are identical)
|
|
60
|
+
*
|
|
61
|
+
* @param Code
|
|
62
|
+
* @returns boolean
|
|
63
|
+
*/
|
|
64
|
+
equals(comparison: Code): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the Code as a single string.
|
|
67
|
+
*
|
|
68
|
+
* @param options
|
|
69
|
+
* importStringifier - function to convert ImportableReferences to strings.
|
|
70
|
+
* Defaults to an internal function whose only guarantee is that equivalent
|
|
71
|
+
* ImportableReferencesit will result in equivalent strings.
|
|
72
|
+
* @returns string representation of the code
|
|
73
|
+
*/
|
|
74
|
+
toString(options?: {
|
|
75
|
+
importStringifier?: (reference: ImportableReference) => string;
|
|
76
|
+
}): string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A tagged template literal wrapper for Code. Strings & parameters are
|
|
80
|
+
* interleaved as chunks in the returned Code.
|
|
81
|
+
*
|
|
82
|
+
* @param strings strings from the tagged template literal
|
|
83
|
+
* @param params expressions from the tagged template literal
|
|
84
|
+
* @returns Code
|
|
85
|
+
*/
|
|
86
|
+
export declare function code(strings: TemplateStringsArray, ...params: any[]): Code;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type NamedService, type ServiceDescriptor } from '@conduit-client/utils';
|
|
2
|
+
import { Code } from './code';
|
|
3
|
+
/**
|
|
4
|
+
* Service that builds TypeScript source files.
|
|
5
|
+
*/
|
|
6
|
+
export type FileService = {
|
|
7
|
+
/**
|
|
8
|
+
* Convenience method that creates a File if one with the
|
|
9
|
+
* specified name does not already exist.
|
|
10
|
+
*
|
|
11
|
+
* @param filename filename
|
|
12
|
+
* @returns File with the given filename
|
|
13
|
+
*/
|
|
14
|
+
build(filename: string): File;
|
|
15
|
+
/**
|
|
16
|
+
* Files that have been created. Key is filename.
|
|
17
|
+
*/
|
|
18
|
+
cache: ReadonlyMap<string, File>;
|
|
19
|
+
};
|
|
20
|
+
export type NamedFileService<Name extends string = 'file'> = NamedService<Name, FileService>;
|
|
21
|
+
export type FileServiceDescriptor = ServiceDescriptor<FileService, '1.0'>;
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new FileService.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fileService(): FileService;
|
|
26
|
+
/**
|
|
27
|
+
* A TypeScript source file.
|
|
28
|
+
*
|
|
29
|
+
* A File consists of arbirtrarily many appendable blocks of code, each
|
|
30
|
+
* identified by a Symbol. A template determines how the blocks of code
|
|
31
|
+
* are concatenated along with other code to create the final contents
|
|
32
|
+
* of the file.
|
|
33
|
+
*/
|
|
34
|
+
export declare class File {
|
|
35
|
+
readonly filename: string;
|
|
36
|
+
/**
|
|
37
|
+
* Symbol used to add code to the default block.
|
|
38
|
+
*/
|
|
39
|
+
static DEFAULT_BLOCK: symbol;
|
|
40
|
+
/**
|
|
41
|
+
* Code blocks for this file.
|
|
42
|
+
*/
|
|
43
|
+
blocks: Map<Symbol, Code>;
|
|
44
|
+
/**
|
|
45
|
+
* Template to use when assembling code blocks. Each entry in the array
|
|
46
|
+
* specifies either literal code or the symbol associated with an entry
|
|
47
|
+
* in blocks. The resulting Code objects are concatenated to create the
|
|
48
|
+
* contents of the file.
|
|
49
|
+
*/
|
|
50
|
+
template: Array<Code | Symbol>;
|
|
51
|
+
constructor(filename: string);
|
|
52
|
+
/**
|
|
53
|
+
* Appends new chunks of code to the default code block. Chunks are handled
|
|
54
|
+
* as in Code.push().
|
|
55
|
+
*
|
|
56
|
+
* @param chunks code to be appended to the default code block
|
|
57
|
+
* @returns this
|
|
58
|
+
*/
|
|
59
|
+
push(...chunks: any[]): this;
|
|
60
|
+
/**
|
|
61
|
+
* Appends code to the specified code block within this file. Code chunks are
|
|
62
|
+
* handled as in Code.push().
|
|
63
|
+
*
|
|
64
|
+
* @param block block to append code to
|
|
65
|
+
* @param chunks code to be appended
|
|
66
|
+
* @returns this
|
|
67
|
+
*/
|
|
68
|
+
pushTo(block: Symbol, ...chunks: any[]): this;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the code for this File, with ImportableReferences resolved.
|
|
71
|
+
*
|
|
72
|
+
* @param options
|
|
73
|
+
* prettififed - true to run the code through prettier
|
|
74
|
+
* @returns TypeScript source code for this File
|
|
75
|
+
*/
|
|
76
|
+
toString(options?: {
|
|
77
|
+
prettified?: boolean;
|
|
78
|
+
}): Promise<string>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NamedFileService } from './file';
|
|
2
|
+
/**
|
|
3
|
+
* Writes the files collected in a FileService to the filesystem.
|
|
4
|
+
*
|
|
5
|
+
* @param services files to be written
|
|
6
|
+
* @param outputDir directory against which to resolve filenames
|
|
7
|
+
* @param options
|
|
8
|
+
* prettififed - true to run the code through prettier
|
|
9
|
+
*/
|
|
10
|
+
export declare function writeFiles(services: NamedFileService, outputDir: string, options?: {
|
|
11
|
+
prettified?: boolean;
|
|
12
|
+
}): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/v1/generators/__tests__/aura-normalized-cache-control-command-generator.spec.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/v1/generators/__tests__/aura-resource-cache-control-command-generator.spec.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Type } from '@conduit-client/model/v1';
|
|
2
|
+
import { ICommandModel } from '../../model/base-command-model';
|
|
3
|
+
export declare function buildAuraCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel;
|
|
4
|
+
export declare function buildAuraResourceCacheCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel;
|
|
5
|
+
export declare function buildAuraNormalizedCacheCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel;
|
|
6
|
+
export declare function buildHttpCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel;
|
|
7
|
+
export declare function buildHttpNormalizedCacheCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel;
|
|
8
|
+
export declare function buildAuraGraphQLCommandModel(filePath: string, configType: Type, responseType: Type): ICommandModel & {
|
|
9
|
+
schema: any;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/v1/generators/__tests__/http-normalized-cache-control-command-generator.spec.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AuraResourceCacheControlCommandGenerator } from './aura-resource-cache-control-command-generator';
|
|
2
|
+
import { HttpCommandGenerator } from './http-command-generator';
|
|
3
|
+
import { type IBindingsGenerator } from './bindings-generator';
|
|
4
|
+
import type { NamedTypeRegistryGeneratorService } from '../normalization/type-registry-generator';
|
|
5
|
+
import type { NamedGraphQLTypeRegistryGeneratorService } from '../normalization/graphql-type-registry-generator';
|
|
6
|
+
import type { NamedFileService } from '../files';
|
|
7
|
+
import type { NamedAPIService, Operation } from '@conduit-client/model/v1';
|
|
8
|
+
import type { NamedJSONSchemaDeclarationService, NamedTypeDefinitionService } from '../types';
|
|
9
|
+
import type { ICommandModel } from '../model/base-command-model';
|
|
10
|
+
import type { ICommandGenerator } from './base-command-generator';
|
|
11
|
+
export declare function defaultCommandModelFactory(operation: Operation): ICommandModel;
|
|
12
|
+
export declare function defaultCommandGeneratorFactory(commandModel: ICommandModel, services: NamedAPIService & NamedFileService & NamedJSONSchemaDeclarationService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService): HttpCommandGenerator | AuraResourceCacheControlCommandGenerator | (import("./base-command-generator").CommandGenerator & import("./normalized-cache-control-generator-mixin").NormalizedCacheControlGenerator);
|
|
13
|
+
export declare function defaultBindingsGeneratorFactory(commandModels: ICommandModel[], services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService): IBindingsGenerator;
|
|
14
|
+
export interface IApiFamilyModuleGenerator {
|
|
15
|
+
build(): void;
|
|
16
|
+
buildModels(): ICommandModel[];
|
|
17
|
+
generateCommands(commandModels: ICommandModel[]): void;
|
|
18
|
+
generateBindings(commandModels: ICommandModel[]): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Class responsible for generating modules based on provided services and factories for commands and bindings.
|
|
22
|
+
*
|
|
23
|
+
* The `ModuleGenerator` class aggregates service interfaces and factory functions for creating command models,
|
|
24
|
+
* command generators, and bindings generators. It uses these components to build modules by processing API
|
|
25
|
+
* operations, generating necessary commands, and binding them into a coherent module structure.
|
|
26
|
+
*
|
|
27
|
+
* The general pattern for generating module code should, by convention, be:
|
|
28
|
+
* 1. Transform the API model service into more targeted models for code generation
|
|
29
|
+
* 2. Use those code generation models in the generator classes to populate a file template
|
|
30
|
+
*
|
|
31
|
+
* API operations map one to one with OneStore commands, and bindings sit on top of all commands, exposing the
|
|
32
|
+
* interface to be consumed by a user, e.g. a component.
|
|
33
|
+
*
|
|
34
|
+
* @property {NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedJSONSchemaDeclarationService} services - Composite object providing essential services like API, File, Type Definition, and JSON Schema Declaration services.
|
|
35
|
+
* @property {(op: Operation) => ICommandModel} commandModelFactory - Factory function to create command models from operations. Defaults to `defaultCommandModelFactory` if not provided.
|
|
36
|
+
* @property {(op: Operation, commandModel: ICommandModel, services: NamedFileService & NamedJSONSchemaDeclarationService & NamedTypeDefinitionService) => ICommandGenerator} commandGeneratorFactory - Factory function to create command generators. Takes an operation, a command model, and services. Defaults to `defaultCommandGeneratorFactory` if not provided.
|
|
37
|
+
* @property {(commandModels: ICommandModel[], services: NamedFileService & NamedTypeDefinitionService) => IBindingsGenerator} bindingsGeneratorFactory - Factory function to create bindings generators from command models and services. Defaults to `defaultBindingsGeneratorFactory` if not provided.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ApiFamilyModuleGenerator implements IApiFamilyModuleGenerator {
|
|
40
|
+
protected services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedJSONSchemaDeclarationService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService;
|
|
41
|
+
protected commandModelFactory: (op: Operation) => ICommandModel;
|
|
42
|
+
protected commandGeneratorFactory: (commandModel: ICommandModel, services: NamedAPIService & NamedFileService & NamedJSONSchemaDeclarationService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService) => ICommandGenerator;
|
|
43
|
+
protected bindingsGeneratorFactory: (commandModels: ICommandModel[], services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService) => IBindingsGenerator;
|
|
44
|
+
constructor(services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedJSONSchemaDeclarationService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService, commandModelFactory?: (op: Operation) => ICommandModel, commandGeneratorFactory?: (commandModel: ICommandModel, services: NamedAPIService & NamedFileService & NamedJSONSchemaDeclarationService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService) => ICommandGenerator, bindingsGeneratorFactory?: (commandModels: ICommandModel[], services: NamedAPIService & NamedFileService & NamedTypeDefinitionService & NamedTypeRegistryGeneratorService & NamedGraphQLTypeRegistryGeneratorService) => IBindingsGenerator);
|
|
45
|
+
/**
|
|
46
|
+
* Builds the module by processing all operations defined in the API service.
|
|
47
|
+
* This method iterates through each endpoint and operation, uses the command model factory to generate command models,
|
|
48
|
+
* then generates commands with the command generator factory, and finally builds bindings using the bindings generator factory.
|
|
49
|
+
*/
|
|
50
|
+
build(): void;
|
|
51
|
+
buildModels(): ICommandModel[];
|
|
52
|
+
generateCommands(commandModels: ICommandModel[]): void;
|
|
53
|
+
generateBindings(commandModels: ICommandModel[]): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Code, type ImportableTypeReference } from '../files';
|
|
2
|
+
import { HttpCommandGenerator } from './http-command-generator';
|
|
3
|
+
/**
|
|
4
|
+
* An extension of the CommandGenerator for generating command files specifically tailored for Salesforce Aura components.
|
|
5
|
+
*
|
|
6
|
+
* This class specializes in handling Aura-specific functionalities such as defining endpoints, generating Aura-compatible
|
|
7
|
+
* parameters, and handling errors in a manner compatible with Aura's handling mechanisms. It leverages the structure and
|
|
8
|
+
* behavior of the parent CommandGenerator class to create command files optimized for Aura component interactions.
|
|
9
|
+
*
|
|
10
|
+
* @extends CommandGenerator
|
|
11
|
+
*/
|
|
12
|
+
export declare class AuraCommandGenerator extends HttpCommandGenerator {
|
|
13
|
+
commandBaseClass: ImportableTypeReference;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs and returns an array of code blocks that form the body of the Aura-specific command class.
|
|
16
|
+
* @returns {Code[]} An array of code snippets that define the command class body, tailored for Aura components.
|
|
17
|
+
*/
|
|
18
|
+
get classBody(): Code[];
|
|
19
|
+
generateNetworkPreference(): Code;
|
|
20
|
+
/**
|
|
21
|
+
* Generates a code snippet that sets the command endpoint based on the controller and method defined in the command model.
|
|
22
|
+
* @returns {Code} A code snippet that statically sets the endpoint for the command.
|
|
23
|
+
*/
|
|
24
|
+
generateEndpoint(): Code;
|
|
25
|
+
/**
|
|
26
|
+
* Generates a getter method that constructs and returns a record of parameters required by the Aura command.
|
|
27
|
+
* @returns {Code} A code snippet defining a getter for the Aura parameters, structured as a record.
|
|
28
|
+
*/
|
|
29
|
+
generateAuraParams(): Code;
|
|
30
|
+
/**
|
|
31
|
+
* Helper method that aggregates all parameters (query and URI) and formats them into a structured record,
|
|
32
|
+
* possibly including the command body if specified.
|
|
33
|
+
* @returns {Code} A code block that constructs the parameters object for the Aura command.
|
|
34
|
+
*/
|
|
35
|
+
generateAuraParamsCode(): Code;
|
|
36
|
+
/**
|
|
37
|
+
* Determines how to destructure the input payload from the command configuration, adjusting based on schema type.
|
|
38
|
+
* @returns {Code | undefined} A code snippet for destructuring the input payload, if a body type is specified.
|
|
39
|
+
*/
|
|
40
|
+
generateInputPayloadParameter(): Code | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Generates a method for transforming Aura-specific errors into a standard format, based on the defined error strategy.
|
|
43
|
+
* @returns {Code} A code snippet for a method that coverts Aura errors into a fetch-compatible response.
|
|
44
|
+
*/
|
|
45
|
+
generateCoerceError(): Code;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AuraGraphQLNormalizedCacheControlCommandGenerator: new (...args: any[]) => import("./base-command-generator").CommandGenerator & import("./normalized-cache-control-generator-mixin").NormalizedCacheControlGenerator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AuraNormalizedCacheControlCommandGenerator: new (...args: any[]) => import("./base-command-generator").CommandGenerator & import("./normalized-cache-control-generator-mixin").NormalizedCacheControlGenerator;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AuraCommandGenerator } from './aura-command-generator';
|
|
2
|
+
import type { Code } from '../files';
|
|
3
|
+
/**
|
|
4
|
+
* Extends AuraCommandGenerator to add cache control strategies specific to resource caching in Aura components.
|
|
5
|
+
*
|
|
6
|
+
* This class further specializes the command generation process by including methods that handle cache control metadata and configuration,
|
|
7
|
+
* ensuring that resources are cached according to the specified strategy in the command model.
|
|
8
|
+
*
|
|
9
|
+
* @extends AuraCommandGenerator
|
|
10
|
+
*/
|
|
11
|
+
export declare class AuraResourceCacheControlCommandGenerator extends AuraCommandGenerator {
|
|
12
|
+
commandBaseClass: {
|
|
13
|
+
readonly module: "@conduit-client/command-aura-resource-cache-control/v1";
|
|
14
|
+
readonly exportedSymbol: "AuraResourceCacheControlCommand";
|
|
15
|
+
readonly isType: true;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Generates a method to build cache control metadata based on the response type and cache strategy defined in the command model.
|
|
19
|
+
* Throws an error if the cache strategy is set to 'none'.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Code} A code snippet that constructs cache control metadata for the command.
|
|
22
|
+
* @throws {Error} Throws an error if the cache strategy is 'none'.
|
|
23
|
+
*/
|
|
24
|
+
generateBuildCacheControlMetadata(): Code;
|
|
25
|
+
/**
|
|
26
|
+
* Generates a getter method that provides configuration for cache control strategies based on the command model settings.
|
|
27
|
+
* Throws an error if the cache strategy is set to 'none'.
|
|
28
|
+
*
|
|
29
|
+
* @returns {Code} A code snippet that provides cache control strategy configuration.
|
|
30
|
+
* @throws {Error} Throws an error if the cache strategy is 'none'.
|
|
31
|
+
*/
|
|
32
|
+
generateCacheControlStrategyConfig(): Code;
|
|
33
|
+
/**
|
|
34
|
+
* Overrides the base classBody method to include methods for cache control alongside the standard Aura command class body.
|
|
35
|
+
*
|
|
36
|
+
* @returns {Code[]} An array of code blocks that form the complete class body for the cache-controlled Aura command.
|
|
37
|
+
*/
|
|
38
|
+
get classBody(): Code[];
|
|
39
|
+
}
|