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
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ In order to use this library you need to have access to an Oracle Field Service

## Installation

1. Clone the repository

2. Add the dependency to your project
1. Add the dependency to your project

`npm install <LOCAL REPOSITORY DIR>`
`npm install <LOCAL REPOSITORY DIR>` (if you have cloned the repository)

3. To use the library in your code:
`npm install https://github.com/oracle-samples/ofs-proxy-js.git` (when installing directly from GitHub)

2. To use the library in your code:

`import {OFSPlugin} from "@ofs_users/proxy"`

Expand Down
95 changes: 95 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
"description": "A Javascript proxy to access Oracle Field Service via REST API",
"main": "dist/ofs.es.js",
"module": "dist/ofs.es.js",
"types": "dist/src/OFS.d.ts",
"types": "dist/OFS.d.ts",
"repository": {
"url": "https://github.com/oracle-samples/ofs-proxy-js"
},
"scripts": {
"build": "tsc",
"start": "ts-node src/index.ts",
"test": "jest",
"dist": "rollup --config rollup.config.mjs"
"dist": "rollup --config rollup.config.mjs",
"prepare": "npm run dist"
},
"keywords": [
"ofsc",
Expand Down Expand Up @@ -56,6 +57,7 @@
"jest-environment-jsdom": "^29.3.1",
"prettier": "^2.8.1",
"pretty-quick": "^3.1.3",
"rollup-plugin-dts": "^5.3.0",
"ts-jest": "^29.0.3",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
Expand All @@ -64,4 +66,4 @@
"dependencies": {
"tslib": "^2.4.1"
}
}
}
47 changes: 29 additions & 18 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,33 @@

import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
export default {
input: "src/OFS.ts",
output: {
name: "OFS",
file: "dist/ofs.es.js",
format: "es",
import dts from "rollup-plugin-dts";
const config = [
{
input: "src/OFS.ts",
output: {
name: "OFS",
file: "dist/ofs.es.js",
format: "es",
},
plugins: [
typescript(),
terser({
compress: {
unsafe: true,
},
mangle: true,
keep_fnames: true,
keep_classnames: true,
}),
],
},
plugins: [
typescript(),
terser({
compress: {
unsafe: true,
},
mangle: true,
keep_fnames: true,
keep_classnames: true,
}),
],
};
{
// path to your declaration files root
input: "dist/build/types/src/OFS.d.ts",
output: [{ file: "dist/OFS.d.ts", format: "es" }],
plugins: [dts()],
},
];

export default config;
11 changes: 9 additions & 2 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ export interface ActivityListResponse {
}

export class OFSSubscriptionResponse extends OFSResponse {
data!: SubscriptionListResponse;
data: SubscriptionListResponse = {
totalResults: 0,
items: [],
links: undefined,
};
}

export class OFSActivityResponse extends OFSResponse {
data!: ActivityResponse;
data: ActivityResponse = {
customerName: undefined,
activityId: 0,
};
}
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/* Modules */
"module": "ES2022", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "rootDir": ".", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
Expand All @@ -49,7 +49,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "build", /* Specify an output folder for all emitted files. */
"outDir": "./build", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand All @@ -65,7 +65,7 @@
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
"declarationDir": "build/types", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */

/* Interop Constraints */
Expand Down