@puckeditor/plugin-pages 0.7.0-canary.75c0f12c
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/api/index.js +117 -0
- package/dist/api/index.mjs +84 -0
- package/dist/chunk-YE56DQ4I.mjs +42 -0
- package/dist/index.css +1593 -0
- package/dist/index.js +6753 -0
- package/dist/index.mjs +6708 -0
- package/package.json +57 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// api/index.ts
|
|
31
|
+
var api_exports = {};
|
|
32
|
+
__export(api_exports, {
|
|
33
|
+
GET: () => GET,
|
|
34
|
+
POST: () => POST
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(api_exports);
|
|
37
|
+
|
|
38
|
+
// ../tsup-config/react-import.js
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
|
|
41
|
+
// ../cloud-client/src/lib/get-api-key.ts
|
|
42
|
+
var getApiKey = () => process.env.PUCK_API_KEY;
|
|
43
|
+
|
|
44
|
+
// api/index.ts
|
|
45
|
+
var GET = async ({
|
|
46
|
+
path,
|
|
47
|
+
versionId,
|
|
48
|
+
siteId,
|
|
49
|
+
latestVersion
|
|
50
|
+
}, options) => {
|
|
51
|
+
const {
|
|
52
|
+
host = "https://cloud.puckeditor.com/api",
|
|
53
|
+
ott,
|
|
54
|
+
apiKey = getApiKey()
|
|
55
|
+
} = options;
|
|
56
|
+
if (!ott && !apiKey) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const res = await fetch(
|
|
62
|
+
`${host}/page?path=${path}${versionId ? `&versionId=${versionId}` : ""}${latestVersion ? `&latestVersion=true` : ""}`,
|
|
63
|
+
{
|
|
64
|
+
headers: {
|
|
65
|
+
...ott ? { "x-ott": ott } : {},
|
|
66
|
+
...apiKey && !ott ? { "x-api-key": apiKey } : {},
|
|
67
|
+
...siteId ? { "site-id": siteId } : {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
if (!res.body) {
|
|
72
|
+
throw new Error(`Puck ${res.status} (${res.statusText})`);
|
|
73
|
+
} else if (!res.ok) {
|
|
74
|
+
const body = await res.json();
|
|
75
|
+
throw new Error(
|
|
76
|
+
`Puck ${res.status} (${res.statusText}): ${body.error ?? "Unknown reason"}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return res;
|
|
80
|
+
};
|
|
81
|
+
var POST = async ({ body, siteId }, options) => {
|
|
82
|
+
const {
|
|
83
|
+
apiKey = getApiKey(),
|
|
84
|
+
host = "https://cloud.puckeditor.com/api",
|
|
85
|
+
ott
|
|
86
|
+
} = options;
|
|
87
|
+
if (!apiKey && !ott) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
const res = await fetch(`${host}/page`, {
|
|
93
|
+
headers: {
|
|
94
|
+
...ott ? { "x-ott": ott } : {},
|
|
95
|
+
...apiKey && !ott ? { "x-api-key": apiKey } : {},
|
|
96
|
+
...siteId ? { "site-id": siteId } : {}
|
|
97
|
+
},
|
|
98
|
+
method: "post",
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
...body
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
if (!res.body) {
|
|
104
|
+
throw new Error(`Puck ${res.status} (${res.statusText})`);
|
|
105
|
+
} else if (!res.ok) {
|
|
106
|
+
const body2 = await res.json();
|
|
107
|
+
throw new Error(
|
|
108
|
+
`Puck ${res.status} (${res.statusText}): ${body2.error ?? "Unknown reason"}`
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return res;
|
|
112
|
+
};
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
GET,
|
|
116
|
+
POST
|
|
117
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "../chunk-YE56DQ4I.mjs";
|
|
4
|
+
|
|
5
|
+
// api/index.ts
|
|
6
|
+
init_react_import();
|
|
7
|
+
|
|
8
|
+
// ../cloud-client/src/lib/get-api-key.ts
|
|
9
|
+
init_react_import();
|
|
10
|
+
var getApiKey = () => process.env.PUCK_API_KEY;
|
|
11
|
+
|
|
12
|
+
// api/index.ts
|
|
13
|
+
var GET = async ({
|
|
14
|
+
path,
|
|
15
|
+
versionId,
|
|
16
|
+
siteId,
|
|
17
|
+
latestVersion
|
|
18
|
+
}, options) => {
|
|
19
|
+
const {
|
|
20
|
+
host = "https://cloud.puckeditor.com/api",
|
|
21
|
+
ott,
|
|
22
|
+
apiKey = getApiKey()
|
|
23
|
+
} = options;
|
|
24
|
+
if (!ott && !apiKey) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const res = await fetch(
|
|
30
|
+
`${host}/page?path=${path}${versionId ? `&versionId=${versionId}` : ""}${latestVersion ? `&latestVersion=true` : ""}`,
|
|
31
|
+
{
|
|
32
|
+
headers: {
|
|
33
|
+
...ott ? { "x-ott": ott } : {},
|
|
34
|
+
...apiKey && !ott ? { "x-api-key": apiKey } : {},
|
|
35
|
+
...siteId ? { "site-id": siteId } : {}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
if (!res.body) {
|
|
40
|
+
throw new Error(`Puck ${res.status} (${res.statusText})`);
|
|
41
|
+
} else if (!res.ok) {
|
|
42
|
+
const body = await res.json();
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Puck ${res.status} (${res.statusText}): ${body.error ?? "Unknown reason"}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return res;
|
|
48
|
+
};
|
|
49
|
+
var POST = async ({ body, siteId }, options) => {
|
|
50
|
+
const {
|
|
51
|
+
apiKey = getApiKey(),
|
|
52
|
+
host = "https://cloud.puckeditor.com/api",
|
|
53
|
+
ott
|
|
54
|
+
} = options;
|
|
55
|
+
if (!apiKey && !ott) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
"No Puck API key specified. Set the PUCK_API_KEY environment variable, or provide one to the function"
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const res = await fetch(`${host}/page`, {
|
|
61
|
+
headers: {
|
|
62
|
+
...ott ? { "x-ott": ott } : {},
|
|
63
|
+
...apiKey && !ott ? { "x-api-key": apiKey } : {},
|
|
64
|
+
...siteId ? { "site-id": siteId } : {}
|
|
65
|
+
},
|
|
66
|
+
method: "post",
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
...body
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
if (!res.body) {
|
|
72
|
+
throw new Error(`Puck ${res.status} (${res.statusText})`);
|
|
73
|
+
} else if (!res.ok) {
|
|
74
|
+
const body2 = await res.json();
|
|
75
|
+
throw new Error(
|
|
76
|
+
`Puck ${res.status} (${res.statusText}): ${body2.error ?? "Unknown reason"}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return res;
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
GET,
|
|
83
|
+
POST
|
|
84
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
|
|
30
|
+
// ../tsup-config/react-import.js
|
|
31
|
+
import React from "react";
|
|
32
|
+
var init_react_import = __esm({
|
|
33
|
+
"../tsup-config/react-import.js"() {
|
|
34
|
+
"use strict";
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
__commonJS,
|
|
40
|
+
__toESM,
|
|
41
|
+
init_react_import
|
|
42
|
+
};
|