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