Skip to content

Commit 6346480

Browse files
authored
Merge pull request #205 from Azure/dev
Promote to master, for 1.4.3 release
2 parents 2ab3095 + 32f442c commit 6346480

File tree

30 files changed

+629
-561
lines changed

30 files changed

+629
-561
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/**
2+
lib/**
3+
samples/node_modules/**

.eslintrc

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
{
2-
"parser": "@typescript-eslint/parser",
3-
"extends": ["plugin:@typescript-eslint/recommended", "prettier/@typescript-eslint", "plugin:prettier/recommended"],
4-
"rules": {
5-
"@typescript-eslint/no-use-before-define": "off",
6-
"@typescript-eslint/no-explicit-any": "off",
7-
"@typescript-eslint/interface-name-prefix": "off"
8-
}
9-
}
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended",
5+
"prettier/@typescript-eslint",
6+
"plugin:prettier/recommended"
7+
],
8+
"rules": {
9+
"@typescript-eslint/no-use-before-define": "off",
10+
"@typescript-eslint/no-explicit-any": "off",
11+
"@typescript-eslint/interface-name-prefix": "off"
12+
},
13+
"overrides": [
14+
{
15+
"files": ["*.js"],
16+
"rules": {
17+
"@typescript-eslint/no-var-requires": "off"
18+
}
19+
}
20+
]
21+
}

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+88-86
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,90 @@
11
{
2-
"name": "durable-functions",
3-
"version": "1.4.2",
4-
"description": "Durable Functions library for Node.js Azure Functions",
5-
"license": "MIT",
6-
"repository": {
7-
"type": "git",
8-
"url": "git+https://github.com/Azure/azure-functions-durable-js.git"
9-
},
10-
"author": "Microsoft Corporation",
11-
"keywords": [
12-
"azure-functions"
13-
],
14-
"files": [
15-
"lib/src"
16-
],
17-
"main": "lib/src/index.js",
18-
"typings": "lib/src/index.d.ts",
19-
"scripts": {
20-
"clean": "rimraf lib",
21-
"lint": "eslint \"src/**/*.ts\"",
22-
"lint:test": "eslint \"test/**/*.ts\"",
23-
"lint:srcfix": "eslint --fix \"src/**/*.ts\"",
24-
"lint:testfix": "eslint --fix \"test/**/*.ts\"",
25-
"build": "npm run clean && npm run lint && npm run lint:test && npm run stripInternalDocs && echo Done",
26-
"build:nolint": "npm run clean && npm run stripInternalDocs && echo Done",
27-
"stripInternalDocs": "tsc --pretty -p tsconfig.nocomments",
28-
"test": "npm run build && mocha --recursive ./lib/test/**/*-spec.js",
29-
"test:nolint": "npm run build:nolint && mocha --recursive ./lib/test/**/*-spec.js",
30-
"watch": "npm run build -- --watch",
31-
"watch:test": "npm run test -- --watch",
32-
"docs": "typedoc --excludePrivate --mode file --out ./lib/docs ./src",
33-
"e2etst": "npm run "
34-
},
35-
"dependencies": {
36-
"@azure/functions": "^1.0.2-beta2",
37-
"@types/lodash": "^4.14.119",
38-
"@types/uuid": "~3.4.4",
39-
"@types/validator": "^9.4.3",
40-
"axios": "^0.19.0",
41-
"commander": "~2.9.0",
42-
"debug": "~2.6.9",
43-
"lodash": "^4.17.15",
44-
"rimraf": "~2.5.4",
45-
"typedoc": "^0.17.1",
46-
"uuid": "~3.3.2",
47-
"validator": "~10.8.0"
48-
},
49-
"devDependencies": {
50-
"@types/chai": "~4.1.6",
51-
"@types/chai-as-promised": "~7.1.0",
52-
"@types/chai-string": "~1.4.1",
53-
"@types/commander": "~2.3.31",
54-
"@types/debug": "0.0.29",
55-
"@types/mocha": "~7.0.2",
56-
"@types/nock": "^9.3.0",
57-
"@types/node": "~6.14.7",
58-
"@types/rimraf": "0.0.28",
59-
"@types/sinon": "~5.0.5",
60-
"@typescript-eslint/eslint-plugin": "^2.21.0",
61-
"@typescript-eslint/parser": "^2.21.0",
62-
"chai": "~4.2.0",
63-
"chai-as-promised": "~7.1.1",
64-
"chai-string": "~1.5.0",
65-
"eslint": "^6.8.0",
66-
"eslint-config-prettier": "^6.10.0",
67-
"eslint-plugin-prettier": "^3.1.2",
68-
"mocha": "~7.1.1",
69-
"moment": "~2.22.2",
70-
"nock": "^10.0.6",
71-
"prettier": "^2.0.5",
72-
"prettier-eslint": "11.0.0",
73-
"sinon": "~7.1.1",
74-
"ts-node": "~1.0.0",
75-
"typescript": "^3.8.3"
76-
},
77-
"engines": {
78-
"node": ">=6.5.0"
79-
},
80-
"bugs": {
81-
"url": "https://github.com/Azure/azure-functions-durable-js/issues"
82-
},
83-
"homepage": "https://github.com/Azure/azure-functions-durable-js#readme",
84-
"directories": {
85-
"lib": "lib",
86-
"test": "test"
87-
}
2+
"name": "durable-functions",
3+
"version": "1.4.3",
4+
"description": "Durable Functions library for Node.js Azure Functions",
5+
"license": "MIT",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/Azure/azure-functions-durable-js.git"
9+
},
10+
"author": "Microsoft Corporation",
11+
"keywords": [
12+
"azure-functions"
13+
],
14+
"files": [
15+
"lib/src"
16+
],
17+
"main": "lib/src/index.js",
18+
"typings": "lib/src/index.d.ts",
19+
"scripts": {
20+
"clean": "rimraf lib",
21+
"lint": "eslint --ext .ts,.json src/",
22+
"lint:test": "eslint --ext .ts,.json test/",
23+
"lint:samples": "eslint --ext .ts,.js samples/",
24+
"lint:srcfix": "eslint --ext .ts,.json src/ --fix",
25+
"lint:testfix": "eslint --ext .ts,.json test/ --fix",
26+
"lint:samplesfix": "eslint --ext .ts,.js samples/ --fix",
27+
"build": "npm run clean && npm run lint && npm run lint:test && npx tsc && npm run stripInternalDocs && echo Done",
28+
"build:nolint": "npm run clean && npm run stripInternalDocs && echo Done",
29+
"stripInternalDocs": "tsc --pretty -p tsconfig.nocomments",
30+
"test": "npm run build && mocha --recursive ./lib/test/**/*-spec.js",
31+
"test:nolint": "npm run build:nolint && mocha --recursive ./lib/test/**/*-spec.js",
32+
"watch": "tsc --watch",
33+
"watch:test": "npm run test -- --watch",
34+
"docs": "typedoc --excludePrivate --mode file --out ./lib/docs ./src",
35+
"e2etst": "npm run "
36+
},
37+
"dependencies": {
38+
"@azure/functions": "^1.0.2-beta2",
39+
"@types/lodash": "^4.14.119",
40+
"@types/uuid": "~3.4.4",
41+
"@types/validator": "^9.4.3",
42+
"axios": "^0.19.0",
43+
"commander": "~2.9.0",
44+
"debug": "~2.6.9",
45+
"lodash": "^4.17.15",
46+
"rimraf": "~2.5.4",
47+
"typedoc": "^0.17.1",
48+
"uuid": "~3.3.2",
49+
"validator": "~10.8.0"
50+
},
51+
"devDependencies": {
52+
"@types/chai": "~4.1.6",
53+
"@types/chai-as-promised": "~7.1.0",
54+
"@types/chai-string": "~1.4.1",
55+
"@types/commander": "~2.3.31",
56+
"@types/debug": "0.0.29",
57+
"@types/mocha": "~7.0.2",
58+
"@types/nock": "^9.3.0",
59+
"@types/node": "~6.14.7",
60+
"@types/rimraf": "0.0.28",
61+
"@types/sinon": "~5.0.5",
62+
"@typescript-eslint/eslint-plugin": "^2.21.0",
63+
"@typescript-eslint/parser": "^2.21.0",
64+
"chai": "~4.2.0",
65+
"chai-as-promised": "~7.1.1",
66+
"chai-string": "~1.5.0",
67+
"eslint": "^6.8.0",
68+
"eslint-config-prettier": "^6.10.0",
69+
"eslint-plugin-prettier": "^3.1.2",
70+
"mocha": "~7.1.1",
71+
"moment": "~2.22.2",
72+
"nock": "^10.0.6",
73+
"prettier": "^2.0.5",
74+
"prettier-eslint": "11.0.0",
75+
"sinon": "~7.1.1",
76+
"ts-node": "~1.0.0",
77+
"typescript": "^3.8.3"
78+
},
79+
"engines": {
80+
"node": ">=6.5.0"
81+
},
82+
"bugs": {
83+
"url": "https://github.com/Azure/azure-functions-durable-js/issues"
84+
},
85+
"homepage": "https://github.com/Azure/azure-functions-durable-js#readme",
86+
"directories": {
87+
"lib": "lib",
88+
"test": "test"
89+
}
8890
}

