@diagonal-hq/cli 0.14.0 → 0.14.1
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/README.md +4 -4
- package/dist/cli.mjs +109 -22
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ The build reads each file with a parser. It runs only the workflow tests.
|
|
|
76
76
|
|
|
77
77
|
A definition can have two identity options. A resource, a page, a workflow `config`, a notification type, a notification template, an email layout, and the front matter of a skill file have a `uid`. No definition uses `slug` yet.
|
|
78
78
|
|
|
79
|
-
- `uid` is the stable identity of the definition. Its value is a lowercase UUID string literal, such as `uid: '
|
|
79
|
+
- `uid` is the stable identity of the definition. Its value is a lowercase UUID string literal, such as `uid: '019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e'`. In skill front matter, it is a YAML string, such as `uid: 019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e`. A file move, a file rename, or a name change keeps the uid. Do not change a uid.
|
|
80
80
|
- `slug` is the editable, user-facing name of the definition. It is kebab-case: lowercase letters and digits in groups that one `-` joins, such as `job-postings`. A slug change keeps the uid.
|
|
81
81
|
|
|
82
82
|
`diagonal check` writes a new uid into each definition that has none. It adds `uid: '<uuid>'` as the first option of the `defineX()` object or of the `export const config` object of a workflow, or `uid: <uuid>` as the first line of the front matter of a skill file, and leaves the rest of the file unchanged. Commit the change.
|
|
@@ -245,7 +245,7 @@ import { Resources } from '@app/generated/resources';
|
|
|
245
245
|
import { defineNotificationType, field } from '@diagonal-hq/cli';
|
|
246
246
|
|
|
247
247
|
export default defineNotificationType({
|
|
248
|
-
uid: '
|
|
248
|
+
uid: '019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e',
|
|
249
249
|
key: 'member-welcome',
|
|
250
250
|
name: 'Member welcome',
|
|
251
251
|
recipient: { resource: Resources.Members.slug },
|
|
@@ -263,7 +263,7 @@ A template has an email, an SMS, or both. A channel is on when the template has
|
|
|
263
263
|
import { defineNotificationTemplate } from '@diagonal-hq/cli';
|
|
264
264
|
|
|
265
265
|
export default defineNotificationTemplate({
|
|
266
|
-
uid: '
|
|
266
|
+
uid: '019a4d6e-4a1b-7c2d-8e3f-6a7b8c9d0e1f',
|
|
267
267
|
key: 'standard',
|
|
268
268
|
type: 'member-welcome',
|
|
269
269
|
name: 'Standard welcome',
|
|
@@ -292,7 +292,7 @@ An email layout is the frame that templates fill in. Each field is a slot that a
|
|
|
292
292
|
import { defineEmailLayout } from '@diagonal-hq/cli';
|
|
293
293
|
|
|
294
294
|
export default defineEmailLayout({
|
|
295
|
-
uid: '
|
|
295
|
+
uid: '019a4d6e-5b2c-7d3e-9f4a-7b8c9d0e1f2a',
|
|
296
296
|
key: 'standard',
|
|
297
297
|
name: 'Standard',
|
|
298
298
|
body: { file: './body.liquid' },
|
package/dist/cli.mjs
CHANGED
|
@@ -24430,7 +24430,7 @@ ${lanes.join("\n")}
|
|
|
24430
24430
|
initial
|
|
24431
24431
|
);
|
|
24432
24432
|
}
|
|
24433
|
-
function appendCommentRange(pos, end, kind, hasTrailingNewLine,
|
|
24433
|
+
function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state2, comments = []) {
|
|
24434
24434
|
comments.push({ kind, pos, end, hasTrailingNewLine });
|
|
24435
24435
|
return comments;
|
|
24436
24436
|
}
|
|
@@ -144188,7 +144188,7 @@ ${lanes.join("\n")}
|
|
|
144188
144188
|
function onLeft(next, _workArea, parent2) {
|
|
144189
144189
|
return maybeEmitExpression(next, parent2, "left");
|
|
144190
144190
|
}
|
|
144191
|
-
function onOperator(operatorToken,
|
|
144191
|
+
function onOperator(operatorToken, _state2, node) {
|
|
144192
144192
|
const isCommaOperator = operatorToken.kind !== 28;
|
|
144193
144193
|
const linesBeforeOperator = getLinesBetweenNodes(node, node.left, operatorToken);
|
|
144194
144194
|
const linesAfterOperator = getLinesBetweenNodes(node, operatorToken, node.right);
|
|
@@ -224525,8 +224525,8 @@ var require_base = __commonJS({
|
|
|
224525
224525
|
function _interopRequireDefault(obj) {
|
|
224526
224526
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
224527
224527
|
}
|
|
224528
|
-
var
|
|
224529
|
-
var
|
|
224528
|
+
var _state2 = require_state();
|
|
224529
|
+
var _state22 = _interopRequireDefault(_state2);
|
|
224530
224530
|
var _charcodes = require_charcodes();
|
|
224531
224531
|
exports.isJSXEnabled;
|
|
224532
224532
|
exports.isTypeScriptEnabled;
|
|
@@ -224570,7 +224570,7 @@ var require_base = __commonJS({
|
|
|
224570
224570
|
exports.locationForIndex = locationForIndex;
|
|
224571
224571
|
function initParser(inputCode, isJSXEnabledArg, isTypeScriptEnabledArg, isFlowEnabledArg) {
|
|
224572
224572
|
exports.input = inputCode;
|
|
224573
|
-
exports.state = new (0,
|
|
224573
|
+
exports.state = new (0, _state22.default)();
|
|
224574
224574
|
exports.nextContextId = 1;
|
|
224575
224575
|
exports.isJSXEnabled = isJSXEnabledArg;
|
|
224576
224576
|
exports.isTypeScriptEnabled = isTypeScriptEnabledArg;
|
|
@@ -241101,7 +241101,7 @@ var require_expression = __commonJS({
|
|
|
241101
241101
|
var _typescript = require_typescript2();
|
|
241102
241102
|
var _index3 = require_tokenizer();
|
|
241103
241103
|
var _keywords = require_keywords();
|
|
241104
|
-
var
|
|
241104
|
+
var _state2 = require_state();
|
|
241105
241105
|
var _types3 = require_types();
|
|
241106
241106
|
var _charcodes = require_charcodes();
|
|
241107
241107
|
var _identifier = require_identifier();
|
|
@@ -241754,14 +241754,14 @@ var require_expression = __commonJS({
|
|
|
241754
241754
|
_statement.parseFunctionParams.call(void 0, allowModifiers, funcContextId);
|
|
241755
241755
|
parseFunctionBodyAndFinish(functionStart, funcContextId);
|
|
241756
241756
|
const endTokenIndex = _base.state.tokens.length;
|
|
241757
|
-
_base.state.scopes.push(new (0,
|
|
241757
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, true));
|
|
241758
241758
|
_base.state.scopeDepth--;
|
|
241759
241759
|
}
|
|
241760
241760
|
exports.parseMethod = parseMethod;
|
|
241761
241761
|
function parseArrowExpression(startTokenIndex) {
|
|
241762
241762
|
parseFunctionBody(true);
|
|
241763
241763
|
const endTokenIndex = _base.state.tokens.length;
|
|
241764
|
-
_base.state.scopes.push(new (0,
|
|
241764
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, true));
|
|
241765
241765
|
_base.state.scopeDepth--;
|
|
241766
241766
|
}
|
|
241767
241767
|
exports.parseArrowExpression = parseArrowExpression;
|
|
@@ -242725,7 +242725,7 @@ var require_statement = __commonJS({
|
|
|
242725
242725
|
var _typescript = require_typescript2();
|
|
242726
242726
|
var _tokenizer = require_tokenizer();
|
|
242727
242727
|
var _keywords = require_keywords();
|
|
242728
|
-
var
|
|
242728
|
+
var _state2 = require_state();
|
|
242729
242729
|
var _types = require_types();
|
|
242730
242730
|
var _charcodes = require_charcodes();
|
|
242731
242731
|
var _base = require_base();
|
|
@@ -242734,7 +242734,7 @@ var require_statement = __commonJS({
|
|
|
242734
242734
|
var _util = require_util();
|
|
242735
242735
|
function parseTopLevel() {
|
|
242736
242736
|
parseBlockBody(_types.TokenType.eof);
|
|
242737
|
-
_base.state.scopes.push(new (0,
|
|
242737
|
+
_base.state.scopes.push(new (0, _state2.Scope)(0, _base.state.tokens.length, true));
|
|
242738
242738
|
if (_base.state.scopeDepth !== 0) {
|
|
242739
242739
|
throw new Error(`Invalid scope depth at end of file: ${_base.state.scopeDepth}`);
|
|
242740
242740
|
}
|
|
@@ -242945,7 +242945,7 @@ var require_statement = __commonJS({
|
|
|
242945
242945
|
const startTokenIndex = _base.state.tokens.length;
|
|
242946
242946
|
parseAmbiguousForStatement();
|
|
242947
242947
|
const endTokenIndex = _base.state.tokens.length;
|
|
242948
|
-
_base.state.scopes.push(new (0,
|
|
242948
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, false));
|
|
242949
242949
|
_base.state.scopeDepth--;
|
|
242950
242950
|
}
|
|
242951
242951
|
function isUsingInLoop() {
|
|
@@ -243036,7 +243036,7 @@ var require_statement = __commonJS({
|
|
|
243036
243036
|
}
|
|
243037
243037
|
_tokenizer.next.call(void 0);
|
|
243038
243038
|
const endTokenIndex = _base.state.tokens.length;
|
|
243039
|
-
_base.state.scopes.push(new (0,
|
|
243039
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, false));
|
|
243040
243040
|
_base.state.scopeDepth--;
|
|
243041
243041
|
}
|
|
243042
243042
|
function parseThrowStatement() {
|
|
@@ -243070,7 +243070,7 @@ var require_statement = __commonJS({
|
|
|
243070
243070
|
parseBlock();
|
|
243071
243071
|
if (catchBindingStartTokenIndex != null) {
|
|
243072
243072
|
const endTokenIndex = _base.state.tokens.length;
|
|
243073
|
-
_base.state.scopes.push(new (0,
|
|
243073
|
+
_base.state.scopes.push(new (0, _state2.Scope)(catchBindingStartTokenIndex, endTokenIndex, false));
|
|
243074
243074
|
_base.state.scopeDepth--;
|
|
243075
243075
|
}
|
|
243076
243076
|
}
|
|
@@ -243116,7 +243116,7 @@ var require_statement = __commonJS({
|
|
|
243116
243116
|
_base.state.tokens[_base.state.tokens.length - 1].contextId = contextId;
|
|
243117
243117
|
}
|
|
243118
243118
|
const endTokenIndex = _base.state.tokens.length;
|
|
243119
|
-
_base.state.scopes.push(new (0,
|
|
243119
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, isFunctionScope));
|
|
243120
243120
|
_base.state.scopeDepth--;
|
|
243121
243121
|
}
|
|
243122
243122
|
exports.parseBlock = parseBlock;
|
|
@@ -243189,10 +243189,10 @@ var require_statement = __commonJS({
|
|
|
243189
243189
|
parseFunctionParams();
|
|
243190
243190
|
_expression.parseFunctionBodyAndFinish.call(void 0, functionStart);
|
|
243191
243191
|
const endTokenIndex = _base.state.tokens.length;
|
|
243192
|
-
_base.state.scopes.push(new (0,
|
|
243192
|
+
_base.state.scopes.push(new (0, _state2.Scope)(startTokenIndex, endTokenIndex, true));
|
|
243193
243193
|
_base.state.scopeDepth--;
|
|
243194
243194
|
if (nameScopeStartTokenIndex !== null) {
|
|
243195
|
-
_base.state.scopes.push(new (0,
|
|
243195
|
+
_base.state.scopes.push(new (0, _state2.Scope)(nameScopeStartTokenIndex, endTokenIndex, true));
|
|
243196
243196
|
_base.state.scopeDepth--;
|
|
243197
243197
|
}
|
|
243198
243198
|
}
|
|
@@ -243241,7 +243241,7 @@ var require_statement = __commonJS({
|
|
|
243241
243241
|
_base.state.tokens[_base.state.tokens.length - 1].contextId = contextId;
|
|
243242
243242
|
if (nameScopeStartTokenIndex !== null) {
|
|
243243
243243
|
const endTokenIndex = _base.state.tokens.length;
|
|
243244
|
-
_base.state.scopes.push(new (0,
|
|
243244
|
+
_base.state.scopes.push(new (0, _state2.Scope)(nameScopeStartTokenIndex, endTokenIndex, false));
|
|
243245
243245
|
_base.state.scopeDepth--;
|
|
243246
243246
|
}
|
|
243247
243247
|
}
|
|
@@ -268083,17 +268083,104 @@ function checkCapabilities(resources, platformSlugs, diagnostics) {
|
|
|
268083
268083
|
|
|
268084
268084
|
// scripts/lib/runtime-build/definition-uid.mjs
|
|
268085
268085
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
268086
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
268087
|
-
import { randomUUID } from "node:crypto";
|
|
268088
268086
|
import { writeFileSync as writeFileSync2 } from "node:fs";
|
|
268089
268087
|
import { join as join3 } from "node:path";
|
|
268088
|
+
|
|
268089
|
+
// node_modules/uuid/dist-node/index.js
|
|
268090
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
268091
|
+
|
|
268092
|
+
// node_modules/uuid/dist-node/stringify.js
|
|
268093
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
268094
|
+
var byteToHex = [];
|
|
268095
|
+
for (let i = 0; i < 256; ++i) {
|
|
268096
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
268097
|
+
}
|
|
268098
|
+
function unsafeStringify(arr, offset = 0) {
|
|
268099
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
268100
|
+
}
|
|
268101
|
+
|
|
268102
|
+
// node_modules/uuid/dist-node/rng.js
|
|
268103
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
268104
|
+
var rnds8 = new Uint8Array(16);
|
|
268105
|
+
function rng() {
|
|
268106
|
+
return crypto.getRandomValues(rnds8);
|
|
268107
|
+
}
|
|
268108
|
+
|
|
268109
|
+
// node_modules/uuid/dist-node/v7.js
|
|
268110
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
268111
|
+
var _state = {};
|
|
268112
|
+
function v7(options2, buf, offset) {
|
|
268113
|
+
let bytes;
|
|
268114
|
+
if (options2) {
|
|
268115
|
+
bytes = v7Bytes(options2.random ?? options2.rng?.() ?? rng(), options2.msecs, options2.seq, buf, offset);
|
|
268116
|
+
} else {
|
|
268117
|
+
const now = Date.now();
|
|
268118
|
+
const rnds = rng();
|
|
268119
|
+
updateV7State(_state, now, rnds);
|
|
268120
|
+
bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
|
|
268121
|
+
}
|
|
268122
|
+
return buf ?? unsafeStringify(bytes);
|
|
268123
|
+
}
|
|
268124
|
+
function updateV7State(state, now, rnds) {
|
|
268125
|
+
state.msecs ??= -Infinity;
|
|
268126
|
+
state.seq ??= 0;
|
|
268127
|
+
if (now > state.msecs) {
|
|
268128
|
+
state.seq = v7Sequence(rnds);
|
|
268129
|
+
state.msecs = now;
|
|
268130
|
+
} else {
|
|
268131
|
+
state.seq = state.seq + 1 | 0;
|
|
268132
|
+
if (state.seq === 0) {
|
|
268133
|
+
state.msecs++;
|
|
268134
|
+
}
|
|
268135
|
+
}
|
|
268136
|
+
return state;
|
|
268137
|
+
}
|
|
268138
|
+
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
268139
|
+
if (rnds.length < 16) {
|
|
268140
|
+
throw new Error("Random bytes length must be >= 16");
|
|
268141
|
+
}
|
|
268142
|
+
if (!buf) {
|
|
268143
|
+
buf = new Uint8Array(16);
|
|
268144
|
+
offset = 0;
|
|
268145
|
+
} else {
|
|
268146
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
268147
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
268148
|
+
}
|
|
268149
|
+
}
|
|
268150
|
+
msecs ??= Date.now();
|
|
268151
|
+
seq ??= v7Sequence(rnds);
|
|
268152
|
+
buf[offset++] = msecs / 1099511627776 & 255;
|
|
268153
|
+
buf[offset++] = msecs / 4294967296 & 255;
|
|
268154
|
+
buf[offset++] = msecs / 16777216 & 255;
|
|
268155
|
+
buf[offset++] = msecs / 65536 & 255;
|
|
268156
|
+
buf[offset++] = msecs / 256 & 255;
|
|
268157
|
+
buf[offset++] = msecs & 255;
|
|
268158
|
+
buf[offset++] = 112 | seq >>> 28 & 15;
|
|
268159
|
+
buf[offset++] = seq >>> 20 & 255;
|
|
268160
|
+
buf[offset++] = 128 | seq >>> 14 & 63;
|
|
268161
|
+
buf[offset++] = seq >>> 6 & 255;
|
|
268162
|
+
buf[offset++] = seq << 2 & 255 | rnds[10] & 3;
|
|
268163
|
+
buf[offset++] = rnds[11];
|
|
268164
|
+
buf[offset++] = rnds[12];
|
|
268165
|
+
buf[offset++] = rnds[13];
|
|
268166
|
+
buf[offset++] = rnds[14];
|
|
268167
|
+
buf[offset++] = rnds[15];
|
|
268168
|
+
return buf;
|
|
268169
|
+
}
|
|
268170
|
+
function v7Sequence(rnds) {
|
|
268171
|
+
return (rnds[6] & 127) << 24 | rnds[7] << 16 | rnds[8] << 8 | rnds[9];
|
|
268172
|
+
}
|
|
268173
|
+
var v7_default = v7;
|
|
268174
|
+
|
|
268175
|
+
// scripts/lib/runtime-build/definition-uid.mjs
|
|
268176
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
268090
268177
|
var UID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
268091
|
-
var UID_EXAMPLE = "
|
|
268178
|
+
var UID_EXAMPLE = "019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e";
|
|
268092
268179
|
function isUid(value) {
|
|
268093
268180
|
return typeof value === "string" && UID_PATTERN.test(value);
|
|
268094
268181
|
}
|
|
268095
268182
|
function newUid() {
|
|
268096
|
-
return
|
|
268183
|
+
return v7_default();
|
|
268097
268184
|
}
|
|
268098
268185
|
function uidProperty(object) {
|
|
268099
268186
|
return object.properties.find(
|
|
@@ -300128,7 +300215,7 @@ var PROPERTIES = {
|
|
|
300128
300215
|
manualOnly: { type: "boolean", required: false, fallback: false }
|
|
300129
300216
|
};
|
|
300130
300217
|
var KEYS = ["uid", ...Object.keys(PROPERTIES)];
|
|
300131
|
-
var EXAMPLE = ["---", "uid:
|
|
300218
|
+
var EXAMPLE = ["---", "uid: 019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e", "name: membership-support", "description: Help members with membership questions.", "---"].join("\n");
|
|
300132
300219
|
function characterCount(value) {
|
|
300133
300220
|
return [...value].length;
|
|
300134
300221
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type StaticValue =
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The stable identity of a definition: a lowercase UUID string literal, such as
|
|
42
|
-
* `'
|
|
42
|
+
* `'019a4d6e-3c2f-7b8a-9d1e-5f6a7b8c9d0e'`. `diagonal check` writes one into a
|
|
43
43
|
* definition that has none. A file move or a rename keeps it. Do not change it.
|
|
44
44
|
*/
|
|
45
45
|
export type DefinitionUid = string;
|