merchi_sdk_js 0.18.1 → 0.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_js",
3
- "version": "0.18.1",
3
+ "version": "0.19.1",
4
4
  "type": "module",
5
5
  "main": "src/merchi.js",
6
6
  "module": "src/merchi.js",
package/src/domain.js CHANGED
@@ -263,6 +263,19 @@ export function Domain() {
263
263
  * @property {string} [googleAdsQuoteConversionLabel]
264
264
  */
265
265
 
266
+ /**
267
+ * Public BYO connection status (never includes encrypted tokens).
268
+ * @typedef {Object} StorefrontV2ByoStatus
269
+ * @property {'platform'|'byo'} infrastructureMode
270
+ * @property {boolean} githubAppConfigured
271
+ * @property {boolean} vercelOauthConfigured
272
+ * @property {boolean} githubConnected
273
+ * @property {boolean} vercelConnected
274
+ * @property {string|null} [githubAccountLogin]
275
+ * @property {string|null} [githubInstallationId]
276
+ * @property {string|null} [vercelTeamId]
277
+ */
278
+
266
279
  /**
267
280
  * @typedef {Object} StorefrontV2Config
268
281
  * @property {number} [id]
@@ -278,6 +291,11 @@ export function Domain() {
278
291
  * @property {string|null} [repoOwner]
279
292
  * @property {string|null} [repoName]
280
293
  * @property {string|null} [vercelProjectId]
294
+ * @property {string|null} [vercelTeamId]
295
+ * @property {'platform'|'byo'|string|null} [infrastructureMode]
296
+ * @property {string|null} [githubInstallationId]
297
+ * @property {string|null} [githubAccountLogin]
298
+ * @property {StorefrontV2ByoStatus|null} [byo]
281
299
  * @property {string|null} [lastSuccessfulCommitSha]
282
300
  * @property {StorefrontGoogleIntegrations|null} [googleIntegrations]
283
301
  * @property {Array<string>} [approvedStarterTemplates]
package/src/model.js CHANGED
@@ -676,6 +676,13 @@ export function serialise(obj, existing, prefix, files, options) {
676
676
  property !== 'id') {
677
677
  return;
678
678
  }
679
+ // JSON/JSONB columns (e.g. Domain.jobAgentPolicy) are plain objects.
680
+ // FormData stringifies objects as "[object Object]" unless we encode.
681
+ if (value !== null &&
682
+ typeof value === 'object' &&
683
+ !(typeof Blob !== 'undefined' && value instanceof Blob)) {
684
+ value = JSON.stringify(value);
685
+ }
679
686
  appendData(property, value);
680
687
  }
681
688
  });
@@ -0,0 +1,25 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { Domain } from './domain.js';
4
+ import { serialise } from './model.js';
5
+
6
+ test('serialise encodes jobAgentPolicy JSON for form data', () => {
7
+ const domain = new Domain();
8
+ domain.id(7);
9
+ domain.jobAgentPolicy({
10
+ playbooks: { drafting: false, invoice: true },
11
+ outreach: { sendEmail: true },
12
+ });
13
+
14
+ const [data] = serialise(domain);
15
+ const encoded = data.get('jobAgentPolicy');
16
+
17
+ assert.equal(
18
+ encoded,
19
+ JSON.stringify({
20
+ playbooks: { drafting: false, invoice: true },
21
+ outreach: { sendEmail: true },
22
+ })
23
+ );
24
+ assert.notEqual(encoded, '[object Object]');
25
+ });