bulletin-deploy 0.5.2 → 0.5.3

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { deploy } from "../src/deploy.js";
4
- import { bootstrapPool } from "../src/pool.js";
3
+ import { deploy } from "../dist/deploy.js";
4
+ import { bootstrapPool } from "../dist/pool.js";
5
5
  import * as fs from "fs";
6
6
 
7
7
  const args = process.argv.slice(2);
package/cdm.json ADDED
@@ -0,0 +1,118 @@
1
+ {
2
+ "targets": {
3
+ "acc2c3b5e912b762": {
4
+ "asset-hub": "wss://asset-hub-paseo-rpc.n.dwellir.com",
5
+ "bulletin": "https://paseo-ipfs.polkadot.io/ipfs"
6
+ }
7
+ },
8
+ "dependencies": {
9
+ "acc2c3b5e912b762": {
10
+ "@example/playground-registry": "latest"
11
+ }
12
+ },
13
+ "contracts": {
14
+ "acc2c3b5e912b762": {
15
+ "@example/playground-registry": {
16
+ "version": 2,
17
+ "address": "0x7D97a3E87c0C2fe921E471D076b95975886CEAA8",
18
+ "abi": [
19
+ {
20
+ "type": "constructor",
21
+ "inputs": [],
22
+ "stateMutability": "nonpayable"
23
+ },
24
+ {
25
+ "type": "function",
26
+ "name": "publish",
27
+ "inputs": [
28
+ {
29
+ "name": "domain",
30
+ "type": "string"
31
+ },
32
+ {
33
+ "name": "metadata_uri",
34
+ "type": "string"
35
+ }
36
+ ],
37
+ "outputs": [],
38
+ "stateMutability": "nonpayable"
39
+ },
40
+ {
41
+ "type": "function",
42
+ "name": "getMetadataUri",
43
+ "inputs": [
44
+ {
45
+ "name": "domain",
46
+ "type": "string"
47
+ }
48
+ ],
49
+ "outputs": [
50
+ {
51
+ "name": "",
52
+ "type": "tuple",
53
+ "components": [
54
+ {
55
+ "name": "isSome",
56
+ "type": "bool"
57
+ },
58
+ {
59
+ "name": "value",
60
+ "type": "string"
61
+ }
62
+ ]
63
+ }
64
+ ],
65
+ "stateMutability": "view"
66
+ },
67
+ {
68
+ "type": "function",
69
+ "name": "getDomainAt",
70
+ "inputs": [
71
+ {
72
+ "name": "index",
73
+ "type": "uint32"
74
+ }
75
+ ],
76
+ "outputs": [
77
+ {
78
+ "name": "",
79
+ "type": "string"
80
+ }
81
+ ],
82
+ "stateMutability": "view"
83
+ },
84
+ {
85
+ "type": "function",
86
+ "name": "getOwner",
87
+ "inputs": [
88
+ {
89
+ "name": "domain",
90
+ "type": "string"
91
+ }
92
+ ],
93
+ "outputs": [
94
+ {
95
+ "name": "",
96
+ "type": "address"
97
+ }
98
+ ],
99
+ "stateMutability": "view"
100
+ },
101
+ {
102
+ "type": "function",
103
+ "name": "getAppCount",
104
+ "inputs": [],
105
+ "outputs": [
106
+ {
107
+ "name": "",
108
+ "type": "uint32"
109
+ }
110
+ ],
111
+ "stateMutability": "view"
112
+ }
113
+ ],
114
+ "metadataCid": "bafk2bzacecrjrmrgumcww7oc23rllfscbxpd2lxc6p2svb26c6e5tjvmr565s"
115
+ }
116
+ }
117
+ }
118
+ }
@@ -1,71 +1,62 @@
1
- // Sentry telemetry. Enabled by default (DSN is write-only, safe to embed).
2
- // Set BULLETIN_DEPLOY_TELEMETRY=0 to disable.
3
-
4
- import { execSync } from "node:child_process";
5
- import * as fs from "node:fs";
6
- import * as path from "node:path";
7
-
8
- const DEFAULT_DSN = "https://e021c025d79c4c3ade2862a11f13c40b@o4509440811401216.ingest.de.sentry.io/4511093597405264";
9
- const DISABLED = process.env.BULLETIN_DEPLOY_TELEMETRY === "0";
10
-
11
- let Sentry = null;
12
-
1
+ // src/telemetry.ts
2
+ import { execSync } from "child_process";
3
+ import * as fs from "fs";
4
+ import * as path from "path";
5
+ var DEFAULT_DSN = "https://e021c025d79c4c3ade2862a11f13c40b@o4509440811401216.ingest.de.sentry.io/4511093597405264";
6
+ var DISABLED = process.env.BULLETIN_DEPLOY_TELEMETRY === "0";
7
+ var Sentry = null;
13
8
  if (!DISABLED) {
14
9
  try {
15
10
  Sentry = await import("@sentry/node");
16
11
  } catch {
17
- // @sentry/node not installed — telemetry disabled
18
12
  }
19
13
  }
