Skip to content

Commit 75db60a

Browse files
authored
Merge bff9250 into 40be2db
2 parents 40be2db + bff9250 commit 75db60a

File tree

95 files changed

+2811
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2811
-371
lines changed

.changeset/late-beers-develop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'firebase': major
3+
---
4+
5+
Remove `vertexai` import path

.changeset/spotty-ghosts-kneel.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/tricky-years-pump.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ body:
5858
description: Select the Firebase product(s) relevant to your issue. You can select multiple options in the dropdown.
5959
multiple: true
6060
options:
61+
- AI
6162
- Analytics
6263
- AppCheck
6364
- Auth
@@ -72,7 +73,6 @@ body:
7273
- Performance
7374
- Remote-Config
7475
- Storage
75-
- VertexAI
7676
validations:
7777
required: true
7878
- type: textarea

.github/workflows/e2e-test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030

3131
defaults:
3232
run:
33-
# Run any command steps in the /e2e subdir
34-
working-directory: './e2e'
33+
# Run any command steps in the /e2e/smoke-tests subdir
34+
working-directory: './e2e/smoke-tests'
3535

3636
steps:
3737
- name: Checkout Repo
@@ -53,7 +53,9 @@ jobs:
5353
- name: Poll npm until version to test is available for install
5454
run: |
5555
echo "Polling npm for firebase@${{ github.event.client_payload.versionOrTag }}"
56-
node ../scripts/release/poll-npm-publish.js
56+
node ./scripts/release/poll-npm-publish.js
57+
# run in root
58+
working-directory: '.'
5759
env:
5860
VERSION: ${{ github.event.client_payload.versionOrTag }}
5961
- name: Yarn install

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ vertexai-sdk-test-data
103103
mocks-lookup.ts
104104

105105
# temp changeset output
106-
changeset-temp.json
106+
changeset-temp.json

