Skip to content

Commit

Permalink
chore: generated files for the Web Bluetooth spec
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Mar 26, 2024
1 parent 31e3a92 commit 47f3f87
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 0 deletions.
113 changes: 113 additions & 0 deletions src/protocol-parser/generated/webdriver-bidi-bluetooth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/**
* Copyright 2024 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* THIS FILE IS AUTOGENERATED by cddlconv 0.1.2.
* Run `node tools/generate-bidi-types.mjs` to regenerate.
* @see https://github.com/w3c/webdriver-bidi/blob/master/index.bs
*/

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck Some types may be circular.

import z from 'zod';

export namespace Bluetooth {
export const RequestDeviceSchema = z.lazy(() => z.string());
}
export namespace Bluetooth {
export const RequestDeviceInfoSchema = z.lazy(() =>
z.object({
id: Bluetooth.RequestDeviceSchema,
name: z.string(),
})
);
}
export namespace Bluetooth {
export const RequestDevicePromptSchema = z.lazy(() => z.string());
}
export namespace Bluetooth {
export const HandleRequestDevicePromptSchema = z.lazy(() =>
z.object({
method: z.literal('bluetooth.handleRequestDevicePrompt'),
params: Bluetooth.HandleRequestDevicePromptParametersSchema,
})
);
}
export namespace Bluetooth {
export const HandleRequestDevicePromptParametersSchema = z.lazy(() =>
z
.object({
context: z.string(),
prompt: Bluetooth.RequestDevicePromptSchema,
})
.and(
z.union([
Bluetooth.HandleRequestDevicePromptAcceptParametersSchema,
Bluetooth.HandleRequestDevicePromptCancelParametersSchema,
])
)
);
}
export namespace Bluetooth {
export const HandleRequestDevicePromptAcceptParametersSchema = z.lazy(() =>
z.object({
accept: z.literal(true),
device: Bluetooth.RequestDeviceSchema,
})
);
}
export namespace Bluetooth {
export const HandleRequestDevicePromptCancelParametersSchema = z.lazy(() =>
z.object({
accept: z.literal(false),
})
);
}
export namespace Bluetooth {
export const RequestDevicePromptOpenedSchema = z.lazy(() =>
z.object({
method: z.literal('bluetooth.requestDevicePromptOpened'),
params: Bluetooth.RequestDevicePromptOpenedParametersSchema,
})
);
}
export namespace Bluetooth {
export const RequestDevicePromptOpenedParametersSchema = z.lazy(() =>
z.object({
context: z.string(),
prompt: Bluetooth.RequestDevicePromptSchema,
devices: z.array(Bluetooth.RequestDeviceInfoSchema),
})
);
}
export namespace Bluetooth {
export const RequestDevicePromptClosedSchema = z.lazy(() =>
z.object({
method: z.literal('bluetooth.requestDevicePromptClosed'),
params: Bluetooth.RequestDevicePromptClosedParametersSchema,
})
);
}
export namespace Bluetooth {
export const RequestDevicePromptClosedParametersSchema = z.lazy(() =>
z.object({
context: z.string(),
prompt: Bluetooth.RequestDevicePromptSchema,
})
);
}
86 changes: 86 additions & 0 deletions src/protocol/generated/webdriver-bidi-bluetooth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Copyright 2024 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* THIS FILE IS AUTOGENERATED by cddlconv 0.1.2.
* Run `node tools/generate-bidi-types.mjs` to regenerate.
* @see https://github.com/w3c/webdriver-bidi/blob/master/index.bs
*/

export namespace Bluetooth {
export type RequestDevice = string;
}
export namespace Bluetooth {
export type RequestDeviceInfo = {
id: Bluetooth.RequestDevice;
name: string;
};
}
export namespace Bluetooth {
export type RequestDevicePrompt = string;
}
export namespace Bluetooth {
export type HandleRequestDevicePrompt = {
method: 'bluetooth.handleRequestDevicePrompt';
params: Bluetooth.HandleRequestDevicePromptParameters;
};
}
export namespace Bluetooth {
export type HandleRequestDevicePromptParameters = {
context: string;
prompt: Bluetooth.RequestDevicePrompt;
} & (
| Bluetooth.HandleRequestDevicePromptAcceptParameters
| Bluetooth.HandleRequestDevicePromptCancelParameters
);
}
export namespace Bluetooth {
export type HandleRequestDevicePromptAcceptParameters = {
accept: true;
device: Bluetooth.RequestDevice;
};
}
export namespace Bluetooth {
export type HandleRequestDevicePromptCancelParameters = {
accept: false;
};
}
export namespace Bluetooth {
export type RequestDevicePromptOpened = {
method: 'bluetooth.requestDevicePromptOpened';
params: Bluetooth.RequestDevicePromptOpenedParameters;
};
}
export namespace Bluetooth {
export type RequestDevicePromptOpenedParameters = {
context: string;
prompt: Bluetooth.RequestDevicePrompt;
devices: [...Bluetooth.RequestDeviceInfo[]];
};
}
export namespace Bluetooth {
export type RequestDevicePromptClosed = {
method: 'bluetooth.requestDevicePromptClosed';
params: Bluetooth.RequestDevicePromptClosedParameters;
};
}
export namespace Bluetooth {
export type RequestDevicePromptClosedParameters = {
context: string;
prompt: Bluetooth.RequestDevicePrompt;
};
}

0 comments on commit 47f3f87

Please sign in to comment.