Skip to content
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
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage

# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
log:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
2 changes: 2 additions & 0 deletions apps/docs/src/app/categories/javascript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import StringCategory from './utils/sub-categories/string/ng-doc.category';
import FileCategory from './utils/sub-categories/file/ng-doc.category';
import NumberCategory from './utils/sub-categories/number/ng-doc.category';
import JavascriptCategory from './ng-doc.category';
import TypesCategory from './types/ng-doc.category';

export {
PaginationCategory,
Expand All @@ -26,4 +27,5 @@ export {
StringCategory,
FileCategory,
NumberCategory,
TypesCategory,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { NgDocCategory } from '@ng-doc/core';
import JavascriptCategory from '../ng-doc.category';

const TypesCategory: NgDocCategory = {
title: 'Types',
category: JavascriptCategory,
};

export default TypesCategory;
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
keyword: AuthenticationPage
---

`@studiohyperdrive/types` is a collection of individual packages that aim to form a bridge between front-end and back-end related packages.

## Installation

```shell
npm install @studiohyperdrive/types-auth
```

### Versioning and build information

This package will follow a semver-like format, `major.minor.patch`, in which:

- `major`: Follows the Angular major version
- `minor`: Introduces new features and (potential) breaking changes
- `patch`: Introduces bugfixes and minor non-breaking changes

For more information about the build process, authors, contributions and issues, we refer to the [ngx-tools](https://github.com/studiohyperdrive/hyperdrive-opensource) repository.

## Types

In order to plug into the corresponding frontend packages, the package provides an `AuthenticatedUserSession` and an `AuthenticationResponse` type.

`AuthenticatedUserSession` provides the basics for both permissions and feature flags provided to a user during their session.

`AuthenticationResponse` provides the authenticated user, an optional session and optional metadata.

## Corresponding packages

For Angular, the corresponding package is [@studiohyperdrive/ngx-auth](https://open-source.studiohyperdrive.be/docs/angular/authentication/introduction).
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NgDocPage } from '@ng-doc/core';
import { TypesCategory } from '../../../../../categories/javascript';

const AuthenticationPage: NgDocPage = {
title: `Authentication`,
mdFile: './index.md',
category: TypesCategory,
order: 1,
};

export default AuthenticationPage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
keyword: IntroductionPage
---

`@studiohyperdrive/types` is a collection of individual packages that aim to form a bridge between frontend and backend related packages.

## For developers

Our `@studiohyperdrive/types` packages form the bridge between backend and frontend applications, ensuring that both sides of the story can easily connect with each other. These packages are divided based on their context with the intent of keeping them as lightweight as possible.

Looking for more information on how these packages can help you out in your application? Check out the individual packages to find out more!
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NgDocPage } from '@ng-doc/core';
import { TypesCategory } from '../../../../../categories/javascript';

const IntroductionPage: NgDocPage = {
title: `Introduction`,
mdFile: './index.md',
category: TypesCategory,
order: 0,
};

export default IntroductionPage;
25 changes: 25 additions & 0 deletions libs/javascript/types/auth/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": ["../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
25 changes: 25 additions & 0 deletions libs/javascript/types/auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Javascript Tools: Authentication Types (`@studiohyperdrive/types-auth`)

`@studiohyperdrive/types-auth` is a set of base types used for the frontend-equivalent packages such as `@studiohyperdrive/ngx-auth`.

## Installation

Install the package first:

```shell
npm install @studiohyperdrive/types-auth
```

## Versioning and build information

This package will follow a semver-like format, `major.minor.patch`, in which:

- `major`: Introduces new features or breaking changes
- `minor`: Introduces minor non-breaking changes
- `patch`: Introduces bugfixes

For more information about the build process, authors, contributions and issues, we refer to the [hyperdrive-opensource](https://github.com/studiohyperdrive/hyperdrive-opensource) repository.

## Documentation

To find more information regarding this package, we refer to [our documentation platform](https://open-source.studiohyperdrive.be/docs/javascript/types/introduction).
27 changes: 27 additions & 0 deletions libs/javascript/types/auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@studiohyperdrive/types-auth",
"version": "0.0.1",
"dependencies": {},
"type": "commonjs",
"main": "./index.cjs",
"typings": "./index.d.ts",
"description": "A package containing common authentication related types",
"keywords": [
"authentication",
"user",
"session",
"features",
"permissions"
],
"homepage": "https://open-source.studiohyperdrive.be/docs/javascript/types/introduction",
"author": {
"name": "Studio Hyperdrive",
"url": "https://studiohyperdrive.be/"
},
"repository": {
"type": "git",
"url": "https://github.com/studiohyperdrive/hyperdrive-opensource",
"directory": "libs/javascript/types/auth/src"
},
"license": "MIT"
}
34 changes: 34 additions & 0 deletions libs/javascript/types/auth/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "js-types-auth",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/javascript/types/auth/src",
"projectType": "library",
"release": {
"version": {
"generatorOptions": {
"packageRoot": "dist/{projectRoot}",
"currentVersionResolver": "git-tag"
}
}
},
"tags": [],
"targets": {
"build": {
"executor": "@nx/esbuild:esbuild",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/libs/javascript/types/auth",
"main": "libs/javascript/types/auth/src/index.ts",
"tsConfig": "libs/javascript/types/auth/tsconfig.lib.json",
"format": ["cjs"],
"assets": ["libs/javascript/types/auth/*.md"],
"generatePackageJson": true
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
}
}
}
1 change: 1 addition & 0 deletions libs/javascript/types/auth/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
1 change: 1 addition & 0 deletions libs/javascript/types/auth/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './types';
1 change: 1 addition & 0 deletions libs/javascript/types/auth/src/lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './user.types';
41 changes: 41 additions & 0 deletions libs/javascript/types/auth/src/lib/types/user.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* A base type for the session of the authenticated user, providing features and permissions
*
* @template FeatureType - A list of possible features
* @template PermissionType - A list of possible permissions
*/
export interface AuthenticatedUserSession<
FeatureType extends string = string,
PermissionType extends string = string,
> {
/**
* An optional list of feature flags assigned to the user
*/
features?: FeatureType[];

/**
* An optional list of permissions assigned to the user
*/
permissions?: PermissionType[];
}

/**
* A base type for an authentication request, providing the authenticated user and optional session and metadata.
*
* @template UserType - The type of the authenticated user
* @template MetadataType - An optional type of the metadata
*/
export interface AuthenticationResponse<UserType, MetadataType = any> {
/**
* The authenticated user
*/
user: UserType;
/**
* An optional set of session related data
*/
session?: AuthenticatedUserSession;
/**
* The optional set of metadata
*/
metadata?: MetadataType;
}
16 changes: 16 additions & 0 deletions libs/javascript/types/auth/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
}
]
}
10 changes: 10 additions & 0 deletions libs/javascript/types/auth/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../../dist/out-tsc",
"declaration": true,
"types": ["node"],
"composite": true
},
"include": ["src/**/*.ts"]
}
20 changes: 19 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
"stylelint": {
"inputs": ["default", "{workspaceRoot}/.stylelintrc(.(json|yml|yaml|js))?"],
"cache": true
},
"@nx/esbuild:esbuild": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
}
},
"generators": {
Expand All @@ -87,5 +92,18 @@
"unitTestRunner": "jest"
}
},
"useLegacyCache": true
"useLegacyCache": true,
"release": {
"version": {
"preVersionCommand": "npx nx run-many -t build"
}
},
"plugins": [
{
"plugin": "@nx/eslint/plugin",
"options": {
"targetName": "eslint:lint"
}
}
]
}
Loading