@webiny/app-sdk-playground 0.0.0-unstable.e2758ee1cf → 0.0.0-unstable.e6f0dc8ca7
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/PermissionsSchema.d.ts +15 -0
- package/PermissionsSchema.js +18 -0
- package/PermissionsSchema.js.map +1 -0
- package/SecurityPermission.d.ts +2 -0
- package/SecurityPermission.js +18 -0
- package/SecurityPermission.js.map +1 -0
- package/index.js +25 -10
- package/index.js.map +1 -1
- package/package.json +15 -12
- package/plugins/declarations/cms.d.ts +1 -0
- package/plugins/declarations/cms.js +180 -0
- package/plugins/declarations/cms.js.map +1 -0
- package/plugins/declarations/common.d.ts +1 -0
- package/plugins/declarations/common.js +38 -0
- package/plugins/declarations/common.js.map +1 -0
- package/plugins/declarations/fileManager.d.ts +1 -0
- package/plugins/declarations/fileManager.js +224 -0
- package/plugins/declarations/fileManager.js.map +1 -0
- package/plugins/declarations/languages.d.ts +1 -0
- package/plugins/declarations/languages.js +22 -0
- package/plugins/declarations/languages.js.map +1 -0
- package/plugins/declarations/tasks.d.ts +1 -0
- package/plugins/declarations/tasks.js +112 -0
- package/plugins/declarations/tasks.js.map +1 -0
- package/plugins/declarations/tenantManager.d.ts +1 -0
- package/plugins/declarations/tenantManager.js +57 -0
- package/plugins/declarations/tenantManager.js.map +1 -0
- package/plugins/defaultCode.d.ts +1 -1
- package/plugins/defaultCode.js +2 -2
- package/plugins/defaultCode.js.map +1 -1
- package/plugins/sdkGlobalDeclaration.d.ts +1 -1
- package/plugins/sdkGlobalDeclaration.js +27 -200
- package/plugins/sdkGlobalDeclaration.js.map +1 -1
- package/plugins/useCodeExecution.d.ts +1 -1
- package/plugins/useCodeExecution.js +8 -10
- package/plugins/useCodeExecution.js.map +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DEV_TOOLS_PERMISSIONS_SCHEMA: {
|
|
2
|
+
readonly prefix: "dev-tools";
|
|
3
|
+
readonly fullAccess: true;
|
|
4
|
+
readonly entities: [{
|
|
5
|
+
readonly id: "graphql-playground";
|
|
6
|
+
readonly title: "GraphQL Playground";
|
|
7
|
+
readonly permission: "dev-tools.graphql-playground.*";
|
|
8
|
+
readonly scopes: ["full"];
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "sdk-playground";
|
|
11
|
+
readonly title: "SDK Playground";
|
|
12
|
+
readonly permission: "dev-tools.sdk-playground.*";
|
|
13
|
+
readonly scopes: ["full"];
|
|
14
|
+
}];
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createPermissionSchema } from "@webiny/app-admin";
|
|
2
|
+
export const DEV_TOOLS_PERMISSIONS_SCHEMA = createPermissionSchema({
|
|
3
|
+
prefix: "dev-tools",
|
|
4
|
+
fullAccess: true,
|
|
5
|
+
entities: [{
|
|
6
|
+
id: "graphql-playground",
|
|
7
|
+
title: "GraphQL Playground",
|
|
8
|
+
permission: "dev-tools.graphql-playground.*",
|
|
9
|
+
scopes: ["full"]
|
|
10
|
+
}, {
|
|
11
|
+
id: "sdk-playground",
|
|
12
|
+
title: "SDK Playground",
|
|
13
|
+
permission: "dev-tools.sdk-playground.*",
|
|
14
|
+
scopes: ["full"]
|
|
15
|
+
}]
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=PermissionsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPermissionSchema","DEV_TOOLS_PERMISSIONS_SCHEMA","prefix","fullAccess","entities","id","title","permission","scopes"],"sources":["PermissionsSchema.ts"],"sourcesContent":["import { createPermissionSchema } from \"@webiny/app-admin\";\n\nexport const DEV_TOOLS_PERMISSIONS_SCHEMA = createPermissionSchema({\n prefix: \"dev-tools\",\n fullAccess: true,\n entities: [\n {\n id: \"graphql-playground\",\n title: \"GraphQL Playground\",\n permission: \"dev-tools.graphql-playground.*\",\n scopes: [\"full\"]\n },\n {\n id: \"sdk-playground\",\n title: \"SDK Playground\",\n permission: \"dev-tools.sdk-playground.*\",\n scopes: [\"full\"]\n }\n ]\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,mBAAmB;AAE1D,OAAO,MAAMC,4BAA4B,GAAGD,sBAAsB,CAAC;EAC/DE,MAAM,EAAE,WAAW;EACnBC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,CACN;IACIC,EAAE,EAAE,oBAAoB;IACxBC,KAAK,EAAE,oBAAoB;IAC3BC,UAAU,EAAE,gCAAgC;IAC5CC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC,EACD;IACIH,EAAE,EAAE,gBAAgB;IACpBC,KAAK,EAAE,gBAAgB;IACvBC,UAAU,EAAE,4BAA4B;IACxCC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AdminConfig } from "@webiny/app-admin";
|
|
3
|
+
import { ReactComponent as DevToolsIcon } from "@webiny/icons/developer_mode.svg";
|
|
4
|
+
import { DEV_TOOLS_PERMISSIONS_SCHEMA } from "./PermissionsSchema.js";
|
|
5
|
+
const {
|
|
6
|
+
Security
|
|
7
|
+
} = AdminConfig;
|
|
8
|
+
export const SecurityPermission = () => {
|
|
9
|
+
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Security.Permissions, {
|
|
10
|
+
name: "dev-tools",
|
|
11
|
+
title: "Dev Tools",
|
|
12
|
+
description: "Manage Dev Tools access.",
|
|
13
|
+
icon: /*#__PURE__*/React.createElement(DevToolsIcon, null),
|
|
14
|
+
schema: DEV_TOOLS_PERMISSIONS_SCHEMA
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=SecurityPermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","AdminConfig","ReactComponent","DevToolsIcon","DEV_TOOLS_PERMISSIONS_SCHEMA","Security","SecurityPermission","createElement","Permissions","name","title","description","icon","schema"],"sources":["SecurityPermission.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { ReactComponent as DevToolsIcon } from \"@webiny/icons/developer_mode.svg\";\nimport { DEV_TOOLS_PERMISSIONS_SCHEMA } from \"./PermissionsSchema.js\";\n\nconst { Security } = AdminConfig;\n\nexport const SecurityPermission = () => {\n return (\n <AdminConfig>\n <Security.Permissions\n name=\"dev-tools\"\n title=\"Dev Tools\"\n description=\"Manage Dev Tools access.\"\n icon={<DevToolsIcon />}\n schema={DEV_TOOLS_PERMISSIONS_SCHEMA}\n />\n </AdminConfig>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,cAAc,IAAIC,YAAY,QAAQ,kCAAkC;AACjF,SAASC,4BAA4B;AAErC,MAAM;EAAEC;AAAS,CAAC,GAAGJ,WAAW;AAEhC,OAAO,MAAMK,kBAAkB,GAAGA,CAAA,KAAM;EACpC,oBACIN,KAAA,CAAAO,aAAA,CAACN,WAAW,qBACRD,KAAA,CAAAO,aAAA,CAACF,QAAQ,CAACG,WAAW;IACjBC,IAAI,EAAC,WAAW;IAChBC,KAAK,EAAC,WAAW;IACjBC,WAAW,EAAC,0BAA0B;IACtCC,IAAI,eAAEZ,KAAA,CAAAO,aAAA,CAACJ,YAAY,MAAE,CAAE;IACvBU,MAAM,EAAET;EAA6B,CACxC,CACQ,CAAC;AAEtB,CAAC","ignoreList":[]}
|
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { memo } from "react";
|
|
2
|
-
import { useRouter, AdminConfig, AdminLayout } from "@webiny/app-admin";
|
|
2
|
+
import { useRouter, AdminConfig, AdminLayout, HasPermission } from "@webiny/app-admin";
|
|
3
3
|
import { ReactComponent as CodeIcon } from "@webiny/icons/code.svg";
|
|
4
|
+
import { ReactComponent as DevToolsIcon } from "@webiny/icons/developer_mode.svg";
|
|
4
5
|
import Playground from "./plugins/Playground.js";
|
|
6
|
+
import { SecurityPermission } from "./SecurityPermission.js";
|
|
5
7
|
import { Routes } from "./routes.js";
|
|
6
8
|
const {
|
|
7
9
|
Route,
|
|
@@ -9,23 +11,36 @@ const {
|
|
|
9
11
|
} = AdminConfig;
|
|
10
12
|
const SdkPlaygroundExtension = () => {
|
|
11
13
|
const router = useRouter();
|
|
12
|
-
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Menu
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SecurityPermission, null), /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Menu, {
|
|
15
|
+
name: "dev-tools",
|
|
16
|
+
hideIfEmpty: true,
|
|
17
|
+
pin: "end",
|
|
18
|
+
element: /*#__PURE__*/React.createElement(Menu.Item, {
|
|
19
|
+
text: "Dev Tools",
|
|
20
|
+
icon: /*#__PURE__*/React.createElement(Menu.Item.Icon, {
|
|
21
|
+
label: "Dev Tools",
|
|
22
|
+
element: /*#__PURE__*/React.createElement(DevToolsIcon, null)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
}), /*#__PURE__*/React.createElement(HasPermission, {
|
|
26
|
+
any: ["dev-tools.*", "dev-tools.sdk-playground.*"]
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
28
|
+
name: "dev-tools.sdk",
|
|
29
|
+
parent: "dev-tools",
|
|
30
|
+
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
16
31
|
text: "SDK Playground",
|
|
17
|
-
|
|
32
|
+
to: router.getLink(Routes.SdkPlayground),
|
|
33
|
+
icon: /*#__PURE__*/React.createElement(Menu.Link.Icon, {
|
|
18
34
|
label: "SDK Playground",
|
|
19
35
|
element: /*#__PURE__*/React.createElement(CodeIcon, null)
|
|
20
|
-
})
|
|
21
|
-
to: router.getLink(Routes.SdkPlayground)
|
|
36
|
+
})
|
|
22
37
|
})
|
|
23
|
-
}), /*#__PURE__*/React.createElement(Route, {
|
|
38
|
+
})), /*#__PURE__*/React.createElement(Route, {
|
|
24
39
|
route: Routes.SdkPlayground,
|
|
25
40
|
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
26
41
|
title: "SDK Playground"
|
|
27
42
|
}, /*#__PURE__*/React.createElement(Playground, null))
|
|
28
|
-
}));
|
|
43
|
+
})));
|
|
29
44
|
};
|
|
30
45
|
export const SdkPlayground = /*#__PURE__*/memo(SdkPlaygroundExtension);
|
|
31
46
|
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","useRouter","AdminConfig","AdminLayout","ReactComponent","CodeIcon","Playground","Routes","Route","Menu","SdkPlaygroundExtension","router","createElement","
|
|
1
|
+
{"version":3,"names":["React","memo","useRouter","AdminConfig","AdminLayout","HasPermission","ReactComponent","CodeIcon","DevToolsIcon","Playground","SecurityPermission","Routes","Route","Menu","SdkPlaygroundExtension","router","createElement","Fragment","name","hideIfEmpty","pin","element","Item","text","icon","Icon","label","any","parent","Link","to","getLink","SdkPlayground","route","title"],"sources":["index.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport { useRouter, AdminConfig, AdminLayout, HasPermission } from \"@webiny/app-admin\";\nimport { ReactComponent as CodeIcon } from \"@webiny/icons/code.svg\";\nimport { ReactComponent as DevToolsIcon } from \"@webiny/icons/developer_mode.svg\";\nimport Playground from \"./plugins/Playground.js\";\nimport { SecurityPermission } from \"./SecurityPermission.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Route, Menu } = AdminConfig;\n\nconst SdkPlaygroundExtension = () => {\n const router = useRouter();\n\n return (\n <>\n <SecurityPermission />\n <AdminConfig>\n <Menu\n name={\"dev-tools\"}\n hideIfEmpty={true}\n pin={\"end\"}\n element={\n <Menu.Item\n text={\"Dev Tools\"}\n icon={<Menu.Item.Icon label=\"Dev Tools\" element={<DevToolsIcon />} />}\n />\n }\n />\n <HasPermission any={[\"dev-tools.*\", \"dev-tools.sdk-playground.*\"]}>\n <Menu\n name={\"dev-tools.sdk\"}\n parent={\"dev-tools\"}\n element={\n <Menu.Link\n text={\"SDK Playground\"}\n to={router.getLink(Routes.SdkPlayground)}\n icon={\n <Menu.Link.Icon label=\"SDK Playground\" element={<CodeIcon />} />\n }\n />\n }\n />\n </HasPermission>\n\n <Route\n route={Routes.SdkPlayground}\n element={\n <AdminLayout title={\"SDK Playground\"}>\n <Playground />\n </AdminLayout>\n }\n />\n </AdminConfig>\n </>\n );\n};\n\nexport const SdkPlayground = memo(SdkPlaygroundExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,SAAS,EAAEC,WAAW,EAAEC,WAAW,EAAEC,aAAa,QAAQ,mBAAmB;AACtF,SAASC,cAAc,IAAIC,QAAQ,QAAQ,wBAAwB;AACnE,SAASD,cAAc,IAAIE,YAAY,QAAQ,kCAAkC;AACjF,OAAOC,UAAU;AACjB,SAASC,kBAAkB;AAC3B,SAASC,MAAM;AAEf,MAAM;EAAEC,KAAK;EAAEC;AAAK,CAAC,GAAGV,WAAW;AAEnC,MAAMW,sBAAsB,GAAGA,CAAA,KAAM;EACjC,MAAMC,MAAM,GAAGb,SAAS,CAAC,CAAC;EAE1B,oBACIF,KAAA,CAAAgB,aAAA,CAAAhB,KAAA,CAAAiB,QAAA,qBACIjB,KAAA,CAAAgB,aAAA,CAACN,kBAAkB,MAAE,CAAC,eACtBV,KAAA,CAAAgB,aAAA,CAACb,WAAW,qBACRH,KAAA,CAAAgB,aAAA,CAACH,IAAI;IACDK,IAAI,EAAE,WAAY;IAClBC,WAAW,EAAE,IAAK;IAClBC,GAAG,EAAE,KAAM;IACXC,OAAO,eACHrB,KAAA,CAAAgB,aAAA,CAACH,IAAI,CAACS,IAAI;MACNC,IAAI,EAAE,WAAY;MAClBC,IAAI,eAAExB,KAAA,CAAAgB,aAAA,CAACH,IAAI,CAACS,IAAI,CAACG,IAAI;QAACC,KAAK,EAAC,WAAW;QAACL,OAAO,eAAErB,KAAA,CAAAgB,aAAA,CAACR,YAAY,MAAE;MAAE,CAAE;IAAE,CACzE;EACJ,CACJ,CAAC,eACFR,KAAA,CAAAgB,aAAA,CAACX,aAAa;IAACsB,GAAG,EAAE,CAAC,aAAa,EAAE,4BAA4B;EAAE,gBAC9D3B,KAAA,CAAAgB,aAAA,CAACH,IAAI;IACDK,IAAI,EAAE,eAAgB;IACtBU,MAAM,EAAE,WAAY;IACpBP,OAAO,eACHrB,KAAA,CAAAgB,aAAA,CAACH,IAAI,CAACgB,IAAI;MACNN,IAAI,EAAE,gBAAiB;MACvBO,EAAE,EAAEf,MAAM,CAACgB,OAAO,CAACpB,MAAM,CAACqB,aAAa,CAAE;MACzCR,IAAI,eACAxB,KAAA,CAAAgB,aAAA,CAACH,IAAI,CAACgB,IAAI,CAACJ,IAAI;QAACC,KAAK,EAAC,gBAAgB;QAACL,OAAO,eAAErB,KAAA,CAAAgB,aAAA,CAACT,QAAQ,MAAE;MAAE,CAAE;IAClE,CACJ;EACJ,CACJ,CACU,CAAC,eAEhBP,KAAA,CAAAgB,aAAA,CAACJ,KAAK;IACFqB,KAAK,EAAEtB,MAAM,CAACqB,aAAc;IAC5BX,OAAO,eACHrB,KAAA,CAAAgB,aAAA,CAACZ,WAAW;MAAC8B,KAAK,EAAE;IAAiB,gBACjClC,KAAA,CAAAgB,aAAA,CAACP,UAAU,MAAE,CACJ;EAChB,CACJ,CACQ,CACf,CAAC;AAEX,CAAC;AAED,OAAO,MAAMuB,aAAa,gBAAG/B,IAAI,CAACa,sBAAsB,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-sdk-playground",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.e6f0dc8ca7",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -11,23 +14,23 @@
|
|
|
11
14
|
"license": "MIT",
|
|
12
15
|
"dependencies": {
|
|
13
16
|
"@monaco-editor/react": "4.7.0",
|
|
14
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
15
|
-
"@webiny/app": "0.0.0-unstable.
|
|
16
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
17
|
-
"@webiny/icons": "0.0.0-unstable.
|
|
18
|
-
"@webiny/sdk": "0.0.0-unstable.
|
|
17
|
+
"@webiny/admin-ui": "0.0.0-unstable.e6f0dc8ca7",
|
|
18
|
+
"@webiny/app": "0.0.0-unstable.e6f0dc8ca7",
|
|
19
|
+
"@webiny/app-admin": "0.0.0-unstable.e6f0dc8ca7",
|
|
20
|
+
"@webiny/icons": "0.0.0-unstable.e6f0dc8ca7",
|
|
21
|
+
"@webiny/sdk": "0.0.0-unstable.e6f0dc8ca7",
|
|
19
22
|
"monaco-editor": "0.53.0",
|
|
20
|
-
"react": "18.
|
|
21
|
-
"react-dom": "18.
|
|
23
|
+
"react": "18.3.1",
|
|
24
|
+
"react-dom": "18.3.1"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
27
|
+
"@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
|
|
25
28
|
"rimraf": "6.1.3",
|
|
26
|
-
"typescript": "
|
|
29
|
+
"typescript": "6.0.3"
|
|
27
30
|
},
|
|
28
31
|
"publishConfig": {
|
|
29
32
|
"access": "public",
|
|
30
33
|
"directory": "dist"
|
|
31
34
|
},
|
|
32
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
|
|
33
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CMS_DECLARATIONS = "\ntype SdkEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\ninterface SdkEntryValues {\n [key: string]: any;\n}\n\ninterface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n id?: string;\n entryId?: string;\n status?: SdkEntryStatus;\n createdOn?: string;\n modifiedOn?: string | null;\n savedOn?: string;\n deletedOn?: string | null;\n restoredOn?: string | null;\n createdBy?: SdkIdentity;\n modifiedBy?: SdkIdentity;\n savedBy?: SdkIdentity;\n firstPublishedOn?: string;\n lastPublishedOn?: string;\n firstPublishedBy?: SdkIdentity;\n lastPublishedBy?: SdkIdentity;\n revisionCreatedOn?: string;\n revisionModifiedOn?: string | null;\n revisionSavedOn?: string;\n revisionCreatedBy?: SdkIdentity;\n revisionModifiedBy?: SdkIdentity | null;\n revisionSavedBy?: SdkIdentity;\n revisionFirstPublishedOn?: string;\n revisionLastPublishedOn?: string;\n revisionFirstPublishedBy?: SdkIdentity;\n revisionLastPublishedBy?: SdkIdentity;\n location?: { folderId?: string | null };\n values?: TValues;\n}\n\ninterface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {\n data: SdkEntryData<TValues>[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\ninterface SdkGetEntryParams {\n /** The model ID to query. */\n modelId: string;\n where: {\n /** Revision ID, e.g. \"abc#0001\". */\n id?: string;\n /** Entry ID, e.g. \"abc\". */\n entryId?: string;\n /** Filter by entry field values. */\n values?: Record<string, unknown>;\n };\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkListEntriesParams {\n /** The model ID to query. */\n modelId: string;\n /** Filter conditions. */\n where?: Record<string, unknown>;\n /** Sort order per field, e.g. { createdOn: \"desc\" }. */\n sort?: Record<string, \"asc\" | \"desc\">;\n /** Maximum number of entries to return. Defaults to 10. */\n limit?: number;\n /** Pagination cursor from a previous response. */\n after?: string;\n /** Full-text search term to filter entries across searchable fields. */\n search?: string;\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values: TValues | undefined;\n status?: SdkEntryStatus;\n location?: { folderId?: string | null };\n}\n\ninterface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The entry data to create. */\n data: SdkCreateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values?: Partial<TValues>;\n location?: { folderId?: string | null };\n}\n\ninterface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** The fields to update. */\n data: SdkUpdateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkDeleteEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** When true, permanently deletes the entry. Defaults to false. */\n permanent?: boolean;\n}\n\ninterface SdkPublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUnpublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkCms {\n /** Get a single entry by ID or field values. */\n getEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkGetEntryParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** List entries with optional filtering, sorting, and pagination. */\n listEntries<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkListEntriesParams\n ): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkError>>;\n\n /** Create a new entry. */\n createEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkCreateEntryParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Update an existing entry revision. */\n updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUpdateEntryRevisionParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Delete an entry revision. */\n deleteEntryRevision(\n params: SdkDeleteEntryRevisionParams\n ): Promise<SdkResult<boolean, SdkError>>;\n\n /** Publish an entry revision. */\n publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkPublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Unpublish an entry revision. */\n unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUnpublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n}\n";
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// CMS SDK type declarations.
|
|
2
|
+
export const CMS_DECLARATIONS = `
|
|
3
|
+
type SdkEntryStatus = "published" | "unpublished" | "draft";
|
|
4
|
+
|
|
5
|
+
interface SdkEntryValues {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
10
|
+
id?: string;
|
|
11
|
+
entryId?: string;
|
|
12
|
+
status?: SdkEntryStatus;
|
|
13
|
+
createdOn?: string;
|
|
14
|
+
modifiedOn?: string | null;
|
|
15
|
+
savedOn?: string;
|
|
16
|
+
deletedOn?: string | null;
|
|
17
|
+
restoredOn?: string | null;
|
|
18
|
+
createdBy?: SdkIdentity;
|
|
19
|
+
modifiedBy?: SdkIdentity;
|
|
20
|
+
savedBy?: SdkIdentity;
|
|
21
|
+
firstPublishedOn?: string;
|
|
22
|
+
lastPublishedOn?: string;
|
|
23
|
+
firstPublishedBy?: SdkIdentity;
|
|
24
|
+
lastPublishedBy?: SdkIdentity;
|
|
25
|
+
revisionCreatedOn?: string;
|
|
26
|
+
revisionModifiedOn?: string | null;
|
|
27
|
+
revisionSavedOn?: string;
|
|
28
|
+
revisionCreatedBy?: SdkIdentity;
|
|
29
|
+
revisionModifiedBy?: SdkIdentity | null;
|
|
30
|
+
revisionSavedBy?: SdkIdentity;
|
|
31
|
+
revisionFirstPublishedOn?: string;
|
|
32
|
+
revisionLastPublishedOn?: string;
|
|
33
|
+
revisionFirstPublishedBy?: SdkIdentity;
|
|
34
|
+
revisionLastPublishedBy?: SdkIdentity;
|
|
35
|
+
location?: { folderId?: string | null };
|
|
36
|
+
values?: TValues;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
40
|
+
data: SdkEntryData<TValues>[];
|
|
41
|
+
meta: {
|
|
42
|
+
cursor: string | null;
|
|
43
|
+
hasMoreItems: boolean;
|
|
44
|
+
totalCount: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface SdkGetEntryParams {
|
|
49
|
+
/** The model ID to query. */
|
|
50
|
+
modelId: string;
|
|
51
|
+
where: {
|
|
52
|
+
/** Revision ID, e.g. "abc#0001". */
|
|
53
|
+
id?: string;
|
|
54
|
+
/** Entry ID, e.g. "abc". */
|
|
55
|
+
entryId?: string;
|
|
56
|
+
/** Filter by entry field values. */
|
|
57
|
+
values?: Record<string, unknown>;
|
|
58
|
+
};
|
|
59
|
+
/** Fields to include in the response. Use "values.fieldName" for entry values. */
|
|
60
|
+
fields: string[];
|
|
61
|
+
/** When true, returns unpublished/draft content. Defaults to false. */
|
|
62
|
+
preview?: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface SdkListEntriesParams {
|
|
66
|
+
/** The model ID to query. */
|
|
67
|
+
modelId: string;
|
|
68
|
+
/** Filter conditions. */
|
|
69
|
+
where?: Record<string, unknown>;
|
|
70
|
+
/** Sort order per field, e.g. { createdOn: "desc" }. */
|
|
71
|
+
sort?: Record<string, "asc" | "desc">;
|
|
72
|
+
/** Maximum number of entries to return. Defaults to 10. */
|
|
73
|
+
limit?: number;
|
|
74
|
+
/** Pagination cursor from a previous response. */
|
|
75
|
+
after?: string;
|
|
76
|
+
/** Full-text search term to filter entries across searchable fields. */
|
|
77
|
+
search?: string;
|
|
78
|
+
/** Fields to include in the response. Use "values.fieldName" for entry values. */
|
|
79
|
+
fields: string[];
|
|
80
|
+
/** When true, returns unpublished/draft content. Defaults to false. */
|
|
81
|
+
preview?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
85
|
+
values: TValues | undefined;
|
|
86
|
+
status?: SdkEntryStatus;
|
|
87
|
+
location?: { folderId?: string | null };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
91
|
+
/** The model ID. */
|
|
92
|
+
modelId: string;
|
|
93
|
+
/** The entry data to create. */
|
|
94
|
+
data: SdkCreateEntryData<TValues>;
|
|
95
|
+
/** Fields to include in the response. */
|
|
96
|
+
fields: string[];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
100
|
+
values?: Partial<TValues>;
|
|
101
|
+
location?: { folderId?: string | null };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {
|
|
105
|
+
/** The model ID. */
|
|
106
|
+
modelId: string;
|
|
107
|
+
/** The revision ID, e.g. "abc#0001". */
|
|
108
|
+
revisionId: string;
|
|
109
|
+
/** The fields to update. */
|
|
110
|
+
data: SdkUpdateEntryData<TValues>;
|
|
111
|
+
/** Fields to include in the response. */
|
|
112
|
+
fields: string[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface SdkDeleteEntryRevisionParams {
|
|
116
|
+
/** The model ID. */
|
|
117
|
+
modelId: string;
|
|
118
|
+
/** The revision ID, e.g. "abc#0001". */
|
|
119
|
+
revisionId: string;
|
|
120
|
+
/** When true, permanently deletes the entry. Defaults to false. */
|
|
121
|
+
permanent?: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface SdkPublishEntryRevisionParams {
|
|
125
|
+
/** The model ID. */
|
|
126
|
+
modelId: string;
|
|
127
|
+
/** The revision ID, e.g. "abc#0001". */
|
|
128
|
+
revisionId: string;
|
|
129
|
+
/** Fields to include in the response. */
|
|
130
|
+
fields: string[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface SdkUnpublishEntryRevisionParams {
|
|
134
|
+
/** The model ID. */
|
|
135
|
+
modelId: string;
|
|
136
|
+
/** The revision ID, e.g. "abc#0001". */
|
|
137
|
+
revisionId: string;
|
|
138
|
+
/** Fields to include in the response. */
|
|
139
|
+
fields: string[];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface SdkCms {
|
|
143
|
+
/** Get a single entry by ID or field values. */
|
|
144
|
+
getEntry<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
145
|
+
params: SdkGetEntryParams
|
|
146
|
+
): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;
|
|
147
|
+
|
|
148
|
+
/** List entries with optional filtering, sorting, and pagination. */
|
|
149
|
+
listEntries<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
150
|
+
params: SdkListEntriesParams
|
|
151
|
+
): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkError>>;
|
|
152
|
+
|
|
153
|
+
/** Create a new entry. */
|
|
154
|
+
createEntry<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
155
|
+
params: SdkCreateEntryParams<TValues>
|
|
156
|
+
): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;
|
|
157
|
+
|
|
158
|
+
/** Update an existing entry revision. */
|
|
159
|
+
updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
160
|
+
params: SdkUpdateEntryRevisionParams<TValues>
|
|
161
|
+
): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;
|
|
162
|
+
|
|
163
|
+
/** Delete an entry revision. */
|
|
164
|
+
deleteEntryRevision(
|
|
165
|
+
params: SdkDeleteEntryRevisionParams
|
|
166
|
+
): Promise<SdkResult<boolean, SdkError>>;
|
|
167
|
+
|
|
168
|
+
/** Publish an entry revision. */
|
|
169
|
+
publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
170
|
+
params: SdkPublishEntryRevisionParams
|
|
171
|
+
): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;
|
|
172
|
+
|
|
173
|
+
/** Unpublish an entry revision. */
|
|
174
|
+
unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(
|
|
175
|
+
params: SdkUnpublishEntryRevisionParams
|
|
176
|
+
): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
|
|
180
|
+
//# sourceMappingURL=cms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CMS_DECLARATIONS"],"sources":["cms.ts"],"sourcesContent":["// CMS SDK type declarations.\nexport const CMS_DECLARATIONS = `\ntype SdkEntryStatus = \"published\" | \"unpublished\" | \"draft\";\n\ninterface SdkEntryValues {\n [key: string]: any;\n}\n\ninterface SdkEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n id?: string;\n entryId?: string;\n status?: SdkEntryStatus;\n createdOn?: string;\n modifiedOn?: string | null;\n savedOn?: string;\n deletedOn?: string | null;\n restoredOn?: string | null;\n createdBy?: SdkIdentity;\n modifiedBy?: SdkIdentity;\n savedBy?: SdkIdentity;\n firstPublishedOn?: string;\n lastPublishedOn?: string;\n firstPublishedBy?: SdkIdentity;\n lastPublishedBy?: SdkIdentity;\n revisionCreatedOn?: string;\n revisionModifiedOn?: string | null;\n revisionSavedOn?: string;\n revisionCreatedBy?: SdkIdentity;\n revisionModifiedBy?: SdkIdentity | null;\n revisionSavedBy?: SdkIdentity;\n revisionFirstPublishedOn?: string;\n revisionLastPublishedOn?: string;\n revisionFirstPublishedBy?: SdkIdentity;\n revisionLastPublishedBy?: SdkIdentity;\n location?: { folderId?: string | null };\n values?: TValues;\n}\n\ninterface SdkListEntriesResult<TValues extends SdkEntryValues = SdkEntryValues> {\n data: SdkEntryData<TValues>[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\ninterface SdkGetEntryParams {\n /** The model ID to query. */\n modelId: string;\n where: {\n /** Revision ID, e.g. \"abc#0001\". */\n id?: string;\n /** Entry ID, e.g. \"abc\". */\n entryId?: string;\n /** Filter by entry field values. */\n values?: Record<string, unknown>;\n };\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkListEntriesParams {\n /** The model ID to query. */\n modelId: string;\n /** Filter conditions. */\n where?: Record<string, unknown>;\n /** Sort order per field, e.g. { createdOn: \"desc\" }. */\n sort?: Record<string, \"asc\" | \"desc\">;\n /** Maximum number of entries to return. Defaults to 10. */\n limit?: number;\n /** Pagination cursor from a previous response. */\n after?: string;\n /** Full-text search term to filter entries across searchable fields. */\n search?: string;\n /** Fields to include in the response. Use \"values.fieldName\" for entry values. */\n fields: string[];\n /** When true, returns unpublished/draft content. Defaults to false. */\n preview?: boolean;\n}\n\ninterface SdkCreateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values: TValues | undefined;\n status?: SdkEntryStatus;\n location?: { folderId?: string | null };\n}\n\ninterface SdkCreateEntryParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The entry data to create. */\n data: SdkCreateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUpdateEntryData<TValues extends SdkEntryValues = SdkEntryValues> {\n values?: Partial<TValues>;\n location?: { folderId?: string | null };\n}\n\ninterface SdkUpdateEntryRevisionParams<TValues extends SdkEntryValues = SdkEntryValues> {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** The fields to update. */\n data: SdkUpdateEntryData<TValues>;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkDeleteEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** When true, permanently deletes the entry. Defaults to false. */\n permanent?: boolean;\n}\n\ninterface SdkPublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkUnpublishEntryRevisionParams {\n /** The model ID. */\n modelId: string;\n /** The revision ID, e.g. \"abc#0001\". */\n revisionId: string;\n /** Fields to include in the response. */\n fields: string[];\n}\n\ninterface SdkCms {\n /** Get a single entry by ID or field values. */\n getEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkGetEntryParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** List entries with optional filtering, sorting, and pagination. */\n listEntries<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkListEntriesParams\n ): Promise<SdkResult<SdkListEntriesResult<TValues>, SdkError>>;\n\n /** Create a new entry. */\n createEntry<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkCreateEntryParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Update an existing entry revision. */\n updateEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUpdateEntryRevisionParams<TValues>\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Delete an entry revision. */\n deleteEntryRevision(\n params: SdkDeleteEntryRevisionParams\n ): Promise<SdkResult<boolean, SdkError>>;\n\n /** Publish an entry revision. */\n publishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkPublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n\n /** Unpublish an entry revision. */\n unpublishEntryRevision<TValues extends SdkEntryValues = SdkEntryValues>(\n params: SdkUnpublishEntryRevisionParams\n ): Promise<SdkResult<SdkEntryData<TValues>, SdkError>>;\n}\n`;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,gBAAgB,GAAG;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COMMON_DECLARATIONS = "\ninterface SdkIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\ninterface SdkResult<TValue, TError = unknown> {\n isOk(): boolean;\n isFail(): boolean;\n readonly value: TValue;\n readonly error: TError;\n}\n\ndeclare class SdkBaseError extends Error {\n readonly code: string;\n readonly message: string;\n}\n\ndeclare class SdkHttpError extends SdkBaseError {\n readonly code: \"HTTP_ERROR\";\n readonly data: { status: number };\n}\n\ndeclare class SdkGraphQLError extends SdkBaseError {\n readonly code: \"GRAPHQL_ERROR\";\n readonly data: { code?: string };\n}\n\ndeclare class SdkNetworkError extends SdkBaseError {\n readonly code: \"NETWORK_ERROR\";\n}\n\ntype SdkError = SdkHttpError | SdkGraphQLError | SdkNetworkError;\n";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Common types shared across all SDK modules.
|
|
2
|
+
export const COMMON_DECLARATIONS = `
|
|
3
|
+
interface SdkIdentity {
|
|
4
|
+
id: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface SdkResult<TValue, TError = unknown> {
|
|
10
|
+
isOk(): boolean;
|
|
11
|
+
isFail(): boolean;
|
|
12
|
+
readonly value: TValue;
|
|
13
|
+
readonly error: TError;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class SdkBaseError extends Error {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class SdkHttpError extends SdkBaseError {
|
|
22
|
+
readonly code: "HTTP_ERROR";
|
|
23
|
+
readonly data: { status: number };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare class SdkGraphQLError extends SdkBaseError {
|
|
27
|
+
readonly code: "GRAPHQL_ERROR";
|
|
28
|
+
readonly data: { code?: string };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class SdkNetworkError extends SdkBaseError {
|
|
32
|
+
readonly code: "NETWORK_ERROR";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type SdkError = SdkHttpError | SdkGraphQLError | SdkNetworkError;
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["COMMON_DECLARATIONS"],"sources":["common.ts"],"sourcesContent":["// Common types shared across all SDK modules.\nexport const COMMON_DECLARATIONS = `\ninterface SdkIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\ninterface SdkResult<TValue, TError = unknown> {\n isOk(): boolean;\n isFail(): boolean;\n readonly value: TValue;\n readonly error: TError;\n}\n\ndeclare class SdkBaseError extends Error {\n readonly code: string;\n readonly message: string;\n}\n\ndeclare class SdkHttpError extends SdkBaseError {\n readonly code: \"HTTP_ERROR\";\n readonly data: { status: number };\n}\n\ndeclare class SdkGraphQLError extends SdkBaseError {\n readonly code: \"GRAPHQL_ERROR\";\n readonly data: { code?: string };\n}\n\ndeclare class SdkNetworkError extends SdkBaseError {\n readonly code: \"NETWORK_ERROR\";\n}\n\ntype SdkError = SdkHttpError | SdkGraphQLError | SdkNetworkError;\n`;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,mBAAmB,GAAG;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FILE_MANAGER_DECLARATIONS = "\ninterface SdkFmIdentity {\n id: string;\n displayName: string;\n type: string;\n}\n\ninterface SdkFmLocation {\n folderId: string;\n}\n\ninterface SdkFmFile_Metadata {\n image?: {\n width?: number;\n height?: number;\n format?: string;\n orientation?: number;\n };\n exif?: Record<string, any>;\n iptc?: Record<string, any>;\n [key: string]: any;\n}\n\ntype SdkFmFile_AccessControl = {\n type: \"public\" | \"private-authenticated\";\n};\n\ninterface SdkFmFile {\n id: string;\n createdOn: string;\n modifiedOn?: string;\n savedOn: string;\n createdBy: SdkFmIdentity;\n modifiedBy?: SdkFmIdentity;\n savedBy: SdkFmIdentity;\n location: SdkFmLocation;\n src?: string;\n name?: string;\n key?: string;\n type?: string;\n size?: number;\n metadata?: SdkFmFile_Metadata;\n tags?: string[];\n accessControl?: SdkFmFile_AccessControl;\n [key: string]: any;\n}\n\ninterface SdkFmTag {\n tag: string;\n count: number;\n}\n\ninterface SdkUploadProgress {\n sent: number;\n total: number;\n percentage: number;\n}\n\ntype SdkBatchUploadStrategy = \"fail-fast\" | \"continue\";\n\ninterface SdkGetFileParams {\n /** ID of the file to get. */\n id: string;\n /** Fields to select (dot notation supported, e.g., \"location.folderId\", \"createdBy.displayName\"). */\n fields: string[];\n}\n\ninterface SdkListFilesParams {\n /** Search query. */\n search?: string;\n /** Filter conditions. */\n where?: {\n location?: {\n folderId?: string;\n folderId_in?: string[];\n };\n name?: string;\n name_contains?: string;\n type?: string;\n type_in?: string[];\n tags?: string[];\n tags_in?: string[];\n };\n /** Maximum number of items to return. */\n limit?: number;\n /** Cursor for pagination. */\n after?: string;\n /** Sort order. */\n sort?: (\"savedOn_ASC\" | \"savedOn_DESC\" | \"createdOn_ASC\" | \"createdOn_DESC\" | \"name_ASC\" | \"name_DESC\" | \"size_ASC\" | \"size_DESC\")[];\n /** Fields to select (dot notation supported, e.g., \"location.folderId\", \"createdBy.displayName\"). */\n fields: string[];\n}\n\ninterface SdkListFilesResult {\n data: SdkFmFile[];\n meta: {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n };\n}\n\ninterface SdkCreateFileParams {\n /** Optional: The actual file content to upload (Buffer in Node.js, File/Blob in browser). */\n file?: any;\n /** The file metadata. */\n data: {\n id?: string;\n name?: string;\n key?: string;\n keyPrefix?: string;\n type?: string;\n size?: number;\n tags?: string[];\n location?: { folderId: string };\n [key: string]: any;\n };\n /** Fields to select (dot notation supported, e.g., \"location.folderId\", \"createdBy.displayName\"). */\n fields: string[];\n /** Optional: Progress callback. */\n onProgress?: (progress: SdkUploadProgress) => void;\n /** Optional: Threshold in MB for multi-part upload (default: 100). */\n multiPartThreshold?: number;\n /** Optional: AbortSignal for cancellation. */\n signal?: AbortSignal;\n}\n\ninterface SdkCreateFilesParams {\n /** Array of files with their data. */\n files: Array<{\n file?: any;\n data: {\n id?: string;\n name?: string;\n key?: string;\n keyPrefix?: string;\n type?: string;\n size?: number;\n tags?: string[];\n location?: { folderId: string };\n [key: string]: any;\n };\n /** Fields to select (dot notation supported, e.g., \"location.folderId\", \"createdBy.displayName\"). */\n fields: string[];\n onProgress?: (progress: SdkUploadProgress) => void;\n }>;\n /** Optional: Threshold in MB for multi-part upload (default: 100). */\n multiPartThreshold?: number;\n /** Optional: Number of concurrent uploads (default: 5). */\n concurrency?: number;\n /** Optional: Batch upload strategy (default: \"fail-fast\"). */\n strategy?: SdkBatchUploadStrategy;\n /** Optional: AbortSignal for cancellation. */\n signal?: AbortSignal;\n}\n\ninterface SdkCreateFilesResult {\n successful: SdkFmFile[];\n failed: Array<{\n data: any;\n error: Error;\n }>;\n}\n\ninterface SdkUpdateFileParams {\n /** ID of the file to update. */\n id: string;\n /** The file data to update. */\n data: {\n name?: string;\n tags?: string[];\n location?: { folderId: string };\n [key: string]: any;\n };\n /** Fields to select (dot notation supported, e.g., \"location.folderId\", \"createdBy.displayName\"). */\n fields: string[];\n}\n\ninterface SdkDeleteFileParams {\n /** ID of the file to delete. */\n id: string;\n}\n\ninterface SdkListTagsParams {\n /** Filter conditions. */\n where?: {\n createdBy?: string;\n tags_startsWith?: string;\n tags_not_startsWith?: string;\n };\n}\n\ninterface SdkFileManager {\n /** Get a single file by ID. */\n getFile(params: SdkGetFileParams): Promise<SdkResult<SdkFmFile, SdkError>>;\n\n /** List files with optional filtering, sorting, and pagination. */\n listFiles(params: SdkListFilesParams): Promise<SdkResult<SdkListFilesResult, SdkError>>;\n\n /** \n * Create a new file. If 'file' is provided, uploads to S3 first.\n * If no 'file' is provided, only creates metadata record.\n */\n createFile(params: SdkCreateFileParams): Promise<SdkResult<SdkFmFile, SdkError>>;\n\n /** \n * Create multiple files. If 'file' is provided for each, uploads to S3 first.\n * Supports batch upload with configurable concurrency and error handling strategy.\n */\n createFiles(params: SdkCreateFilesParams): Promise<SdkResult<SdkCreateFilesResult, SdkError>>;\n\n /** Update a file's metadata. */\n updateFile(params: SdkUpdateFileParams): Promise<SdkResult<SdkFmFile, SdkError>>;\n\n /** Delete a file. */\n deleteFile(params: SdkDeleteFileParams): Promise<SdkResult<boolean, SdkError>>;\n\n /** List tags with optional filtering. */\n listTags(params?: SdkListTagsParams): Promise<SdkResult<SdkFmTag[], SdkError>>;\n}\n";
|