@datocms/cma-client 3.0.4 → 3.0.6

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,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateId = void 0;
4
+ var uuid_1 = require("uuid");
5
+ var decoder = new TextDecoder('utf8');
6
+ function toBase64(bytes) {
7
+ if (typeof Buffer !== 'undefined') {
8
+ return Buffer.from(bytes).toString('base64');
9
+ }
10
+ return btoa(decoder.decode(bytes));
11
+ }
12
+ function generateId() {
13
+ var bytes = (0, uuid_1.v4)(null, new Uint8Array(16));
14
+ // unset first bit to ensure [A-Za-f] first char
15
+ bytes[0] = bytes[0] & 0x7f;
16
+ var base64 = toBase64(bytes);
17
+ return (base64
18
+ // Replace + with - (see RFC 4648, sec. 5)
19
+ .replace(/\+/g, '-')
20
+ // Replace / with _ (see RFC 4648, sec. 5)
21
+ .replace(/\//g, '_')
22
+ // Drop '==' padding
23
+ .substring(0, 22));
24
+ }
25
+ exports.generateId = generateId;
26
+ //# sourceMappingURL=generateId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateId.js","sourceRoot":"","sources":["../../src/generateId.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAC1B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAExC,SAAS,QAAQ,CAAC,KAAiB;IACjC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC9C;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAgB,UAAU;IACxB,IAAM,KAAK,GAAG,IAAA,SAAE,EAAC,IAAI,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,gDAAgD;IAChD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE3B,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,CACL,MAAM;QACJ,0CAA0C;SACzC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,0CAA0C;SACzC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,oBAAoB;SACnB,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,CAAC;AACJ,CAAC;AAjBD,gCAiBC"}
@@ -127,7 +127,7 @@ var Client = /** @class */ (function () {
127
127
  });
128
128
  Client.prototype.request = function (options) {
129
129
  var _this = this;
130
- return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.0.4', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
130
+ return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.0.6', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
131
131
  ? { 'X-Environment': this.config.environment }
132
132
  : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
133
133
  return _this.jobResultsFetcher
@@ -99,8 +99,9 @@ var Webhook = /** @class */ (function (_super) {
99
99
  * @throws {ApiError}
100
100
  * @throws {TimeoutError}
101
101
  */
102
- Webhook.prototype.update = function (userId, body) {
103
- return this.rawUpdate(Utils.toId(userId), Utils.serializeRequestBody(body, {
102
+ Webhook.prototype.update = function (webhookId, body) {
103
+ return this.rawUpdate(Utils.toId(webhookId), Utils.serializeRequestBody(body, {
104
+ id: Utils.toId(webhookId),
104
105
  type: 'webhook',
105
106
  attributes: [
106
107
  'name',
@@ -127,10 +128,10 @@ var Webhook = /** @class */ (function (_super) {
127
128
  * @throws {ApiError}
128
129
  * @throws {TimeoutError}
129
130
  */
130
- Webhook.prototype.rawUpdate = function (userId, body) {
131
+ Webhook.prototype.rawUpdate = function (webhookId, body) {
131
132
  return this.client.request({
132
133
  method: 'PUT',
133
- url: "/webhooks/".concat(userId),
134
+ url: "/webhooks/".concat(webhookId),
134
135
  body: body,
135
136
  });
136
137
  };
@@ -169,8 +170,8 @@ var Webhook = /** @class */ (function (_super) {
169
170
  * @throws {ApiError}
170
171
  * @throws {TimeoutError}
171
172
  */
172
- Webhook.prototype.find = function (userId) {
173
- return this.rawFind(Utils.toId(userId)).then(function (body) {
173
+ Webhook.prototype.find = function (webhookId) {
174
+ return this.rawFind(Utils.toId(webhookId)).then(function (body) {
174
175
  return Utils.deserializeResponseBody(body);
175
176
  });
176
177
  };
@@ -182,10 +183,10 @@ var Webhook = /** @class */ (function (_super) {
182
183
  * @throws {ApiError}
183
184
  * @throws {TimeoutError}
184
185
  */
185
- Webhook.prototype.rawFind = function (userId) {
186
+ Webhook.prototype.rawFind = function (webhookId) {
186
187
  return this.client.request({
187
188
  method: 'GET',
188
- url: "/webhooks/".concat(userId),
189
+ url: "/webhooks/".concat(webhookId),
189
190
  });
190
191
  };
191
192
  /**
@@ -196,8 +197,8 @@ var Webhook = /** @class */ (function (_super) {
196
197
  * @throws {ApiError}
197
198
  * @throws {TimeoutError}
198
199
  */
199
- Webhook.prototype.destroy = function (userId) {
200
- return this.rawDestroy(Utils.toId(userId)).then(function (body) {
200
+ Webhook.prototype.destroy = function (webhookId) {
201
+ return this.rawDestroy(Utils.toId(webhookId)).then(function (body) {
201
202
  return Utils.deserializeResponseBody(body);
202
203
  });
203
204
  };
@@ -209,10 +210,10 @@ var Webhook = /** @class */ (function (_super) {
209
210
  * @throws {ApiError}
210
211
  * @throws {TimeoutError}
211
212
  */
212
- Webhook.prototype.rawDestroy = function (userId) {
213
+ Webhook.prototype.rawDestroy = function (webhookId) {
213
214
  return this.client.request({
214
215
  method: 'DELETE',
215
- url: "/webhooks/".concat(userId),
216
+ url: "/webhooks/".concat(webhookId),
216
217
  });
217
218
  };
218
219
  Webhook.TYPE = 'webhook';
@@ -1 +1 @@
1
- {"version":3,"file":"Webhook.js","sourceRoot":"","sources":["../../../../src/generated/resources/Webhook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAoD;AAGpD,oEAA8C;AAE9C;IAAqC,2BAAY;IAAjD;;IA0MA,CAAC;IAvMC;;;;;;;OAOG;IACH,wBAAM,GAAN,UAAO,IAA2C;QAChD,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,CAAC,oBAAoB,CAAkC,IAAI,EAAE;YAChE,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,MAAM;gBACN,KAAK;gBACL,gBAAgB;gBAChB,SAAS;gBACT,QAAQ;gBACR,iBAAiB;gBACjB,qBAAqB;gBACrB,SAAS;gBACT,qBAAqB;gBACrB,yBAAyB;aAC1B;YACD,aAAa,EAAE,EAAE;SAClB,CAAC,CACH,CAAC,IAAI,CAAC,UAAC,IAAI;YACV,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,2BAAS,GAAT,UACE,IAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwC;YAChE,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,WAAW;YAChB,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,wBAAM,GAAN,UACE,MAA2C,EAC3C,IAA2C;QAE3C,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAClB,KAAK,CAAC,oBAAoB,CAAkC,IAAI,EAAE;YAChE,IAAI,EAAE,S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C;IAED;;;;;;;OAOG;IACH,yBAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA2C;YACnE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,WAAW;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,sBAAI,GAAJ,UAAK,SAAiD;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACnD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,yBAAO,GAAP,UAAQ,SAAiB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsC;YAC9D,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,oBAAa,SAAS,CAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,yBAAO,GAAP,UAAQ,SAAiD;QACvD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAU,GAAV,UACE,SAAiB;QAEjB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,oBAAa,SAAS,CAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IA3Me,YAAI,GAAc,SAAS,CAAC;IA4M9C,cAAC;CAAA,AA7MD,CAAqC,sBAAY,GA6MhD;kBA7MoB,OAAO"}
package/dist/cjs/index.js CHANGED
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () {
36
36
  exports.Resources = __importStar(require("./generated/resources"));
37
37
  __exportStar(require("./buildClient"), exports);
38
38
  __exportStar(require("./buildBlockRecord"), exports);
39
+ __exportStar(require("./generateId"), exports);
39
40
  exports.SchemaTypes = __importStar(require("./generated/SchemaTypes"));
40
41
  exports.SimpleSchemaTypes = __importStar(require("./generated/SimpleSchemaTypes"));
41
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8E;AAArE,6GAAA,QAAQ,OAAA;AAAE,iHAAA,YAAY,OAAA;AAAE,6GAAA,QAAQ,OAAA;AACzC,6CAA4C;AAAnC,gGAAA,MAAM,OAAA;AACf,mEAAmD;AAEnD,gDAA8B;AAC9B,qDAAmC;AACnC,uEAAuD;AACvD,mFAAmE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8E;AAArE,6GAAA,QAAQ,OAAA;AAAE,iHAAA,YAAY,OAAA;AAAE,6GAAA,QAAQ,OAAA;AACzC,6CAA4C;AAAnC,gGAAA,MAAM,OAAA;AACf,mEAAmD;AAEnD,gDAA8B;AAC9B,qDAAmC;AACnC,+CAA6B;AAC7B,uEAAuD;AACvD,mFAAmE"}
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
@@ -0,0 +1,22 @@
1
+ import { v4 } from 'uuid';
2
+ var decoder = new TextDecoder('utf8');
3
+ function toBase64(bytes) {
4
+ if (typeof Buffer !== 'undefined') {
5
+ return Buffer.from(bytes).toString('base64');
6
+ }
7
+ return btoa(decoder.decode(bytes));
8
+ }
9
+ export function generateId() {
10
+ var bytes = v4(null, new Uint8Array(16));
11
+ // unset first bit to ensure [A-Za-f] first char
12
+ bytes[0] = bytes[0] & 0x7f;
13
+ var base64 = toBase64(bytes);
14
+ return (base64
15
+ // Replace + with - (see RFC 4648, sec. 5)
16
+ .replace(/\+/g, '-')
17
+ // Replace / with _ (see RFC 4648, sec. 5)
18
+ .replace(/\//g, '_')
19
+ // Drop '==' padding
20
+ .substring(0, 22));
21
+ }
22
+ //# sourceMappingURL=generateId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateId.js","sourceRoot":"","sources":["../../src/generateId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAExC,SAAS,QAAQ,CAAC,KAAiB;IACjC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC9C;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,IAAM,KAAK,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,gDAAgD;IAChD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAE3B,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,CACL,MAAM;QACJ,0CAA0C;SACzC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,0CAA0C;SACzC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,oBAAoB;SACnB,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,CAAC;AACJ,CAAC"}
@@ -101,7 +101,7 @@ var Client = /** @class */ (function () {
101
101
  });
102
102
  Client.prototype.request = function (options) {
103
103
  var _this = this;
104
- return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.0.4', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
104
+ return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.0.6', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
105
105
  ? { 'X-Environment': this.config.environment }
106
106
  : {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
107
107
  return _this.jobResultsFetcher
@@ -3328,6 +3328,7 @@ export declare type MenuItemData = {
3328
3328
  */
3329
3329
  export declare type MenuItemCreateSchema = {
3330
3330
  data: {
3331
+ id?: MenuItemIdentity;
3331
3332
  type: MenuItemType;
3332
3333
  /**
3333
3334
  * JSON API attributes
@@ -3653,6 +3654,7 @@ export declare type ItemTypeMeta = {
3653
3654
  */
3654
3655
  export declare type ItemTypeCreateSchema = {
3655
3656
  data: {
3657
+ id?: ItemTypeIdentity;
3656
3658
  type: ItemTypeType;
3657
3659
  /**
3658
3660
  * JSON API attributes
@@ -4931,6 +4933,7 @@ export declare type FieldRelationships = {
4931
4933
  */
4932
4934
  export declare type FieldCreateSchema = {
4933
4935
  data: {
4936
+ id?: FieldIdentity;
4934
4937
  type: FieldType;
4935
4938
  /**
4936
4939
  * JSON API attributes
@@ -5295,6 +5298,7 @@ export declare type FieldsetRelationships = {
5295
5298
  */
5296
5299
  export declare type FieldsetCreateSchema = {
5297
5300
  data: {
5301
+ id?: FieldsetIdentity;
5298
5302
  type: FieldsetType;
5299
5303
  /**
5300
5304
  * JSON API attributes
@@ -5556,6 +5560,7 @@ export declare type PluginData = {
5556
5560
  */
5557
5561
  export declare type PluginCreateSchema = {
5558
5562
  data: {
5563
+ id?: PluginIdentity;
5559
5564
  type: PluginType;
5560
5565
  attributes: {
5561
5566
  /**
@@ -6090,6 +6095,7 @@ export declare type ItemValidateNewSchema = {
6090
6095
  */
6091
6096
  export declare type ItemCreateSchema = {
6092
6097
  data: {
6098
+ id?: ItemIdentity;
6093
6099
  type: ItemType1;
6094
6100
  /**
6095
6101
  * The JSON data associated to the record
@@ -7122,6 +7128,7 @@ export declare type UploadData = {
7122
7128
  */
7123
7129
  export declare type UploadCreateSchema = {
7124
7130
  data: {
7131
+ id?: UploadIdentity;
7125
7132
  type: UploadType;
7126
7133
  attributes: {
7127
7134
  /**
@@ -8336,6 +8343,7 @@ export declare type ItemTypeFilterRelationships = {
8336
8343
  */
8337
8344
  export declare type ItemTypeFilterCreateSchema = {
8338
8345
  data: {
8346
+ id?: ItemTypeFilterIdentity;
8339
8347
  type: ItemTypeFilterType;
8340
8348
  attributes: {
8341
8349
  /**
@@ -8542,6 +8550,7 @@ export declare type UploadFilterData = {
8542
8550
  */
8543
8551
  export declare type UploadFilterCreateSchema = {
8544
8552
  data: {
8553
+ id?: UploadFilterIdentity;
8545
8554
  type: UploadFilterType;
8546
8555
  /**
8547
8556
  * JSON API attributes
@@ -10021,6 +10030,7 @@ export declare type WorkflowAttributes = {
10021
10030
  */
10022
10031
  export declare type WorkflowCreateSchema = {
10023
10032
  data: {
10033
+ id?: WorkflowIdentity;
10024
10034
  type: WorkflowType;
10025
10035
  /**
10026
10036
  * JSON API attributes
@@ -3929,6 +3929,7 @@ export declare type MenuItemRelationships = {
3929
3929
  * via the `create.schema` link.
3930
3930
  */
3931
3931
  export declare type MenuItemCreateSchema = {
3932
+ id?: MenuItemIdentity;
3932
3933
  type?: MenuItemType;
3933
3934
  /**
3934
3935
  * The label of the menu item
@@ -4202,6 +4203,7 @@ export declare type ItemTypeRelationships = {
4202
4203
  * via the `create.schema` link.
4203
4204
  */
4204
4205
  export declare type ItemTypeCreateSchema = {
4206
+ id?: ItemTypeIdentity;
4205
4207
  type?: ItemTypeType;
4206
4208
  /**
4207
4209
  * Name of the model
@@ -5533,6 +5535,7 @@ export declare type FieldRelationships = {
5533
5535
  * via the `create.schema` link.
5534
5536
  */
5535
5537
  export declare type FieldCreateSchema = {
5538
+ id?: FieldIdentity;
5536
5539
  type?: FieldType;
5537
5540
  /**
5538
5541
  * The label of the field
@@ -5796,6 +5799,7 @@ export declare type FieldsetRelationships = {
5796
5799
  * via the `create.schema` link.
5797
5800
  */
5798
5801
  export declare type FieldsetCreateSchema = {
5802
+ id?: FieldsetIdentity;
5799
5803
  type?: FieldsetType;
5800
5804
  /**
5801
5805
  * The title of the fieldset
@@ -6039,6 +6043,7 @@ export declare type PluginAttributes = {
6039
6043
  * via the `create.schema` link.
6040
6044
  */
6041
6045
  export declare type PluginCreateSchema = {
6046
+ id?: PluginIdentity;
6042
6047
  type?: PluginType;
6043
6048
  /**
6044
6049
  * NPM package name of the public plugin you want to install. For public plugins, that's the only attribute you need to pass.
@@ -6481,6 +6486,7 @@ export declare type ItemValidateNewSchema = {
6481
6486
  * via the `create.schema` link.
6482
6487
  */
6483
6488
  export declare type ItemCreateSchema = {
6489
+ id?: ItemIdentity;
6484
6490
  type?: ItemType1;
6485
6491
  item_type: ItemTypeData;
6486
6492
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
@@ -7167,6 +7173,7 @@ export declare type UploadRelationships = {
7167
7173
  * via the `create.schema` link.
7168
7174
  */
7169
7175
  export declare type UploadCreateSchema = {
7176
+ id?: UploadIdentity;
7170
7177
  type?: UploadType;
7171
7178
  /**
7172
7179
  * Upload path
@@ -8370,6 +8377,7 @@ export declare type ItemTypeFilterRelationships = {
8370
8377
  * via the `create.schema` link.
8371
8378
  */
8372
8379
  export declare type ItemTypeFilterCreateSchema = {
8380
+ id?: ItemTypeFilterIdentity;
8373
8381
  type?: ItemTypeFilterType;
8374
8382
  /**
8375
8383
  * The name of the filter
@@ -8533,6 +8541,7 @@ export declare type UploadFilterAttributes = {
8533
8541
  * via the `create.schema` link.
8534
8542
  */
8535
8543
  export declare type UploadFilterCreateSchema = {
8544
+ id?: UploadFilterIdentity;
8536
8545
  type?: UploadFilterType;
8537
8546
  /**
8538
8547
  * The name of the filter
@@ -9942,6 +9951,7 @@ export declare type WorkflowAttributes = {
9942
9951
  * via the `create.schema` link.
9943
9952
  */
9944
9953
  export declare type WorkflowCreateSchema = {
9954
+ id?: WorkflowIdentity;
9945
9955
  type?: WorkflowType;
9946
9956
  /**
9947
9957
  * The name of the workflow
@@ -29,7 +29,7 @@ export default class Webhook extends BaseResource {
29
29
  * @throws {ApiError}
30
30
  * @throws {TimeoutError}
31
31
  */
32
- update(userId: string | SimpleSchemaTypes.UserData, body: SimpleSchemaTypes.WebhookUpdateSchema): Promise<SimpleSchemaTypes.Webhook>;
32
+ update(webhookId: string | SimpleSchemaTypes.WebhookData, body: SimpleSchemaTypes.WebhookUpdateSchema): Promise<SimpleSchemaTypes.Webhook>;
33
33
  /**
34
34
  * Update a webhook
35
35
  *
@@ -38,7 +38,7 @@ export default class Webhook extends BaseResource {
38
38
  * @throws {ApiError}
39
39
  * @throws {TimeoutError}
40
40
  */
41
- rawUpdate(userId: string, body: SchemaTypes.WebhookUpdateSchema): Promise<SchemaTypes.WebhookUpdateTargetSchema>;
41
+ rawUpdate(webhookId: string, body: SchemaTypes.WebhookUpdateSchema): Promise<SchemaTypes.WebhookUpdateTargetSchema>;
42
42
  /**
43
43
  * List all webhooks
44
44
  *
@@ -65,7 +65,7 @@ export default class Webhook extends BaseResource {
65
65
  * @throws {ApiError}
66
66
  * @throws {TimeoutError}
67
67
  */
68
- find(userId: string | SimpleSchemaTypes.UserData): Promise<SimpleSchemaTypes.Webhook>;
68
+ find(webhookId: string | SimpleSchemaTypes.WebhookData): Promise<SimpleSchemaTypes.Webhook>;
69
69
  /**
70
70
  * Retrieve a webhook
71
71
  *
@@ -74,7 +74,7 @@ export default class Webhook extends BaseResource {
74
74
  * @throws {ApiError}
75
75
  * @throws {TimeoutError}
76
76
  */
77
- rawFind(userId: string): Promise<SchemaTypes.WebhookSelfTargetSchema>;
77
+ rawFind(webhookId: string): Promise<SchemaTypes.WebhookSelfTargetSchema>;
78
78
  /**
79
79
  * Delete a webhook
80
80
  *
@@ -83,7 +83,7 @@ export default class Webhook extends BaseResource {
83
83
  * @throws {ApiError}
84
84
  * @throws {TimeoutError}
85
85
  */
86
- destroy(userId: string | SimpleSchemaTypes.UserData): Promise<SimpleSchemaTypes.Webhook>;
86
+ destroy(webhookId: string | SimpleSchemaTypes.WebhookData): Promise<SimpleSchemaTypes.Webhook>;
87
87
  /**
88
88
  * Delete a webhook
89
89
  *
@@ -92,5 +92,5 @@ export default class Webhook extends BaseResource {
92
92
  * @throws {ApiError}
93
93
  * @throws {TimeoutError}
94
94
  */
95
- rawDestroy(userId: string): Promise<SchemaTypes.WebhookDestroyTargetSchema>;
95
+ rawDestroy(webhookId: string): Promise<SchemaTypes.WebhookDestroyTargetSchema>;
96
96
  }
@@ -71,8 +71,9 @@ var Webhook = /** @class */ (function (_super) {
71
71
  * @throws {ApiError}
72
72
  * @throws {TimeoutError}
73
73
  */
74
- Webhook.prototype.update = function (userId, body) {
75
- return this.rawUpdate(Utils.toId(userId), Utils.serializeRequestBody(body, {
74
+ Webhook.prototype.update = function (webhookId, body) {
75
+ return this.rawUpdate(Utils.toId(webhookId), Utils.serializeRequestBody(body, {
76
+ id: Utils.toId(webhookId),
76
77
  type: 'webhook',
77
78
  attributes: [
78
79
  'name',
@@ -99,10 +100,10 @@ var Webhook = /** @class */ (function (_super) {
99
100
  * @throws {ApiError}
100
101
  * @throws {TimeoutError}
101
102
  */
102
- Webhook.prototype.rawUpdate = function (userId, body) {
103
+ Webhook.prototype.rawUpdate = function (webhookId, body) {
103
104
  return this.client.request({
104
105
  method: 'PUT',
105
- url: "/webhooks/".concat(userId),
106
+ url: "/webhooks/".concat(webhookId),
106
107
  body: body,
107
108
  });
108
109
  };
@@ -141,8 +142,8 @@ var Webhook = /** @class */ (function (_super) {
141
142
  * @throws {ApiError}
142
143
  * @throws {TimeoutError}
143
144
  */
144
- Webhook.prototype.find = function (userId) {
145
- return this.rawFind(Utils.toId(userId)).then(function (body) {
145
+ Webhook.prototype.find = function (webhookId) {
146
+ return this.rawFind(Utils.toId(webhookId)).then(function (body) {
146
147
  return Utils.deserializeResponseBody(body);
147
148
  });
148
149
  };
@@ -154,10 +155,10 @@ var Webhook = /** @class */ (function (_super) {
154
155
  * @throws {ApiError}
155
156
  * @throws {TimeoutError}
156
157
  */
157
- Webhook.prototype.rawFind = function (userId) {
158
+ Webhook.prototype.rawFind = function (webhookId) {
158
159
  return this.client.request({
159
160
  method: 'GET',
160
- url: "/webhooks/".concat(userId),
161
+ url: "/webhooks/".concat(webhookId),
161
162
  });
162
163
  };
163
164
  /**
@@ -168,8 +169,8 @@ var Webhook = /** @class */ (function (_super) {
168
169
  * @throws {ApiError}
169
170
  * @throws {TimeoutError}
170
171
  */
171
- Webhook.prototype.destroy = function (userId) {
172
- return this.rawDestroy(Utils.toId(userId)).then(function (body) {
172
+ Webhook.prototype.destroy = function (webhookId) {
173
+ return this.rawDestroy(Utils.toId(webhookId)).then(function (body) {
173
174
  return Utils.deserializeResponseBody(body);
174
175
  });
175
176
  };
@@ -181,10 +182,10 @@ var Webhook = /** @class */ (function (_super) {
181
182
  * @throws {ApiError}
182
183
  * @throws {TimeoutError}
183
184
  */
184
- Webhook.prototype.rawDestroy = function (userId) {
185
+ Webhook.prototype.rawDestroy = function (webhookId) {
185
186
  return this.client.request({
186
187
  method: 'DELETE',
187
- url: "/webhooks/".concat(userId),
188
+ url: "/webhooks/".concat(webhookId),
188
189
  });
189
190
  };
190
191
  Webhook.TYPE = 'webhook';
@@ -1 +1 @@
1
- {"version":3,"file":"Webhook.js","sourceRoot":"","sources":["../../../../src/generated/resources/Webhook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;IAAqC,2BAAY;IAAjD;;IA0MA,CAAC;IAvMC;;;;;;;OAOG;IACH,wBA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AC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,oBAAa,MAAM,CAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAxMe,YAAI,GAAc,SAAS,CAAC;IAyM9C,cAAC;CAAA,AA1MD,CAAqC,YAAY,GA0MhD;eA1MoB,OAAO"}
1
+ {"version":3,"file":"Webhook.js","sourceRoot":"","sources":["../../../../src/generated/resources/Webhook.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAGpD,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAE9C;IAAqC,2BAAY;IAAjD;;IA6MA,CAAC;IA1MC;;;;;;;OAOG;IACH,wBAAM,GAAN,UAAO,IAA2C;QAChD,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,CAAC,oBAAoB,CAAkC,IAAI,EAAE;YAChE,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,MAAM;gBACN,KAAK;gBACL,gBAAgB;gBAChB,SAAS;gBACT,QAAQ;gBACR,iBAAiB;gBACjB,qBAAqB;gBACrB,SAAS;gBACT,qBAAqB;gBACrB,yBAAyB;aAC1B;YACD,aAAa,EAAE,EAAE;SAClB,CAAC,CACH,CAAC,IAAI,CAAC,UAAC,IAAI;YACV,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,2BAAS,GAAT,UACE,IAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwC;YAChE,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,WAAW;YAChB,IAAI,MAAA;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,wBAAM,GAAN,UACE,SAAiD,EACjD,IAA2C;QAE3C,OAAO,IAAI,CAAC,SAAS,CACnB,KAAK,CAAC,IAAI,CAAC,SAAS,CA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CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,yBAAO,GAAP,UAAQ,SAAiB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsC;YAC9D,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,oBAAa,SAAS,CAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,yBAAO,GAAP,UAAQ,SAAiD;QACvD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,IAAI;YACtD,OAAA,KAAK,CAAC,uBAAuB,CAC3B,IAAI,CACL;QAFD,CAEC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,4BAAU,GAAV,UACE,SAAiB;QAEjB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyC;YACjE,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,oBAAa,SAAS,CAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IA3Me,YAAI,GAAc,SAAS,CAAC;IA4M9C,cAAC;CAAA,AA7MD,CAAqC,YAAY,GA6MhD;eA7MoB,OAAO"}
@@ -4,5 +4,6 @@ export * as Resources from './generated/resources';
4
4
  export type { ClientConfigOptions } from './generated/Client';
5
5
  export * from './buildClient';
6
6
  export * from './buildBlockRecord';
7
+ export * from './generateId';
7
8
  export * as SchemaTypes from './generated/SchemaTypes';
8
9
  export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';
package/dist/esm/index.js CHANGED
@@ -3,6 +3,7 @@ export { Client } from './generated/Client';
3
3
  export * as Resources from './generated/resources';
4
4
  export * from './buildClient';
5
5
  export * from './buildBlockRecord';
6
+ export * from './generateId';
6
7
  export * as SchemaTypes from './generated/SchemaTypes';
7
8
  export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AAEnD,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AAEnD,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function generateId(): string;
@@ -3328,6 +3328,7 @@ export declare type MenuItemData = {
3328
3328
  */
3329
3329
  export declare type MenuItemCreateSchema = {
3330
3330
  data: {
3331
+ id?: MenuItemIdentity;
3331
3332
  type: MenuItemType;
3332
3333
  /**
3333
3334
  * JSON API attributes
@@ -3653,6 +3654,7 @@ export declare type ItemTypeMeta = {
3653
3654
  */
3654
3655
  export declare type ItemTypeCreateSchema = {
3655
3656
  data: {
3657
+ id?: ItemTypeIdentity;
3656
3658
  type: ItemTypeType;
3657
3659
  /**
3658
3660
  * JSON API attributes
@@ -4931,6 +4933,7 @@ export declare type FieldRelationships = {
4931
4933
  */
4932
4934
  export declare type FieldCreateSchema = {
4933
4935
  data: {
4936
+ id?: FieldIdentity;
4934
4937
  type: FieldType;
4935
4938
  /**
4936
4939
  * JSON API attributes
@@ -5295,6 +5298,7 @@ export declare type FieldsetRelationships = {
5295
5298
  */
5296
5299
  export declare type FieldsetCreateSchema = {
5297
5300
  data: {
5301
+ id?: FieldsetIdentity;
5298
5302
  type: FieldsetType;
5299
5303
  /**
5300
5304
  * JSON API attributes
@@ -5556,6 +5560,7 @@ export declare type PluginData = {
5556
5560
  */
5557
5561
  export declare type PluginCreateSchema = {
5558
5562
  data: {
5563
+ id?: PluginIdentity;
5559
5564
  type: PluginType;
5560
5565
  attributes: {
5561
5566
  /**
@@ -6090,6 +6095,7 @@ export declare type ItemValidateNewSchema = {
6090
6095
  */
6091
6096
  export declare type ItemCreateSchema = {
6092
6097
  data: {
6098
+ id?: ItemIdentity;
6093
6099
  type: ItemType1;
6094
6100
  /**
6095
6101
  * The JSON data associated to the record
@@ -7122,6 +7128,7 @@ export declare type UploadData = {
7122
7128
  */
7123
7129
  export declare type UploadCreateSchema = {
7124
7130
  data: {
7131
+ id?: UploadIdentity;
7125
7132
  type: UploadType;
7126
7133
  attributes: {
7127
7134
  /**
@@ -8336,6 +8343,7 @@ export declare type ItemTypeFilterRelationships = {
8336
8343
  */
8337
8344
  export declare type ItemTypeFilterCreateSchema = {
8338
8345
  data: {
8346
+ id?: ItemTypeFilterIdentity;
8339
8347
  type: ItemTypeFilterType;
8340
8348
  attributes: {
8341
8349
  /**
@@ -8542,6 +8550,7 @@ export declare type UploadFilterData = {
8542
8550
  */
8543
8551
  export declare type UploadFilterCreateSchema = {
8544
8552
  data: {
8553
+ id?: UploadFilterIdentity;
8545
8554
  type: UploadFilterType;
8546
8555
  /**
8547
8556
  * JSON API attributes
@@ -10021,6 +10030,7 @@ export declare type WorkflowAttributes = {
10021
10030
  */
10022
10031
  export declare type WorkflowCreateSchema = {
10023
10032
  data: {
10033
+ id?: WorkflowIdentity;
10024
10034
  type: WorkflowType;
10025
10035
  /**
10026
10036
  * JSON API attributes
@@ -3929,6 +3929,7 @@ export declare type MenuItemRelationships = {
3929
3929
  * via the `create.schema` link.
3930
3930
  */
3931
3931
  export declare type MenuItemCreateSchema = {
3932
+ id?: MenuItemIdentity;
3932
3933
  type?: MenuItemType;
3933
3934
  /**
3934
3935
  * The label of the menu item
@@ -4202,6 +4203,7 @@ export declare type ItemTypeRelationships = {
4202
4203
  * via the `create.schema` link.
4203
4204
  */
4204
4205
  export declare type ItemTypeCreateSchema = {
4206
+ id?: ItemTypeIdentity;
4205
4207
  type?: ItemTypeType;
4206
4208
  /**
4207
4209
  * Name of the model
@@ -5533,6 +5535,7 @@ export declare type FieldRelationships = {
5533
5535
  * via the `create.schema` link.
5534
5536
  */
5535
5537
  export declare type FieldCreateSchema = {
5538
+ id?: FieldIdentity;
5536
5539
  type?: FieldType;
5537
5540
  /**
5538
5541
  * The label of the field
@@ -5796,6 +5799,7 @@ export declare type FieldsetRelationships = {
5796
5799
  * via the `create.schema` link.
5797
5800
  */
5798
5801
  export declare type FieldsetCreateSchema = {
5802
+ id?: FieldsetIdentity;
5799
5803
  type?: FieldsetType;
5800
5804
  /**
5801
5805
  * The title of the fieldset
@@ -6039,6 +6043,7 @@ export declare type PluginAttributes = {
6039
6043
  * via the `create.schema` link.
6040
6044
  */
6041
6045
  export declare type PluginCreateSchema = {
6046
+ id?: PluginIdentity;
6042
6047
  type?: PluginType;
6043
6048
  /**
6044
6049
  * NPM package name of the public plugin you want to install. For public plugins, that's the only attribute you need to pass.
@@ -6481,6 +6486,7 @@ export declare type ItemValidateNewSchema = {
6481
6486
  * via the `create.schema` link.
6482
6487
  */
6483
6488
  export declare type ItemCreateSchema = {
6489
+ id?: ItemIdentity;
6484
6490
  type?: ItemType1;
6485
6491
  item_type: ItemTypeData;
6486
6492
  creator?: AccountData | AccessTokenData | UserData | SsoUserData | OrganizationData;
@@ -7167,6 +7173,7 @@ export declare type UploadRelationships = {
7167
7173
  * via the `create.schema` link.
7168
7174
  */
7169
7175
  export declare type UploadCreateSchema = {
7176
+ id?: UploadIdentity;
7170
7177
  type?: UploadType;
7171
7178
  /**
7172
7179
  * Upload path
@@ -8370,6 +8377,7 @@ export declare type ItemTypeFilterRelationships = {
8370
8377
  * via the `create.schema` link.
8371
8378
  */
8372
8379
  export declare type ItemTypeFilterCreateSchema = {
8380
+ id?: ItemTypeFilterIdentity;
8373
8381
  type?: ItemTypeFilterType;
8374
8382
  /**
8375
8383
  * The name of the filter
@@ -8533,6 +8541,7 @@ export declare type UploadFilterAttributes = {
8533
8541
  * via the `create.schema` link.
8534
8542
  */
8535
8543
  export declare type UploadFilterCreateSchema = {
8544
+ id?: UploadFilterIdentity;
8536
8545
  type?: UploadFilterType;
8537
8546
  /**
8538
8547
  * The name of the filter
@@ -9942,6 +9951,7 @@ export declare type WorkflowAttributes = {
9942
9951
  * via the `create.schema` link.
9943
9952
  */
9944
9953
  export declare type WorkflowCreateSchema = {
9954
+ id?: WorkflowIdentity;
9945
9955
  type?: WorkflowType;
9946
9956
  /**
9947
9957
  * The name of the workflow
@@ -29,7 +29,7 @@ export default class Webhook extends BaseResource {
29
29
  * @throws {ApiError}
30
30
  * @throws {TimeoutError}
31
31
  */
32
- update(userId: string | SimpleSchemaTypes.UserData, body: SimpleSchemaTypes.WebhookUpdateSchema): Promise<SimpleSchemaTypes.Webhook>;
32
+ update(webhookId: string | SimpleSchemaTypes.WebhookData, body: SimpleSchemaTypes.WebhookUpdateSchema): Promise<SimpleSchemaTypes.Webhook>;
33
33
  /**
34
34
  * Update a webhook
35
35
  *
@@ -38,7 +38,7 @@ export default class Webhook extends BaseResource {
38
38
  * @throws {ApiError}
39
39
  * @throws {TimeoutError}
40
40
  */
41
- rawUpdate(userId: string, body: SchemaTypes.WebhookUpdateSchema): Promise<SchemaTypes.WebhookUpdateTargetSchema>;
41
+ rawUpdate(webhookId: string, body: SchemaTypes.WebhookUpdateSchema): Promise<SchemaTypes.WebhookUpdateTargetSchema>;
42
42
  /**
43
43
  * List all webhooks
44
44
  *
@@ -65,7 +65,7 @@ export default class Webhook extends BaseResource {
65
65
  * @throws {ApiError}
66
66
  * @throws {TimeoutError}
67
67
  */
68
- find(userId: string | SimpleSchemaTypes.UserData): Promise<SimpleSchemaTypes.Webhook>;
68
+ find(webhookId: string | SimpleSchemaTypes.WebhookData): Promise<SimpleSchemaTypes.Webhook>;
69
69
  /**
70
70
  * Retrieve a webhook
71
71
  *
@@ -74,7 +74,7 @@ export default class Webhook extends BaseResource {
74
74
  * @throws {ApiError}
75
75
  * @throws {TimeoutError}
76
76
  */
77
- rawFind(userId: string): Promise<SchemaTypes.WebhookSelfTargetSchema>;
77
+ rawFind(webhookId: string): Promise<SchemaTypes.WebhookSelfTargetSchema>;
78
78
  /**
79
79
  * Delete a webhook
80
80
  *
@@ -83,7 +83,7 @@ export default class Webhook extends BaseResource {
83
83
  * @throws {ApiError}
84
84
  * @throws {TimeoutError}
85
85
  */
86
- destroy(userId: string | SimpleSchemaTypes.UserData): Promise<SimpleSchemaTypes.Webhook>;
86
+ destroy(webhookId: string | SimpleSchemaTypes.WebhookData): Promise<SimpleSchemaTypes.Webhook>;
87
87
  /**
88
88
  * Delete a webhook
89
89
  *
@@ -92,5 +92,5 @@ export default class Webhook extends BaseResource {
92
92
  * @throws {ApiError}
93
93
  * @throws {TimeoutError}
94
94
  */
95
- rawDestroy(userId: string): Promise<SchemaTypes.WebhookDestroyTargetSchema>;
95
+ rawDestroy(webhookId: string): Promise<SchemaTypes.WebhookDestroyTargetSchema>;
96
96
  }
@@ -4,5 +4,6 @@ export * as Resources from './generated/resources';
4
4
  export type { ClientConfigOptions } from './generated/Client';
5
5
  export * from './buildClient';
6
6
  export * from './buildBlockRecord';
7
+ export * from './generateId';
7
8
  export * as SchemaTypes from './generated/SchemaTypes';
8
9
  export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datocms/cma-client",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "JS client for DatoCMS REST Content Management API",
5
5
  "keywords": [
6
6
  "datocms",
@@ -37,10 +37,12 @@
37
37
  "url": "https://github.com/datocms/js-rest-api-clients/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@datocms/rest-client-utils": "^3.0.1"
40
+ "@datocms/rest-client-utils": "^3.0.5",
41
+ "uuid": "^9.0.1"
41
42
  },
42
43
  "devDependencies": {
43
- "@datocms/dashboard-client": "^3.0.4"
44
+ "@datocms/dashboard-client": "^3.0.5",
45
+ "@types/uuid": "^9.0.7"
44
46
  },
45
- "gitHead": "d6bbcf5972f0854f49bbf2e04270de9596287092"
47
+ "gitHead": "cee3f805421882ded88e56e4a76a4710df5ce2d9"
46
48
  }
package/resources.json CHANGED
@@ -2408,13 +2408,13 @@
2408
2408
  "returnsCollection": false,
2409
2409
  "docUrl": "https://www.datocms.com/docs/content-management-api/resources/webhook/update",
2410
2410
  "rel": "update",
2411
- "urlTemplate": "/webhooks/${userId}",
2411
+ "urlTemplate": "/webhooks/${webhookId}",
2412
2412
  "method": "PUT",
2413
2413
  "comment": "Update a webhook",
2414
2414
  "urlPlaceholder": {
2415
- "variableName": "userId",
2416
- "isEntityId": false,
2417
- "relType": "UserData"
2415
+ "variableName": "webhookId",
2416
+ "isEntityId": true,
2417
+ "relType": "WebhookData"
2418
2418
  },
2419
2419
  "requestBodyType": "WebhookUpdateSchema",
2420
2420
  "optionalRequestBody": false,
@@ -2457,13 +2457,13 @@
2457
2457
  "returnsCollection": false,
2458
2458
  "docUrl": "https://www.datocms.com/docs/content-management-api/resources/webhook/self",
2459
2459
  "rel": "self",
2460
- "urlTemplate": "/webhooks/${userId}",
2460
+ "urlTemplate": "/webhooks/${webhookId}",
2461
2461
  "method": "GET",
2462
2462
  "comment": "Retrieve a webhook",
2463
2463
  "urlPlaceholder": {
2464
- "variableName": "userId",
2465
- "isEntityId": false,
2466
- "relType": "UserData"
2464
+ "variableName": "webhookId",
2465
+ "isEntityId": true,
2466
+ "relType": "WebhookData"
2467
2467
  },
2468
2468
  "optionalRequestBody": false,
2469
2469
  "queryParamsRequired": false,
@@ -2475,13 +2475,13 @@
2475
2475
  "returnsCollection": false,
2476
2476
  "docUrl": "https://www.datocms.com/docs/content-management-api/resources/webhook/destroy",
2477
2477
  "rel": "destroy",
2478
- "urlTemplate": "/webhooks/${userId}",
2478
+ "urlTemplate": "/webhooks/${webhookId}",
2479
2479
  "method": "DELETE",
2480
2480
  "comment": "Delete a webhook",
2481
2481
  "urlPlaceholder": {
2482
- "variableName": "userId",
2483
- "isEntityId": false,
2484
- "relType": "UserData"
2482
+ "variableName": "webhookId",
2483
+ "isEntityId": true,
2484
+ "relType": "WebhookData"
2485
2485
  },
2486
2486
  "optionalRequestBody": false,
2487
2487
  "queryParamsRequired": false,
@@ -3259,7 +3259,6 @@
3259
3259
  "optionalRequestBody": false,
3260
3260
  "requestStructure": {
3261
3261
  "type": "sso_settings",
3262
- "idRequired": true,
3263
3262
  "attributes": [
3264
3263
  "idp_saml_metadata_url",
3265
3264
  "idp_saml_metadata_xml"
@@ -3304,7 +3303,6 @@
3304
3303
  "optionalRequestBody": false,
3305
3304
  "requestStructure": {
3306
3305
  "type": "white_label_settings",
3307
- "idRequired": true,
3308
3306
  "attributes": [
3309
3307
  "custom_i18n_messages_template_url"
3310
3308
  ],
@@ -3484,7 +3482,6 @@
3484
3482
  "optionalRequestBody": false,
3485
3483
  "requestStructure": {
3486
3484
  "type": "site",
3487
- "idRequired": true,
3488
3485
  "attributes": [
3489
3486
  "no_index",
3490
3487
  "favicon",
@@ -0,0 +1,29 @@
1
+ import { v4 } from 'uuid';
2
+ const decoder = new TextDecoder('utf8');
3
+
4
+ function toBase64(bytes: Uint8Array) {
5
+ if (typeof Buffer !== 'undefined') {
6
+ return Buffer.from(bytes).toString('base64');
7
+ }
8
+
9
+ return btoa(decoder.decode(bytes));
10
+ }
11
+
12
+ export function generateId() {
13
+ const bytes = v4(null, new Uint8Array(16));
14
+
15
+ // unset first bit to ensure [A-Za-f] first char
16
+ bytes[0] = bytes[0] & 0x7f;
17
+
18
+ const base64 = toBase64(bytes);
19
+
20
+ return (
21
+ base64
22
+ // Replace + with - (see RFC 4648, sec. 5)
23
+ .replace(/\+/g, '-')
24
+ // Replace / with _ (see RFC 4648, sec. 5)
25
+ .replace(/\//g, '_')
26
+ // Drop '==' padding
27
+ .substring(0, 22)
28
+ );
29
+ }
@@ -135,7 +135,7 @@ export class Client {
135
135
  ...this.config,
136
136
  ...options,
137
137
  logFn: this.config.logFn || console.log,
138
- userAgent: '@datocms/cma-client v3.0.4',
138
+ userAgent: '@datocms/cma-client v3.0.6',
139
139
  baseUrl: this.baseUrl,
140
140
  preCallStack: new Error().stack,
141
141
  extraHeaders: {
@@ -3553,6 +3553,7 @@ export type MenuItemData = {
3553
3553
  */
3554
3554
  export type MenuItemCreateSchema = {
3555
3555
  data: {
3556
+ id?: MenuItemIdentity;
3556
3557
  type: MenuItemType;
3557
3558
  /**
3558
3559
  * JSON API attributes
@@ -3898,6 +3899,7 @@ export type ItemTypeMeta = {
3898
3899
  */
3899
3900
  export type ItemTypeCreateSchema = {
3900
3901
  data: {
3902
+ id?: ItemTypeIdentity;
3901
3903
  type: ItemTypeType;
3902
3904
  /**
3903
3905
  * JSON API attributes
@@ -5225,6 +5227,7 @@ export type FieldRelationships = {
5225
5227
  */
5226
5228
  export type FieldCreateSchema = {
5227
5229
  data: {
5230
+ id?: FieldIdentity;
5228
5231
  type: FieldType;
5229
5232
  /**
5230
5233
  * JSON API attributes
@@ -5654,6 +5657,7 @@ export type FieldsetRelationships = {
5654
5657
  */
5655
5658
  export type FieldsetCreateSchema = {
5656
5659
  data: {
5660
+ id?: FieldsetIdentity;
5657
5661
  type: FieldsetType;
5658
5662
  /**
5659
5663
  * JSON API attributes
@@ -5952,6 +5956,7 @@ export type PluginData = {
5952
5956
  */
5953
5957
  export type PluginCreateSchema = {
5954
5958
  data: {
5959
+ id?: PluginIdentity;
5955
5960
  type: PluginType;
5956
5961
  attributes: {
5957
5962
  /**
@@ -6564,6 +6569,7 @@ export type ItemValidateNewSchema = {
6564
6569
  */
6565
6570
  export type ItemCreateSchema = {
6566
6571
  data: {
6572
+ id?: ItemIdentity;
6567
6573
  type: ItemType1;
6568
6574
  /**
6569
6575
  * The JSON data associated to the record
@@ -7678,6 +7684,7 @@ export type UploadData = {
7678
7684
  */
7679
7685
  export type UploadCreateSchema = {
7680
7686
  data: {
7687
+ id?: UploadIdentity;
7681
7688
  type: UploadType;
7682
7689
  attributes: {
7683
7690
  /**
@@ -8972,6 +8979,7 @@ export type ItemTypeFilterRelationships = {
8972
8979
  */
8973
8980
  export type ItemTypeFilterCreateSchema = {
8974
8981
  data: {
8982
+ id?: ItemTypeFilterIdentity;
8975
8983
  type: ItemTypeFilterType;
8976
8984
  attributes: {
8977
8985
  /**
@@ -9192,6 +9200,7 @@ export type UploadFilterData = {
9192
9200
  */
9193
9201
  export type UploadFilterCreateSchema = {
9194
9202
  data: {
9203
+ id?: UploadFilterIdentity;
9195
9204
  type: UploadFilterType;
9196
9205
  /**
9197
9206
  * JSON API attributes
@@ -10765,6 +10774,7 @@ export type WorkflowAttributes = {
10765
10774
  */
10766
10775
  export type WorkflowCreateSchema = {
10767
10776
  data: {
10777
+ id?: WorkflowIdentity;
10768
10778
  type: WorkflowType;
10769
10779
  /**
10770
10780
  * JSON API attributes
@@ -4168,6 +4168,7 @@ export type MenuItemRelationships = {
4168
4168
  * via the `create.schema` link.
4169
4169
  */
4170
4170
  export type MenuItemCreateSchema = {
4171
+ id?: MenuItemIdentity;
4171
4172
  type?: MenuItemType;
4172
4173
  /**
4173
4174
  * The label of the menu item
@@ -4460,6 +4461,7 @@ export type ItemTypeRelationships = {
4460
4461
  * via the `create.schema` link.
4461
4462
  */
4462
4463
  export type ItemTypeCreateSchema = {
4464
+ id?: ItemTypeIdentity;
4463
4465
  type?: ItemTypeType;
4464
4466
  /**
4465
4467
  * Name of the model
@@ -5854,6 +5856,7 @@ export type FieldRelationships = {
5854
5856
  * via the `create.schema` link.
5855
5857
  */
5856
5858
  export type FieldCreateSchema = {
5859
+ id?: FieldIdentity;
5857
5860
  type?: FieldType;
5858
5861
  /**
5859
5862
  * The label of the field
@@ -6169,6 +6172,7 @@ export type FieldsetRelationships = {
6169
6172
  * via the `create.schema` link.
6170
6173
  */
6171
6174
  export type FieldsetCreateSchema = {
6175
+ id?: FieldsetIdentity;
6172
6176
  type?: FieldsetType;
6173
6177
  /**
6174
6178
  * The title of the fieldset
@@ -6462,6 +6466,7 @@ export type PluginAttributes = {
6462
6466
  * via the `create.schema` link.
6463
6467
  */
6464
6468
  export type PluginCreateSchema = {
6469
+ id?: PluginIdentity;
6465
6470
  type?: PluginType;
6466
6471
  /**
6467
6472
  * NPM package name of the public plugin you want to install. For public plugins, that's the only attribute you need to pass.
@@ -6979,6 +6984,7 @@ export type ItemValidateNewSchema = {
6979
6984
  * via the `create.schema` link.
6980
6985
  */
6981
6986
  export type ItemCreateSchema = {
6987
+ id?: ItemIdentity;
6982
6988
  type?: ItemType1;
6983
6989
  item_type: ItemTypeData;
6984
6990
  creator?:
@@ -7714,6 +7720,7 @@ export type UploadRelationships = {
7714
7720
  * via the `create.schema` link.
7715
7721
  */
7716
7722
  export type UploadCreateSchema = {
7723
+ id?: UploadIdentity;
7717
7724
  type?: UploadType;
7718
7725
  /**
7719
7726
  * Upload path
@@ -8960,6 +8967,7 @@ export type ItemTypeFilterRelationships = {
8960
8967
  * via the `create.schema` link.
8961
8968
  */
8962
8969
  export type ItemTypeFilterCreateSchema = {
8970
+ id?: ItemTypeFilterIdentity;
8963
8971
  type?: ItemTypeFilterType;
8964
8972
  /**
8965
8973
  * The name of the filter
@@ -9131,6 +9139,7 @@ export type UploadFilterAttributes = {
9131
9139
  * via the `create.schema` link.
9132
9140
  */
9133
9141
  export type UploadFilterCreateSchema = {
9142
+ id?: UploadFilterIdentity;
9134
9143
  type?: UploadFilterType;
9135
9144
  /**
9136
9145
  * The name of the filter
@@ -10584,6 +10593,7 @@ export type WorkflowAttributes = {
10584
10593
  * via the `create.schema` link.
10585
10594
  */
10586
10595
  export type WorkflowCreateSchema = {
10596
+ id?: WorkflowIdentity;
10587
10597
  type?: WorkflowType;
10588
10598
  /**
10589
10599
  * The name of the workflow
@@ -66,12 +66,13 @@ export default class Webhook extends BaseResource {
66
66
  * @throws {TimeoutError}
67
67
  */
68
68
  update(
69
- userId: string | SimpleSchemaTypes.UserData,
69
+ webhookId: string | SimpleSchemaTypes.WebhookData,
70
70
  body: SimpleSchemaTypes.WebhookUpdateSchema,
71
71
  ) {
72
72
  return this.rawUpdate(
73
- Utils.toId(userId),
73
+ Utils.toId(webhookId),
74
74
  Utils.serializeRequestBody<SchemaTypes.WebhookUpdateSchema>(body, {
75
+ id: Utils.toId(webhookId),
75
76
  type: 'webhook',
76
77
  attributes: [
77
78
  'name',
@@ -103,12 +104,12 @@ export default class Webhook extends BaseResource {
103
104
  * @throws {TimeoutError}
104
105
  */
105
106
  rawUpdate(
106
- userId: string,
107
+ webhookId: string,
107
108
  body: SchemaTypes.WebhookUpdateSchema,
108
109
  ): Promise<SchemaTypes.WebhookUpdateTargetSchema> {
109
110
  return this.client.request<SchemaTypes.WebhookUpdateTargetSchema>({
110
111
  method: 'PUT',
111
- url: `/webhooks/${userId}`,
112
+ url: `/webhooks/${webhookId}`,
112
113
  body,
113
114
  });
114
115
  }
@@ -152,8 +153,8 @@ export default class Webhook extends BaseResource {
152
153
  * @throws {ApiError}
153
154
  * @throws {TimeoutError}
154
155
  */
155
- find(userId: string | SimpleSchemaTypes.UserData) {
156
- return this.rawFind(Utils.toId(userId)).then((body) =>
156
+ find(webhookId: string | SimpleSchemaTypes.WebhookData) {
157
+ return this.rawFind(Utils.toId(webhookId)).then((body) =>
157
158
  Utils.deserializeResponseBody<SimpleSchemaTypes.WebhookSelfTargetSchema>(
158
159
  body,
159
160
  ),
@@ -168,10 +169,10 @@ export default class Webhook extends BaseResource {
168
169
  * @throws {ApiError}
169
170
  * @throws {TimeoutError}
170
171
  */
171
- rawFind(userId: string): Promise<SchemaTypes.WebhookSelfTargetSchema> {
172
+ rawFind(webhookId: string): Promise<SchemaTypes.WebhookSelfTargetSchema> {
172
173
  return this.client.request<SchemaTypes.WebhookSelfTargetSchema>({
173
174
  method: 'GET',
174
- url: `/webhooks/${userId}`,
175
+ url: `/webhooks/${webhookId}`,
175
176
  });
176
177
  }
177
178
 
@@ -183,8 +184,8 @@ export default class Webhook extends BaseResource {
183
184
  * @throws {ApiError}
184
185
  * @throws {TimeoutError}
185
186
  */
186
- destroy(userId: string | SimpleSchemaTypes.UserData) {
187
- return this.rawDestroy(Utils.toId(userId)).then((body) =>
187
+ destroy(webhookId: string | SimpleSchemaTypes.WebhookData) {
188
+ return this.rawDestroy(Utils.toId(webhookId)).then((body) =>
188
189
  Utils.deserializeResponseBody<SimpleSchemaTypes.WebhookDestroyTargetSchema>(
189
190
  body,
190
191
  ),
@@ -199,10 +200,12 @@ export default class Webhook extends BaseResource {
199
200
  * @throws {ApiError}
200
201
  * @throws {TimeoutError}
201
202
  */
202
- rawDestroy(userId: string): Promise<SchemaTypes.WebhookDestroyTargetSchema> {
203
+ rawDestroy(
204
+ webhookId: string,
205
+ ): Promise<SchemaTypes.WebhookDestroyTargetSchema> {
203
206
  return this.client.request<SchemaTypes.WebhookDestroyTargetSchema>({
204
207
  method: 'DELETE',
205
- url: `/webhooks/${userId}`,
208
+ url: `/webhooks/${webhookId}`,
206
209
  });
207
210
  }
208
211
  }
package/src/index.ts CHANGED
@@ -4,5 +4,6 @@ export * as Resources from './generated/resources';
4
4
  export type { ClientConfigOptions } from './generated/Client';
5
5
  export * from './buildClient';
6
6
  export * from './buildBlockRecord';
7
+ export * from './generateId';
7
8
  export * as SchemaTypes from './generated/SchemaTypes';
8
9
  export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';