azure-functions-durable 1.2.8__py3-none-any.whl → 1.2.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. azure/durable_functions/__init__.py +81 -81
  2. azure/durable_functions/constants.py +9 -9
  3. azure/durable_functions/decorators/__init__.py +3 -3
  4. azure/durable_functions/decorators/durable_app.py +249 -249
  5. azure/durable_functions/decorators/metadata.py +109 -109
  6. azure/durable_functions/entity.py +125 -125
  7. azure/durable_functions/models/DurableEntityContext.py +201 -201
  8. azure/durable_functions/models/DurableHttpRequest.py +58 -58
  9. azure/durable_functions/models/DurableOrchestrationBindings.py +66 -66
  10. azure/durable_functions/models/DurableOrchestrationClient.py +781 -711
  11. azure/durable_functions/models/DurableOrchestrationContext.py +722 -707
  12. azure/durable_functions/models/DurableOrchestrationStatus.py +156 -156
  13. azure/durable_functions/models/EntityStateResponse.py +23 -23
  14. azure/durable_functions/models/FunctionContext.py +7 -7
  15. azure/durable_functions/models/OrchestrationRuntimeStatus.py +32 -29
  16. azure/durable_functions/models/OrchestratorState.py +117 -116
  17. azure/durable_functions/models/PurgeHistoryResult.py +33 -33
  18. azure/durable_functions/models/ReplaySchema.py +8 -8
  19. azure/durable_functions/models/RetryOptions.py +69 -69
  20. azure/durable_functions/models/RpcManagementOptions.py +86 -86
  21. azure/durable_functions/models/Task.py +426 -426
  22. azure/durable_functions/models/TaskOrchestrationExecutor.py +346 -333
  23. azure/durable_functions/models/TokenSource.py +56 -56
  24. azure/durable_functions/models/__init__.py +24 -24
  25. azure/durable_functions/models/actions/Action.py +23 -23
  26. azure/durable_functions/models/actions/ActionType.py +18 -18
  27. azure/durable_functions/models/actions/CallActivityAction.py +41 -41
  28. azure/durable_functions/models/actions/CallActivityWithRetryAction.py +45 -45
  29. azure/durable_functions/models/actions/CallEntityAction.py +46 -46
  30. azure/durable_functions/models/actions/CallHttpAction.py +35 -35
  31. azure/durable_functions/models/actions/CallSubOrchestratorAction.py +40 -40
  32. azure/durable_functions/models/actions/CallSubOrchestratorWithRetryAction.py +44 -44
  33. azure/durable_functions/models/actions/CompoundAction.py +35 -35
  34. azure/durable_functions/models/actions/ContinueAsNewAction.py +36 -36
  35. azure/durable_functions/models/actions/CreateTimerAction.py +48 -48
  36. azure/durable_functions/models/actions/NoOpAction.py +35 -35
  37. azure/durable_functions/models/actions/SignalEntityAction.py +47 -47
  38. azure/durable_functions/models/actions/WaitForExternalEventAction.py +63 -63
  39. azure/durable_functions/models/actions/WhenAllAction.py +14 -14
  40. azure/durable_functions/models/actions/WhenAnyAction.py +14 -14
  41. azure/durable_functions/models/actions/__init__.py +24 -24
  42. azure/durable_functions/models/entities/EntityState.py +74 -74
  43. azure/durable_functions/models/entities/OperationResult.py +76 -76
  44. azure/durable_functions/models/entities/RequestMessage.py +53 -53
  45. azure/durable_functions/models/entities/ResponseMessage.py +48 -48
  46. azure/durable_functions/models/entities/Signal.py +62 -62
  47. azure/durable_functions/models/entities/__init__.py +17 -17
  48. azure/durable_functions/models/history/HistoryEvent.py +92 -92
  49. azure/durable_functions/models/history/HistoryEventType.py +27 -25
  50. azure/durable_functions/models/history/__init__.py +8 -8
  51. azure/durable_functions/models/utils/__init__.py +7 -7
  52. azure/durable_functions/models/utils/entity_utils.py +103 -91
  53. azure/durable_functions/models/utils/http_utils.py +69 -69
  54. azure/durable_functions/models/utils/json_utils.py +56 -56
  55. azure/durable_functions/orchestrator.py +71 -71
  56. {azure_functions_durable-1.2.8.dist-info → azure_functions_durable-1.2.10.dist-info}/LICENSE +21 -21
  57. {azure_functions_durable-1.2.8.dist-info → azure_functions_durable-1.2.10.dist-info}/METADATA +58 -58
  58. azure_functions_durable-1.2.10.dist-info/RECORD +100 -0
  59. {azure_functions_durable-1.2.8.dist-info → azure_functions_durable-1.2.10.dist-info}/WHEEL +1 -1
  60. tests/models/test_DecoratorMetadata.py +135 -135
  61. tests/models/test_Decorators.py +107 -107
  62. tests/models/test_DurableOrchestrationBindings.py +68 -56
  63. tests/models/test_DurableOrchestrationClient.py +730 -612
  64. tests/models/test_DurableOrchestrationContext.py +102 -102
  65. tests/models/test_DurableOrchestrationStatus.py +59 -59
  66. tests/models/test_OrchestrationState.py +28 -28
  67. tests/models/test_RpcManagementOptions.py +79 -79
  68. tests/models/test_TokenSource.py +10 -10
  69. tests/orchestrator/models/OrchestrationInstance.py +18 -18
  70. tests/orchestrator/orchestrator_test_utils.py +130 -130
  71. tests/orchestrator/schemas/OrchetrationStateSchema.py +66 -66
  72. tests/orchestrator/test_call_http.py +235 -176
  73. tests/orchestrator/test_continue_as_new.py +67 -67
  74. tests/orchestrator/test_create_timer.py +126 -126
  75. tests/orchestrator/test_entity.py +395 -395
  76. tests/orchestrator/test_external_event.py +53 -53
  77. tests/orchestrator/test_fan_out_fan_in.py +175 -175
  78. tests/orchestrator/test_is_replaying_flag.py +101 -101
  79. tests/orchestrator/test_retries.py +308 -308
  80. tests/orchestrator/test_sequential_orchestrator.py +841 -801
  81. tests/orchestrator/test_sequential_orchestrator_custom_status.py +119 -119
  82. tests/orchestrator/test_sequential_orchestrator_with_retry.py +465 -465
  83. tests/orchestrator/test_serialization.py +30 -30
  84. tests/orchestrator/test_sub_orchestrator.py +95 -95
  85. tests/orchestrator/test_sub_orchestrator_with_retry.py +129 -129
  86. tests/orchestrator/test_task_any.py +60 -60
  87. tests/tasks/tasks_test_utils.py +17 -17
  88. tests/tasks/test_new_uuid.py +34 -34
  89. tests/test_utils/ContextBuilder.py +174 -174
  90. tests/test_utils/EntityContextBuilder.py +56 -56
  91. tests/test_utils/constants.py +1 -1
  92. tests/test_utils/json_utils.py +30 -30
  93. tests/test_utils/testClasses.py +56 -56
  94. tests/utils/__init__.py +1 -0
  95. tests/utils/test_entity_utils.py +24 -0
  96. azure_functions_durable-1.2.8.data/data/_manifest/bsi.json +0 -1
  97. azure_functions_durable-1.2.8.data/data/_manifest/manifest.cat +0 -0
  98. azure_functions_durable-1.2.8.data/data/_manifest/manifest.spdx.json +0 -12845
  99. azure_functions_durable-1.2.8.data/data/_manifest/manifest.spdx.json.sha256 +0 -1
  100. azure_functions_durable-1.2.8.dist-info/RECORD +0 -102
  101. {azure_functions_durable-1.2.8.dist-info → azure_functions_durable-1.2.10.dist-info}/top_level.txt +0 -0