20
-
21
- export function initTelemetry() {
14
+ function initTelemetry() {
22
15
  if (!Sentry) return;
23
16
  Sentry.init({
24
17
  dsn: process.env.SENTRY_DSN || DEFAULT_DSN,
25
- tracesSampleRate: 1.0,
26
- environment: process.env.CI ? "ci" : "local",
18
+ tracesSampleRate: 1,
19
+ environment: process.env.CI ? "ci" : "local"
27
20
  });
28
21
  }
29
-
30
22
  function extractRepoSlug(url) {
31
23
  return url.replace(/.*github\.com[:/]/, "").replace(/\.git$/, "");
32
24
  }
33
-
34
25
  function tryGitRemote() {
35
26
  try {
36
27
  return extractRepoSlug(execSync("git remote get-url origin", { encoding: "utf-8" }).trim());
37
- } catch { return undefined; }
28
+ } catch {
29
+ return void 0;
30
+ }
38
31
  }
39
-
40
32
  function tryPackageJsonRepo() {
41
33
  try {
42
34
  const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
43
35
  const repo = typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url;
44
36
  if (repo) return extractRepoSlug(repo);
45
- } catch {}
46
- return undefined;
37
+ } catch {
38
+ }
39
+ return void 0;
47
40
  }
48
-
49
- export function resolveRepo(domain) {
41
+ function resolveRepo(domain) {
50
42
  return process.env.GITHUB_REPOSITORY || tryGitRemote() || tryPackageJsonRepo() || domain || "unknown";
51
43
  }
52
-
53
44
  function tryGitBranch() {
54
45
  try {
55
46
  return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
56
- } catch { return "unknown"; }
47
+ } catch {
48
+ return "unknown";
49
+ }
57
50
  }
58
-
59
51
  function getDeployAttributes(domain) {
60
52
  return {
61
53
  "deploy.repo": resolveRepo(domain),
62
54
  "deploy.branch": process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || tryGitBranch(),
63
55
  "deploy.source": process.env.CI ? "ci" : "local",
64
- "deploy.pr": process.env.GITHUB_PR_NUMBER || undefined,
56
+ "deploy.pr": process.env.GITHUB_PR_NUMBER || void 0
65
57
  };
66
58
  }
67
-
68
- export async function withSpan(op, description, attributes, fn) {
59
+ async function withSpan(op, description, attributes, fn) {
69
60
  if (!Sentry) return fn();
70
61
  return Sentry.startSpan({ op, name: description, attributes }, async (span) => {
71
62
  try {
@@ -79,8 +70,7 @@ export async function withSpan(op, description, attributes, fn) {
79
70
  }
80
71
  });
81
72
  }
82
-
83
- export async function withDeploySpan(domain, fn) {
73
+ async function withDeploySpan(domain, fn) {
84
74
  if (!Sentry) return fn();
85
75
  const attrs = { ...getDeployAttributes(domain), "deploy.domain": domain };
86
76
  try {
@@ -89,7 +79,7 @@ export async function withDeploySpan(domain, fn) {
89
79
  "deploy.repo": attrs["deploy.repo"],
90
80
  "deploy.branch": attrs["deploy.branch"],
91
81
  "deploy.domain": domain,
92
- "deploy.source": attrs["deploy.source"],
82
+ "deploy.source": attrs["deploy.source"]
93
83
  });
94
84
  try {
95
85
  return await fn();
@@ -104,25 +94,33 @@ export async function withDeploySpan(domain, fn) {
104
94
  }
105
95
  });
106
96
  } finally {
107
- await Sentry.flush(5000);
97
+ await Sentry.flush(5e3);
108
98
  }
109
99
  }
110
-
111
- export function setDeployAttribute(key, value) {
100
+ function setDeployAttribute(key, value) {
112
101
  if (!Sentry) return;
113
102
  const span = Sentry.getActiveSpan();
114
103
  if (span) span.setAttribute(key, value);
115
104
  }
116
-
117
- export function captureWarning(message, context) {
105
+ function captureWarning(message, context) {
118
106
  if (!Sentry) return;
119
107
  try {
120
108
  Sentry.addBreadcrumb({ level: "warning", message, data: context });
121
109
  Sentry.captureMessage(message, { level: "warning", extra: context });
122
- } catch { /* telemetry must never break the deploy */ }
110
+ } catch {
111
+ }
123
112
  }
124
-
125
- export async function flush() {
113
+ async function flush() {
126
114
  if (!Sentry) return;
127
- await Sentry.flush(5000);
115
+ await Sentry.flush(5e3);
128
116
  }
117
+
118
+ export {
119
+ initTelemetry,
120
+ resolveRepo,
121
+ withSpan,
122
+ withDeploySpan,
123
+ setDeployAttribute,
124
+ captureWarning,
125
+ flush
126
+ };