@dbos-inc/dbos-sdk 0.7.18-preview

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +30 -0
  3. package/dbos-config.schema.json +121 -0
  4. package/dbos-test-config.yaml +16 -0
  5. package/dist/schemas/system_db_schema.d.ts +34 -0
  6. package/dist/schemas/system_db_schema.d.ts.map +1 -0
  7. package/dist/schemas/system_db_schema.js +75 -0
  8. package/dist/schemas/system_db_schema.js.map +1 -0
  9. package/dist/schemas/user_db_schema.d.ts +11 -0
  10. package/dist/schemas/user_db_schema.d.ts.map +1 -0
  11. package/dist/schemas/user_db_schema.js +16 -0
  12. package/dist/schemas/user_db_schema.js.map +1 -0
  13. package/dist/src/cloud-cli/applications/configure.d.ts +2 -0
  14. package/dist/src/cloud-cli/applications/configure.d.ts.map +1 -0
  15. package/dist/src/cloud-cli/applications/configure.js +57 -0
  16. package/dist/src/cloud-cli/applications/configure.js.map +1 -0
  17. package/dist/src/cloud-cli/applications/delete-app.d.ts +2 -0
  18. package/dist/src/cloud-cli/applications/delete-app.d.ts.map +1 -0
  19. package/dist/src/cloud-cli/applications/delete-app.js +36 -0
  20. package/dist/src/cloud-cli/applications/delete-app.js.map +1 -0
  21. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts +2 -0
  22. package/dist/src/cloud-cli/applications/deploy-app-code.d.ts.map +1 -0
  23. package/dist/src/cloud-cli/applications/deploy-app-code.js +64 -0
  24. package/dist/src/cloud-cli/applications/deploy-app-code.js.map +1 -0
  25. package/dist/src/cloud-cli/applications/get-app-logs.d.ts +2 -0
  26. package/dist/src/cloud-cli/applications/get-app-logs.d.ts.map +1 -0
  27. package/dist/src/cloud-cli/applications/get-app-logs.js +37 -0
  28. package/dist/src/cloud-cli/applications/get-app-logs.js.map +1 -0
  29. package/dist/src/cloud-cli/applications/index.d.ts +8 -0
  30. package/dist/src/cloud-cli/applications/index.d.ts.map +1 -0
  31. package/dist/src/cloud-cli/applications/index.js +18 -0
  32. package/dist/src/cloud-cli/applications/index.js.map +1 -0
  33. package/dist/src/cloud-cli/applications/list-apps.d.ts +2 -0
  34. package/dist/src/cloud-cli/applications/list-apps.d.ts.map +1 -0
  35. package/dist/src/cloud-cli/applications/list-apps.js +45 -0
  36. package/dist/src/cloud-cli/applications/list-apps.js.map +1 -0
  37. package/dist/src/cloud-cli/applications/register-app.d.ts +2 -0
  38. package/dist/src/cloud-cli/applications/register-app.d.ts.map +1 -0
  39. package/dist/src/cloud-cli/applications/register-app.js +41 -0
  40. package/dist/src/cloud-cli/applications/register-app.js.map +1 -0
  41. package/dist/src/cloud-cli/applications/types.d.ts +7 -0
  42. package/dist/src/cloud-cli/applications/types.d.ts.map +1 -0
  43. package/dist/src/cloud-cli/applications/types.js +3 -0
  44. package/dist/src/cloud-cli/applications/types.js.map +1 -0
  45. package/dist/src/cloud-cli/applications/update-app.d.ts +2 -0
  46. package/dist/src/cloud-cli/applications/update-app.d.ts.map +1 -0
  47. package/dist/src/cloud-cli/applications/update-app.js +42 -0
  48. package/dist/src/cloud-cli/applications/update-app.js.map +1 -0
  49. package/dist/src/cloud-cli/cli.d.ts +3 -0
  50. package/dist/src/cloud-cli/cli.d.ts.map +1 -0
  51. package/dist/src/cloud-cli/cli.js +148 -0
  52. package/dist/src/cloud-cli/cli.js.map +1 -0
  53. package/dist/src/cloud-cli/login.d.ts +7 -0
  54. package/dist/src/cloud-cli/login.d.ts.map +1 -0
  55. package/dist/src/cloud-cli/login.js +40 -0
  56. package/dist/src/cloud-cli/login.js.map +1 -0
  57. package/dist/src/cloud-cli/register.d.ts +2 -0
  58. package/dist/src/cloud-cli/register.d.ts.map +1 -0
  59. package/dist/src/cloud-cli/register.js +35 -0
  60. package/dist/src/cloud-cli/register.js.map +1 -0
  61. package/dist/src/cloud-cli/userdb.d.ts +4 -0
  62. package/dist/src/cloud-cli/userdb.d.ts.map +1 -0
  63. package/dist/src/cloud-cli/userdb.js +149 -0
  64. package/dist/src/cloud-cli/userdb.js.map +1 -0
  65. package/dist/src/cloud-cli/utils.d.ts +3 -0
  66. package/dist/src/cloud-cli/utils.d.ts.map +1 -0
  67. package/dist/src/cloud-cli/utils.js +17 -0
  68. package/dist/src/cloud-cli/utils.js.map +1 -0
  69. package/dist/src/communicator.d.ts +24 -0
  70. package/dist/src/communicator.d.ts.map +1 -0
  71. package/dist/src/communicator.js +26 -0
  72. package/dist/src/communicator.js.map +1 -0
  73. package/dist/src/context.d.ts +60 -0
  74. package/dist/src/context.d.ts.map +1 -0
  75. package/dist/src/context.js +94 -0
  76. package/dist/src/context.js.map +1 -0
  77. package/dist/src/data_validation.d.ts +3 -0
  78. package/dist/src/data_validation.d.ts.map +1 -0
  79. package/dist/src/data_validation.js +168 -0
  80. package/dist/src/data_validation.js.map +1 -0
  81. package/dist/src/dbos-executor.d.ts +79 -0
  82. package/dist/src/dbos-executor.d.ts.map +1 -0
  83. package/dist/src/dbos-executor.js +408 -0
  84. package/dist/src/dbos-executor.js.map +1 -0
  85. package/dist/src/dbos-runtime/TypeParser.d.ts +33 -0
  86. package/dist/src/dbos-runtime/TypeParser.d.ts.map +1 -0
  87. package/dist/src/dbos-runtime/TypeParser.js +104 -0
  88. package/dist/src/dbos-runtime/TypeParser.js.map +1 -0
  89. package/dist/src/dbos-runtime/applicationVersion.d.ts +3 -0
  90. package/dist/src/dbos-runtime/applicationVersion.d.ts.map +1 -0
  91. package/dist/src/dbos-runtime/applicationVersion.js +13 -0
  92. package/dist/src/dbos-runtime/applicationVersion.js.map +1 -0
  93. package/dist/src/dbos-runtime/cli.d.ts +8 -0
  94. package/dist/src/dbos-runtime/cli.d.ts.map +1 -0
  95. package/dist/src/dbos-runtime/cli.js +52 -0
  96. package/dist/src/dbos-runtime/cli.js.map +1 -0
  97. package/dist/src/dbos-runtime/config.d.ts +28 -0
  98. package/dist/src/dbos-runtime/config.d.ts.map +1 -0
  99. package/dist/src/dbos-runtime/config.js +111 -0
  100. package/dist/src/dbos-runtime/config.js.map +1 -0
  101. package/dist/src/dbos-runtime/init.d.ts +7 -0
  102. package/dist/src/dbos-runtime/init.d.ts.map +1 -0
  103. package/dist/src/dbos-runtime/init.js +51 -0
  104. package/dist/src/dbos-runtime/init.js.map +1 -0
  105. package/dist/src/dbos-runtime/openApi.d.ts +35 -0
  106. package/dist/src/dbos-runtime/openApi.d.ts.map +1 -0
  107. package/dist/src/dbos-runtime/openApi.js +595 -0
  108. package/dist/src/dbos-runtime/openApi.js.map +1 -0
  109. package/dist/src/dbos-runtime/runtime.d.ts +28 -0
  110. package/dist/src/dbos-runtime/runtime.d.ts.map +1 -0
  111. package/dist/src/dbos-runtime/runtime.js +96 -0
  112. package/dist/src/dbos-runtime/runtime.js.map +1 -0
  113. package/dist/src/dbos-runtime/tsDiagUtil.d.ts +16 -0
  114. package/dist/src/dbos-runtime/tsDiagUtil.d.ts.map +1 -0
  115. package/dist/src/dbos-runtime/tsDiagUtil.js +72 -0
  116. package/dist/src/dbos-runtime/tsDiagUtil.js.map +1 -0
  117. package/dist/src/decorators.d.ts +118 -0
  118. package/dist/src/decorators.d.ts.map +1 -0
  119. package/dist/src/decorators.js +467 -0
  120. package/dist/src/decorators.js.map +1 -0
  121. package/dist/src/error.d.ts +44 -0
  122. package/dist/src/error.d.ts.map +1 -0
  123. package/dist/src/error.js +164 -0
  124. package/dist/src/error.js.map +1 -0
  125. package/dist/src/httpServer/handler.d.ts +62 -0
  126. package/dist/src/httpServer/handler.d.ts.map +1 -0
  127. package/dist/src/httpServer/handler.js +168 -0
  128. package/dist/src/httpServer/handler.js.map +1 -0
  129. package/dist/src/httpServer/middleware.d.ts +56 -0
  130. package/dist/src/httpServer/middleware.d.ts.map +1 -0
  131. package/dist/src/httpServer/middleware.js +57 -0
  132. package/dist/src/httpServer/middleware.js.map +1 -0
  133. package/dist/src/httpServer/server.d.ts +40 -0
  134. package/dist/src/httpServer/server.d.ts.map +1 -0
  135. package/dist/src/httpServer/server.js +231 -0
  136. package/dist/src/httpServer/server.js.map +1 -0
  137. package/dist/src/index.d.ts +12 -0
  138. package/dist/src/index.d.ts.map +1 -0
  139. package/dist/src/index.js +75 -0
  140. package/dist/src/index.js.map +1 -0
  141. package/dist/src/provenance/provenance_daemon.d.ts +34 -0
  142. package/dist/src/provenance/provenance_daemon.d.ts.map +1 -0
  143. package/dist/src/provenance/provenance_daemon.js +86 -0
  144. package/dist/src/provenance/provenance_daemon.js.map +1 -0
  145. package/dist/src/system_database.d.ts +69 -0
  146. package/dist/src/system_database.d.ts.map +1 -0
  147. package/dist/src/system_database.js +384 -0
  148. package/dist/src/system_database.js.map +1 -0
  149. package/dist/src/telemetry/collector.d.ts +17 -0
  150. package/dist/src/telemetry/collector.d.ts.map +1 -0
  151. package/dist/src/telemetry/collector.js +77 -0
  152. package/dist/src/telemetry/collector.js.map +1 -0
  153. package/dist/src/telemetry/exporters.d.ts +29 -0
  154. package/dist/src/telemetry/exporters.d.ts.map +1 -0
  155. package/dist/src/telemetry/exporters.js +186 -0
  156. package/dist/src/telemetry/exporters.js.map +1 -0
  157. package/dist/src/telemetry/index.d.ts +7 -0
  158. package/dist/src/telemetry/index.d.ts.map +1 -0
  159. package/dist/src/telemetry/index.js +3 -0
  160. package/dist/src/telemetry/index.js.map +1 -0
  161. package/dist/src/telemetry/logs.d.ts +25 -0
  162. package/dist/src/telemetry/logs.d.ts.map +1 -0
  163. package/dist/src/telemetry/logs.js +91 -0
  164. package/dist/src/telemetry/logs.js.map +1 -0
  165. package/dist/src/telemetry/signals.d.ts +30 -0
  166. package/dist/src/telemetry/signals.d.ts.map +1 -0
  167. package/dist/src/telemetry/signals.js +11 -0
  168. package/dist/src/telemetry/signals.js.map +1 -0
  169. package/dist/src/telemetry/traces.d.ts +17 -0
  170. package/dist/src/telemetry/traces.d.ts.map +1 -0
  171. package/dist/src/telemetry/traces.js +76 -0
  172. package/dist/src/telemetry/traces.js.map +1 -0
  173. package/dist/src/testing/testing_runtime.d.ts +76 -0
  174. package/dist/src/testing/testing_runtime.d.ts.map +1 -0
  175. package/dist/src/testing/testing_runtime.js +147 -0
  176. package/dist/src/testing/testing_runtime.js.map +1 -0
  177. package/dist/src/transaction.d.ts +28 -0
  178. package/dist/src/transaction.d.ts.map +1 -0
  179. package/dist/src/transaction.js +27 -0
  180. package/dist/src/transaction.js.map +1 -0
  181. package/dist/src/user_database.d.ts +132 -0
  182. package/dist/src/user_database.d.ts.map +1 -0
  183. package/dist/src/user_database.js +324 -0
  184. package/dist/src/user_database.js.map +1 -0
  185. package/dist/src/utils.d.ts +6 -0
  186. package/dist/src/utils.d.ts.map +1 -0
  187. package/dist/src/utils.js +35 -0
  188. package/dist/src/utils.js.map +1 -0
  189. package/dist/src/workflow.d.ts +179 -0
  190. package/dist/src/workflow.d.ts.map +1 -0
  191. package/dist/src/workflow.js +446 -0
  192. package/dist/src/workflow.js.map +1 -0
  193. package/examples/hello/README.md +41 -0
  194. package/examples/hello/dbos-config.yaml +15 -0
  195. package/examples/hello/jest.config.js +8 -0
  196. package/examples/hello/knexfile.ts +23 -0
  197. package/examples/hello/migrations/create_dbos_hello_tables.ts +12 -0
  198. package/examples/hello/package.json +21 -0
  199. package/examples/hello/src/operations.test.ts +38 -0
  200. package/examples/hello/src/operations.ts +21 -0
  201. package/examples/hello/start_postgres_docker.sh +23 -0
  202. package/examples/hello/tsconfig.json +24 -0
  203. package/package.json +78 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 DBOS, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # DBOS Typescript SDK
