-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ama-sdk): move ApiFetchClient to dedicated package
- Loading branch information
Showing
100 changed files
with
2,837 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
/* eslint-disable quote-props */ | ||
|
||
module.exports = { | ||
'root': true, | ||
'parserOptions': { | ||
'tsconfigRootDir': __dirname, | ||
'project': [ | ||
'tsconfig.build.json', | ||
'tsconfig.builders.json', | ||
'tsconfig.spec.json', | ||
'tsconfig.eslint.json' | ||
], | ||
'sourceType': 'module' | ||
}, | ||
'extends': [ | ||
'../../../.eslintrc.js' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/fwk | ||
/helpers | ||
/index.* | ||
/bundles | ||
/test | ||
/dist-test | ||
/plugins | ||
/dist | ||
/utils | ||
/build |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Ama SDK Fetch Client | ||
|
||
[![Stable Version](https://img.shields.io/npm/v/@ama-sdk/client-fetch?style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/client-fetch) | ||
[![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-sdk/client-fetch?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-sdk/client-fetch) | ||
|
||
This package exposes the **Api Fetch Client** from an SDK based on [@ama-sdk/core](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/core). | ||
|
||
This package contains all the [Fetch Plugins](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins), helpers and object definitions to dialog with an API following the `ama-sdk` architecture. | ||
|
||
> [!TIP] | ||
> Please refer to the [SDK initializer](https://www.npmjs.com/package/@ama-sdk/create) package for getting started with an API client SDK based on `ama-sdk` architecture. | ||
## Setup | ||
|
||
The **Api Fetch Client** can be added to your project via the following command: | ||
|
||
```shell | ||
ng add @ama-sdk/client-fetch | ||
``` | ||
|
||
> [!NOTE] | ||
> In case of migration from deprecated `ApiFetchClient` imported from `@ama-sdk/core`, the `ng add` command will replace, in your existing code, the import from `@ama-sdk/core` to `@ama-sdk/client-fetch` for the deprecated dependencies. | ||
## Available plugins | ||
|
||
- [abort](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/abort) | ||
- [concurrent](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/concurrent) | ||
- [keepalive](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/keepalive) | ||
- [mock-intercept](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/mock-intercept) | ||
- [perf-metric](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/perf-metric) | ||
- [retry](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/retry) | ||
- [timeout](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/timeout) | ||
- [wait-for](https://github.com/AmadeusITGroup/otter/tree/main/packages/%40ama-sdk/client-fetch/src/plugins/wait-for) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/angular/angular-cli/main/packages/angular_devkit/schematics/collection-schema.json", | ||
"schematics": { | ||
"ng-add": { | ||
"description": "Add the SDK Fetch Client API to the project.", | ||
"factory": "./schematics/ng-add/index#ngAdd", | ||
"schema": "./schematics/ng-add/schema.json", | ||
"aliases": ["install", "i"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const getJestGlobalConfig = require('../../../jest.config.ut').getJestGlobalConfig; | ||
|
||
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */ | ||
module.exports = { | ||
...getJestGlobalConfig(), | ||
projects: [ | ||
'<rootDir>/testing/jest.config.ut.js', | ||
'<rootDir>/testing/jest.config.ut.builders.js' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
{ | ||
"name": "@ama-sdk/client-fetch", | ||
"version": "0.0.0-placeholder", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"description": "API Request client for @ama-sdk/core based SDK", | ||
"module": "dist/src/public_api.js", | ||
"esm2015": "dist/esm2015/public_api.js", | ||
"esm2020": "dist/src/public_api.js", | ||
"typings": "dist/src/public_api.d.ts", | ||
"sideEffects": false, | ||
"exports": { | ||
"./package.json": { | ||
"default": "./package.json" | ||
}, | ||
".": { | ||
"module": "./dist/src/public_api.js", | ||
"esm2020": "./dist/src/public_api.js", | ||
"esm2015": "./dist/esm2015/public_api.js", | ||
"es2020": "./dist/cjs/public_api.js", | ||
"default": "./dist/cjs/public_api.js", | ||
"typings": "./dist/src/public_api.d.ts", | ||
"import": "./dist/src/public_api.js", | ||
"node": "./dist/cjs/public_api.js", | ||
"require": "./dist/cjs/public_api.js" | ||
} | ||
}, | ||
"scripts": { | ||
"nx": "nx", | ||
"ng": "yarn nx", | ||
"build": "yarn nx build ama-sdk-client-fetch", | ||
"build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q --strip-leading-paths", | ||
"build:esm2015": "swc src -d dist/esm2015 -C module.type=es6 -q --strip-leading-paths", | ||
"build:esm2020": "tsc -b tsconfig.build.json", | ||
"postbuild": "yarn cpy './package.json' dist && patch-package-json-main", | ||
"prepare:build:builders": "yarn cpy 'schematics/**/*.json' dist/schematics && yarn cpy 'collection.json' dist", | ||
"build:builders": "tsc -b tsconfig.builders.json --pretty && yarn generate-cjs-manifest", | ||
"prepare:publish": "prepare-publish ./dist" | ||
}, | ||
"dependencies": { | ||
"@swc/helpers": "~0.5.0", | ||
"tslib": "^2.6.2", | ||
"uuid": "^10.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@ama-sdk/core": "workspace:^", | ||
"@angular-devkit/schematics": "~18.2.0", | ||
"@angular/cli": "~18.2.0", | ||
"@angular/common": "~18.2.0", | ||
"@o3r/schematics": "workspace:^", | ||
"@schematics/angular": "~18.2.0", | ||
"isomorphic-fetch": "^3.0.0", | ||
"typescript": "~5.5.4" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@angular-devkit/schematics": { | ||
"optional": true | ||
}, | ||
"@angular/cli": { | ||
"optional": true | ||
}, | ||
"@angular/common": { | ||
"optional": true | ||
}, | ||
"@o3r/schematics": { | ||
"optional": true | ||
}, | ||
"@schematics/angular": { | ||
"optional": true | ||
}, | ||
"isomorphic-fetch": { | ||
"optional": true | ||
}, | ||
"typescript": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@ama-sdk/core": "workspace:^", | ||
"@angular-devkit/core": "~18.2.0", | ||
"@angular-devkit/schematics": "~18.2.0", | ||
"@angular-eslint/eslint-plugin": "~18.3.0", | ||
"@angular/common": "~18.2.0", | ||
"@angular/core": "~18.2.0", | ||
"@nx/eslint-plugin": "~19.5.0", | ||
"@nx/jest": "~19.5.0", | ||
"@o3r/build-helpers": "workspace:^", | ||
"@o3r/eslint-plugin": "workspace:^", | ||
"@o3r/test-helpers": "workspace:^", | ||
"@schematics/angular": "~18.2.0", | ||
"@stylistic/eslint-plugin-ts": "~2.4.0", | ||
"@swc/cli": "~0.4.0", | ||
"@swc/core": "~1.7.0", | ||
"@types/jest": "~29.5.2", | ||
"@types/node": "^20.0.0", | ||
"@types/uuid": "^9.0.0", | ||
"@typescript-eslint/eslint-plugin": "^7.14.1", | ||
"@typescript-eslint/parser": "^7.14.1", | ||
"@typescript-eslint/utils": "^7.14.1", | ||
"cpy-cli": "^5.0.0", | ||
"eslint": "^8.57.0", | ||
"eslint-import-resolver-node": "^0.3.9", | ||
"eslint-plugin-jest": "~28.8.0", | ||
"eslint-plugin-jsdoc": "~48.11.0", | ||
"eslint-plugin-prefer-arrow": "~1.2.3", | ||
"eslint-plugin-unicorn": "^54.0.0", | ||
"isomorphic-fetch": "~3.0.0", | ||
"jest": "~29.7.0", | ||
"jest-junit": "~16.0.0", | ||
"jsonc-eslint-parser": "~2.4.0", | ||
"minimist": "^1.2.6", | ||
"pid-from-port": "^1.1.3", | ||
"rimraf": "^5.0.1", | ||
"rxjs": "^7.8.1", | ||
"semver": "^7.5.2", | ||
"ts-jest": "~29.2.0", | ||
"ts-node": "~10.9.2", | ||
"type-fest": "^4.10.2", | ||
"typescript": "~5.5.4", | ||
"zone.js": "~0.14.2" | ||
}, | ||
"engines": { | ||
"node": "^18.19.1 || ^20.11.1 || >=22.0.0" | ||
}, | ||
"schematics": "./collection.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"name": "ama-sdk-client-fetch", | ||
"$schema": "https://raw.githubusercontent.com/nrwl/nx/master/packages/nx/schemas/project-schema.json", | ||
"projectType": "library", | ||
"sourceRoot": "packages/@ama-sdk/client-fetch/src", | ||
"prefix": "o3r", | ||
"targets": { | ||
"build": { | ||
"executor": "nx:run-script", | ||
"outputs": ["{projectRoot}/dist/package.json"], | ||
"options": { | ||
"script": "postbuild" | ||
}, | ||
"dependsOn": [ | ||
"build-builders", | ||
"compile", | ||
"build-esm2015", | ||
"build-cjs" | ||
] | ||
}, | ||
"build-esm2015": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "build:esm2015" | ||
} | ||
}, | ||
"build-cjs": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "build:cjs" | ||
} | ||
}, | ||
"compile": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "build:esm2020" | ||
}, | ||
"outputs": ["{projectRoot}/dist/src"] | ||
}, | ||
"lint": { | ||
"options": { | ||
"eslintConfig": "packages/@ama-sdk/client-fetch/.eslintrc.js", | ||
"lintFilePatterns": [ | ||
"packages/@ama-sdk/client-fetch/src/**/*.ts", | ||
"packages/@ama-sdk/client-fetch/package.json" | ||
] | ||
}, | ||
"dependsOn": [ | ||
"build" | ||
] | ||
}, | ||
"test": { | ||
"executor": "@nx/jest:jest", | ||
"options": { | ||
"jestConfig": "packages/@ama-sdk/client-fetch/jest.config.js" | ||
} | ||
}, | ||
"prepare-publish": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "prepare:publish" | ||
} | ||
}, | ||
"publish": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "npm publish packages/@ama-sdk/client-fetch/dist" | ||
} | ||
}, | ||
"prepare-build-builders": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "prepare:build:builders" | ||
} | ||
}, | ||
"build-builders": { | ||
"executor": "nx:run-script", | ||
"options": { | ||
"script": "build:builders" | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
This files is used to allow the usage of the builder within @o3r/framework mono-repository. | ||
It should not be part of the package. | ||
*/ | ||
|
||
const {resolve} = require('node:path'); | ||
|
||
require('ts-node').register({ project: resolve(__dirname, '..', '..', 'tsconfig.builders.json') }); | ||
require('ts-node').register = () => {}; | ||
|
||
module.exports = require('./index.ts'); |
Oops, something went wrong.