@ubiquity-os/plugin-sdk 3.1.4 → 3.1.6

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