samples/AsyncCounterEntity/index.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
const df = require("durable-functions");
2-
3-
module.exports = df.entity(async function(context) {
4-
await Promise.resolve();
5-
let currentValue = context.df.getState(() => 0);
6-
7-
switch (context.df.operationName) {
8-
case "add":
9-
const amount = context.df.getInput();
10-
currentValue += amount;
11-
break;
12-
case "reset":
13-
currentValue = 0;
14-
break;
15-
case "get":
16-
context.df.return(currentValue);
17-
break;
18-
}
19-
20-
context.df.setState(currentValue);
21-
});
1+
const df = require("durable-functions");
2+
3+
module.exports = df.entity(async function (context) {
4+
await Promise.resolve();
5+
let currentValue = context.df.getState(() => 0);
6+
7+
switch (context.df.operationName) {
8+
case "add":
9+
const amount = context.df.getInput();
10+
currentValue += amount;
11+
break;
12+
case "reset":
13+
currentValue = 0;
14+
break;
15+
case "get":
16+
context.df.return(currentValue);
17+
break;
18+
}
19+
20+
context.df.setState(currentValue);
21+
});
+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const df = require("durable-functions");
2-
3-
module.exports = df.orchestrator(function*(context){
4-
const entityId = new df.EntityId("AsyncCounterEntity", "myAsyncCounter");
5-
6-
currentValue = yield context.df.callEntity(entityId, "get");
7-
if (currentValue < 10) {
8-
yield context.df.callEntity(entityId, "add", 1);
9-
}
10-
});
1+
const df = require("durable-functions");
2+
3+
module.exports = df.orchestrator(function* (context) {
4+
const entityId = new df.EntityId("AsyncCounterEntity", "myAsyncCounter");
5+
6+
currentValue = yield context.df.callEntity(entityId, "get");
7+
if (currentValue < 10) {
8+
yield context.df.callEntity(entityId, "add", 1);
9+
}
10+
});
+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
const df = require("durable-functions");
2-
3-
module.exports = df.orchestrator(function*(context){
4-
const retryOptions = new df.RetryOptions(1000, 2);
5-
let returnValue;
6-
7-
try {
8-
returnValue = yield context.df.callActivityWithRetry("FlakyFunction", retryOptions);
9-
} catch (e) {
10-
context.log("Orchestrator caught exception. Flaky function is extremely flaky.");
11-
}
12-
13-
return returnValue;
14-
});
1+
const df = require("durable-functions");
2+
3+
module.exports = df.orchestrator(function* (context) {
4+
const retryOptions = new df.RetryOptions(1000, 2);
5+
let returnValue;
6+
7+
try {
8+
returnValue = yield context.df.callActivityWithRetry("FlakyFunction", retryOptions);
9+
} catch (e) {
10+
context.log("Orchestrator caught exception. Flaky function is extremely flaky.");
11+
}
12+
13+
return returnValue;
14+
});
+21-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
const df = require("durable-functions");
2-
3-
module.exports = df.orchestrator(function*(context){
4-
const retryOptions = new df.RetryOptions(10000, 2);
5-
const childId = `${context.df.instanceId}:0`;
6-
7-
let returnValue;
8-
9-
try {
10-
returnValue = yield context.df.callSubOrchestratorWithRetry("ThrowsErrorInline", retryOptions, "Matter", childId);
11-
} catch (e) {
12-
context.log("Orchestrator caught exception. Sub-orchestrator failed.");
13-
}
14-
15-
return returnValue;
16-
});
1+
const df = require("durable-functions");
2+
3+
module.exports = df.orchestrator(function* (context) {
4+
const retryOptions = new df.RetryOptions(10000, 2);
5+
const childId = `${context.df.instanceId}:0`;
6+
7+
let returnValue;
8+
9+
try {
10+
returnValue = yield context.df.callSubOrchestratorWithRetry(
11+
"ThrowsErrorInline",
12+
retryOptions,
13+
"Matter",
14+
childId
15+
);
16+
} catch (e) {
17+
context.log("Orchestrator caught exception. Sub-orchestrator failed.");
18+
}
19+
20+
return returnValue;
21+
});

