@uniformdev/canvas 18.1.2-alpha.7 → 18.2.0
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/{chunk-RFV573P3.mjs → chunk-D45SO56S.mjs} +14 -16
- package/dist/cli/cli.js +16 -24
- package/dist/cli/cli.mjs +3 -9
- package/dist/index.d.ts +4 -7
- package/dist/index.esm.js +1 -1
- package/dist/index.js +14 -16
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
@@ -475,19 +475,17 @@ function createLimitPolicy({
|
|
475
475
|
var nullLimitPolicy = async (func) => await func();
|
476
476
|
|
477
477
|
// src/CanvasClient.ts
|
478
|
-
var CANVAS_URL = "/api/v1/canvas";
|
479
478
|
var CanvasClient = class extends ApiClient {
|
480
479
|
constructor(options) {
|
481
|
-
var _a;
|
482
480
|
if (!options.limitPolicy) {
|
483
481
|
options.limitPolicy = createLimitPolicy({});
|
484
482
|
}
|
485
483
|
super(options);
|
486
|
-
this.
|
484
|
+
this.canvasUrl = "/api/v1/canvas";
|
487
485
|
}
|
488
486
|
async getCompositionList(options) {
|
489
487
|
const { projectId } = this.options;
|
490
|
-
const fetchUri = this.createUrl(
|
488
|
+
const fetchUri = this.createUrl(this.canvasUrl, { ...options, projectId });
|
491
489
|
return await this.apiClient(fetchUri);
|
492
490
|
}
|
493
491
|
unstable_getCompositionByNodePath(options) {
|
@@ -509,20 +507,20 @@ var CanvasClient = class extends ApiClient {
|
|
509
507
|
...params
|
510
508
|
}) {
|
511
509
|
const { projectId } = this.options;
|
512
|
-
|
513
|
-
|
510
|
+
const url = resolveData ? "/api/edge/v1/composition" : this.canvasUrl;
|
511
|
+
const dataResolutionParams = {};
|
512
|
+
if (resolveData) {
|
513
|
+
if (dynamicVariables) {
|
514
|
+
dataResolutionParams.dynamicVariables = JSON.stringify(dynamicVariables);
|
515
|
+
}
|
516
|
+
if (dataDiagnostics) {
|
517
|
+
dataResolutionParams.dataDiagnostics = "true";
|
518
|
+
}
|
514
519
|
}
|
515
|
-
|
516
|
-
...params,
|
517
|
-
projectId,
|
518
|
-
...dynamicVariables ? { dynamicVariables: JSON.stringify(dynamicVariables) } : {},
|
519
|
-
...dataDiagnostics ? { dataDiagnostics: "true" } : {}
|
520
|
-
};
|
521
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
522
|
-
return this.apiClient(edgeUrl);
|
520
|
+
return this.apiClient(this.createUrl(url, { ...params, ...dataResolutionParams, projectId }));
|
523
521
|
}
|
524
522
|
async updateComposition(body) {
|
525
|
-
const fetchUri = this.createUrl(
|
523
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
526
524
|
await this.apiClient(fetchUri, {
|
527
525
|
method: "PUT",
|
528
526
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
@@ -530,7 +528,7 @@ var CanvasClient = class extends ApiClient {
|
|
530
528
|
});
|
531
529
|
}
|
532
530
|
async removeComposition(body) {
|
533
|
-
const fetchUri = this.createUrl(
|
531
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
534
532
|
const { projectId } = this.options;
|
535
533
|
await this.apiClient(fetchUri, {
|
536
534
|
method: "DELETE",
|
package/dist/cli/cli.js
CHANGED
@@ -18094,15 +18094,10 @@ function withApiOptions(yargs) {
|
|
18094
18094
|
demandOption: true,
|
18095
18095
|
type: "string"
|
18096
18096
|
}).option("apiHost", {
|
18097
|
-
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env
|
18097
|
+
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.",
|
18098
18098
|
default: process.env.UNIFORM_CLI_BASE_URL || "https://uniform.app",
|
18099
18099
|
demandOption: true,
|
18100
18100
|
type: "string"
|
18101
|
-
}).option("edgeApiHost", {
|
18102
|
-
describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
|
18103
|
-
default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
|
18104
|
-
demandOption: true,
|
18105
|
-
type: "string"
|
18106
18101
|
}).option("proxy", {
|
18107
18102
|
describe: "HTTPS proxy to use for Uniform API calls. Defaults to HTTPS_PROXY, https_proxy, ALL_PROXY, or all_proxy env vars (in that order). Supports dotenv.",
|
18108
18103
|
default: process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy,
|
@@ -18603,19 +18598,17 @@ function createLimitPolicy({
|
|
18603
18598
|
}
|
18604
18599
|
|
18605
18600
|
// src/CanvasClient.ts
|
18606
|
-
var CANVAS_URL = "/api/v1/canvas";
|
18607
18601
|
var CanvasClient = class extends import_api.ApiClient {
|
18608
18602
|
constructor(options) {
|
18609
|
-
var _a2;
|
18610
18603
|
if (!options.limitPolicy) {
|
18611
18604
|
options.limitPolicy = createLimitPolicy({});
|
18612
18605
|
}
|
18613
18606
|
super(options);
|
18614
|
-
this.
|
18607
|
+
this.canvasUrl = "/api/v1/canvas";
|
18615
18608
|
}
|
18616
18609
|
async getCompositionList(options) {
|
18617
18610
|
const { projectId } = this.options;
|
18618
|
-
const fetchUri = this.createUrl(
|
18611
|
+
const fetchUri = this.createUrl(this.canvasUrl, { ...options, projectId });
|
18619
18612
|
return await this.apiClient(fetchUri);
|
18620
18613
|
}
|
18621
18614
|
unstable_getCompositionByNodePath(options) {
|
@@ -18637,20 +18630,20 @@ var CanvasClient = class extends import_api.ApiClient {
|
|
18637
18630
|
...params
|
18638
18631
|
}) {
|
18639
18632
|
const { projectId } = this.options;
|
18640
|
-
|
18641
|
-
|
18633
|
+
const url = resolveData ? "/api/edge/v1/composition" : this.canvasUrl;
|
18634
|
+
const dataResolutionParams = {};
|
18635
|
+
if (resolveData) {
|
18636
|
+
if (dynamicVariables) {
|
18637
|
+
dataResolutionParams.dynamicVariables = JSON.stringify(dynamicVariables);
|
18638
|
+
}
|
18639
|
+
if (dataDiagnostics) {
|
18640
|
+
dataResolutionParams.dataDiagnostics = "true";
|
18641
|
+
}
|
18642
18642
|
}
|
18643
|
-
|
18644
|
-
...params,
|
18645
|
-
projectId,
|
18646
|
-
...dynamicVariables ? { dynamicVariables: JSON.stringify(dynamicVariables) } : {},
|
18647
|
-
...dataDiagnostics ? { dataDiagnostics: "true" } : {}
|
18648
|
-
};
|
18649
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
18650
|
-
return this.apiClient(edgeUrl);
|
18643
|
+
return this.apiClient(this.createUrl(url, { ...params, ...dataResolutionParams, projectId }));
|
18651
18644
|
}
|
18652
18645
|
async updateComposition(body) {
|
18653
|
-
const fetchUri = this.createUrl(
|
18646
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
18654
18647
|
await this.apiClient(fetchUri, {
|
18655
18648
|
method: "PUT",
|
18656
18649
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
@@ -18658,7 +18651,7 @@ var CanvasClient = class extends import_api.ApiClient {
|
|
18658
18651
|
});
|
18659
18652
|
}
|
18660
18653
|
async removeComposition(body) {
|
18661
|
-
const fetchUri = this.createUrl(
|
18654
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
18662
18655
|
const { projectId } = this.options;
|
18663
18656
|
await this.apiClient(fetchUri, {
|
18664
18657
|
method: "DELETE",
|
@@ -19153,7 +19146,6 @@ var CompositionGetModule = {
|
|
19153
19146
|
),
|
19154
19147
|
handler: async ({
|
19155
19148
|
apiHost,
|
19156
|
-
edgeApiHost,
|
19157
19149
|
apiKey,
|
19158
19150
|
proxy,
|
19159
19151
|
id,
|
@@ -19167,7 +19159,7 @@ var CompositionGetModule = {
|
|
19167
19159
|
unstableDataDiagnostics
|
19168
19160
|
}) => {
|
19169
19161
|
const fetch2 = nodeFetchProxy(proxy);
|
19170
|
-
const client = new UncachedCanvasClient({ apiKey,
|
19162
|
+
const client = new UncachedCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
19171
19163
|
const res = prepCompositionForDisk(
|
19172
19164
|
await client.getCompositionById({
|
19173
19165
|
compositionId: id,
|
package/dist/cli/cli.mjs
CHANGED
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
__require,
|
15
15
|
__toCommonJS,
|
16
16
|
__toESM
|
17
|
-
} from "../chunk-
|
17
|
+
} from "../chunk-D45SO56S.mjs";
|
18
18
|
|
19
19
|
// ../../node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
|
20
20
|
var require_ms = __commonJS({
|
@@ -17813,15 +17813,10 @@ function withApiOptions(yargs) {
|
|
17813
17813
|
demandOption: true,
|
17814
17814
|
type: "string"
|
17815
17815
|
}).option("apiHost", {
|
17816
|
-
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env
|
17816
|
+
describe: "Uniform host. Defaults to UNIFORM_CLI_BASE_URL env or https://uniform.app. Supports dotenv.",
|
17817
17817
|
default: process.env.UNIFORM_CLI_BASE_URL || "https://uniform.app",
|
17818
17818
|
demandOption: true,
|
17819
17819
|
type: "string"
|
17820
|
-
}).option("edgeApiHost", {
|
17821
|
-
describe: "Uniform edge host. Defaults to UNIFORM_CLI_BASE_EDGE_URL env var or https://uniform.global. Supports dotenv.",
|
17822
|
-
default: process.env.UNIFORM_CLI_BASE_EDGE_URL || "https://uniform.global",
|
17823
|
-
demandOption: true,
|
17824
|
-
type: "string"
|
17825
17820
|
}).option("proxy", {
|
17826
17821
|
describe: "HTTPS proxy to use for Uniform API calls. Defaults to HTTPS_PROXY, https_proxy, ALL_PROXY, or all_proxy env vars (in that order). Supports dotenv.",
|
17827
17822
|
default: process.env.HTTPS_PROXY || process.env.https_proxy || process.env.ALL_PROXY || process.env.all_proxy,
|
@@ -18596,7 +18591,6 @@ var CompositionGetModule = {
|
|
18596
18591
|
),
|
18597
18592
|
handler: async ({
|
18598
18593
|
apiHost,
|
18599
|
-
edgeApiHost,
|
18600
18594
|
apiKey,
|
18601
18595
|
proxy,
|
18602
18596
|
id,
|
@@ -18610,7 +18604,7 @@ var CompositionGetModule = {
|
|
18610
18604
|
unstableDataDiagnostics
|
18611
18605
|
}) => {
|
18612
18606
|
const fetch2 = nodeFetchProxy(proxy);
|
18613
|
-
const client = new UncachedCanvasClient({ apiKey,
|
18607
|
+
const client = new UncachedCanvasClient({ apiKey, apiHost, fetch: fetch2, projectId });
|
18614
18608
|
const res = prepCompositionForDisk(
|
18615
18609
|
await client.getCompositionById({
|
18616
18610
|
compositionId: id,
|
package/dist/index.d.ts
CHANGED
@@ -7,12 +7,9 @@ import { Options } from 'p-throttle';
|
|
7
7
|
import { PersonalizedVariant, TestVariant } from '@uniformdev/context';
|
8
8
|
import 'pusher-js';
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
declare class CanvasClient extends ApiClient<CanvasClientOptions> {
|
14
|
-
private edgeApiHost;
|
15
|
-
constructor(options: CanvasClientOptions);
|
10
|
+
declare class CanvasClient extends ApiClient<ClientOptions> {
|
11
|
+
constructor(options: ClientOptions);
|
12
|
+
private canvasUrl;
|
16
13
|
/** Fetches lists of Canvas compositions, optionally by type */
|
17
14
|
getCompositionList(options?: Omit<CompositionGetParameters, 'projectId' | 'compositionId' | 'slug'>): Promise<{
|
18
15
|
compositions: {
|
@@ -202,7 +199,7 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
|
|
202
199
|
removeComponentDefinition(body: Omit<ComponentDefinitionDeleteParameters, 'projectId'>): Promise<void>;
|
203
200
|
}
|
204
201
|
declare class UncachedCanvasClient extends CanvasClient {
|
205
|
-
constructor(options: Omit<
|
202
|
+
constructor(options: Omit<ClientOptions, 'bypassCache'>);
|
206
203
|
}
|
207
204
|
|
208
205
|
type EnhancerContext = {
|
package/dist/index.esm.js
CHANGED
package/dist/index.js
CHANGED
@@ -513,19 +513,17 @@ function createLimitPolicy({
|
|
513
513
|
var nullLimitPolicy = async (func) => await func();
|
514
514
|
|
515
515
|
// src/CanvasClient.ts
|
516
|
-
var CANVAS_URL = "/api/v1/canvas";
|
517
516
|
var CanvasClient = class extends import_api.ApiClient {
|
518
517
|
constructor(options) {
|
519
|
-
var _a;
|
520
518
|
if (!options.limitPolicy) {
|
521
519
|
options.limitPolicy = createLimitPolicy({});
|
522
520
|
}
|
523
521
|
super(options);
|
524
|
-
this.
|
522
|
+
this.canvasUrl = "/api/v1/canvas";
|
525
523
|
}
|
526
524
|
async getCompositionList(options) {
|
527
525
|
const { projectId } = this.options;
|
528
|
-
const fetchUri = this.createUrl(
|
526
|
+
const fetchUri = this.createUrl(this.canvasUrl, { ...options, projectId });
|
529
527
|
return await this.apiClient(fetchUri);
|
530
528
|
}
|
531
529
|
unstable_getCompositionByNodePath(options) {
|
@@ -547,20 +545,20 @@ var CanvasClient = class extends import_api.ApiClient {
|
|
547
545
|
...params
|
548
546
|
}) {
|
549
547
|
const { projectId } = this.options;
|
550
|
-
|
551
|
-
|
548
|
+
const url = resolveData ? "/api/edge/v1/composition" : this.canvasUrl;
|
549
|
+
const dataResolutionParams = {};
|
550
|
+
if (resolveData) {
|
551
|
+
if (dynamicVariables) {
|
552
|
+
dataResolutionParams.dynamicVariables = JSON.stringify(dynamicVariables);
|
553
|
+
}
|
554
|
+
if (dataDiagnostics) {
|
555
|
+
dataResolutionParams.dataDiagnostics = "true";
|
556
|
+
}
|
552
557
|
}
|
553
|
-
|
554
|
-
...params,
|
555
|
-
projectId,
|
556
|
-
...dynamicVariables ? { dynamicVariables: JSON.stringify(dynamicVariables) } : {},
|
557
|
-
...dataDiagnostics ? { dataDiagnostics: "true" } : {}
|
558
|
-
};
|
559
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
560
|
-
return this.apiClient(edgeUrl);
|
558
|
+
return this.apiClient(this.createUrl(url, { ...params, ...dataResolutionParams, projectId }));
|
561
559
|
}
|
562
560
|
async updateComposition(body) {
|
563
|
-
const fetchUri = this.createUrl(
|
561
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
564
562
|
await this.apiClient(fetchUri, {
|
565
563
|
method: "PUT",
|
566
564
|
body: JSON.stringify({ ...body, projectId: this.options.projectId }),
|
@@ -568,7 +566,7 @@ var CanvasClient = class extends import_api.ApiClient {
|
|
568
566
|
});
|
569
567
|
}
|
570
568
|
async removeComposition(body) {
|
571
|
-
const fetchUri = this.createUrl(
|
569
|
+
const fetchUri = this.createUrl("/api/v1/canvas");
|
572
570
|
const { projectId } = this.options;
|
573
571
|
await this.apiClient(fetchUri, {
|
574
572
|
method: "DELETE",
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "18.
|
3
|
+
"version": "18.2.0",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"devDependencies": {
|
50
50
|
"@types/retry": "0.12.1",
|
51
51
|
"@types/yargs": "17.0.20",
|
52
|
-
"@uniformdev/cli": "18.
|
52
|
+
"@uniformdev/cli": "18.2.0",
|
53
53
|
"p-limit": "4.0.0",
|
54
54
|
"p-retry": "5.1.2",
|
55
55
|
"p-throttle": "5.0.0",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"yargs": "17.6.2"
|
58
58
|
},
|
59
59
|
"dependencies": {
|
60
|
-
"@uniformdev/context": "18.
|
60
|
+
"@uniformdev/context": "18.2.0"
|
61
61
|
},
|
62
62
|
"files": [
|
63
63
|
"/dist"
|
@@ -65,5 +65,5 @@
|
|
65
65
|
"publishConfig": {
|
66
66
|
"access": "public"
|
67
67
|
},
|
68
|
-
"gitHead": "
|
68
|
+
"gitHead": "946d96f5a3ebd69cfc1b4fcc003dea75af4480af"
|
69
69
|
}
|