@@ -1,108 +1,108 @@
1
- import azure.durable_functions as df
2
- import azure.functions as func
3
- import json
4
-
5
-
6
- def get_user_code(app):
7
- functions = app.get_functions()
8
- assert len(functions) == 1
9
- return functions[0]
10
-
11
- def assert_json(user_code, expected_dict):
12
- user_code_json = json.dumps(json.loads(str(user_code)), sort_keys=True)
13
- expected_json = json.dumps(expected_dict, sort_keys=True)
14
- assert user_code_json == expected_json
15
-
16
-
17
- def test_orchestration_trigger(app):
18
-
19
- @app.orchestration_trigger(context_name="my_context")
20
- def dummy_function(my_context):
21
- pass
22
-
23
- user_code = get_user_code(app)
24
-
25
- assert user_code.get_function_name() == "dummy_function"
26
- assert_json(user_code, {
27
- "scriptFile": "function_app.py",
28
- "bindings": [
29
- {
30
- "direction": "IN",
31
- "name": "my_context",
32
- "type": "orchestrationTrigger"
33
- }
34
- ]
35
- })
36
-
37
- def test_activity_trigger(app):
38
-
39
- @app.activity_trigger(input_name="my_input")
40
- def dummy_function(my_input):
41
- pass
42
-
43
- user_code = get_user_code(app)
44
-
45
- assert user_code.get_function_name() == "dummy_function"
46
- assert_json(user_code, {
47
- "scriptFile": "function_app.py",
48
- "bindings": [
49
- {
50
- "direction": "IN",
51
- "name": "my_input",
52
- "type": "activityTrigger"
53
- }
54
- ]
55
- })
56
-
57
- def test_entity_trigger(app):
58
-
59
- @app.entity_trigger(context_name="my_context")
60
- def dummy_function(my_context):
61
- pass
62
-
63
- user_code = get_user_code(app)
64
-
65
- assert user_code.get_function_name() == "dummy_function"
66
- assert_json(user_code, {
67
- "scriptFile": "function_app.py",
68
- "bindings": [
69
- {
70
- "direction": "IN",
71
- "name": "my_context",
72
- "type": "entityTrigger"
73
- }
74
- ]
75
- })
76
-
77
- def test_durable_client_input(app):
78
-
79
- @app.durable_client_input(client_name="my_client")
80
- @app.route(route="myOrchestratorRoute")
81
- def dummy_function(req, my_client, message):
82
- pass
83
-
84
- user_code = get_user_code(app)
85
-
86
- assert user_code.get_function_name() == "dummy_function"
87
- assert_json(user_code, {
88
- "scriptFile": "function_app.py",
89
- "bindings": [
90
- {
91
- "direction": "IN",
92
- "type": "httpTrigger",
93
- "authLevel": "ANONYMOUS",
94
- "name": "req",
95
- "route": "myOrchestratorRoute"
96
- },
97
- {
98
- "direction": "OUT",
99
- "name": "$return",
100
- "type": "http"
101
- },
102
- {
103
- "direction": "IN",
104
- "name": "my_client",
105
- "type": "durableClient"
106
- }
107
- ]
1
+ import azure.durable_functions as df
2
+ import azure.functions as func
3
+ import json
4
+
5
+
6
+ def get_user_code(app):
7
+ functions = app.get_functions()
8
+ assert len(functions) == 1
9
+ return functions[0]
10
+
11
+ def assert_json(user_code, expected_dict):
12
+ user_code_json = json.dumps(json.loads(str(user_code)), sort_keys=True)
13
+ expected_json = json.dumps(expected_dict, sort_keys=True)
14
+ assert user_code_json == expected_json
15
+
16
+
17
+ def test_orchestration_trigger(app):
18
+
19
+ @app.orchestration_trigger(context_name="my_context")
20
+ def dummy_function(my_context):
21
+ pass
22
+
23
+ user_code = get_user_code(app)
24
+
25
+ assert user_code.get_function_name() == "dummy_function"
26
+ assert_json(user_code, {
27
+ "scriptFile": "function_app.py",
28
+ "bindings": [
29
+ {
30
+ "direction": "IN",
31
+ "name": "my_context",
32
+ "type": "orchestrationTrigger"
33
+ }
34
+ ]
35
+ })
36
+
37
+ def test_activity_trigger(app):
38
+
39
+ @app.activity_trigger(input_name="my_input")
40
+ def dummy_function(my_input):
41
+ pass
42
+
43
+ user_code = get_user_code(app)
44
+
45
+ assert user_code.get_function_name() == "dummy_function"
46
+ assert_json(user_code, {
47
+ "scriptFile": "function_app.py",
48
+ "bindings": [
49
+ {
50
+ "direction": "IN",
51
+ "name": "my_input",
52
+ "type": "activityTrigger"
53
+ }
54
+ ]
55
+ })
56
+
57
+ def test_entity_trigger(app):
58
+
59
+ @app.entity_trigger(context_name="my_context")
60
+ def dummy_function(my_context):
61
+ pass
62
+
63
+ user_code = get_user_code(app)
64
+
65
+ assert user_code.get_function_name() == "dummy_function"
66
+ assert_json(user_code, {
67
+ "scriptFile": "function_app.py",
68
+ "bindings": [
69
+ {
70
+ "direction": "IN",
71
+ "name": "my_context",
72
+ "type": "entityTrigger"
73
+ }
74
+ ]
75
+ })
76
+
77
+ def test_durable_client_input(app):
78
+
79
+ @app.durable_client_input(client_name="my_client")
80
+ @app.route(route="myOrchestratorRoute")
81
+ def dummy_function(req, my_client, message):
82
+ pass
83
+
84
+ user_code = get_user_code(app)
85
+
86
+ assert user_code.get_function_name() == "dummy_function"
87
+ assert_json(user_code, {
88
+ "scriptFile": "function_app.py",
89
+ "bindings": [
90
+ {
91
+ "direction": "IN",
92
+ "type": "httpTrigger",
93
+ "authLevel": "ANONYMOUS",
94
+ "name": "req",
95
+ "route": "myOrchestratorRoute"
96
+ },
97
+ {
98
+ "direction": "OUT",
99
+ "name": "$return",
100
+ "type": "http"
101
+ },
102
+ {
103
+ "direction": "IN",
104
+ "name": "my_client",
105
+ "type": "durableClient"
106
+ }
107
+ ]
108
108
  })
@@ -1,56 +1,68 @@
1
- from tests.conftest import TASK_HUB_NAME, replace_stand_in_bits
2
-
3
-
4
- def test_extracts_task_hub_name(binding_info):
5
- assert TASK_HUB_NAME == binding_info.task_hub_name
6
-
7
-
8
- def test_extracts_create_new_instance_post_uri(binding_info):
9
- expected_url = replace_stand_in_bits(
10
- "BASE_URL/orchestrators/{functionName}[/{instanceId}]?code=AUTH_CODE")
11
- assert \
12
- expected_url == binding_info.creation_urls["createNewInstancePostUri"]
13
-
14
-
15
- def test_extracts_create_and_wait_on_new_instance_post_uri(binding_info):
16
- expected_url = replace_stand_in_bits(
17
- "BASE_URL/orchestrators/{functionName}[/{instanceId}]?timeout={"
18
- "timeoutInSeconds}&pollingInterval={intervalInSeconds}&code=AUTH_CODE")
19
- assert expected_url == binding_info.creation_urls[
20
- "createAndWaitOnNewInstancePostUri"]
21
-
22
-
23
- def test_extracts_status_query_get_uri(binding_info):
24
- expected_url = replace_stand_in_bits(
25
- "BASE_URL/instances/INSTANCEID?taskHub=TASK_HUB_NAME&connection"
26
- "=Storage&code=AUTH_CODE")
27
- assert expected_url == binding_info.management_urls["statusQueryGetUri"]
28
-
29
-
30
- def test_extracts_send_event_post_uri(binding_info):
31
- expected_url = replace_stand_in_bits(
32
- "BASE_URL/instances/INSTANCEID/raiseEvent/{"
33
- "eventName}?taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
34
- assert expected_url == binding_info.management_urls["sendEventPostUri"]
35
-
36
-
37
- def test_extracts_terminate_post_uri(binding_info):
38
- expected_url = replace_stand_in_bits(
39
- "BASE_URL/instances/INSTANCEID/terminate?reason={"
40
- "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
41
- assert expected_url == binding_info.management_urls["terminatePostUri"]
42
-
43
-
44
- def test_extracts_rewind_post_uri(binding_info):
45
- expected_url = replace_stand_in_bits(
46
- "BASE_URL/instances/INSTANCEID/rewind?reason={"
47
- "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
48
- assert expected_url == binding_info.management_urls["rewindPostUri"]
49
-
50
-
51
- def test_extracts_purge_history_delete_uri(binding_info):
52
- expected_url = replace_stand_in_bits(
53
- "BASE_URL/instances/INSTANCEID?taskHub=TASK_HUB_NAME&connection"
54
- "=Storage&code=AUTH_CODE")
55
- assert expected_url == binding_info.management_urls[
56
- "purgeHistoryDeleteUri"]
1
+ from tests.conftest import TASK_HUB_NAME, replace_stand_in_bits
2
+
3
+
4
+ def test_extracts_task_hub_name(binding_info):
5
+ assert TASK_HUB_NAME == binding_info.task_hub_name
6
+
7
+
8
+ def test_extracts_create_new_instance_post_uri(binding_info):
9
+ expected_url = replace_stand_in_bits(
10
+ "BASE_URL/orchestrators/{functionName}[/{instanceId}]?code=AUTH_CODE")
11
+ assert \
12
+ expected_url == binding_info.creation_urls["createNewInstancePostUri"]
13
+
14
+
15
+ def test_extracts_create_and_wait_on_new_instance_post_uri(binding_info):
16
+ expected_url = replace_stand_in_bits(
17
+ "BASE_URL/orchestrators/{functionName}[/{instanceId}]?timeout={"
18
+ "timeoutInSeconds}&pollingInterval={intervalInSeconds}&code=AUTH_CODE")
19
+ assert expected_url == binding_info.creation_urls[
20
+ "createAndWaitOnNewInstancePostUri"]
21
+
22
+
23
+ def test_extracts_status_query_get_uri(binding_info):
24
+ expected_url = replace_stand_in_bits(
25
+ "BASE_URL/instances/INSTANCEID?taskHub=TASK_HUB_NAME&connection"
26
+ "=Storage&code=AUTH_CODE")
27
+ assert expected_url == binding_info.management_urls["statusQueryGetUri"]
28
+
29
+
30
+ def test_extracts_send_event_post_uri(binding_info):
31
+ expected_url = replace_stand_in_bits(
32
+ "BASE_URL/instances/INSTANCEID/raiseEvent/{"
33
+ "eventName}?taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
34
+ assert expected_url == binding_info.management_urls["sendEventPostUri"]
35
+
36
+
37
+ def test_extracts_terminate_post_uri(binding_info):
38
+ expected_url = replace_stand_in_bits(
39
+ "BASE_URL/instances/INSTANCEID/terminate?reason={"
40
+ "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
41
+ assert expected_url == binding_info.management_urls["terminatePostUri"]
42
+
43
+
44
+ def test_extracts_rewind_post_uri(binding_info):
45
+ expected_url = replace_stand_in_bits(
46
+ "BASE_URL/instances/INSTANCEID/rewind?reason={"
47
+ "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
48
+ assert expected_url == binding_info.management_urls["rewindPostUri"]
49
+
50
+
51
+ def test_extracts_purge_history_delete_uri(binding_info):
52
+ expected_url = replace_stand_in_bits(
53
+ "BASE_URL/instances/INSTANCEID?taskHub=TASK_HUB_NAME&connection"
54
+ "=Storage&code=AUTH_CODE")
55
+ assert expected_url == binding_info.management_urls[
56
+ "purgeHistoryDeleteUri"]
57
+
58
+ def test_extracts_suspend_post_uri(binding_info):
59
+ expected_url = replace_stand_in_bits(
60
+ "BASE_URL/instances/INSTANCEID/suspend?reason={"
61
+ "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
62
+ assert expected_url == binding_info.management_urls["suspendPostUri"]
63
+
64
+ def test_extracts_resume_post_uri(binding_info):
65
+ expected_url = replace_stand_in_bits(
66
+ "BASE_URL/instances/INSTANCEID/resume?reason={"
67
+ "text}&taskHub=TASK_HUB_NAME&connection=Storage&code=AUTH_CODE")
68
+ assert expected_url == binding_info.management_urls["resumePostUri"]