@datocms/cma-client 3.1.5 → 3.1.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.
- package/dist/cjs/generated/Client.js +1 -1
- package/dist/cjs/idUtils.js +66 -0
- package/dist/cjs/idUtils.js.map +1 -0
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/generated/Client.js +1 -1
- package/dist/esm/generated/SchemaTypes.d.ts +27 -27
- package/dist/esm/generated/SimpleSchemaTypes.d.ts +39 -39
- package/dist/esm/idUtils.d.ts +2 -0
- package/dist/esm/idUtils.js +61 -0
- package/dist/esm/idUtils.js.map +1 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/types/generated/SchemaTypes.d.ts +27 -27
- package/dist/types/generated/SimpleSchemaTypes.d.ts +39 -39
- package/dist/types/idUtils.d.ts +2 -0
- package/dist/types/index.d.ts +5 -5
- package/package.json +2 -2
- package/src/generated/Client.ts +1 -1
- package/src/generated/SchemaTypes.ts +39 -27
- package/src/generated/SimpleSchemaTypes.ts +39 -39
- package/src/idUtils.ts +83 -0
- package/src/index.ts +5 -5
- package/dist/cjs/generateId.js +0 -26
- package/dist/cjs/generateId.js.map +0 -1
- package/dist/esm/generateId.d.ts +0 -1
- package/dist/esm/generateId.js +0 -22
- package/dist/esm/generateId.js.map +0 -1
- package/dist/types/generateId.d.ts +0 -1
- package/src/generateId.ts +0 -29
|
@@ -129,7 +129,7 @@ var Client = /** @class */ (function () {
|
|
|
129
129
|
});
|
|
130
130
|
Client.prototype.request = function (options) {
|
|
131
131
|
var _this = this;
|
|
132
|
-
return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.
|
|
132
|
+
return (0, rest_client_utils_1.request)(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.6', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
|
|
133
133
|
? { 'X-Environment': this.config.environment }
|
|
134
134
|
: {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
|
|
135
135
|
return _this.jobResultsFetcher
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateId = exports.isValidId = void 0;
|
|
4
|
+
var uuid_1 = require("uuid");
|
|
5
|
+
var decoder = new TextDecoder('utf8');
|
|
6
|
+
function fromUint8ArrayToUrlSafeBase64(bytes) {
|
|
7
|
+
var base64 = typeof Buffer === 'undefined'
|
|
8
|
+
? btoa(decoder.decode(bytes))
|
|
9
|
+
: Buffer.from(bytes).toString('base64');
|
|
10
|
+
// Convert to URL-safe format (see RFC 4648, sec. 5)
|
|
11
|
+
return (base64
|
|
12
|
+
// Replace + with -
|
|
13
|
+
.replace(/\+/g, '-')
|
|
14
|
+
// Replace / with _
|
|
15
|
+
.replace(/\//g, '_')
|
|
16
|
+
// Drop '==' padding
|
|
17
|
+
.substring(0, 22));
|
|
18
|
+
}
|
|
19
|
+
function fromUrlSafeBase64toUint8Array(urlSafeBase64) {
|
|
20
|
+
// Convert from URL-safe format (see RFC 4648, sec. 5)
|
|
21
|
+
var base64 = urlSafeBase64
|
|
22
|
+
// Replace - with +
|
|
23
|
+
.replace(/-/g, '+')
|
|
24
|
+
// Replace _ with /
|
|
25
|
+
.replace(/_/g, '/');
|
|
26
|
+
return typeof Buffer === 'undefined'
|
|
27
|
+
? Uint8Array.from(atob(base64), function (c) { return c.charCodeAt(0); })
|
|
28
|
+
: new Uint8Array(Buffer.from(base64, 'base64'));
|
|
29
|
+
}
|
|
30
|
+
function isValidId(id) {
|
|
31
|
+
var bytes = fromUrlSafeBase64toUint8Array(id);
|
|
32
|
+
// UUIDs are 16 bytes
|
|
33
|
+
if (bytes.length !== 16) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
// The variant field determines the layout of the UUID
|
|
37
|
+
// (see RFC 4122, sec. 4.1.1)
|
|
38
|
+
var variant = bytes.at(8);
|
|
39
|
+
// Variant must be the one described in RFC 4122
|
|
40
|
+
if ((variant & 192) !== 128) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
// The version number is in the most significant 4 bits
|
|
44
|
+
// of the time stamp (see RFC 4122, sec. 4.1.3)
|
|
45
|
+
var version = bytes.at(6) >> 4;
|
|
46
|
+
// Version number must be 4 (randomly generated)
|
|
47
|
+
if (version !== 0x4) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
exports.isValidId = isValidId;
|
|
53
|
+
function generateId() {
|
|
54
|
+
var bytes = (0, uuid_1.v4)(null, new Uint8Array(16));
|
|
55
|
+
// Here we unset the first bit to ensure [A-Za-f] as the first char.
|
|
56
|
+
//
|
|
57
|
+
// If we didn't do this, we would generate IDs that, once encoded
|
|
58
|
+
// in base64, could start with a '+' or a '/'. This makes them less
|
|
59
|
+
// easy to copy/paste, with bad DX.
|
|
60
|
+
// This choice is purely aesthetic: definitely non-mandatory!
|
|
61
|
+
bytes[0] = bytes[0] & 0x7f;
|
|
62
|
+
var base64 = fromUint8ArrayToUrlSafeBase64(bytes);
|
|
63
|
+
return base64;
|
|
64
|
+
}
|
|
65
|
+
exports.generateId = generateId;
|
|
66
|
+
//# sourceMappingURL=idUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idUtils.js","sourceRoot":"","sources":["../../src/idUtils.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAExC,SAAS,6BAA6B,CAAC,KAAiB;IACtD,IAAM,MAAM,GACV,OAAO,M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GAAU,CAAC,KAAK,GAAU,EAAE;QACzC,OAAO,KAAK,CAAC;KACd;IAED,uDAAuD;IACvD,+CAA+C;IAE/C,IAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAE,IAAI,CAAC,CAAC;IAElC,gDAAgD;IAChD,IAAI,OAAO,KAAK,GAAG,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA7BD,8BA6BC;AAED,SAAgB,UAAU;IACxB,IAAM,KAAK,GAAG,IAAA,SAAE,EAAC,IAAI,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,oEAAoE;IACpE,EAAE;IACF,iEAAiE;IACjE,mEAAmE;IACnE,mCAAmC;IAEnC,6DAA6D;IAE7D,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC;IAE5B,IAAM,MAAM,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAChB,CAAC;AAhBD,gCAgBC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
18
21
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
22
|
if (mod && mod.__esModule) return mod;
|
|
20
23
|
var result = {};
|
|
@@ -22,21 +25,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
25
|
__setModuleDefault(result, mod);
|
|
23
26
|
return result;
|
|
24
27
|
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SimpleSchemaTypes = exports.SchemaTypes = exports.Resources = exports.Client = exports.
|
|
29
|
+
exports.SimpleSchemaTypes = exports.SchemaTypes = exports.Resources = exports.Client = exports.TimeoutError = exports.LogLevel = exports.ApiError = void 0;
|
|
30
30
|
var rest_client_utils_1 = require("@datocms/rest-client-utils");
|
|
31
31
|
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return rest_client_utils_1.ApiError; } });
|
|
32
|
-
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return rest_client_utils_1.TimeoutError; } });
|
|
33
32
|
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return rest_client_utils_1.LogLevel; } });
|
|
33
|
+
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return rest_client_utils_1.TimeoutError; } });
|
|
34
|
+
__exportStar(require("./buildBlockRecord"), exports);
|
|
35
|
+
__exportStar(require("./buildClient"), exports);
|
|
34
36
|
var Client_1 = require("./generated/Client");
|
|
35
37
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
|
|
36
38
|
exports.Resources = __importStar(require("./generated/resources"));
|
|
37
|
-
__exportStar(require("./buildClient"), exports);
|
|
38
|
-
__exportStar(require("./buildBlockRecord"), exports);
|
|
39
|
-
__exportStar(require("./generateId"), exports);
|
|
40
39
|
exports.SchemaTypes = __importStar(require("./generated/SchemaTypes"));
|
|
41
40
|
exports.SimpleSchemaTypes = __importStar(require("./generated/SimpleSchemaTypes"));
|
|
41
|
+
__exportStar(require("./idUtils"), exports);
|
|
42
42
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8E;AAArE,6GAAA,QAAQ,OAAA;AAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8E;AAArE,6GAAA,QAAQ,OAAA;AAAE,6GAAA,QAAQ,OAAA;AAAE,iHAAA,YAAY,OAAA;AACzC,qDAAmC;AACnC,gDAA8B;AAC9B,6CAA4C;AAAnC,gGAAA,MAAM,OAAA;AAEf,mEAAmD;AACnD,uEAAuD;AACvD,mFAAmE;AACnE,4CAA0B"}
|
|
@@ -103,7 +103,7 @@ var Client = /** @class */ (function () {
|
|
|
103
103
|
});
|
|
104
104
|
Client.prototype.request = function (options) {
|
|
105
105
|
var _this = this;
|
|
106
|
-
return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.
|
|
106
|
+
return request(__assign(__assign(__assign({}, this.config), options), { logFn: this.config.logFn || console.log, userAgent: '@datocms/cma-client v3.1.6', baseUrl: this.baseUrl, preCallStack: new Error().stack, extraHeaders: __assign(__assign(__assign({}, (this.config.extraHeaders || {})), (this.config.environment
|
|
107
107
|
? { 'X-Environment': this.config.environment }
|
|
108
108
|
: {})), { 'X-API-Version': '3' }), fetchJobResult: function (jobId) {
|
|
109
109
|
return _this.jobResultsFetcher
|
|
@@ -8285,49 +8285,49 @@ export type BuildTrigger = {
|
|
|
8285
8285
|
*/
|
|
8286
8286
|
export type BuildTriggerAttributes = {
|
|
8287
8287
|
/**
|
|
8288
|
-
* Name of the
|
|
8288
|
+
* Name of the build trigger
|
|
8289
8289
|
*/
|
|
8290
8290
|
name: string;
|
|
8291
8291
|
/**
|
|
8292
|
-
* The
|
|
8292
|
+
* The type of build trigger
|
|
8293
8293
|
*/
|
|
8294
|
-
adapter:
|
|
8294
|
+
adapter: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8295
8295
|
/**
|
|
8296
|
-
* Additional
|
|
8296
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8297
8297
|
*/
|
|
8298
8298
|
adapter_settings: {
|
|
8299
8299
|
[k: string]: unknown;
|
|
8300
8300
|
};
|
|
8301
8301
|
/**
|
|
8302
|
-
* Timestamp of the last
|
|
8302
|
+
* Timestamp of the last build
|
|
8303
8303
|
*/
|
|
8304
8304
|
last_build_completed_at: string | null;
|
|
8305
8305
|
/**
|
|
8306
|
-
* Status of last
|
|
8306
|
+
* Status of last build
|
|
8307
8307
|
*/
|
|
8308
8308
|
build_status: string;
|
|
8309
8309
|
/**
|
|
8310
|
-
* Unique token
|
|
8310
|
+
* Unique token for the webhook (it's the same token present in `webhook_url`)
|
|
8311
8311
|
*/
|
|
8312
8312
|
webhook_token?: string;
|
|
8313
8313
|
/**
|
|
8314
|
-
*
|
|
8314
|
+
* The URL of the webhook your service has to call when the build completes to report it's status (success or error)
|
|
8315
8315
|
*/
|
|
8316
8316
|
webhook_url: string;
|
|
8317
8317
|
/**
|
|
8318
|
-
* Status of
|
|
8318
|
+
* Status of Site Search for the frontend
|
|
8319
8319
|
*/
|
|
8320
8320
|
indexing_status: string;
|
|
8321
8321
|
/**
|
|
8322
|
-
*
|
|
8322
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8323
8323
|
*/
|
|
8324
8324
|
frontend_url: string | null;
|
|
8325
8325
|
/**
|
|
8326
|
-
*
|
|
8326
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8327
8327
|
*/
|
|
8328
8328
|
autotrigger_on_scheduled_publications: boolean;
|
|
8329
8329
|
/**
|
|
8330
|
-
*
|
|
8330
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8331
8331
|
*/
|
|
8332
8332
|
indexing_enabled: boolean;
|
|
8333
8333
|
};
|
|
@@ -8354,31 +8354,31 @@ export type BuildTriggerCreateSchema = {
|
|
|
8354
8354
|
type: BuildTriggerType;
|
|
8355
8355
|
attributes: {
|
|
8356
8356
|
/**
|
|
8357
|
-
* Name of the
|
|
8357
|
+
* Name of the build trigger
|
|
8358
8358
|
*/
|
|
8359
8359
|
name: string;
|
|
8360
8360
|
/**
|
|
8361
|
-
* Unique token
|
|
8361
|
+
* Unique token for the webhook (it's the same token present in `webhook_url`)
|
|
8362
8362
|
*/
|
|
8363
8363
|
webhook_token?: string;
|
|
8364
8364
|
/**
|
|
8365
|
-
* The
|
|
8365
|
+
* The type of build trigger
|
|
8366
8366
|
*/
|
|
8367
|
-
adapter:
|
|
8367
|
+
adapter: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8368
8368
|
/**
|
|
8369
|
-
*
|
|
8369
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8370
8370
|
*/
|
|
8371
8371
|
indexing_enabled: boolean;
|
|
8372
8372
|
/**
|
|
8373
|
-
*
|
|
8373
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8374
8374
|
*/
|
|
8375
8375
|
frontend_url: string | null;
|
|
8376
8376
|
/**
|
|
8377
|
-
*
|
|
8377
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8378
8378
|
*/
|
|
8379
8379
|
autotrigger_on_scheduled_publications: boolean;
|
|
8380
8380
|
/**
|
|
8381
|
-
* Additional
|
|
8381
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8382
8382
|
*/
|
|
8383
8383
|
adapter_settings: {
|
|
8384
8384
|
[k: string]: unknown;
|
|
@@ -8403,27 +8403,27 @@ export type BuildTriggerUpdateSchema = {
|
|
|
8403
8403
|
id: BuildTriggerIdentity;
|
|
8404
8404
|
attributes: {
|
|
8405
8405
|
/**
|
|
8406
|
-
* Name of the
|
|
8406
|
+
* Name of the build trigger
|
|
8407
8407
|
*/
|
|
8408
8408
|
name?: string;
|
|
8409
8409
|
/**
|
|
8410
|
-
* The
|
|
8410
|
+
* The type of build trigger
|
|
8411
8411
|
*/
|
|
8412
|
-
adapter?:
|
|
8412
|
+
adapter?: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8413
8413
|
/**
|
|
8414
|
-
*
|
|
8414
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8415
8415
|
*/
|
|
8416
8416
|
indexing_enabled?: boolean;
|
|
8417
8417
|
/**
|
|
8418
|
-
*
|
|
8418
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8419
8419
|
*/
|
|
8420
8420
|
frontend_url?: string | null;
|
|
8421
8421
|
/**
|
|
8422
|
-
*
|
|
8422
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8423
8423
|
*/
|
|
8424
8424
|
autotrigger_on_scheduled_publications?: boolean;
|
|
8425
8425
|
/**
|
|
8426
|
-
* Additional
|
|
8426
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8427
8427
|
*/
|
|
8428
8428
|
adapter_settings?: {
|
|
8429
8429
|
[k: string]: unknown;
|
|
@@ -8197,49 +8197,49 @@ export type BuildTrigger = {
|
|
|
8197
8197
|
id: BuildTriggerIdentity;
|
|
8198
8198
|
type: BuildTriggerType;
|
|
8199
8199
|
/**
|
|
8200
|
-
* Name of the
|
|
8200
|
+
* Name of the build trigger
|
|
8201
8201
|
*/
|
|
8202
8202
|
name: string;
|
|
8203
8203
|
/**
|
|
8204
|
-
* The
|
|
8204
|
+
* The type of build trigger
|
|
8205
8205
|
*/
|
|
8206
|
-
adapter:
|
|
8206
|
+
adapter: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8207
8207
|
/**
|
|
8208
|
-
* Additional
|
|
8208
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8209
8209
|
*/
|
|
8210
8210
|
adapter_settings: {
|
|
8211
8211
|
[k: string]: unknown;
|
|
8212
8212
|
};
|
|
8213
8213
|
/**
|
|
8214
|
-
* Timestamp of the last
|
|
8214
|
+
* Timestamp of the last build
|
|
8215
8215
|
*/
|
|
8216
8216
|
last_build_completed_at: string | null;
|
|
8217
8217
|
/**
|
|
8218
|
-
* Status of last
|
|
8218
|
+
* Status of last build
|
|
8219
8219
|
*/
|
|
8220
8220
|
build_status: string;
|
|
8221
8221
|
/**
|
|
8222
|
-
* Unique token
|
|
8222
|
+
* Unique token for the webhook (it's the same token present in `webhook_url`)
|
|
8223
8223
|
*/
|
|
8224
8224
|
webhook_token?: string;
|
|
8225
8225
|
/**
|
|
8226
|
-
*
|
|
8226
|
+
* The URL of the webhook your service has to call when the build completes to report it's status (success or error)
|
|
8227
8227
|
*/
|
|
8228
8228
|
webhook_url: string;
|
|
8229
8229
|
/**
|
|
8230
|
-
* Status of
|
|
8230
|
+
* Status of Site Search for the frontend
|
|
8231
8231
|
*/
|
|
8232
8232
|
indexing_status: string;
|
|
8233
8233
|
/**
|
|
8234
|
-
*
|
|
8234
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8235
8235
|
*/
|
|
8236
8236
|
frontend_url: string | null;
|
|
8237
8237
|
/**
|
|
8238
|
-
*
|
|
8238
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8239
8239
|
*/
|
|
8240
8240
|
autotrigger_on_scheduled_publications: boolean;
|
|
8241
8241
|
/**
|
|
8242
|
-
*
|
|
8242
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8243
8243
|
*/
|
|
8244
8244
|
indexing_enabled: boolean;
|
|
8245
8245
|
};
|
|
@@ -8255,49 +8255,49 @@ export type BuildTriggerDestroyTargetSchema = BuildTrigger;
|
|
|
8255
8255
|
*/
|
|
8256
8256
|
export type BuildTriggerAttributes = {
|
|
8257
8257
|
/**
|
|
8258
|
-
* Name of the
|
|
8258
|
+
* Name of the build trigger
|
|
8259
8259
|
*/
|
|
8260
8260
|
name: string;
|
|
8261
8261
|
/**
|
|
8262
|
-
* The
|
|
8262
|
+
* The type of build trigger
|
|
8263
8263
|
*/
|
|
8264
|
-
adapter:
|
|
8264
|
+
adapter: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8265
8265
|
/**
|
|
8266
|
-
* Additional
|
|
8266
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8267
8267
|
*/
|
|
8268
8268
|
adapter_settings: {
|
|
8269
8269
|
[k: string]: unknown;
|
|
8270
8270
|
};
|
|
8271
8271
|
/**
|
|
8272
|
-
* Timestamp of the last
|
|
8272
|
+
* Timestamp of the last build
|
|
8273
8273
|
*/
|
|
8274
8274
|
last_build_completed_at: string | null;
|
|
8275
8275
|
/**
|
|
8276
|
-
* Status of last
|
|
8276
|
+
* Status of last build
|
|
8277
8277
|
*/
|
|
8278
8278
|
build_status: string;
|
|
8279
8279
|
/**
|
|
8280
|
-
* Unique token
|
|
8280
|
+
* Unique token for the webhook (it's the same token present in `webhook_url`)
|
|
8281
8281
|
*/
|
|
8282
8282
|
webhook_token?: string;
|
|
8283
8283
|
/**
|
|
8284
|
-
*
|
|
8284
|
+
* The URL of the webhook your service has to call when the build completes to report it's status (success or error)
|
|
8285
8285
|
*/
|
|
8286
8286
|
webhook_url: string;
|
|
8287
8287
|
/**
|
|
8288
|
-
* Status of
|
|
8288
|
+
* Status of Site Search for the frontend
|
|
8289
8289
|
*/
|
|
8290
8290
|
indexing_status: string;
|
|
8291
8291
|
/**
|
|
8292
|
-
*
|
|
8292
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8293
8293
|
*/
|
|
8294
8294
|
frontend_url: string | null;
|
|
8295
8295
|
/**
|
|
8296
|
-
*
|
|
8296
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8297
8297
|
*/
|
|
8298
8298
|
autotrigger_on_scheduled_publications: boolean;
|
|
8299
8299
|
/**
|
|
8300
|
-
*
|
|
8300
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8301
8301
|
*/
|
|
8302
8302
|
indexing_enabled: boolean;
|
|
8303
8303
|
};
|
|
@@ -8308,31 +8308,31 @@ export type BuildTriggerAttributes = {
|
|
|
8308
8308
|
export type BuildTriggerCreateSchema = {
|
|
8309
8309
|
type?: BuildTriggerType;
|
|
8310
8310
|
/**
|
|
8311
|
-
* Name of the
|
|
8311
|
+
* Name of the build trigger
|
|
8312
8312
|
*/
|
|
8313
8313
|
name: string;
|
|
8314
8314
|
/**
|
|
8315
|
-
* Unique token
|
|
8315
|
+
* Unique token for the webhook (it's the same token present in `webhook_url`)
|
|
8316
8316
|
*/
|
|
8317
8317
|
webhook_token?: string;
|
|
8318
8318
|
/**
|
|
8319
|
-
* The
|
|
8319
|
+
* The type of build trigger
|
|
8320
8320
|
*/
|
|
8321
|
-
adapter:
|
|
8321
|
+
adapter: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8322
8322
|
/**
|
|
8323
|
-
*
|
|
8323
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8324
8324
|
*/
|
|
8325
8325
|
indexing_enabled: boolean;
|
|
8326
8326
|
/**
|
|
8327
|
-
*
|
|
8327
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8328
8328
|
*/
|
|
8329
8329
|
frontend_url: string | null;
|
|
8330
8330
|
/**
|
|
8331
|
-
*
|
|
8331
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8332
8332
|
*/
|
|
8333
8333
|
autotrigger_on_scheduled_publications: boolean;
|
|
8334
8334
|
/**
|
|
8335
|
-
* Additional
|
|
8335
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8336
8336
|
*/
|
|
8337
8337
|
adapter_settings: {
|
|
8338
8338
|
[k: string]: unknown;
|
|
@@ -8346,27 +8346,27 @@ export type BuildTriggerUpdateSchema = {
|
|
|
8346
8346
|
id?: BuildTriggerIdentity;
|
|
8347
8347
|
type?: BuildTriggerType;
|
|
8348
8348
|
/**
|
|
8349
|
-
* Name of the
|
|
8349
|
+
* Name of the build trigger
|
|
8350
8350
|
*/
|
|
8351
8351
|
name?: string;
|
|
8352
8352
|
/**
|
|
8353
|
-
* The
|
|
8353
|
+
* The type of build trigger
|
|
8354
8354
|
*/
|
|
8355
|
-
adapter?:
|
|
8355
|
+
adapter?: 'custom' | 'netlify' | 'vercel' | 'circle_ci' | 'gitlab' | 'travis';
|
|
8356
8356
|
/**
|
|
8357
|
-
*
|
|
8357
|
+
* Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content
|
|
8358
8358
|
*/
|
|
8359
8359
|
indexing_enabled?: boolean;
|
|
8360
8360
|
/**
|
|
8361
|
-
*
|
|
8361
|
+
* The public URL of the frontend. If Site Search is enabled (indicated by `indexing_enabled`), this is the starting point from which the website's spidering will start
|
|
8362
8362
|
*/
|
|
8363
8363
|
frontend_url?: string | null;
|
|
8364
8364
|
/**
|
|
8365
|
-
*
|
|
8365
|
+
* Wheter an automatic build request to `webhook_url` should be made on scheduled publications/unpublishings
|
|
8366
8366
|
*/
|
|
8367
8367
|
autotrigger_on_scheduled_publications?: boolean;
|
|
8368
8368
|
/**
|
|
8369
|
-
* Additional
|
|
8369
|
+
* Additional settings for the build trigger. The value depends on the `adapter`.
|
|
8370
8370
|
*/
|
|
8371
8371
|
adapter_settings?: {
|
|
8372
8372
|
[k: string]: unknown;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { v4 } from 'uuid';
|
|
2
|
+
var decoder = new TextDecoder('utf8');
|
|
3
|
+
function fromUint8ArrayToUrlSafeBase64(bytes) {
|
|
4
|
+
var base64 = typeof Buffer === 'undefined'
|
|
5
|
+
? btoa(decoder.decode(bytes))
|
|
6
|
+
: Buffer.from(bytes).toString('base64');
|
|
7
|
+
// Convert to URL-safe format (see RFC 4648, sec. 5)
|
|
8
|
+
return (base64
|
|
9
|
+
// Replace + with -
|
|
10
|
+
.replace(/\+/g, '-')
|
|
11
|
+
// Replace / with _
|
|
12
|
+
.replace(/\//g, '_')
|
|
13
|
+
// Drop '==' padding
|
|
14
|
+
.substring(0, 22));
|
|
15
|
+
}
|
|
16
|
+
function fromUrlSafeBase64toUint8Array(urlSafeBase64) {
|
|
17
|
+
// Convert from URL-safe format (see RFC 4648, sec. 5)
|
|
18
|
+
var base64 = urlSafeBase64
|
|
19
|
+
// Replace - with +
|
|
20
|
+
.replace(/-/g, '+')
|
|
21
|
+
// Replace _ with /
|
|
22
|
+
.replace(/_/g, '/');
|
|
23
|
+
return typeof Buffer === 'undefined'
|
|
24
|
+
? Uint8Array.from(atob(base64), function (c) { return c.charCodeAt(0); })
|
|
25
|
+
: new Uint8Array(Buffer.from(base64, 'base64'));
|
|
26
|
+
}
|
|
27
|
+
export function isValidId(id) {
|
|
28
|
+
var bytes = fromUrlSafeBase64toUint8Array(id);
|
|
29
|
+
// UUIDs are 16 bytes
|
|
30
|
+
if (bytes.length !== 16) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// The variant field determines the layout of the UUID
|
|
34
|
+
// (see RFC 4122, sec. 4.1.1)
|
|
35
|
+
var variant = bytes.at(8);
|
|
36
|
+
// Variant must be the one described in RFC 4122
|
|
37
|
+
if ((variant & 192) !== 128) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
// The version number is in the most significant 4 bits
|
|
41
|
+
// of the time stamp (see RFC 4122, sec. 4.1.3)
|
|
42
|
+
var version = bytes.at(6) >> 4;
|
|
43
|
+
// Version number must be 4 (randomly generated)
|
|
44
|
+
if (version !== 0x4) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
export function generateId() {
|
|
50
|
+
var bytes = v4(null, new Uint8Array(16));
|
|
51
|
+
// Here we unset the first bit to ensure [A-Za-f] as the first char.
|
|
52
|
+
//
|
|
53
|
+
// If we didn't do this, we would generate IDs that, once encoded
|
|
54
|
+
// in base64, could start with a '+' or a '/'. This makes them less
|
|
55
|
+
// easy to copy/paste, with bad DX.
|
|
56
|
+
// This choice is purely aesthetic: definitely non-mandatory!
|
|
57
|
+
bytes[0] = bytes[0] & 0x7f;
|
|
58
|
+
var base64 = fromUint8ArrayToUrlSafeBase64(bytes);
|
|
59
|
+
return base64;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=idUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idUtils.js","sourceRoot":"","sources":["../../src/idUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,IAAM,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AAExC,SAAS,6BAA6B,CAAC,KAAiB;IACtD,IAAM,MAAM,GACV,OAAO,MAAM,KAAK,WAAW;QAC3B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAE5C,oDAAoD;IACpD,OAAO,CACL,MAAM;QACJ,mBAAmB;SAClB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACpB,mBAAmB;SAClB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U,UAAU;IACxB,IAAM,KAAK,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,oEAAoE;IACpE,EAAE;IACF,iEAAiE;IACjE,mEAAmE;IACnE,mCAAmC;IAEnC,6DAA6D;IAE7D,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAE,GAAG,IAAI,CAAC;IAE5B,IAAM,MAAM,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { ApiError,
|
|
1
|
+
export { ApiError, LogLevel, TimeoutError } from '@datocms/rest-client-utils';
|
|
2
|
+
export * from './buildBlockRecord';
|
|
3
|
+
export * from './buildClient';
|
|
2
4
|
export { Client } from './generated/Client';
|
|
3
|
-
export * as Resources from './generated/resources';
|
|
4
5
|
export type { ClientConfigOptions } from './generated/Client';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './buildBlockRecord';
|
|
7
|
-
export * from './generateId';
|
|
6
|
+
export * as Resources from './generated/resources';
|
|
8
7
|
export * as SchemaTypes from './generated/SchemaTypes';
|
|
9
8
|
export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';
|
|
9
|
+
export * from './idUtils';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { ApiError,
|
|
1
|
+
export { ApiError, LogLevel, TimeoutError } from '@datocms/rest-client-utils';
|
|
2
|
+
export * from './buildBlockRecord';
|
|
3
|
+
export * from './buildClient';
|
|
2
4
|
export { Client } from './generated/Client';
|
|
3
5
|
export * as Resources from './generated/resources';
|
|
4
|
-
export * from './buildClient';
|
|
5
|
-
export * from './buildBlockRecord';
|
|
6
|
-
export * from './generateId';
|
|
7
6
|
export * as SchemaTypes from './generated/SchemaTypes';
|
|
8
7
|
export * as SimpleSchemaTypes from './generated/SimpleSchemaTypes';
|
|
8
|
+
export * from './idUtils';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC9E,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,cAAc,WAAW,CAAC"}
|