@mondaydotcomorg/z2h-cli 0.9.0 → 0.9.1

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 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF3E"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuF3E"}
@@ -75,6 +75,8 @@ async function deployCommand(opts = {}) {
75
75
  await util_s3_upload.uploadDir(paths.shadowBuild, keyPrefix);
76
76
  util_logger.info(`updating manifest entry "${appName}" → v${version}`);
77
77
  await util_manifest.writeManifest(util_manifest.upsertEntry(manifest, appName, entry));
78
+ util_logger.info(`registering app "${appName}" → v${version}`);
79
+ await registerApp(appName, token, version, entry);
78
80
  }
79
81
  finally {
80
82
  await releaseLockBestEffort(appName, token);
@@ -94,6 +96,17 @@ async function deployCommand(opts = {}) {
94
96
  entry,
95
97
  });
96
98
  }
99
+ async function registerApp(appName, token, version, entry) {
100
+ const res = await fetch(`${constants.brokerBaseUrl()}/z2h-cli/apps/register`, {
101
+ method: 'POST',
102
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
103
+ body: JSON.stringify({ appName, version, entry }),
104
+ });
105
+ if (!res.ok) {
106
+ const text = await res.text();
107
+ throw new Error(`App registration failed (${res.status}): ${text.slice(0, 1024)}`);
108
+ }
109
+ }
97
110
  // best-effort — the 5-min TTL backstop handles failures
98
111
  async function releaseLockBestEffort(appName, token) {
99
112
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF3E"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAGD,wBAAsB,aAAa,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuF3E"}
@@ -68,6 +68,8 @@ async function deployCommand(opts = {}) {
68
68
  await uploadDir(paths.shadowBuild, keyPrefix);
69
69
  info(`updating manifest entry "${appName}" → v${version}`);
70
70
  await writeManifest(upsertEntry(manifest, appName, entry));
71
+ info(`registering app "${appName}" → v${version}`);
72
+ await registerApp(appName, token, version, entry);
71
73
  }
72
74
  finally {
73
75
  await releaseLockBestEffort(appName, token);
@@ -87,6 +89,17 @@ async function deployCommand(opts = {}) {
87
89
  entry,
88
90
  });
89
91
  }
92
+ async function registerApp(appName, token, version, entry) {
93
+ const res = await fetch(`${brokerBaseUrl()}/z2h-cli/apps/register`, {
94
+ method: 'POST',
95
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
96
+ body: JSON.stringify({ appName, version, entry }),
97
+ });
98
+ if (!res.ok) {
99
+ const text = await res.text();
100
+ throw new Error(`App registration failed (${res.status}): ${text.slice(0, 1024)}`);
101
+ }
102
+ }
90
103
  // best-effort — the 5-min TTL backstop handles failures
91
104
  async function releaseLockBestEffort(appName, token) {
92
105
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/z2h-cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "bin": "./bin/z2h-cli.js",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -90,6 +90,9 @@ export async function deployCommand(opts: DeployOptions = {}): Promise<void> {
90
90
 
91
91
  info(`updating manifest entry "${appName}" → v${version}`);
92
92
  await writeManifest(upsertEntry(manifest, appName, entry));
93
+
94
+ info(`registering app "${appName}" → v${version}`);
95
+ await registerApp(appName, token, version, entry);
93
96
  } finally {
94
97
  await releaseLockBestEffort(appName, token);
95
98
  }
@@ -110,6 +113,18 @@ export async function deployCommand(opts: DeployOptions = {}): Promise<void> {
110
113
  });
111
114
  }
112
115
 
116
+ async function registerApp(appName: string, token: string, version: number, entry: ManifestEntry): Promise<void> {
117
+ const res = await fetch(`${brokerBaseUrl()}/z2h-cli/apps/register`, {
118
+ method: 'POST',
119
+ headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
120
+ body: JSON.stringify({ appName, version, entry }),
121
+ });
122
+ if (!res.ok) {
123
+ const text = await res.text();
124
+ throw new Error(`App registration failed (${res.status}): ${text.slice(0, 1024)}`);
125
+ }
126
+ }
127
+
113
128
  // best-effort — the 5-min TTL backstop handles failures
114
129
  async function releaseLockBestEffort(appName: string, token: string): Promise<void> {
115
130
  try {