Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sdk/core/core-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"sdk-type": "client",
"main": "dist/index.js",
"module": "dist-esm/src/index.js",
"browser": {
"./dist-esm/src/base64.js": "./dist-esm/src/base64.browser.js",
"./dist-esm/src/url.js": "./dist-esm/src/url.browser.js"
},
"types": "types/latest/core-client.d.ts",
"typesVersions": {
"<3.6": {
Expand Down Expand Up @@ -73,6 +77,10 @@
"sideEffects": false,
"prettier": "@azure/eslint-plugin-azure-sdk/prettier.json",
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-auth": "^1.1.3",
"@azure/core-https": "1.0.0-preview.1",
"@azure/core-tracing": "1.0.0-preview.8",
"@opentelemetry/api": "^0.6.1",
"tslib": "^2.0.0"
},
Expand All @@ -86,6 +94,7 @@
"@types/chai": "^4.1.6",
"@types/mocha": "^7.0.2",
"@types/node": "^8.0.0",
"@types/sinon": "^9.0.4",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
Expand Down Expand Up @@ -117,6 +126,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-terser": "^5.1.1",
"rollup-plugin-visualizer": "^4.0.4",
"sinon": "^9.0.2",
"typescript": "~3.9.3",
"util": "^0.12.1"
}
Expand Down
334 changes: 333 additions & 1 deletion sdk/core/core-client/review/core-client.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,340 @@