2
+
3
+ The DBOS SDK (from [DBOS, Inc.](https://dbos.dev)) is a **Typescript framework built on the database** that helps you develop transactional backend applications.
4
+ DBOS fully embraces the power of your application database, helping you write backend applications that are reliable by default.
5
+ It runs your Typescript functions as database transactions, guarantees they run "once and only once" for each request, and orchestrates them into workflows so reliable that if your server restarts, they resume exactly where they left off.
6
+
7
+ In the near future, DBOS Inc. expects to release a hosted cloud runtime for DBOS applications.
8
+ This scalable, secure runtime will allow you to deploy DBOS applications with the push of a button.
9
+ Also coming soon is our cloud “time-travel” debugger, which will set up and replay any scenario that occurred in production for analysis in the development environment.
10
+
11
+ ## Getting Started
12
+
13
+ The fastest way to get started with DBOS is by following the [quickstart](https://docs.dbos.dev/getting-started/quickstart), where you'll learn how to get a backend running in less than five minutes.
14
+
15
+ ## Documentation
16
+
17
+ You can find our full documentation at [https://docs.dbos.dev/](https://docs.dbos.dev/).
18
+
19
+ Check out our [Getting Started](https://docs.dbos.dev/category/getting-started) for an overview of how to build an application.
20
+
21
+ Our documentation has the following sections:
22
+
23
+ - [Getting Started](https://docs.dbos.dev/category/getting-started)
24
+ - [Tutorials](https://docs.dbos.dev/category/tutorials)
25
+ - [API Reference](https://docs.dbos.dev/category/reference)
26
+ - [Concepts and Explanations](https://docs.dbos.dev/category/concepts-and-explanations)
27
+
28
+ ## Community
29
+
30
+ Please join our community on [Discord](https://discord.gg/VrYtAZD5v)! If you see a bug or have a feature request, don't hesitate to open an issue here on GitHub.
@@ -0,0 +1,121 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "DBOS Config",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "database": {
8
+ "type": "object",
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "hostname": {
12
+ "type": "string",
13
+ "description": "The hostname or IP address of the application database"
14
+ },
15
+ "port": {
16
+ "type": "number",
17
+ "description": "The port number of the application database"
18
+ },
19
+ "username": {
20
+ "type": "string",
21
+ "description": "The username to use when connecting to the application database"
22
+ },
23
+ "password": {
24
+ "type": "string",
25
+ "description": "The password to use when connecting to the application database. Developers are strongly encouraged to use environment variable substitution to avoid storing secrets in source."
26
+ },
27
+ "connectionTimeoutMillis": {
28
+ "type": "number",
29
+ "description": "The number of milliseconds the system waits before timing out when connecting to the application database"
30
+ },
31
+ "user_database": {
32
+ "type": "string",
33
+ "description": "The name of the application database"
34
+ },
35
+ "system_database": {
36
+ "type": "string",
37
+ "description": "The name of a database to which DBOS can write system data. Defaults to `dbos_systemdb`"
38
+ },
39
+ "ssl_ca": {
40
+ "type": "string",
41
+ "description": "If using SSL/TLS to securely connect to a database, path to an SSL root certificate file"
42
+ },
43
+ "observability_database": {
44
+ "type": "string"
45
+ },
46
+ "user_dbclient": {
47
+ "type": "string",
48
+ "description": "Specify the database client to use to connect to the application database",
49
+ "enum": [
50
+ "pg-node",
51
+ "prisma",
52
+ "typeorm",
53
+ "knex"
54
+ ]
55
+ }
56
+ },
57
+ "required": [
58
+ "hostname",
59
+ "port",
60
+ "username",
61
+ "password",
62
+ "user_database"
63
+ ]
64
+ },
65
+ "telemetry": {
66
+ "type": "object",
67
+ "additionalProperties": false,
68
+ "properties": {
69
+ "logs": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "addContextMetadata": {
74
+ "type": "boolean",
75
+ "description": "Adds contextual information, such as workflow UUID, to each log entry"
76
+ },
77
+ "logLevel": {
78
+ "type": "string",
79
+ "description": "A filter on what logs should be printed to the standard output"
80
+ },
81
+ "silent": {
82
+ "type": "boolean",
83
+ "description": "Silences the logger such that nothing is printed to the standard output"
84
+ }
85
+ }
86
+ },
87
+ "traces": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "enabled": {
92
+ "type": "boolean",
93
+ "description": "Whether or not to export traces in Open Telemetry format"
94
+ },
95
+ "endpoint": {
96
+ "type": "string",
97
+ "description": "The FQDN of a Jaeger endpoint."
98
+ }
99
+ }
100
+ }
101
+ }
102
+ },
103
+ "runtimeConfig": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "properties": {
107
+ "entrypoint": {
108
+ "type": "string"
109
+ },
110
+ "port": {
111
+ "type": "number"
112
+ }
113
+ }
114
+ },
115
+ "application": {},
116
+ "dbClientMetadata": {}
117
+ },
118
+ "required": [
119
+ "database"
120
+ ]
121
+ }
@@ -0,0 +1,16 @@
1
+ database:
2
+ hostname: 'localhost'
3
+ port: 5432
4
+ username: 'postgres'
5
+ password: ${PGPASSWORD}
6
+ user_database: 'dbostest'
7
+ system_database: 'dbostest_systemdb'
8
+ user_dbclient: 'pg-node'
9
+ connectionTimeoutMillis: 3000
10
+ telemetry:
11
+ logs:
12
+ logLevel: 'debug'
13
+ addContextMetadata: true
14
+ silent: true
15
+ application:
16
+ testvalue: 'postgres'
@@ -0,0 +1,34 @@
1
+ export interface workflow_status {
2
+ workflow_uuid: string;
3
+ status: string;
4
+ name: string;
5
+ authenticated_user: string;
6
+ output: string;
7
+ error: string;
8
+ assumed_role: string;
9
+ authenticated_roles: string;
10
+ request: string;
11
+ executor_id: string;
12
+ }
13
+ export interface notifications {
14
+ destination_uuid: string;
15
+ topic: string;
16
+ message: string;
17
+ }
18
+ export interface workflow_events {
19
+ workflow_uuid: string;
20
+ key: string;
21
+ value: string;
22
+ }
23
+ export interface operation_outputs {
24
+ workflow_uuid: string;
25
+ function_id: number;
26
+ output: string;
27
+ error: string;
28
+ }
29
+ export interface workflow_inputs {
30
+ workflow_uuid: string;
31
+ inputs: string;
32
+ }
33
+ export declare const systemDBSchema = "\n CREATE TABLE IF NOT EXISTS operation_outputs (\n workflow_uuid TEXT NOT NULL,\n function_id INT NOT NULL,\n output TEXT,\n error TEXT,\n PRIMARY KEY (workflow_uuid, function_id)\n );\n\n CREATE TABLE IF NOT EXISTS workflow_inputs (\n workflow_uuid TEXT PRIMARY KEY NOT NULL,\n inputs TEXT NOT NULL\n );\n\n CREATE TABLE IF NOT EXISTS workflow_status (\n workflow_uuid TEXT PRIMARY KEY,\n status TEXT,\n name TEXT,\n authenticated_user TEXT,\n assumed_role TEXT,\n authenticated_roles TEXT,\n request TEXT,\n output TEXT,\n error TEXT,\n executor_id TEXT\n );\n\n CREATE TABLE IF NOT EXISTS notifications (\n destination_uuid TEXT NOT NULL,\n topic TEXT,\n message TEXT NOT NULL,\n created_at_epoch_ms BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM now())*1000)::bigint\n );\n\n CREATE TABLE IF NOT EXISTS workflow_events (\n workflow_uuid TEXT NOT NULL,\n key TEXT NOT NULL,\n value TEXT NOT NULL,\n PRIMARY KEY (workflow_uuid, key)\n );\n\n CREATE INDEX IF NOT EXISTS idx_workflow_topic ON notifications (destination_uuid, topic);\n\n CREATE OR REPLACE FUNCTION notifications_function() RETURNS TRIGGER AS $$\n DECLARE\n payload text := NEW.destination_uuid || '::' || NEW.topic;\n BEGIN\n -- Publish a notification for all keys\n PERFORM pg_notify('dbos_notifications_channel', payload);\n RETURN NEW;\n END;\n $$ LANGUAGE plpgsql;\n \n CREATE OR REPLACE TRIGGER dbos_notifications_trigger\n AFTER INSERT ON notifications\n FOR EACH ROW EXECUTE FUNCTION notifications_function();\n\n CREATE OR REPLACE FUNCTION workflow_events_function() RETURNS TRIGGER AS $$\n DECLARE\n payload text := NEW.workflow_uuid || '::' || NEW.key;\n BEGIN\n -- Publish a notification for all keys\n PERFORM pg_notify('dbos_workflow_events_channel', payload);\n RETURN NEW;\n END;\n $$ LANGUAGE plpgsql;\n\n CREATE OR REPLACE TRIGGER dbos_workflow_events_trigger\n AFTER INSERT ON workflow_events\n FOR EACH ROW EXECUTE FUNCTION workflow_events_function();\n";
34
+ //# sourceMappingURL=system_db_schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,cAAc,qlEAsE1B,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.systemDBSchema = void 0;
4
+ exports.systemDBSchema = `
5
+ CREATE TABLE IF NOT EXISTS operation_outputs (
6
+ workflow_uuid TEXT NOT NULL,
7
+ function_id INT NOT NULL,
8
+ output TEXT,
9
+ error TEXT,
10
+ PRIMARY KEY (workflow_uuid, function_id)
11
+ );
12
+
13
+ CREATE TABLE IF NOT EXISTS workflow_inputs (
14
+ workflow_uuid TEXT PRIMARY KEY NOT NULL,
15
+ inputs TEXT NOT NULL
16
+ );
17
+
18
+ CREATE TABLE IF NOT EXISTS workflow_status (
19
+ workflow_uuid TEXT PRIMARY KEY,
20
+ status TEXT,
21
+ name TEXT,
22
+ authenticated_user TEXT,
23
+ assumed_role TEXT,
24
+ authenticated_roles TEXT,
25
+ request TEXT,
26
+ output TEXT,
27
+ error TEXT,
28
+ executor_id TEXT
29
+ );
30
+
31
+ CREATE TABLE IF NOT EXISTS notifications (
32
+ destination_uuid TEXT NOT NULL,
33
+ topic TEXT,
34
+ message TEXT NOT NULL,
35
+ created_at_epoch_ms BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM now())*1000)::bigint
36
+ );
37
+
38
+ CREATE TABLE IF NOT EXISTS workflow_events (
39
+ workflow_uuid TEXT NOT NULL,
40
+ key TEXT NOT NULL,
41
+ value TEXT NOT NULL,
42
+ PRIMARY KEY (workflow_uuid, key)
43
+ );
44
+
45
+ CREATE INDEX IF NOT EXISTS idx_workflow_topic ON notifications (destination_uuid, topic);
46
+
47
+ CREATE OR REPLACE FUNCTION notifications_function() RETURNS TRIGGER AS $$
48
+ DECLARE
49
+ payload text := NEW.destination_uuid || '::' || NEW.topic;
50
+ BEGIN
51
+ -- Publish a notification for all keys
52
+ PERFORM pg_notify('dbos_notifications_channel', payload);
53
+ RETURN NEW;
54
+ END;
55
+ $$ LANGUAGE plpgsql;
56
+
57
+ CREATE OR REPLACE TRIGGER dbos_notifications_trigger
58
+ AFTER INSERT ON notifications
59
+ FOR EACH ROW EXECUTE FUNCTION notifications_function();
60
+
61
+ CREATE OR REPLACE FUNCTION workflow_events_function() RETURNS TRIGGER AS $$
62
+ DECLARE
63
+ payload text := NEW.workflow_uuid || '::' || NEW.key;
64
+ BEGIN
65
+ -- Publish a notification for all keys
66
+ PERFORM pg_notify('dbos_workflow_events_channel', payload);
67
+ RETURN NEW;
68
+ END;
69
+ $$ LANGUAGE plpgsql;
70
+
71
+ CREATE OR REPLACE TRIGGER dbos_workflow_events_trigger
72
+ AFTER INSERT ON workflow_events
73
+ FOR EACH ROW EXECUTE FUNCTION workflow_events_function();
74
+ `;
75
+ //# sourceMappingURL=system_db_schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system_db_schema.js","sourceRoot":"","sources":["../../schemas/system_db_schema.ts"],"names":[],"mappings":";;;AAqCa,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsE7B,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface transaction_outputs {
2
+ workflow_uuid: string;
3
+ function_id: number;
4
+ output: string;
5
+ error: string;
6
+ txn_id: string;
7
+ txn_snapshot: string;
8
+ }
9
+ export declare const createUserDBSchema = "CREATE SCHEMA IF NOT EXISTS dbos;";
10
+ export declare const userDBSchema = "\n CREATE TABLE IF NOT EXISTS dbos.transaction_outputs (\n workflow_uuid TEXT NOT NULL,\n function_id INT NOT NULL,\n output TEXT,\n error TEXT,\n txn_id TEXT,\n txn_snapshot TEXT NOT NULL,\n PRIMARY KEY (workflow_uuid, function_id)\n );\n";
11
+ //# sourceMappingURL=user_db_schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_db_schema.d.ts","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,sCAAsC,CAAC;AAEtE,eAAO,MAAM,YAAY,2QAUxB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userDBSchema = exports.createUserDBSchema = void 0;
4
+ exports.createUserDBSchema = `CREATE SCHEMA IF NOT EXISTS dbos;`;
5
+ exports.userDBSchema = `
6
+ CREATE TABLE IF NOT EXISTS dbos.transaction_outputs (
7
+ workflow_uuid TEXT NOT NULL,
8
+ function_id INT NOT NULL,
9
+ output TEXT,
10
+ error TEXT,
11
+ txn_id TEXT,
12
+ txn_snapshot TEXT NOT NULL,
13
+ PRIMARY KEY (workflow_uuid, function_id)
14
+ );
15
+ `;
16
+ //# sourceMappingURL=user_db_schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user_db_schema.js","sourceRoot":"","sources":["../../schemas/user_db_schema.ts"],"names":[],"mappings":";;;AASa,QAAA,kBAAkB,GAAG,mCAAmC,CAAC;AAEzD,QAAA,YAAY,GAAG;;;;;;;;;;CAU3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function configureApp(host: string, port: string, dbName: string): Promise<void>;
2
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/configure.ts"],"names":[],"mappings":"AAOA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAmD5E"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.configureApp = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const yaml_1 = __importDefault(require("yaml"));
10
+ const logs_1 = require("../../telemetry/logs");
11
+ const utils_1 = require("../utils");
12
+ const config_1 = require("../../dbos-runtime/config");
13
+ async function configureApp(host, port, dbName) {
14
+ const logger = (0, logs_1.createGlobalLogger)();
15
+ const userCredentials = (0, utils_1.getCloudCredentials)();
16
+ const bearerToken = "Bearer " + userCredentials.token;
17
+ // call cloud and get hostname and port
18
+ const res = await axios_1.default.get(`http://${host}:${port}/${userCredentials.userName}/databases/userdb/info/${dbName}`, {
19
+ headers: {
20
+ "Content-Type": "application/json",
21
+ Authorization: bearerToken,
22
+ },
23
+ });
24
+ // if status is not available or no hostname/port print error and exit
25
+ if (res.status != 200) {
26
+ logger.error("Error getting info for ${dbName} error: ${res.data}.");
27
+ return;
28
+ }
29
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
30
+ const userdbHostname = res.data.HostName;
31
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
32
+ const userdbPort = res.data.Port;
33
+ if (userdbHostname == "" || userdbPort == 0) {
34
+ logger.error("HostName: ${userdbHostname} Port: ${userdbPort} not available.");
35
+ return;
36
+ }
37
+ // read the yaml file
38
+ const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
39
+ if (!configFile) {
40
+ logger.error(`failed to parse ${config_1.dbosConfigFilePath}`);
41
+ return;
42
+ }
43
+ // update hostname and port
44
+ configFile.database.hostname = userdbHostname;
45
+ configFile.database.port = userdbPort;
46
+ // save the file
47
+ try {
48
+ fs_1.default.writeFileSync(`${config_1.dbosConfigFilePath}`, yaml_1.default.stringify(configFile));
49
+ }
50
+ catch (e) {
51
+ logger.error(`failed to write ${config_1.dbosConfigFilePath}: ${e.message}`);
52
+ return;
53
+ }
54
+ logger.info("Successfully configure user database at ${userdbHostname}:${userdbPort}.");
55
+ }
56
+ exports.configureApp = configureApp;
57
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/configure.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AACxB,+CAA0D;AAC1D,oCAA+C;AAC/C,sDAA2F;AAEpF,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,IAAY,EAAE,MAAc;IACzE,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,uCAAuC;IACvC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,0BAA0B,MAAM,EAAE,EAChH;QACE,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,WAAW;SAC3B;KACF,CAAC,CAAC;IAEH,sEAAsE;IACtE,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE;QACrB,MAAM,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACpE,OAAM;KACP;IAED,+GAA+G;IAC/G,MAAM,cAAc,GAAW,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAA;IAChD,+GAA+G;IAC/G,MAAM,UAAU,GAAW,GAAG,CAAC,IAAI,CAAC,IAAI,CAAA;IAExC,IAAI,cAAc,IAAI,EAAE,IAAI,UAAU,IAAI,CAAC,EAAE;QAC3C,MAAM,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAA;QAC9E,OAAM;KACP;IAED,qBAAqB;IACrB,MAAM,UAAU,GAA2B,IAAA,uBAAc,EAAC,2BAAkB,CAAC,CAAC;IAC9E,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,CAAC,KAAK,CAAC,mBAAmB,2BAAkB,EAAE,CAAC,CAAC;QACtD,OAAO;KACR;IAED,2BAA2B;IAC3B,UAAU,CAAC,QAAQ,CAAC,QAAQ,GAAG,cAAc,CAAA;IAC7C,UAAU,CAAC,QAAQ,CAAC,IAAI,GAAG,UAAU,CAAA;IAErC,gBAAgB;IAChB,IAAI;QACF,YAAE,CAAC,aAAa,CAAC,GAAG,2BAAkB,EAAE,EAAE,cAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;KACvE;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,KAAK,CAAC,mBAAmB,2BAAkB,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/E,OAAO;KACR;IAED,MAAM,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAA;AAE3F,CAAC;AAnDD,oCAmDC"}
@@ -0,0 +1,2 @@
1
+ export declare function deleteApp(appName: string, host: string, port: string): Promise<number>;
2
+ //# sourceMappingURL=delete-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-app.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/delete-app.ts"],"names":[],"mappings":"AAIA,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB5F"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteApp = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../../telemetry/logs");
9
+ const utils_1 = require("../utils");
10
+ async function deleteApp(appName, host, port) {
11
+ const logger = (0, logs_1.createGlobalLogger)();
12
+ const userCredentials = (0, utils_1.getCloudCredentials)();
13
+ const bearerToken = "Bearer " + userCredentials.token;
14
+ try {
15
+ await axios_1.default.delete(`http://${host}:${port}/${userCredentials.userName}/application/${appName}`, {
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ Authorization: bearerToken,
19
+ },
20
+ });
21
+ logger.info(`Successfully deleted application: ${appName}`);
22
+ return 0;
23
+ }
24
+ catch (e) {
25
+ if (axios_1.default.isAxiosError(e) && e.response) {
26
+ logger.error(`failed to delete application ${appName}: ${e.response?.data}`);
27
+ return 1;
28
+ }
29
+ else {
30
+ logger.error(`failed to delete application ${appName}: ${e.message}`);
31
+ return 1;
32
+ }
33
+ }
34
+ }
35
+ exports.deleteApp = deleteApp;
36
+ //# sourceMappingURL=delete-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-app.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/delete-app.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA0D;AAC1D,oCAA+C;AAExC,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,IAAY,EAAE,IAAY;IACzE,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI;QACF,MAAM,eAAK,CAAC,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,gBAAgB,OAAO,EAAE,EAAE;YAC9F,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,OAAO,CAAC,CAAC;SACV;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,CAAC;SACV;KACF;AACH,CAAC;AAxBD,8BAwBC"}
@@ -0,0 +1,2 @@
1
+ export declare function deployAppCode(appName: string, host: string, port: string): Promise<number>;
2
+ //# sourceMappingURL=deploy-app-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-app-code.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/deploy-app-code.ts"],"names":[],"mappings":"AAWA,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDhG"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deployAppCode = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const yaml_1 = __importDefault(require("yaml"));
9
+ const child_process_1 = require("child_process");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const logs_1 = require("../../telemetry/logs");
12
+ const utils_1 = require("../utils");
13
+ const utils_2 = require("../../utils");
14
+ const config_1 = require("../../dbos-runtime/config");
15
+ const deployDirectoryName = "dbos_deploy";
16
+ async function deployAppCode(appName, host, port) {
17
+ const logger = (0, logs_1.createGlobalLogger)();
18
+ const userCredentials = (0, utils_1.getCloudCredentials)();
19
+ const bearerToken = "Bearer " + userCredentials.token;
20
+ try {
21
+ (0, utils_2.createDirectory)(deployDirectoryName);
22
+ const configFile = (0, config_1.loadConfigFile)(config_1.dbosConfigFilePath);
23
+ if (!configFile) {
24
+ logger.error(`failed to parse ${config_1.dbosConfigFilePath}`);
25
+ return 1;
26
+ }
27
+ // Parse version from config file. If missing, use current epoch
28
+ const version = configFile.version ?? Date.now().toString();
29
+ configFile.version = version;
30
+ try {
31
+ fs_1.default.writeFileSync(`${deployDirectoryName}/${config_1.dbosConfigFilePath}`, yaml_1.default.stringify(configFile));
32
+ }
33
+ catch (e) {
34
+ logger.error(`failed to write ${config_1.dbosConfigFilePath}: ${e.message}`);
35
+ return 1;
36
+ }
37
+ (0, child_process_1.execSync)(`zip -ry ${deployDirectoryName}/${appName}.zip ./* -x ${deployDirectoryName}/* ${config_1.dbosConfigFilePath} > /dev/null`);
38
+ (0, child_process_1.execSync)(`zip -j ${deployDirectoryName}/${appName}.zip ${deployDirectoryName}/${config_1.dbosConfigFilePath} > /dev/null`);
39
+ const zipData = (0, utils_2.readFileSync)(`${deployDirectoryName}/${appName}.zip`, "base64");
40
+ await axios_1.default.post(`http://${host}:${port}/${userCredentials.userName}/application/${appName}`, {
41
+ application_version: version,
42
+ application_archive: zipData,
43
+ }, {
44
+ headers: {
45
+ "Content-Type": "application/json",
46
+ Authorization: bearerToken,
47
+ },
48
+ });
49
+ logger.info(`Successfully deployed ${appName} with version ${version}`);
50
+ return 0;
51
+ }
52
+ catch (e) {
53
+ if (axios_1.default.isAxiosError(e) && e.response) {
54
+ logger.error(`failed to deploy application ${appName}: ${e.response?.data}`);
55
+ return 1;
56
+ }
57
+ else {
58
+ logger.error(`failed to deploy application ${appName}: ${e.message}`);
59
+ return 1;
60
+ }
61
+ }
62
+ }
63
+ exports.deployAppCode = deployAppCode;
64
+ //# sourceMappingURL=deploy-app-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-app-code.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/deploy-app-code.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,iDAAyC;AACzC,4CAAoB;AACpB,+CAA0D;AAC1D,oCAA+C;AAC/C,uCAA4D;AAC5D,sDAA2F;AAE3F,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEnC,KAAK,UAAU,aAAa,CAAC,OAAe,EAAE,IAAY,EAAE,IAAY;IAC7E,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI;QACF,IAAA,uBAAe,EAAC,mBAAmB,CAAC,CAAC;QAErC,MAAM,UAAU,GAA2B,IAAA,uBAAc,EAAC,2BAAkB,CAAC,CAAC;QAC9E,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,CAAC,KAAK,CAAC,mBAAmB,2BAAkB,EAAE,CAAC,CAAC;YACtD,OAAO,CAAC,CAAC;SACV;QAED,gEAAgE;QAChE,MAAM,OAAO,GAAW,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpE,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;QAE7B,IAAI;YACF,YAAE,CAAC,aAAa,CAAC,GAAG,mBAAmB,IAAI,2BAAkB,EAAE,EAAE,cAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;SAC9F;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,mBAAmB,2BAAkB,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/E,OAAO,CAAC,CAAC;SACV;QAED,IAAA,wBAAQ,EAAC,WAAW,mBAAmB,IAAI,OAAO,eAAe,mBAAmB,MAAM,2BAAkB,cAAc,CAAC,CAAC;QAC5H,IAAA,wBAAQ,EAAC,UAAU,mBAAmB,IAAI,OAAO,QAAQ,mBAAmB,IAAI,2BAAkB,cAAc,CAAC,CAAC;QAElH,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,GAAG,mBAAmB,IAAI,OAAO,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChF,MAAM,eAAK,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,gBAAgB,OAAO,EAAE,EAC1F;YACE,mBAAmB,EAAE,OAAO;YACnC,mBAAmB,EAAE,OAAO;SACtB,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CACF,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,yBAAyB,OAAO,iBAAiB,OAAO,EAAE,CAAC,CAAC;QACxE,OAAO,CAAC,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,OAAO,CAAC,CAAC;SACV;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YACjF,OAAO,CAAC,CAAC;SACV;KACF;AACH,CAAC;AApDD,sCAoDC"}
@@ -0,0 +1,2 @@
1
+ export declare function getAppLogs(appName: string, host: string, port: string): Promise<number>;
2
+ //# sourceMappingURL=get-app-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-app-logs.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/get-app-logs.ts"],"names":[],"mappings":"AAIA,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAyB7F"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAppLogs = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const logs_1 = require("../../telemetry/logs");
9
+ const utils_1 = require("../utils");
10
+ async function getAppLogs(appName, host, port) {
11
+ const logger = (0, logs_1.createGlobalLogger)();
12
+ const userCredentials = (0, utils_1.getCloudCredentials)();
13
+ const bearerToken = "Bearer " + userCredentials.token;
14
+ try {
15
+ const res = await axios_1.default.get(`http://${host}:${port}/${userCredentials.userName}/logs/application/${appName}`, {
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ Authorization: bearerToken,
19
+ },
20
+ });
21
+ logger.info(`Successfully retrieved logs of application: ${appName}`);
22
+ logger.info(res.data);
23
+ return 0;
24
+ }
25
+ catch (e) {
26
+ if (axios_1.default.isAxiosError(e) && e.response) {
27
+ logger.error(`failed to retrieve logs of application ${appName}: ${e.response?.data}`);
28
+ return 1;
29
+ }
30
+ else {
31
+ logger.error(`failed to retrieve logs of application ${appName}: ${e.message}`);
32
+ return 1;
33
+ }
34
+ }
35
+ }
36
+ exports.getAppLogs = getAppLogs;
37
+ //# sourceMappingURL=get-app-logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-app-logs.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/get-app-logs.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAA0D;AAC1D,oCAA+C;AAExC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,IAAY,EAAE,IAAY;IAC1E,MAAM,MAAM,GAAG,IAAA,yBAAkB,GAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAA,2BAAmB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC;IAEtD,IAAI;QACF,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,eAAe,CAAC,QAAQ,qBAAqB,OAAO,EAAE,EAAE;YAC5G,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,WAAW;aAC3B;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,+CAA+C,OAAO,EAAE,CAAC,CAAC;QACtE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACrB,OAAO,CAAC,CAAC;KACV;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YACvC,MAAM,CAAC,KAAK,CAAC,0CAA0C,OAAO,KAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YACvF,OAAO,CAAC,CAAC;SACV;aAAM;YACL,MAAM,CAAC,KAAK,CAAC,0CAA0C,OAAO,KAAM,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3F,OAAO,CAAC,CAAC;SACV;KACF;AACH,CAAC;AAzBD,gCAyBC"}
@@ -0,0 +1,8 @@
1
+ export { registerApp } from './register-app';
2
+ export { listApps } from './list-apps';
3
+ export { deleteApp } from './delete-app';
4
+ export { deployAppCode } from './deploy-app-code';
5
+ export { getAppLogs } from './get-app-logs';
6
+ export { configureApp } from './configure';
7
+ export { updateApp } from './update-app';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateApp = exports.configureApp = exports.getAppLogs = exports.deployAppCode = exports.deleteApp = exports.listApps = exports.registerApp = void 0;
4
+ var register_app_1 = require("./register-app");
5
+ Object.defineProperty(exports, "registerApp", { enumerable: true, get: function () { return register_app_1.registerApp; } });
6
+ var list_apps_1 = require("./list-apps");
7
+ Object.defineProperty(exports, "listApps", { enumerable: true, get: function () { return list_apps_1.listApps; } });
8
+ var delete_app_1 = require("./delete-app");
9
+ Object.defineProperty(exports, "deleteApp", { enumerable: true, get: function () { return delete_app_1.deleteApp; } });
10
+ var deploy_app_code_1 = require("./deploy-app-code");
11
+ Object.defineProperty(exports, "deployAppCode", { enumerable: true, get: function () { return deploy_app_code_1.deployAppCode; } });
12
+ var get_app_logs_1 = require("./get-app-logs");
13
+ Object.defineProperty(exports, "getAppLogs", { enumerable: true, get: function () { return get_app_logs_1.getAppLogs; } });
14
+ var configure_1 = require("./configure");
15
+ Object.defineProperty(exports, "configureApp", { enumerable: true, get: function () { return configure_1.configureApp; } });
16
+ var update_app_1 = require("./update-app");
17
+ Object.defineProperty(exports, "updateApp", { enumerable: true, get: function () { return update_app_1.updateApp; } });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cloud-cli/applications/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,+CAA4C;AAAnC,0GAAA,UAAU,OAAA;AACnB,yCAA0C;AAAjC,yGAAA,YAAY,OAAA;AACrB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function listApps(host: string, port: string): Promise<number>;
2
+ //# sourceMappingURL=list-apps.d.ts.map