.vscode/launch.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "node",
1010
"request": "launch",
1111
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
12-
"cwd": "${workspaceRoot}/packages/vertexai",
12+
"cwd": "${workspaceRoot}/packages/ai",
1313
"args": [
1414
"--require",
1515
"ts-node/register",
@@ -24,6 +24,26 @@
2424
},
2525
"sourceMaps": true
2626
},
27+
{
28+
"name": "AI Integration Tests (node)",
29+
"type": "node",
30+
"request": "launch",
31+
"program": "${workspaceFolder}/node_modules/.bin/_mocha",
32+
"cwd": "${workspaceRoot}/packages/ai",
33+
"args": [
34+
"--require",
35+
"ts-node/register",
36+
"--require",
37+
"src/index.node.ts",
38+
"--timeout",
39+
"5000",
40+
"integration/**/*.test.ts"
41+
],
42+
"env": {
43+
"TS_NODE_COMPILER_OPTIONS": "{\"module\":\"commonjs\"}"
44+
},
45+
"sourceMaps": true
46+
},
2747
{
2848
"type": "node",
2949
"request": "launch",

common/api-review/ai.api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,9 @@ export abstract class Schema implements SchemaInterface {
791791
format?: string;
792792
// (undocumented)
793793
static integer(integerParams?: SchemaParams): IntegerSchema;
794+
items?: SchemaInterface;
795+
maxItems?: number;
796+
minItems?: number;
794797
nullable: boolean;
795798
// (undocumented)
796799
static number(numberParams?: SchemaParams): NumberSchema;
@@ -833,7 +836,9 @@ export interface SchemaShared<T> {
833836
format?: string;
834837
items?: T;
835838
maximum?: number;
839+
maxItems?: number;
836840
minimum?: number;
841+
minItems?: number;
837842
nullable?: boolean;
838843
properties?: {
839844
[k: string]: T;

docs-devsite/ai.schema.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export declare abstract class Schema implements SchemaInterface
3232
| [description](./ai.schema.md#schemadescription) | | string | Optional. The description of the property. |
3333
| [example](./ai.schema.md#schemaexample) | | unknown | Optional. The example of the property. |
3434
| [format](./ai.schema.md#schemaformat) | | string | Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBER type: "float", "double"</li> <li>for INTEGER type: "int32", "int64"</li> <li>for STRING type: "email", "byte", etc</li> </ul> |
35+
| [items](./ai.schema.md#schemaitems) | | [SchemaInterface](./ai.schemainterface.md#schemainterface_interface) | Optional. The items of the property. |
36+
| [maxItems](./ai.schema.md#schemamaxitems) | | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
37+
| [minItems](./ai.schema.md#schemaminitems) | | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3538
| [nullable](./ai.schema.md#schemanullable) | | boolean | Optional. Whether the property is nullable. Defaults to false. |
3639
| [type](./ai.schema.md#schematype) | | [SchemaType](./ai.md#schematype) | Optional. The type of the property. [SchemaType](./ai.md#schematype)<!-- -->. |
3740
@@ -93,6 +96,36 @@ Optional. The format of the property. Supported formats:<br/> <ul> <li>for NUMBE
9396
format?: string;
9497
```
9598
99+
## Schema.items
100+
101+
Optional. The items of the property.
102+
103+
<b>Signature:</b>
104+
105+
```typescript
106+
items?: SchemaInterface;
107+
```
108+
109+
## Schema.maxItems
110+
111+
The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
112+
113+
<b>Signature:</b>
114+
115+
```typescript
116+
maxItems?: number;
117+
```
118+
119+
## Schema.minItems
120+
121+
The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
122+
123+
<b>Signature:</b>
124+
125+
```typescript
126+
minItems?: number;
127+
```
128+
96129
## Schema.nullable
97130
98131
Optional. Whether the property is nullable. Defaults to false.

docs-devsite/ai.schemashared.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export interface SchemaShared<T>
2828
| [format](./ai.schemashared.md#schemasharedformat) | string | Optional. The format of the property. When using the Gemini Developer API ([GoogleAIBackend](./ai.googleaibackend.md#googleaibackend_class)<!-- -->), this must be either <code>'enum'</code> or <code>'date-time'</code>, otherwise requests will fail. |
2929
| [items](./ai.schemashared.md#schemashareditems) | T | Optional. The items of the property. |
3030
| [maximum](./ai.schemashared.md#schemasharedmaximum) | number | The maximum value of a numeric type. |
31+
| [maxItems](./ai.schemashared.md#schemasharedmaxitems) | number | The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3132
| [minimum](./ai.schemashared.md#schemasharedminimum) | number | The minimum value of a numeric type. |
33+
| [minItems](./ai.schemashared.md#schemasharedminitems) | number | The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->. |
3234
| [nullable](./ai.schemashared.md#schemasharednullable) | boolean | Optional. Whether the property is nullable. |
3335
| [properties](./ai.schemashared.md#schemasharedproperties) | { \[k: string\]: T; } | Optional. Map of <code>Schema</code> objects. |
3436
| [propertyOrdering](./ai.schemashared.md#schemasharedpropertyordering) | string\[\] | A hint suggesting the order in which the keys should appear in the generated JSON string. |
@@ -94,6 +96,16 @@ The maximum value of a numeric type.
9496
maximum?: number;
9597
```
9698

99+
## SchemaShared.maxItems
100+
101+
The maximum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
102+
103+
<b>Signature:</b>
104+
105+
```typescript
106+
maxItems?: number;
107+
```
108+
97109
## SchemaShared.minimum
98110

99111
The minimum value of a numeric type.
@@ -104,6 +116,16 @@ The minimum value of a numeric type.
104116
minimum?: number;
105117
```
106118

119+
## SchemaShared.minItems
120+
121+
The minimum number of items (elements) in a schema of type [SchemaType.ARRAY](./ai.md#schematypearray_enummember)<!-- -->.
122+
123+
<b>Signature:</b>
124+
125+
```typescript
126+
minItems?: number;
127+
```
128+
107129
## SchemaShared.nullable
108130

109131
Optional. Whether the property is nullable.

e2e/README.md

Lines changed: 7 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,11 @@
1-
# Firebase JS SDK E2E Tests
1+
# E2E Tests
22

3-
This directory contains end-to-end tests for the Firebase JS SDK package as well as minimal quick start sample apps for debugging and development.
3+
This directory is for Firebase E2E tests that are completely independent of the main SDK workspaces. Packages in here should:
44

5-
## E2E Tests
5+
* Have a start trigger independent of the main CI PR/push triggers (e.g., manual trigger, repository_dispatch, from an external runner like Kokoro, etc.)
6+
7+
A common use case might be to clone this repo, cd into the chosen directory under e2e, npm install, and run npm scripts.
68

7-
### Setup
9+
* Have a self-contained set of NPM dependencies. They should not depend on the local version of Firebase in the SDK nor assume inherited availability of any packages in the top level package.json of this repo (typescript, firebase, karma, etc.).
810

9-
Before running the tests, you will need:
10-
11-
- a project config
12-
- a test user with an email/password login which has read/write privileges for Storage, Realtime Database, and Firestore
13-
- an App Check debug token
14-
- to deploy the `callTest` Cloud Function
15-
16-
#### Project Config and Test User
17-
18-
Create a file named `firebase-config.js` in the top level of this `e2e/` directory. The contents of the file should be:
19-
20-
```javascript
21-
// A config for a project
22-
export const config = {
23-
apiKey: ************,
24-
authDomain: ************,
25-
databaseURL: ************,
26-
projectId: ************,
27-
storageBucket: ************,
28-
messagingSenderId: ************,
29-
appId: ************,
30-
measurementId: ************
31-
};
32-
*
33-
// A user account with read/write privileges in that project
34-
// for storage, database, firestore
35-
export const testAccount = {
36-
email: ************,
37-
password: ************
38-
}
39-
```
40-
41-
#### App Check Debug Token
42-
43-
Create an App Check debug token in the Firebase Console. Assign it to an environment variable in your shell named `APP_CHECK_DEBUG_TOKEN`.
44-
45-
#### Deploy `callTest` Cloud Function
46-
47-
From the top level of the firebase repo, ensure you have the Firebase CLI (`firebase-tools`) installed (if not, `npm install -g firebase-tools`).
48-
49-
Ensure you are logged in using the CLI (`firebase login`);
50-
51-
Then deploy the function with:
52-
`firebase deploy --only functions:callTest --project YOUR_PROJECT_ID`
53-
54-
### Running the Tests
55-
56-
To run the tests on the default modular API:
57-
58-
```
59-
yarn test:modular
60-
```
61-
62-
To run the tests on the compat API:
63-
64-
```
65-
yarn test:compat
66-
```
67-
68-
## Sample Apps
69-
70-
Two minimal sample apps are provided for quick debugging and development. These apps import and initialize every product in the SDK and call some basic methods. Products can easily be commented out to focus on one or more products you are interested in looking at.
71-
72-
### Setup
73-
74-
The setup is the same as for the E2E tests above. Certain tests can be skipped if you are commenting out that product (e.g, no need to deploy the Cloud Function if you are commenting out the `callFunctions()` line in the sample app, and no need to set the App Check debug token env variable if not using App Check).
75-
76-
### Running Sample Apps
77-
78-
To run the modular sample app (uses current default version of the API):
79-
80-
```
81-
yarn start:modular
82-
```
83-
84-
Then open `localhost:8080` in a browser.
85-
86-
To run the compat sample app (uses current compat version of the API):
87-
88-
```
89-
yarn start:compat
90-
```
91-
92-
Then open `localhost:8080` in a browser.
11+
See the `template/` directory for an example.

0 commit comments

Comments
 (0)