sanity-plugin-cloudinary 1.0.1 → 1.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Sanity.io
3
+ Copyright (c) 2023 Sanity.io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -124,24 +124,28 @@ Here is an example of which data is stored on your document after selecting an a
124
124
 
125
125
  ```json
126
126
  {
127
- "public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
128
- "resource_type": "image",
129
- "type": "upload",
130
- "format": "jpg",
131
- "version": 1616474653,
132
- "url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
133
- "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
134
- "width": 2400,
135
- "height": 1344,
136
- "bytes": 547710,
137
- "duration": null,
138
- "tags": [],
139
- "metadata": {},
140
- "created_at": "2021-03-23T04:44:13Z",
141
- "access_mode": "public",
142
- "_version": 1,
143
- "_type": "cloudinary.asset"
144
- }
127
+ "public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
128
+ "resource_type": "image",
129
+ "type": "upload",
130
+ "format": "jpg",
131
+ "version": 1616474653,
132
+ "url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
133
+ "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
134
+ "width": 2400,
135
+ "height": 1344,
136
+ "bytes": 547710,
137
+ "duration": null,
138
+ "tags": [],
139
+ "context": {
140
+ "custom": {
141
+ "alt": "alternative text for image"
142
+ }
143
+ },
144
+ "created_at": "2021-03-23T04:44:13Z",
145
+ "access_mode": "public",
146
+ "_version": 1,
147
+ "_type": "cloudinary.asset"
148
+ }
145
149
  ```
146
150
 
147
151
  Note: The `_version` in the data here refers to the schema version of this plugin, should the way it stores the data from Cloudinary change in the future.
@@ -154,31 +158,35 @@ You can create a transformation when selecting the asset, and this information i
154
158
 
155
159
  ```json
156
160
  {
157
- "public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
158
- "resource_type": "image",
159
- "type": "upload",
160
- "format": "jpg",
161
- "version": 1616474653,
162
- "url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
163
- "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
164
- "width": 2400,
165
- "height": 1344,
166
- "bytes": 547710,
167
- "duration": null,
168
- "tags": null,
169
- "metadata": [],
170
- "created_at": "2021-03-23T04:44:13Z",
171
- "derived": [
172
- {
173
- "url": "http://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
174
- "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
175
- "raw_transformation": "a_45"
176
- }
177
- ],
178
- "access_mode": "public",
179
- "_version": 1,
180
- "_type": "cloudinary.asset"
181
- }
161
+ "public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
162
+ "resource_type": "image",
163
+ "type": "upload",
164
+ "format": "jpg",
165
+ "version": 1616474653,
166
+ "url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
167
+ "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
168
+ "width": 2400,
169
+ "height": 1344,
170
+ "bytes": 547710,
171
+ "duration": null,
172
+ "tags": null,
173
+ "context": {
174
+ "custom": {
175
+ "alt": "alternative text for image"
176
+ }
177
+ },
178
+ "created_at": "2021-03-23T04:44:13Z",
179
+ "derived": [
180
+ {
181
+ "url": "http://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
182
+ "secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
183
+ "raw_transformation": "a_45"
184
+ }
185
+ ],
186
+ "access_mode": "public",
187
+ "_version": 1,
188
+ "_type": "cloudinary.asset"
189
+ }
182
190
  ```
183
191
 
184
192
  ## Video
package/lib/index.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ import {AssetSource} from 'sanity'
2
+ import {ObjectDefinition} from 'sanity'
3
+ import {Plugin as Plugin_2} from 'sanity'
4
+ import {PreviewConfig} from 'sanity'
5
+
6
+ export declare type AssetDocument = {
7
+ _id: string
8
+ label?: string
9
+ title?: string
10
+ description?: string
11
+ source?: {
12
+ id: string
13
+ name: string
14
+ url?: string
15
+ }
16
+ creditLine?: string
17
+ originalFilename?: string
18
+ }
19
+
20
+ export declare type CloudinaryAsset = {
21
+ _type: string
22
+ _key?: string
23
+ _version: number
24
+ public_id: string
25
+ resource_type: string
26
+ type: string
27
+ format: string
28
+ version: number
29
+ url: string
30
+ secure_url: string
31
+ derived?: CloudinaryAssetDerived[]
32
+ }
33
+
34
+ export declare interface CloudinaryAssetContext {
35
+ custom: object
36
+ }
37
+
38
+ export declare const cloudinaryAssetContext: {
39
+ type: 'object'
40
+ name: 'cloudinary.assetContext'
41
+ } & Omit<ObjectDefinition, 'preview'> & {
42
+ preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
43
+ }
44
+
45
+ export declare type CloudinaryAssetContextCustom = {
46
+ alt: string
47
+ caption: string
48
+ }
49
+
50
+ export declare const cloudinaryAssetContextCustom: {
51
+ type: 'object'
52
+ name: 'cloudinary.assetContextCustom'
53
+ } & Omit<ObjectDefinition, 'preview'> & {
54
+ preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
55
+ }
56
+
57
+ export declare type CloudinaryAssetDerived = {
58
+ raw_transformation: string
59
+ url: string
60
+ secure_url: string
61
+ }
62
+
63
+ export declare const cloudinaryAssetDerivedSchema: {
64
+ type: 'object'
65
+ name: 'cloudinary.assetDerived'
66
+ } & Omit<ObjectDefinition, 'preview'> & {
67
+ preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
68
+ }
69
+
70
+ export declare const cloudinaryAssetSchema: {
71
+ type: 'object'
72
+ name: 'cloudinary.asset'
73
+ } & Omit<ObjectDefinition, 'preview'> & {
74
+ preview?:
75
+ | PreviewConfig<
76
+ {
77
+ url: string
78
+ resource_type: string
79
+ derived: string
80
+ },
81
+ Record<'url' | 'derived' | 'resource_type', any>
82
+ >
83
+ | undefined
84
+ }
85
+
86
+ export declare const cloudinaryAssetSourcePlugin: Plugin_2<void>
87
+
88
+ export declare const cloudinaryImageSource: AssetSource
89
+
90
+ export declare const cloudinarySchemaPlugin: Plugin_2<void>
91
+
92
+ export {}