```ts

import { AbortSignalLike } from '@azure/abort-controller';
import { HttpMethods } from '@azure/core-https';
import { HttpsClient } from '@azure/core-https';
import { OperationTracingOptions } from '@azure/core-tracing';
import { Pipeline } from '@azure/core-https';
import { PipelinePolicy } from '@azure/core-https';
import { PipelineRequest } from '@azure/core-https';
import { PipelineResponse } from '@azure/core-https';
import { TokenCredential } from '@azure/core-auth';
import { TransferProgressEvent } from '@azure/core-https';

// @public (undocumented)
export interface BaseMapper {
// (undocumented)
constraints?: MapperConstraints;
// (undocumented)
defaultValue?: any;
// (undocumented)
isConstant?: boolean;
// (undocumented)
nullable?: boolean;
// (undocumented)
readOnly?: boolean;
// (undocumented)
required?: boolean;
// (undocumented)
serializedName?: string;
// (undocumented)
type: MapperType;
// (undocumented)
xmlElementName?: string;
// (undocumented)
xmlIsAttribute?: boolean;
// (undocumented)
xmlIsWrapped?: boolean;
// (undocumented)
xmlName?: string;
}

// @public (undocumented)
export interface CompositeMapper extends BaseMapper {
// (undocumented)
type: CompositeMapperType;
}

// @public (undocumented)
export interface CompositeMapperType {
// (undocumented)
additionalProperties?: Mapper;
// (undocumented)
className?: string;
// (undocumented)
modelProperties?: {
[propertyName: string]: Mapper;
};
// (undocumented)
name: "Composite";
// (undocumented)
polymorphicDiscriminator?: PolymorphicDiscriminator;
// (undocumented)
uberParent?: string;
}

// @public
export function createSerializer(modelMappers?: {
[key: string]: any;
}, isXML?: boolean): Serializer;

// @public
export interface DeserializationContentTypes {
json?: string[];
xml?: string[];
}

// @public
export function deserializationPolicy(options?: DeserializationPolicyOptions): PipelinePolicy;

// @public
export const deserializationPolicyName = "deserializationPolicy";

// @public
export interface DeserializationPolicyOptions {
expectedContentTypes?: DeserializationContentTypes;
parseXML?: (str: string, opts?: {
includeRoot?: boolean;
}) => Promise<any>;
}

// @public (undocumented)
export interface DictionaryMapper extends BaseMapper {
// (undocumented)
headerCollectionPrefix?: string;
// (undocumented)
type: DictionaryMapperType;
}

// @public (undocumented)
export interface DictionaryMapperType {
// (undocumented)
name: "Dictionary";
// (undocumented)
value: Mapper;
}

// @public (undocumented)
export interface EnumMapper extends BaseMapper {
// (undocumented)
type: EnumMapperType;
}

// @public (undocumented)
export interface EnumMapperType {
// (undocumented)
allowedValues: any[];
// (undocumented)
name: "Enum";
}

// @public
export interface FullOperationResponse extends PipelineResponse {
parsedBody?: any;
parsedHeaders?: {
[key: string]: unknown;
};
request: OperationRequest;
}

// @public (undocumented)
export type Mapper = BaseMapper | CompositeMapper | SequenceMapper | DictionaryMapper | EnumMapper;

// @public (undocumented)
export interface MapperConstraints {
// (undocumented)
ExclusiveMaximum?: number;
// (undocumented)
ExclusiveMinimum?: number;
// (undocumented)
InclusiveMaximum?: number;
// (undocumented)
InclusiveMinimum?: number;
// (undocumented)
MaxItems?: number;
// (undocumented)
MaxLength?: number;
// (undocumented)
MinItems?: number;
// (undocumented)
MinLength?: number;
// (undocumented)
MultipleOf?: number;
// (undocumented)
Pattern?: RegExp;
// (undocumented)
UniqueItems?: true;
}

// @public (undocumented)
export type MapperType = SimpleMapperType | CompositeMapperType | SequenceMapperType | DictionaryMapperType | EnumMapperType;

// @public
export const MapperTypeNames: {
readonly Base64Url: "Base64Url";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sorting these 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take credit but really I just replaced a crazy utility function that made a fake enum with a simple const object. 😅

readonly Boolean: "Boolean";
readonly ByteArray: "ByteArray";
readonly Composite: "Composite";
readonly Date: "Date";
readonly DateTime: "DateTime";
readonly DateTimeRfc1123: "DateTimeRfc1123";
readonly Dictionary: "Dictionary";
readonly Enum: "Enum";
readonly Number: "Number";
readonly Object: "Object";
readonly Sequence: "Sequence";
readonly String: "String";
readonly Stream: "Stream";
readonly TimeSpan: "TimeSpan";
readonly UnixTime: "UnixTime";
};

// @public
export interface OperationArguments {
[parameterName: string]: unknown;
options?: OperationOptions;
}

// @public
export interface OperationOptions {
abortSignal?: AbortSignalLike;
requestOptions?: OperationRequestOptions;
tracingOptions?: OperationTracingOptions;
}

// @public
export interface OperationParameter {
mapper: Mapper;
parameterPath: ParameterPath;
}

// @public
export interface OperationQueryParameter extends OperationParameter {
collectionFormat?: QueryCollectionFormat;
skipEncoding?: boolean;
}

// @public
export type OperationRequest = PipelineRequest<OperationRequestInfo>;

// @public
export interface OperationRequestInfo {
operationResponseGetter?: (operationSpec: OperationSpec, response: PipelineResponse) => undefined | OperationResponseMap;
operationSpec?: OperationSpec;
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
}

// @public
export interface OperationRequestOptions {
customHeaders?: {
[key: string]: string;
};
onDownloadProgress?: (progress: TransferProgressEvent) => void;
onUploadProgress?: (progress: TransferProgressEvent) => void;
shouldDeserialize?: boolean | ((response: PipelineResponse) => boolean);
timeout?: number;
}

// @public
export interface OperationResponse {
// (undocumented)
[key: string]: any;
_response: FullOperationResponse;
}

// @public
export interface OperationResponseMap {
bodyMapper?: Mapper;
headersMapper?: Mapper;
}

// @public
export interface OperationSpec {
readonly baseUrl?: string;
readonly contentType?: string;
readonly formDataParameters?: ReadonlyArray<OperationParameter>;
readonly headerParameters?: ReadonlyArray<OperationParameter>;
readonly httpMethod: HttpMethods;
readonly isXML?: boolean;
readonly mediaType?: "json" | "xml" | "form" | "binary" | "multipart" | "text" | "unknown" | string;
readonly path?: string;
readonly queryParameters?: ReadonlyArray<OperationQueryParameter>;
readonly requestBody?: OperationParameter;
readonly responses: {
[responseCode: string]: OperationResponseMap;
};
readonly serializer: Serializer;
readonly urlParameters?: ReadonlyArray<OperationURLParameter>;
}

// @public
export interface OperationURLParameter extends OperationParameter {
skipEncoding?: boolean;
}

// @public
export type ParameterPath = string | string[] | {
[propertyName: string]: ParameterPath;
};

// @public (undocumented)
export interface PolymorphicDiscriminator {
// (undocumented)
[key: string]: string;
// (undocumented)
clientName: string;
// (undocumented)
serializedName: string;
}

// @public
export type QueryCollectionFormat = "CSV" | "SSV" | "TSV" | "Pipes" | "Multi";

// @public (undocumented)
export interface SequenceMapper extends BaseMapper {
// (undocumented)
type: SequenceMapperType;
}

// @public (undocumented)
export interface SequenceMapperType {
// (undocumented)
element: Mapper;
// (undocumented)
name: "Sequence";
}

// @public
export interface Serializer {
// (undocumented)
deserialize(mapper: Mapper, responseBody: any, objectName: string): any;
// (undocumented)
readonly isXML: boolean;
// (undocumented)
readonly modelMappers: {
[key: string]: any;
};
// (undocumented)
serialize(mapper: Mapper, object: any, objectName?: string): any;
// (undocumented)
validateConstraints(mapper: Mapper, value: any, objectName: string): void;
}

// @public
export class ServiceClient {
constructor(options?: ServiceClientOptions);
sendOperationRequest(operationArguments: OperationArguments, operationSpec: OperationSpec): Promise<OperationResponse>;
sendRequest(request: PipelineRequest): Promise<PipelineResponse>;
}

// @public
export interface ServiceClientOptions {
baseUri?: string;
credential?: TokenCredential;
httpsClient?: HttpsClient;
pipeline?: Pipeline;
requestContentType?: string;
stringifyXML?: (obj: any, opts?: {
rootName?: string;
}) => string;
}

// @public (undocumented)
export function helloWorld(): string;
export interface SimpleMapperType {
// (undocumented)
name: "Base64Url" | "Boolean" | "ByteArray" | "Date" | "DateTime" | "DateTimeRfc1123" | "Object" | "Stream" | "String" | "TimeSpan" | "UnixTime" | "Uuid" | "Number" | "any";
}


// (No @packageDocumentation comment for this package)
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-client/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const input = "dist-esm/src/index.js";
const production = process.env.NODE_ENV === "production";

export function nodeConfig(test = false) {
const externalNodeBuiltins = [];
const externalNodeBuiltins = ["url"];
const baseConfig = {
input: input,
external: depNames.concat(externalNodeBuiltins),
Expand Down
Loading