samples/ContinueAsNewCounter/index.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
const df = require("durable-functions");
2-
const moment = require('moment');
3-
4-
module.exports = df.orchestrator(function*(context) {
5-
let currentValue = context.df.getInput() || 0;
6-
context.log(`Value is ${currentValue}`);
7-
currentValue++;
8-
9-
var wait = moment.utc(context.df.currentUtcDateTime).add(30, 's');
10-
context.log("Counting up at" + wait.toString());
11-
yield context.df.createTimer(wait.toDate());
12-
13-
if (currentValue < 10) {
14-
yield context.df.continueAsNew(currentValue);
15-
}
16-
17-
return currentValue;
18-
});
1+
const df = require("durable-functions");
2+
const moment = require("moment");
3+
4+
module.exports = df.orchestrator(function* (context) {
5+
let currentValue = context.df.getInput() || 0;
6+
context.log(`Value is ${currentValue}`);
7+
currentValue++;
8+
9+
const wait = moment.utc(context.df.currentUtcDateTime).add(30, "s");
10+
context.log("Counting up at" + wait.toString());
11+
yield context.df.createTimer(wait.toDate());
12+
13+
if (currentValue < 10) {
14+
yield context.df.continueAsNew(currentValue);
15+
}
16+
17+
return currentValue;
18+
});

0 commit comments

Comments
 (0)