Skip to content

Commit

Permalink
build(client): add experimental presence package (microsoft#22359)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-ha authored Sep 3, 2024
1 parent 34f35b9 commit 9fa5ae0
Show file tree
Hide file tree
Showing 21 changed files with 426 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The dependencies between layers are enforced by the layer-check command._

| Packages | Layer Dependencies |
| --- | --- |
| - [@fluid-experimental/data-objects](/experimental/framework/data-objects)</br>- [@fluidframework/fluid-static](/packages/framework/fluid-static)</br>- [@fluid-experimental/property-binder](/experimental/PropertyDDS/packages/property-binder)</br>- [@fluid-experimental/property-changeset](/experimental/PropertyDDS/packages/property-changeset)</br>- [@fluid-experimental/property-common](/experimental/PropertyDDS/packages/property-common)</br>- [@fluid-internal/platform-dependent](/experimental/PropertyDDS/packages/property-common/platform-dependent) (private)</br>- [@fluid-experimental/property-dds](/experimental/PropertyDDS/packages/property-dds)</br>- [@fluid-experimental/property-inspector-table](/experimental/PropertyDDS/packages/property-inspector-table)</br>- [@fluid-experimental/property-properties](/experimental/PropertyDDS/packages/property-properties)</br>- [@fluid-experimental/property-proxy](/experimental/PropertyDDS/packages/property-proxy)</br>- [@fluid-experimental/property-query](/experimental/PropertyDDS/packages/property-query)</br>- [@fluid-experimental/property-shared-tree-interop](/experimental/PropertyDDS/packages/property-shared-tree-interop)</br>- [@fluid-experimental/last-edited](/experimental/framework/last-edited)</br>- [@fluid-experimental/tree-react-api](/experimental/framework/tree-react-api)</br>- [@fluidframework/agent-scheduler](/packages/framework/agent-scheduler)</br>- [@fluidframework/aqueduct](/packages/framework/aqueduct)</br>- [@fluid-experimental/attributor](/packages/framework/attributor)</br>- [@fluidframework/app-insights-logger](/packages/framework/client-logger/app-insights-logger)</br>- [@fluidframework/fluid-telemetry](/packages/framework/client-logger/fluid-telemetry)</br>- [@fluid-experimental/data-object-base](/packages/framework/data-object-base)</br>- [@fluid-experimental/dds-interceptions](/packages/framework/dds-interceptions)</br>- [@fluid-experimental/oldest-client-observer](/packages/framework/oldest-client-observer)</br>- [@fluidframework/request-handler](/packages/framework/request-handler)</br>- [@fluidframework/synthesize](/packages/framework/synthesize)</br>- [@fluidframework/undo-redo](/packages/framework/undo-redo) | - [Core-Interfaces](#Core-Interfaces)</br>- [Driver-Definitions](#Driver-Definitions)</br>- [Container-Definitions](#Container-Definitions)</br>- [Core-Utils](#Core-Utils)</br>- [Client-Utils](#Client-Utils)</br>- [Telemetry-Utils](#Telemetry-Utils)</br>- [Loader](#Loader)</br>- [Runtime](#Runtime)</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp; |
| - [@fluid-experimental/data-objects](/experimental/framework/data-objects)</br>- [@fluidframework/fluid-static](/packages/framework/fluid-static)</br>- [@fluid-experimental/property-binder](/experimental/PropertyDDS/packages/property-binder)</br>- [@fluid-experimental/property-changeset](/experimental/PropertyDDS/packages/property-changeset)</br>- [@fluid-experimental/property-common](/experimental/PropertyDDS/packages/property-common)</br>- [@fluid-internal/platform-dependent](/experimental/PropertyDDS/packages/property-common/platform-dependent) (private)</br>- [@fluid-experimental/property-dds](/experimental/PropertyDDS/packages/property-dds)</br>- [@fluid-experimental/property-inspector-table](/experimental/PropertyDDS/packages/property-inspector-table)</br>- [@fluid-experimental/property-properties](/experimental/PropertyDDS/packages/property-properties)</br>- [@fluid-experimental/property-proxy](/experimental/PropertyDDS/packages/property-proxy)</br>- [@fluid-experimental/property-query](/experimental/PropertyDDS/packages/property-query)</br>- [@fluid-experimental/property-shared-tree-interop](/experimental/PropertyDDS/packages/property-shared-tree-interop)</br>- [@fluid-experimental/last-edited](/experimental/framework/last-edited)</br>- [@fluid-experimental/tree-react-api](/experimental/framework/tree-react-api)</br>- [@fluidframework/agent-scheduler](/packages/framework/agent-scheduler)</br>- [@fluidframework/aqueduct](/packages/framework/aqueduct)</br>- [@fluid-experimental/attributor](/packages/framework/attributor)</br>- [@fluidframework/app-insights-logger](/packages/framework/client-logger/app-insights-logger)</br>- [@fluidframework/fluid-telemetry](/packages/framework/client-logger/fluid-telemetry)</br>- [@fluid-experimental/data-object-base](/packages/framework/data-object-base)</br>- [@fluid-experimental/dds-interceptions](/packages/framework/dds-interceptions)</br>- [@fluid-experimental/oldest-client-observer](/packages/framework/oldest-client-observer)</br>- [@fluid-experimental/presence](/packages/framework/presence) (private)</br>- [@fluidframework/request-handler](/packages/framework/request-handler)</br>- [@fluidframework/synthesize](/packages/framework/synthesize)</br>- [@fluidframework/undo-redo](/packages/framework/undo-redo) | - [Core-Interfaces](#Core-Interfaces)</br>- [Driver-Definitions](#Driver-Definitions)</br>- [Container-Definitions](#Container-Definitions)</br>- [Core-Utils](#Core-Utils)</br>- [Client-Utils](#Client-Utils)</br>- [Telemetry-Utils](#Telemetry-Utils)</br>- [Loader](#Loader)</br>- [Runtime](#Runtime)</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp;</br>&nbsp; |

### Build

Expand Down
20 changes: 20 additions & 0 deletions packages/framework/presence/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

module.exports = {
extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
parserOptions: {
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
},
overrides: [
{
// Rules only for test files
files: ["*.spec.ts", "src/test/**"],
rules: {
"@typescript-eslint/no-explicit-any": "error",
},
},
],
};
10 changes: 10 additions & 0 deletions packages/framework/presence/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nyc
*.log
**/*.tsbuildinfo
src/test
dist/test
lib/test
api-extractor
**/_api-extractor-temp/**
prettier.config.cjs
tsdoc.json
21 changes: 21 additions & 0 deletions packages/framework/presence/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Microsoft Corporation and contributors. All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115 changes: 115 additions & 0 deletions packages/framework/presence/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# @fluid-experimental/presence

A session only DDS for lightweight data sharing.

<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE) -->

<!-- prettier-ignore-start -->
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->

**IMPORTANT: This package is experimental.**
**Its APIs may change without notice.**

**Do not use in production scenarios.**

## Using Fluid Framework libraries

When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
library consumers should always prefer `^`.

If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.

## Installation

To get started, install the package by running the following command:

```bash
npm i @fluid-experimental/presence
```

## API Documentation

API documentation for **@fluid-experimental/presence** is available at <https://fluidframework.com/docs/apis/presence>.

## Minimum Client Requirements

These are the platform requirements for the current version of Fluid Framework Client Packages.
These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
For Long Term Support (LTS) versions this can require supporting these platforms for several years.

It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.

### Supported Runtimes

- NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
- Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).

### Supported Tools

- TypeScript 5.4:
- All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
- [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
- [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
- `exactOptionalPropertyTypes` is currently not fully supported.
If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
- [webpack](https://webpack.js.org/) 5
- We are not intending to be prescriptive about what bundler to use.
Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.

### Module Resolution

[`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.

### Module Formats

- ES Modules:
ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
- CommonJs:
Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
This is done to accommodate some workflows without good ES Module support.
If you have a workflow you would like included in this list, file an issue.
Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.

- Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))

## Contribution Guidelines

There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.

- Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
- [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).

Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

## Help

Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).

Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).

Thank you!

## Trademark

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.

Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).

Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

<!-- prettier-ignore-end -->

<!-- AUTO-GENERATED-CONTENT:END -->
4 changes: 4 additions & 0 deletions packages/framework/presence/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../../common/build/build-common/api-extractor-base.esm.no-legacy.json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "<projectFolder>/../../../common/build/build-common/api-extractor-lint.entrypoint.json",
"mainEntryPointFilePath": "<projectFolder>/lib/index.d.ts"
}
7 changes: 7 additions & 0 deletions packages/framework/presence/api-report/presence.alpha.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Alpha API Report File for "@fluid-experimental/presence"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

```
7 changes: 7 additions & 0 deletions packages/framework/presence/api-report/presence.beta.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Beta API Report File for "@fluid-experimental/presence"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

```
7 changes: 7 additions & 0 deletions packages/framework/presence/api-report/presence.public.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Public API Report File for "@fluid-experimental/presence"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

```
106 changes: 106 additions & 0 deletions packages/framework/presence/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"name": "@fluid-experimental/presence",
"version": "2.3.0",
"private": true,
"description": "A component for lightweight data sharing within a single session",
"homepage": "https://fluidframework.com",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/FluidFramework.git",
"directory": "packages/framework/presence"
},
"license": "MIT",
"author": "Microsoft and contributors",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./internal": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"files": [
"dist/**/*",
"lib/**/*",
"*.d.ts",
"!**/test/**"
],
"scripts": {
"build": "fluid-build . --task build",
"build:commonjs": "fluid-build . --task commonjs",
"build:compile": "fluid-build . --task compile",
"build:docs": "api-extractor run --local",
"build:esnext": "tsc --project ./tsconfig.json",
"build:test": "tsc --project ./src/test/tsconfig.json",
"check:are-the-types-wrong": "echo skip per issue #112 - node10 requirement: attw --pack .",
"check:biome": "biome check .",
"check:exports": "concurrently \"npm:check:exports:*\"",
"check:exports:bundle-release-tags": "api-extractor run --config api-extractor/api-extractor-lint-bundle.json",
"check:exports:cjs:index": "api-extractor run --config api-extractor/api-extractor-lint-index.cjs.json",
"check:exports:esm:index": "api-extractor run --config api-extractor/api-extractor-lint-index.esm.json",
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
"ci:build:docs": "api-extractor run",
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp",
"eslint": "eslint --format stylish src",
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
"format": "npm run format:biome",
"format:biome": "biome check . --write",
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
"lint": "fluid-build . --task lint",
"lint:fix": "fluid-build . --task eslint:fix --task format",
"test": "echo \"No tests yet\"",
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist"
},
"dependencies": {},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.2",
"@biomejs/biome": "~1.8.3",
"@fluid-tools/build-cli": "^0.44.0",
"@fluidframework/build-common": "^2.0.3",
"@fluidframework/build-tools": "^0.44.0",
"@fluidframework/eslint-config-fluid": "^5.4.0",
"@microsoft/api-extractor": "^7.45.1",
"concurrently": "^8.2.1",
"copyfiles": "^2.4.1",
"eslint": "~8.55.0",
"prettier": "~3.0.3",
"rimraf": "^4.4.0",
"typescript": "~5.4.5"
},
"fluidBuild": {
"tasks": {
"build:test": [
"build:esnext"
],
"check:exports:bundle-release-tags": [
"build:esnext"
],
"check:exports:cjs:index": [
"tsc"
],
"check:exports:esm:index": [
"build:esnext"
]
}
},
"typeValidation": {
"disabled": true,
"broken": {}
}
}
8 changes: 8 additions & 0 deletions packages/framework/presence/prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

module.exports = {
...require("@fluidframework/build-common/prettier.config.cjs"),
};
14 changes: 14 additions & 0 deletions packages/framework/presence/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

/**
* Experimental package for client presence within a connected session.
* @packageDocumentation
*/

/**
* @internal
*/
export const empty = "nothing to see here";
Loading

0 comments on commit 9fa5ae0

Please sign in to comment.