@ubiquity-os/plugin-sdk 3.1.4 → 3.1.5

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.
package/dist/index.js CHANGED
@@ -56,7 +56,20 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
56
56
  }
57
57
  static getInstance(env) {
58
58
  if (!_PluginRuntimeInfo._instance) {
59
- _PluginRuntimeInfo._instance = (0, import_adapter.getRuntimeKey)() === "workerd" ? new CfRuntimeInfo(env) : new NodeRuntimeInfo(env);
59
+ switch ((0, import_adapter.getRuntimeKey)()) {
60
+ case "workerd":
61
+ _PluginRuntimeInfo._instance = new CfRuntimeInfo(env);
62
+ break;
63
+ case "deno":
64
+ _PluginRuntimeInfo._instance = new DenoRuntimeInfo(env);
65
+ break;
66
+ case "node":
67
+ _PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
68
+ break;
69
+ default:
70
+ _PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
71
+ break;
72
+ }
60
73
  }
61
74
  return _PluginRuntimeInfo._instance;
62
75
  }
@@ -82,6 +95,42 @@ var NodeRuntimeInfo = class extends PluginRuntimeInfo {
82
95
  return import_github.default.context.payload.repository ? `${import_github.default.context.payload.repository?.html_url}/actions/runs/${import_github.default.context.runId}` : "http://localhost";
83
96
  }
84
97
  };
98
+ var DenoRuntimeInfo = class extends PluginRuntimeInfo {
99
+ get version() {
100
+ return Promise.resolve(Deno.env.get("DENO_DEPLOYMENT_ID"));
101
+ }
102
+ get runUrl() {
103
+ const projectName = Deno.env.get("DENO_PROJECT_NAME");
104
+ const baseUrl = `https://dash.deno.com/${projectName}/logs`;
105
+ const start = new Date(Date.now() - 6e4).toISOString();
106
+ const end = new Date(Date.now() + 6e4).toISOString();
107
+ const filters = {
108
+ query: "",
109
+ timeRangeOption: "custom",
110
+ recentValue: "1hour",
111
+ customValues: {
112
+ start,
113
+ end
114
+ },
115
+ logLevels: {
116
+ debug: true,
117
+ info: true,
118
+ warning: true,
119
+ error: true
120
+ },
121
+ regions: {
122
+ "gcp-asia-southeast1": true,
123
+ "gcp-europe-west2": true,
124
+ "gcp-europe-west3": true,
125
+ "gcp-southamerica-east1": true,
126
+ "gcp-us-east4": true,
127
+ "gcp-us-west2": true
128
+ }
129
+ };
130
+ const filtersParam = encodeURIComponent(JSON.stringify(filters));
131
+ return `${baseUrl}?filters=${filtersParam}`;
132
+ }
133
+ };
85
134
 
86
135
  // src/util.ts
87
136
  var import_ubiquity_os_logger = require("@ubiquity-os/ubiquity-os-logger");
package/dist/index.mjs CHANGED
@@ -18,7 +18,20 @@ var PluginRuntimeInfo = class _PluginRuntimeInfo {
18
18
  }
19
19
  static getInstance(env) {
20
20
  if (!_PluginRuntimeInfo._instance) {
21
- _PluginRuntimeInfo._instance = getRuntimeKey() === "workerd" ? new CfRuntimeInfo(env) : new NodeRuntimeInfo(env);
21
+ switch (getRuntimeKey()) {
22
+ case "workerd":
23
+ _PluginRuntimeInfo._instance = new CfRuntimeInfo(env);
24
+ break;
25
+ case "deno":
26
+ _PluginRuntimeInfo._instance = new DenoRuntimeInfo(env);
27
+ break;
28
+ case "node":
29
+ _PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
30
+ break;
31
+ default:
32
+ _PluginRuntimeInfo._instance = new NodeRuntimeInfo(env);
33
+ break;
34
+ }
22
35
  }
23
36
  return _PluginRuntimeInfo._instance;
24
37
  }
@@ -44,6 +57,42 @@ var NodeRuntimeInfo = class extends PluginRuntimeInfo {
44
57
  return github.context.payload.repository ? `${github.context.payload.repository?.html_url}/actions/runs/${github.context.runId}` : "http://localhost";
45
58
  }
46
59
  };
60
+ var DenoRuntimeInfo = class extends PluginRuntimeInfo {
61
+ get version() {
62
+ return Promise.resolve(Deno.env.get("DENO_DEPLOYMENT_ID"));
63
+ }
64
+ get runUrl() {
65
+ const projectName = Deno.env.get("DENO_PROJECT_NAME");
66
+ const baseUrl = `https://dash.deno.com/${projectName}/logs`;
67
+ const start = new Date(Date.now() - 6e4).toISOString();
68
+ const end = new Date(Date.now() + 6e4).toISOString();
69
+ const filters = {
70
+ query: "",
71
+ timeRangeOption: "custom",
72
+ recentValue: "1hour",
73
+ customValues: {
74
+ start,
75
+ end
76
+ },
77
+ logLevels: {
78
+ debug: true,
79
+ info: true,
80
+ warning: true,
81
+ error: true
82
+ },
83
+ regions: {
84
+ "gcp-asia-southeast1": true,
85
+ "gcp-europe-west2": true,
86
+ "gcp-europe-west3": true,
87
+ "gcp-southamerica-east1": true,
88
+ "gcp-us-east4": true,
89
+ "gcp-us-west2": true
90
+ }
91
+ };
92
+ const filtersParam = encodeURIComponent(JSON.stringify(filters));
93
+ return `${baseUrl}?filters=${filtersParam}`;
94
+ }
95
+ };
47
96
 
48
97
  // src/util.ts
49
98
  import { LOG_LEVEL } from "@ubiquity-os/ubiquity-os-logger";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubiquity-os/plugin-sdk",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "SDK for plugin support.",
5
5
  "author": "Ubiquity DAO",
6
6
  "license": "MIT",