@uniformdev/assets 19.54.2-alpha.12

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.
@@ -0,0 +1,43 @@
1
+ // src/AssetClient.ts
2
+ import { ApiClient } from "@uniformdev/context/api";
3
+ var ASSET_BASE_PATH = "/api/v1/assets";
4
+ var AssetClient = class extends ApiClient {
5
+ constructor(options) {
6
+ super(options);
7
+ }
8
+ async get(options) {
9
+ const { projectId } = this.options;
10
+ const fetchUri = this.createUrl(ASSET_BASE_PATH, {
11
+ ...options,
12
+ projectId
13
+ });
14
+ return await this.apiClient(fetchUri);
15
+ }
16
+ async upsert(options) {
17
+ const { projectId } = this.options;
18
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
19
+ await this.apiClient(fetchUri, {
20
+ method: "PUT",
21
+ body: JSON.stringify({ ...options, projectId }),
22
+ expectNoContent: true
23
+ });
24
+ }
25
+ async delete(options) {
26
+ const { projectId } = this.options;
27
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
28
+ await this.apiClient(fetchUri, {
29
+ method: "DELETE",
30
+ body: JSON.stringify({ ...options, projectId }),
31
+ expectNoContent: true
32
+ });
33
+ }
34
+ };
35
+ var UncachedAssetClient = class extends AssetClient {
36
+ constructor(options) {
37
+ super({ ...options, bypassCache: true });
38
+ }
39
+ };
40
+ export {
41
+ AssetClient,
42
+ UncachedAssetClient
43
+ };
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ AssetClient: () => AssetClient,
24
+ UncachedAssetClient: () => UncachedAssetClient
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/AssetClient.ts
29
+ var import_api = require("@uniformdev/context/api");
30
+ var ASSET_BASE_PATH = "/api/v1/assets";
31
+ var AssetClient = class extends import_api.ApiClient {
32
+ constructor(options) {
33
+ super(options);
34
+ }
35
+ async get(options) {
36
+ const { projectId } = this.options;
37
+ const fetchUri = this.createUrl(ASSET_BASE_PATH, {
38
+ ...options,
39
+ projectId
40
+ });
41
+ return await this.apiClient(fetchUri);
42
+ }
43
+ async upsert(options) {
44
+ const { projectId } = this.options;
45
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
46
+ await this.apiClient(fetchUri, {
47
+ method: "PUT",
48
+ body: JSON.stringify({ ...options, projectId }),
49
+ expectNoContent: true
50
+ });
51
+ }
52
+ async delete(options) {
53
+ const { projectId } = this.options;
54
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
55
+ await this.apiClient(fetchUri, {
56
+ method: "DELETE",
57
+ body: JSON.stringify({ ...options, projectId }),
58
+ expectNoContent: true
59
+ });
60
+ }
61
+ };
62
+ var UncachedAssetClient = class extends AssetClient {
63
+ constructor(options) {
64
+ super({ ...options, bypassCache: true });
65
+ }
66
+ };
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ AssetClient,
70
+ UncachedAssetClient
71
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,43 @@
1
+ // src/AssetClient.ts
2
+ import { ApiClient } from "@uniformdev/context/api";
3
+ var ASSET_BASE_PATH = "/api/v1/assets";
4
+ var AssetClient = class extends ApiClient {
5
+ constructor(options) {
6
+ super(options);
7
+ }
8
+ async get(options) {
9
+ const { projectId } = this.options;
10
+ const fetchUri = this.createUrl(ASSET_BASE_PATH, {
11
+ ...options,
12
+ projectId
13
+ });
14
+ return await this.apiClient(fetchUri);
15
+ }
16
+ async upsert(options) {
17
+ const { projectId } = this.options;
18
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
19
+ await this.apiClient(fetchUri, {
20
+ method: "PUT",
21
+ body: JSON.stringify({ ...options, projectId }),
22
+ expectNoContent: true
23
+ });
24
+ }
25
+ async delete(options) {
26
+ const { projectId } = this.options;
27
+ const fetchUri = this.createUrl(ASSET_BASE_PATH);
28
+ await this.apiClient(fetchUri, {
29
+ method: "DELETE",
30
+ body: JSON.stringify({ ...options, projectId }),
31
+ expectNoContent: true
32
+ });
33
+ }
34
+ };
35
+ var UncachedAssetClient = class extends AssetClient {
36
+ constructor(options) {
37
+ super({ ...options, bypassCache: true });
38
+ }
39
+ };
40
+ export {
41
+ AssetClient,
42
+ UncachedAssetClient
43
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@uniformdev/assets",
3
+ "version": "19.54.2-alpha.12+7c9fa8960",
4
+ "description": "Uniform Assets",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.esm.js",
8
+ "exports": {
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "node": "./dist/index.mjs",
12
+ "default": "./dist/index.esm.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "types": "./dist/index.d.ts",
20
+ "sideEffects": false,
21
+ "scripts": {
22
+ "build": "run-s update-openapi build:ts",
23
+ "build:ts": "tsup",
24
+ "dev": "run-s update-openapi dev:ts",
25
+ "dev:ts": "tsup --watch",
26
+ "clean": "rimraf dist",
27
+ "test": "jest --maxWorkers=1 --passWithNoTests",
28
+ "lint": "eslint \"src/**/*.{js,ts,tsx}\"",
29
+ "format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
30
+ "update-openapi": "tsx ./scripts/update-openapi.cts"
31
+ },
32
+ "files": [
33
+ "/dist"
34
+ ],
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "@uniformdev/context": "19.54.2-alpha.12+7c9fa8960"
40
+ },
41
+ "gitHead": "7c9fa89606aad125a8cca19f6fc6b50ddc4c3f58"
42
+ }