@depup/firebase__ai 2.9.0-depup.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.
Files changed (119) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/ai-public.d.ts +3472 -0
  4. package/dist/ai.d.ts +3712 -0
  5. package/dist/esm/index.esm.js +4765 -0
  6. package/dist/esm/index.esm.js.map +1 -0
  7. package/dist/esm/package.json +1 -0
  8. package/dist/esm/src/api.d.ts +121 -0
  9. package/dist/esm/src/backend.d.ts +98 -0
  10. package/dist/esm/src/constants.d.ts +29 -0
  11. package/dist/esm/src/errors.d.ts +35 -0
  12. package/dist/esm/src/factory-browser.d.ts +19 -0
  13. package/dist/esm/src/factory-node.d.ts +19 -0
  14. package/dist/esm/src/googleai-mappers.d.ts +73 -0
  15. package/dist/esm/src/helpers.d.ts +30 -0
  16. package/dist/esm/src/index.d.ts +13 -0
  17. package/dist/esm/src/index.node.d.ts +7 -0
  18. package/dist/esm/src/logger.d.ts +18 -0
  19. package/dist/esm/src/methods/chat-session-helpers.d.ts +18 -0
  20. package/dist/esm/src/methods/chat-session.d.ts +77 -0
  21. package/dist/esm/src/methods/chrome-adapter.d.ts +124 -0
  22. package/dist/esm/src/methods/count-tokens.d.ts +21 -0
  23. package/dist/esm/src/methods/generate-content.d.ts +25 -0
  24. package/dist/esm/src/methods/live-session-helpers.d.ts +154 -0
  25. package/dist/esm/src/methods/live-session.d.ts +154 -0
  26. package/dist/esm/src/models/ai-model.d.ts +72 -0
  27. package/dist/esm/src/models/generative-model.d.ts +56 -0
  28. package/dist/esm/src/models/imagen-model.d.ts +102 -0
  29. package/dist/esm/src/models/index.d.ts +20 -0
  30. package/dist/esm/src/models/live-generative-model.d.ts +55 -0
  31. package/dist/esm/src/models/template-generative-model.d.ts +64 -0
  32. package/dist/esm/src/models/template-imagen-model.d.ts +51 -0
  33. package/dist/esm/src/models/utils.d.ts +26 -0
  34. package/dist/esm/src/public-types.d.ts +97 -0
  35. package/dist/esm/src/requests/hybrid-helpers.d.ts +33 -0
  36. package/dist/esm/src/requests/imagen-image-format.d.ts +61 -0
  37. package/dist/esm/src/requests/request-helpers.d.ts +28 -0
  38. package/dist/esm/src/requests/request.d.ts +69 -0
  39. package/dist/esm/src/requests/response-helpers.d.ts +57 -0
  40. package/dist/esm/src/requests/schema-builder.d.ts +170 -0
  41. package/dist/esm/src/requests/stream-reader.d.ts +39 -0
  42. package/dist/esm/src/service.d.ts +35 -0
  43. package/dist/esm/src/types/chrome-adapter.d.ts +61 -0
  44. package/dist/esm/src/types/content.d.ts +266 -0
  45. package/dist/esm/src/types/enums.d.ts +419 -0
  46. package/dist/esm/src/types/error.d.ts +89 -0
  47. package/dist/esm/src/types/googleai.d.ts +57 -0
  48. package/dist/esm/src/types/imagen/index.d.ts +18 -0
  49. package/dist/esm/src/types/imagen/internal.d.ts +134 -0
  50. package/dist/esm/src/types/imagen/requests.d.ts +245 -0
  51. package/dist/esm/src/types/imagen/responses.d.ts +79 -0
  52. package/dist/esm/src/types/index.d.ts +26 -0
  53. package/dist/esm/src/types/internal.d.ts +35 -0
  54. package/dist/esm/src/types/language-model.d.ts +107 -0
  55. package/dist/esm/src/types/live-responses.d.ts +79 -0
  56. package/dist/esm/src/types/requests.d.ts +543 -0
  57. package/dist/esm/src/types/responses.d.ts +607 -0
  58. package/dist/esm/src/types/schema.d.ts +139 -0
  59. package/dist/esm/src/websocket.d.ts +67 -0
  60. package/dist/index.cjs.js +4820 -0
  61. package/dist/index.cjs.js.map +1 -0
  62. package/dist/index.node.cjs.js +4512 -0
  63. package/dist/index.node.cjs.js.map +1 -0
  64. package/dist/index.node.mjs +4457 -0
  65. package/dist/index.node.mjs.map +1 -0
  66. package/dist/src/api.d.ts +121 -0
  67. package/dist/src/backend.d.ts +98 -0
  68. package/dist/src/constants.d.ts +29 -0
  69. package/dist/src/errors.d.ts +35 -0
  70. package/dist/src/factory-browser.d.ts +19 -0
  71. package/dist/src/factory-node.d.ts +19 -0
  72. package/dist/src/googleai-mappers.d.ts +73 -0
  73. package/dist/src/helpers.d.ts +30 -0
  74. package/dist/src/index.d.ts +13 -0
  75. package/dist/src/index.node.d.ts +7 -0
  76. package/dist/src/logger.d.ts +18 -0
  77. package/dist/src/methods/chat-session-helpers.d.ts +18 -0
  78. package/dist/src/methods/chat-session.d.ts +77 -0
  79. package/dist/src/methods/chrome-adapter.d.ts +124 -0
  80. package/dist/src/methods/count-tokens.d.ts +21 -0
  81. package/dist/src/methods/generate-content.d.ts +25 -0
  82. package/dist/src/methods/live-session-helpers.d.ts +154 -0
  83. package/dist/src/methods/live-session.d.ts +154 -0
  84. package/dist/src/models/ai-model.d.ts +72 -0
  85. package/dist/src/models/generative-model.d.ts +56 -0
  86. package/dist/src/models/imagen-model.d.ts +102 -0
  87. package/dist/src/models/index.d.ts +20 -0
  88. package/dist/src/models/live-generative-model.d.ts +55 -0
  89. package/dist/src/models/template-generative-model.d.ts +64 -0
  90. package/dist/src/models/template-imagen-model.d.ts +51 -0
  91. package/dist/src/models/utils.d.ts +26 -0
  92. package/dist/src/public-types.d.ts +97 -0
  93. package/dist/src/requests/hybrid-helpers.d.ts +33 -0
  94. package/dist/src/requests/imagen-image-format.d.ts +61 -0
  95. package/dist/src/requests/request-helpers.d.ts +28 -0
  96. package/dist/src/requests/request.d.ts +69 -0
  97. package/dist/src/requests/response-helpers.d.ts +57 -0
  98. package/dist/src/requests/schema-builder.d.ts +170 -0
  99. package/dist/src/requests/stream-reader.d.ts +39 -0
  100. package/dist/src/service.d.ts +35 -0
  101. package/dist/src/tsdoc-metadata.json +11 -0
  102. package/dist/src/types/chrome-adapter.d.ts +61 -0
  103. package/dist/src/types/content.d.ts +266 -0
  104. package/dist/src/types/enums.d.ts +419 -0
  105. package/dist/src/types/error.d.ts +89 -0
  106. package/dist/src/types/googleai.d.ts +57 -0
  107. package/dist/src/types/imagen/index.d.ts +18 -0
  108. package/dist/src/types/imagen/internal.d.ts +134 -0
  109. package/dist/src/types/imagen/requests.d.ts +245 -0
  110. package/dist/src/types/imagen/responses.d.ts +79 -0
  111. package/dist/src/types/index.d.ts +26 -0
  112. package/dist/src/types/internal.d.ts +35 -0
  113. package/dist/src/types/language-model.d.ts +107 -0
  114. package/dist/src/types/live-responses.d.ts +79 -0
  115. package/dist/src/types/requests.d.ts +543 -0
  116. package/dist/src/types/responses.d.ts +607 -0
  117. package/dist/src/types/schema.d.ts +139 -0
  118. package/dist/src/websocket.d.ts +67 -0
  119. package/package.json +106 -0
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Contains the list of OpenAPI data types
19
+ * as defined by the
20
+ * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
21
+ * @public
22
+ */
23
+ export declare const SchemaType: {
24
+ /** String type. */
25
+ readonly STRING: "string";
26
+ /** Number type. */
27
+ readonly NUMBER: "number";
28
+ /** Integer type. */
29
+ readonly INTEGER: "integer";
30
+ /** Boolean type. */
31
+ readonly BOOLEAN: "boolean";
32
+ /** Array type. */
33
+ readonly ARRAY: "array";
34
+ /** Object type. */
35
+ readonly OBJECT: "object";
36
+ };
37
+ /**
38
+ * Contains the list of OpenAPI data types
39
+ * as defined by the
40
+ * {@link https://swagger.io/docs/specification/data-models/data-types/ | OpenAPI specification}
41
+ * @public
42
+ */
43
+ export type SchemaType = (typeof SchemaType)[keyof typeof SchemaType];
44
+ /**
45
+ * Basic {@link Schema} properties shared across several Schema-related
46
+ * types.
47
+ * @public
48
+ */
49
+ export interface SchemaShared<T> {
50
+ /**
51
+ * An array of {@link Schema}. The generated data must be valid against any of the schemas
52
+ * listed in this array. This allows specifying multiple possible structures or types for a
53
+ * single field.
54
+ */
55
+ anyOf?: T[];
56
+ /** Optional. The format of the property.
57
+ * When using the Gemini Developer API ({@link GoogleAIBackend}), this must be either `'enum'` or
58
+ * `'date-time'`, otherwise requests will fail.
59
+ */
60
+ format?: string;
61
+ /** Optional. The description of the property. */
62
+ description?: string;
63
+ /**
64
+ * The title of the property. This helps document the schema's purpose but does not typically
65
+ * constrain the generated value. It can subtly guide the model by clarifying the intent of a
66
+ * field.
67
+ */
68
+ title?: string;
69
+ /** Optional. The items of the property. */
70
+ items?: T;
71
+ /** The minimum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
72
+ minItems?: number;
73
+ /** The maximum number of items (elements) in a schema of {@link (SchemaType:type)} `array`. */
74
+ maxItems?: number;
75
+ /** Optional. Map of `Schema` objects. */
76
+ properties?: {
77
+ [k: string]: T;
78
+ };
79
+ /** A hint suggesting the order in which the keys should appear in the generated JSON string. */
80
+ propertyOrdering?: string[];
81
+ /** Optional. The enum of the property. */
82
+ enum?: string[];
83
+ /** Optional. The example of the property. */
84
+ example?: unknown;
85
+ /** Optional. Whether the property is nullable. */
86
+ nullable?: boolean;
87
+ /** The minimum value of a numeric type. */
88
+ minimum?: number;
89
+ /** The maximum value of a numeric type. */
90
+ maximum?: number;
91
+ [key: string]: unknown;
92
+ }
93
+ /**
94
+ * Params passed to {@link Schema} static methods to create specific
95
+ * {@link Schema} classes.
96
+ * @public
97
+ */
98
+ export interface SchemaParams extends SchemaShared<SchemaInterface> {
99
+ }
100
+ /**
101
+ * Final format for {@link Schema} params passed to backend requests.
102
+ * @public
103
+ */
104
+ export interface SchemaRequest extends SchemaShared<SchemaRequest> {
105
+ /**
106
+ * The type of the property. this can only be undefined when using `anyOf` schemas,
107
+ * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification }.
108
+ */
109
+ type?: SchemaType;
110
+ /** Optional. Array of required property. */
111
+ required?: string[];
112
+ }
113
+ /**
114
+ * Interface for {@link Schema} class.
115
+ * @public
116
+ */
117
+ export interface SchemaInterface extends SchemaShared<SchemaInterface> {
118
+ /**
119
+ * The type of the property. this can only be undefined when using `anyof` schemas,
120
+ * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI Specification}.
121
+ */
122
+ type?: SchemaType;
123
+ }
124
+ /**
125
+ * Interface for JSON parameters in a schema of {@link (SchemaType:type)}
126
+ * "object" when not using the `Schema.object()` helper.
127
+ * @public
128
+ */
129
+ export interface ObjectSchemaRequest extends SchemaRequest {
130
+ type: 'object';
131
+ /**
132
+ * This is not a property accepted in the final request to the backend, but is
133
+ * a client-side convenience property that is only usable by constructing
134
+ * a schema through the `Schema.object()` helper method. Populating this
135
+ * property will cause response errors if the object is not wrapped with
136
+ * `Schema.object()`.
137
+ */
138
+ optionalProperties?: never;
139
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * A standardized interface for interacting with a WebSocket connection.
19
+ * This abstraction allows the SDK to use the appropriate WebSocket implementation
20
+ * for the current JS environment (Browser vs. Node) without
21
+ * changing the core logic of the `LiveSession`.
22
+ * @internal
23
+ */
24
+ export interface WebSocketHandler {
25
+ /**
26
+ * Establishes a connection to the given URL.
27
+ *
28
+ * @param url The WebSocket URL (e.g., wss://...).
29
+ * @returns A promise that resolves on successful connection or rejects on failure.
30
+ */
31
+ connect(url: string): Promise<void>;
32
+ /**
33
+ * Sends data over the WebSocket.
34
+ *
35
+ * @param data The string or binary data to send.
36
+ */
37
+ send(data: string | ArrayBuffer): void;
38
+ /**
39
+ * Returns an async generator that yields parsed JSON objects from the server.
40
+ * The yielded type is `unknown` because the handler cannot guarantee the shape of the data.
41
+ * The consumer is responsible for type validation.
42
+ * The generator terminates when the connection is closed.
43
+ *
44
+ * @returns A generator that allows consumers to pull messages using a `for await...of` loop.
45
+ */
46
+ listen(): AsyncGenerator<unknown>;
47
+ /**
48
+ * Closes the WebSocket connection.
49
+ *
50
+ * @param code - A numeric status code explaining why the connection is closing.
51
+ * @param reason - A human-readable string explaining why the connection is closing.
52
+ */
53
+ close(code?: number, reason?: string): Promise<void>;
54
+ }
55
+ /**
56
+ * A wrapper for the native `WebSocket` available in both Browsers and Node >= 22.
57
+ *
58
+ * @internal
59
+ */
60
+ export declare class WebSocketHandlerImpl implements WebSocketHandler {
61
+ private ws?;
62
+ constructor();
63
+ connect(url: string): Promise<void>;
64
+ send(data: string | ArrayBuffer): void;
65
+ listen(): AsyncGenerator<unknown>;
66
+ close(code?: number, reason?: string): Promise<void>;
67
+ }