Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔖 Prepare latest release #1526

Merged
merged 14 commits into from
Feb 6, 2023
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
2 changes: 1 addition & 1 deletion clients/client-web-vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4",
"vue": "^2.6.14"
},
Expand Down
2 changes: 1 addition & 1 deletion clients/client-web-vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4",
"vue": "^3.2.21"
},
Expand Down
2 changes: 1 addition & 1 deletion clients/client-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"gitHead": "c9569fabbf075a77c83272149bae8a055f76caee",
Expand Down
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"gitHead": "5a9ba2fe3100f807f627f55117e7b2ad4bbce9c1",
Expand Down
13 changes: 12 additions & 1 deletion docs/jovo-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,18 @@ this.$route;

Context properties contain information that was not explicitly stated by the user, but rather information accompanying the request.

The properties include [`$data`](#data), [`$session`](#session), [`$user`](#user), [`$device`](#device), and [`$history`](#history).
The properties include [`$id`](#id), [`$data`](#data), [`$session`](#session), [`$user`](#user), [`$device`](#device), and [`$history`](#history).

### $id

The `$id` property is a unique identifier for each request going through the [RIDR Lifecycle](#ridr-properties). This could be used for logging or analytics integrations, for example.

```typescript
this.$id;
```

The value is either retreived from the [`$request`](#request) object (if the platform provides a request ID) or generated using UUID v4.


### $data

Expand Down
2 changes: 1 addition & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"gitHead": "9d39800224d277cd6b500b48ba3f0fbacb22f176",
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/alexa/audioplayer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/alexa/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/alexa/lists/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/googleassistant/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/googlebusiness/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/snips/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"tsc-watch": "^4.2.9",
"typescript": "~4.4.4"
},
Expand Down
2 changes: 1 addition & 1 deletion framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"source-map-support": "^0.5.19",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"gitHead": "c9569fabbf075a77c83272149bae8a055f76caee",
Expand Down
4 changes: 3 additions & 1 deletion framework/src/Jovo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { Platform } from './Platform';
import { JovoRoute } from './plugins/RouterPlugin';
import { forEachDeep } from './utilities';
import { DependencyInjector } from './DependencyInjector';

import { v4 as uuidv4 } from 'uuid';
const DELEGATE_MIDDLEWARE = 'event.$delegate';
const RESOLVE_MIDDLEWARE = 'event.$resolve';
const REDIRECT_MIDDLEWARE = 'event.$redirect';
Expand Down Expand Up @@ -117,6 +117,7 @@ export abstract class Jovo<
$route?: JovoRoute;
$session: JovoSession;
$user: USER;
$id: string;

$cms: UnknownObject;

Expand All @@ -127,6 +128,7 @@ export abstract class Jovo<
readonly $platform: PLATFORM,
) {
this.$request = this.$platform.createRequestInstance($handleRequest.server.getRequestObject());
this.$id = this.$request.getRequestId ? this.$request.getRequestId() || uuidv4() : uuidv4();
this.$input = this.$request.getInput();
this.$output = [];

Expand Down
1 change: 1 addition & 0 deletions framework/src/JovoRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export abstract class JovoRequest {
abstract getSessionData(): UnknownObject | undefined;
abstract getSessionId(): string | undefined;
abstract isNewSession(): boolean | undefined;
getRequestId?(): string | undefined;

getSession(): Partial<JovoSession> | undefined {
const sessionId = this.getSessionId();
Expand Down
4 changes: 4 additions & 0 deletions framework/src/testsuite/TestRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ export class TestRequest extends JovoRequest {
getDeviceCapabilities(): string[] | undefined {
return;
}

getRequestId(): string | undefined {
return;
}
}
26 changes: 26 additions & 0 deletions framework/test/Jovo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,29 @@ test('AsyncJovo.$send', async () => {
expect((jovo as AnyObject).sendResponse).toHaveBeenCalledTimes(2);
expect(jovo.$output).toEqual([{ message: 'Hello' }, { message: 'world' }]);
});

test('check generated jovo.$id ', async () => {
const spy = jest
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore`
.spyOn(ExamplePlatformRequest.prototype, 'getRequestId')
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore`
.mockImplementation(() => undefined);
const jovo = platform.createJovoInstance(app, handleRequest);

// @see https://melvingeorge.me/blog/check-if-string-valid-uuid-regex-javascript
const checkIfValidUUID = (str: string) => {
// Regular expression to check if string is a valid UUID
const regexExp =
/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;
return regexExp.test(str);
};
expect(checkIfValidUUID(jovo.$id)).toBeTruthy();
spy.mockRestore();
});

test('check jovo.$id from request', async () => {
const jovo = platform.createJovoInstance(app, handleRequest);
expect(jovo.$id).toEqual('requestId');
});
5 changes: 5 additions & 0 deletions framework/test/utilities/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
export class ExamplePlatformRequest extends JovoRequest {
input: Input = {};
session?: Partial<JovoSession> = {};
requestId?: string = 'requestId';

getUserId(): string | undefined {
return;
Expand All @@ -44,6 +45,10 @@ export class ExamplePlatformRequest extends JovoRequest {
return;
}

getRequestId(): string | undefined {
return this.requestId;
}

getIntent(): JovoInput['intent'] {
return this.input.intent;
}
Expand Down
2 changes: 1 addition & 1 deletion integrations/analytics-dashbot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/cms-airtable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/cms-googlesheets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/cms-sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/db-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/db-filedb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/db-mongodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/nlu-dialogflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/nlu-nlpjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/nlu-rasa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/nlu-snips/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
32 changes: 29 additions & 3 deletions integrations/plugin-debugger/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Learn more about its configuration options in the [Debugger plugin configuration
You can configure the Jovo Debugger plugin in the [app configuration](https://www.jovo.tech/docs/app-config). It includes everything that is needed from the app side for the Debugger to work properly ([for Debugger frontend customization, take a look here](#debugger-customization)).

```typescript
import { JovoDebugger } from '@jovotech/plugin-debugger';
import { JovoDebugger, DEFAULT_INCLUDED_PROPERTIES } from '@jovotech/plugin-debugger';
// ...

app.configure({
Expand All @@ -68,7 +68,8 @@ app.configure({
webhookUrl: 'https://webhook.jovo.cloud',
debuggerConfigPath: './jovo.debugger.js',
modelsPath: './models',
ignoredProperties: ['$app', '$handleRequest', '$platform'],
includedProperties: DEFAULT_INCLUDED_PROPERTIES,
ignoredProperties: ['$app', '$handleRequest', '$platform'], // We recommend using includedProperties instead
}),
// ...
],
Expand All @@ -82,7 +83,8 @@ It includes the following properties:
- `webhookUrl`: The webhook to pass to the Debugger. By default, your [Jovo Webhook](https://www.jovo.tech/docs/webhook) URL is used.
- [`debuggerConfigPath`](#debugger-customization): The path to the Debugger Config file. Learn more in the [Debugger customization](#debugger-customization) section.
- `modelsPath`: The path to the [Jovo Models](https://www.jovo.tech/docs/models) folder.
- `ignoredProperties`: The [Jovo properties](https://www.jovo.tech/docs/jovo-properties) that should be ignored by the Debugger lifecycle view.
- [`includedProperties`](#includedproperties): The [Jovo properties](https://www.jovo.tech/docs/jovo-properties) that should be included in the Debugger lifecycle view.
- `ignoredProperties`: The [Jovo properties](https://www.jovo.tech/docs/jovo-properties) that should be ignored by the Debugger lifecycle view. This is an old config property. We recommend using [`includedProperties`](#includedproperties) instead.

### nlu

Expand Down Expand Up @@ -169,6 +171,30 @@ app.configure({
});
```

### includedProperties

The Debugger lifecycle view displays updates to [Jovo properties](https://www.jovo.tech/docs/jovo-properties) that happen during a request-response lifecycle. This is helpful to track more detailed changes to your app's data.

If you have an additional property that you want to track using the Debugger, you can add it using the `includedProperties` array. We recommend the following approach:

```typescript
import { DEFAULT_INCLUDED_PROPERTIES, JovoDebugger } from '@jovotech/plugin-debugger';
// ...

app.configure({
plugins: [
new JovoDebugger({
includedProperties: [...DEFAULT_INCLUDED_PROPERTIES, '$yourProperty'],
// ...
}),
// ...
],
});
```

Note: Properties that contain a reference to the `Jovo` object can cause `Maximum call stack size exceeded` exceptions.


## Debugger Customization

You can customize the Debugger frontend using the `jovo.debugger.js` file in the root of your Jovo project. [Learn more about the Debugger configuration here](https://www.jovo.tech/docs/debugger-config).
Expand Down
2 changes: 1 addition & 1 deletion integrations/plugin-debugger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"jest": "^29.2.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"ts-jest": "^29.0.4",
"typescript": "~4.4.4"
},
"peerDependencies": {
Expand Down
Loading