@spica-devkit/testing 0.20.8 → 0.21.0-beta.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/index.js +195 -50
- package/index.js.map +1 -1
- package/index.mjs +195 -50
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -439,7 +439,7 @@ const REMOVE$1 = Symbol('remove node');
|
|
|
439
439
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
440
440
|
* specific defined one will be used for each node.
|
|
441
441
|
*/
|
|
442
|
-
function visit$
|
|
442
|
+
function visit$2(node, visitor) {
|
|
443
443
|
const visitor_ = initVisitor(visitor);
|
|
444
444
|
if (isDocument(node)) {
|
|
445
445
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
@@ -453,11 +453,11 @@ function visit$1(node, visitor) {
|
|
|
453
453
|
// namespace using `var`, but then complains about that because
|
|
454
454
|
// `unique symbol` must be `const`.
|
|
455
455
|
/** Terminate visit traversal completely */
|
|
456
|
-
visit$
|
|
456
|
+
visit$2.BREAK = BREAK$1;
|
|
457
457
|
/** Do not visit the children of the current node */
|
|
458
|
-
visit$
|
|
458
|
+
visit$2.SKIP = SKIP$1;
|
|
459
459
|
/** Remove the current node */
|
|
460
|
-
visit$
|
|
460
|
+
visit$2.REMOVE = REMOVE$1;
|
|
461
461
|
function visit_(key, node, visitor, path) {
|
|
462
462
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
463
463
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
@@ -788,7 +788,7 @@ class Directives {
|
|
|
788
788
|
let tagNames;
|
|
789
789
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
790
790
|
const tags = {};
|
|
791
|
-
visit$
|
|
791
|
+
visit$2(doc.contents, (_key, node) => {
|
|
792
792
|
if (isNode(node) && node.tag)
|
|
793
793
|
tags[node.tag] = true;
|
|
794
794
|
});
|
|
@@ -823,7 +823,7 @@ function anchorIsValid(anchor) {
|
|
|
823
823
|
}
|
|
824
824
|
function anchorNames(root) {
|
|
825
825
|
const anchors = new Set();
|
|
826
|
-
visit$
|
|
826
|
+
visit$2(root, {
|
|
827
827
|
Value(_key, node) {
|
|
828
828
|
if (node.anchor)
|
|
829
829
|
anchors.add(node.anchor);
|
|
@@ -1017,7 +1017,7 @@ class Alias extends NodeBase {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
else {
|
|
1019
1019
|
nodes = [];
|
|
1020
|
-
visit$
|
|
1020
|
+
visit$2(doc, {
|
|
1021
1021
|
Node: (_key, node) => {
|
|
1022
1022
|
if (isAlias(node) || hasAnchor(node))
|
|
1023
1023
|
nodes.push(node);
|
|
@@ -5814,7 +5814,7 @@ const REMOVE = Symbol('remove item');
|
|
|
5814
5814
|
* visitor is called on item entry, next visitors are called after handling
|
|
5815
5815
|
* a non-empty `key` and when exiting the item.
|
|
5816
5816
|
*/
|
|
5817
|
-
function visit(cst, visitor) {
|
|
5817
|
+
function visit$1(cst, visitor) {
|
|
5818
5818
|
if ('type' in cst && cst.type === 'document')
|
|
5819
5819
|
cst = { start: cst.start, value: cst.value };
|
|
5820
5820
|
_visit(Object.freeze([]), cst, visitor);
|
|
@@ -5823,13 +5823,13 @@ function visit(cst, visitor) {
|
|
|
5823
5823
|
// namespace using `var`, but then complains about that because
|
|
5824
5824
|
// `unique symbol` must be `const`.
|
|
5825
5825
|
/** Terminate visit traversal completely */
|
|
5826
|
-
visit.BREAK = BREAK;
|
|
5826
|
+
visit$1.BREAK = BREAK;
|
|
5827
5827
|
/** Do not visit the children of the current item */
|
|
5828
|
-
visit.SKIP = SKIP;
|
|
5828
|
+
visit$1.SKIP = SKIP;
|
|
5829
5829
|
/** Remove the current item */
|
|
5830
|
-
visit.REMOVE = REMOVE;
|
|
5830
|
+
visit$1.REMOVE = REMOVE;
|
|
5831
5831
|
/** Find the item at `path` from `cst` as the root */
|
|
5832
|
-
visit.itemAtPath = (cst, path) => {
|
|
5832
|
+
visit$1.itemAtPath = (cst, path) => {
|
|
5833
5833
|
let item = cst;
|
|
5834
5834
|
for (const [field, index] of path) {
|
|
5835
5835
|
const tok = item?.[field];
|
|
@@ -5846,8 +5846,8 @@ visit.itemAtPath = (cst, path) => {
|
|
|
5846
5846
|
*
|
|
5847
5847
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
5848
5848
|
*/
|
|
5849
|
-
visit.parentCollection = (cst, path) => {
|
|
5850
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5849
|
+
visit$1.parentCollection = (cst, path) => {
|
|
5850
|
+
const parent = visit$1.itemAtPath(cst, path.slice(0, -1));
|
|
5851
5851
|
const field = path[path.length - 1][0];
|
|
5852
5852
|
const coll = parent?.[field];
|
|
5853
5853
|
if (coll && 'items' in coll)
|
|
@@ -5986,7 +5986,7 @@ var cst = /*#__PURE__*/Object.freeze({
|
|
|
5986
5986
|
setScalarValue: setScalarValue,
|
|
5987
5987
|
stringify: stringify$1,
|
|
5988
5988
|
tokenType: tokenType,
|
|
5989
|
-
visit: visit
|
|
5989
|
+
visit: visit$1
|
|
5990
5990
|
});
|
|
5991
5991
|
|
|
5992
5992
|
/*
|
|
@@ -7826,7 +7826,7 @@ var YAML = /*#__PURE__*/Object.freeze({
|
|
|
7826
7826
|
parseAllDocuments: parseAllDocuments,
|
|
7827
7827
|
parseDocument: parseDocument,
|
|
7828
7828
|
stringify: stringify,
|
|
7829
|
-
visit: visit$
|
|
7829
|
+
visit: visit$2,
|
|
7830
7830
|
visitAsync: visitAsync
|
|
7831
7831
|
});
|
|
7832
7832
|
|
|
@@ -13027,6 +13027,126 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
13027
13027
|
return ret.join('\n') + '\n';
|
|
13028
13028
|
}
|
|
13029
13029
|
|
|
13030
|
+
var isPlainObject_1;
|
|
13031
|
+
var hasRequiredIsPlainObject;
|
|
13032
|
+
|
|
13033
|
+
function requireIsPlainObject () {
|
|
13034
|
+
if (hasRequiredIsPlainObject) return isPlainObject_1;
|
|
13035
|
+
hasRequiredIsPlainObject = 1;
|
|
13036
|
+
var baseGetTag = require_baseGetTag(),
|
|
13037
|
+
getPrototype = require_getPrototype(),
|
|
13038
|
+
isObjectLike = requireIsObjectLike();
|
|
13039
|
+
|
|
13040
|
+
/** `Object#toString` result references. */
|
|
13041
|
+
var objectTag = '[object Object]';
|
|
13042
|
+
|
|
13043
|
+
/** Used for built-in method references. */
|
|
13044
|
+
var funcProto = Function.prototype,
|
|
13045
|
+
objectProto = Object.prototype;
|
|
13046
|
+
|
|
13047
|
+
/** Used to resolve the decompiled source of functions. */
|
|
13048
|
+
var funcToString = funcProto.toString;
|
|
13049
|
+
|
|
13050
|
+
/** Used to check objects for own properties. */
|
|
13051
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
13052
|
+
|
|
13053
|
+
/** Used to infer the `Object` constructor. */
|
|
13054
|
+
var objectCtorString = funcToString.call(Object);
|
|
13055
|
+
|
|
13056
|
+
/**
|
|
13057
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
13058
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
13059
|
+
*
|
|
13060
|
+
* @static
|
|
13061
|
+
* @memberOf _
|
|
13062
|
+
* @since 0.8.0
|
|
13063
|
+
* @category Lang
|
|
13064
|
+
* @param {*} value The value to check.
|
|
13065
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
13066
|
+
* @example
|
|
13067
|
+
*
|
|
13068
|
+
* function Foo() {
|
|
13069
|
+
* this.a = 1;
|
|
13070
|
+
* }
|
|
13071
|
+
*
|
|
13072
|
+
* _.isPlainObject(new Foo);
|
|
13073
|
+
* // => false
|
|
13074
|
+
*
|
|
13075
|
+
* _.isPlainObject([1, 2, 3]);
|
|
13076
|
+
* // => false
|
|
13077
|
+
*
|
|
13078
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
13079
|
+
* // => true
|
|
13080
|
+
*
|
|
13081
|
+
* _.isPlainObject(Object.create(null));
|
|
13082
|
+
* // => true
|
|
13083
|
+
*/
|
|
13084
|
+
function isPlainObject(value) {
|
|
13085
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
13086
|
+
return false;
|
|
13087
|
+
}
|
|
13088
|
+
var proto = getPrototype(value);
|
|
13089
|
+
if (proto === null) {
|
|
13090
|
+
return true;
|
|
13091
|
+
}
|
|
13092
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
13093
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
13094
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
13095
|
+
}
|
|
13096
|
+
|
|
13097
|
+
isPlainObject_1 = isPlainObject;
|
|
13098
|
+
return isPlainObject_1;
|
|
13099
|
+
}
|
|
13100
|
+
|
|
13101
|
+
var isPlainObjectExports = requireIsPlainObject();
|
|
13102
|
+
var isPlainObject = /*@__PURE__*/getDefaultExportFromCjs(isPlainObjectExports);
|
|
13103
|
+
|
|
13104
|
+
function sortUnorderedArrays(data, paths = []) {
|
|
13105
|
+
if (!paths.length)
|
|
13106
|
+
return data;
|
|
13107
|
+
return visit(data, [], paths.map(p => p.split(".")));
|
|
13108
|
+
}
|
|
13109
|
+
function visit(node, path, patterns) {
|
|
13110
|
+
let visited = node;
|
|
13111
|
+
if (Array.isArray(node)) {
|
|
13112
|
+
visited = node.map((item, i) => visit(item, [...path, String(i)], patterns));
|
|
13113
|
+
}
|
|
13114
|
+
else if (isPlainObject(node)) {
|
|
13115
|
+
visited = Object.fromEntries(Object.entries(node).map(([k, v]) => [
|
|
13116
|
+
k,
|
|
13117
|
+
visit(v, [...path, k], patterns)
|
|
13118
|
+
]));
|
|
13119
|
+
}
|
|
13120
|
+
if (Array.isArray(visited) && patterns.some(p => matches(p, path))) {
|
|
13121
|
+
return visited
|
|
13122
|
+
.map(item => ({ item, key: canonical(item) }))
|
|
13123
|
+
.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))
|
|
13124
|
+
.map(({ item }) => item);
|
|
13125
|
+
}
|
|
13126
|
+
return visited;
|
|
13127
|
+
}
|
|
13128
|
+
function matches(pattern, path) {
|
|
13129
|
+
if (!pattern.length)
|
|
13130
|
+
return !path.length;
|
|
13131
|
+
const [head, ...rest] = pattern;
|
|
13132
|
+
if (head === "**") {
|
|
13133
|
+
return matches(rest, path) || (path.length > 0 && matches(pattern, path.slice(1)));
|
|
13134
|
+
}
|
|
13135
|
+
return path.length > 0 && (head === "*" || head === path[0]) && matches(rest, path.slice(1));
|
|
13136
|
+
}
|
|
13137
|
+
function canonical(value) {
|
|
13138
|
+
if (Array.isArray(value))
|
|
13139
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
13140
|
+
if (isPlainObject(value)) {
|
|
13141
|
+
const obj = value;
|
|
13142
|
+
const entries = Object.keys(obj)
|
|
13143
|
+
.sort()
|
|
13144
|
+
.map(k => `${JSON.stringify(k)}:${canonical(obj[k])}`);
|
|
13145
|
+
return `{${entries.join(",")}}`;
|
|
13146
|
+
}
|
|
13147
|
+
return JSON.stringify(value) ?? "undefined";
|
|
13148
|
+
}
|
|
13149
|
+
|
|
13030
13150
|
async function buildPlan(modules, unlimitedHttp, rootDir, options = {}) {
|
|
13031
13151
|
const { detailed = false, detectRenames = true, reporter = silentReporter, concurrency = DEFAULT_CONCURRENCY, source } = options;
|
|
13032
13152
|
const http = limitConcurrency(unlimitedHttp, concurrency);
|
|
@@ -13140,7 +13260,9 @@ async function applyPlan(plan, unlimitedHttp, opts = {}) {
|
|
|
13140
13260
|
}
|
|
13141
13261
|
return { errors };
|
|
13142
13262
|
}
|
|
13143
|
-
function diffObjectFields(
|
|
13263
|
+
function diffObjectFields(rawLocal, rawRemote, ignoredFields, unorderedPaths = []) {
|
|
13264
|
+
const local = sortUnorderedArrays(rawLocal, unorderedPaths);
|
|
13265
|
+
const remote = sortUnorderedArrays(rawRemote, unorderedPaths);
|
|
13144
13266
|
const allKeys = new Set([...Object.keys(local), ...Object.keys(remote)]);
|
|
13145
13267
|
const changed = [];
|
|
13146
13268
|
for (const key of allKeys) {
|
|
@@ -13152,15 +13274,18 @@ function diffObjectFields(local, remote, ignoredFields) {
|
|
|
13152
13274
|
}
|
|
13153
13275
|
return changed;
|
|
13154
13276
|
}
|
|
13155
|
-
function diffSchemaFields(local, remote, ignoredFields) {
|
|
13156
|
-
return diffObjectFields(local, remote, ignoredFields);
|
|
13277
|
+
function diffSchemaFields(local, remote, ignoredFields, unorderedPaths = []) {
|
|
13278
|
+
return diffObjectFields(local, remote, ignoredFields, unorderedPaths);
|
|
13279
|
+
}
|
|
13280
|
+
function stringifyForDiff(data) {
|
|
13281
|
+
return YAML.stringify(data, { sortMapEntries: true });
|
|
13157
13282
|
}
|
|
13158
13283
|
function buildUnifiedDiff(oldContent, newContent, filename) {
|
|
13159
13284
|
return createTwoFilesPatch(`remote/${filename}`, `local/${filename}`, oldContent, newContent);
|
|
13160
13285
|
}
|
|
13161
|
-
function renderSchemaDetail(localData, remoteData, ignoredFields) {
|
|
13162
|
-
const localYaml =
|
|
13163
|
-
const remoteYaml =
|
|
13286
|
+
function renderSchemaDetail(localData, remoteData, ignoredFields, unorderedPaths = []) {
|
|
13287
|
+
const localYaml = stringifyForDiff(sortUnorderedArrays(omit(localData, ignoredFields), unorderedPaths));
|
|
13288
|
+
const remoteYaml = stringifyForDiff(sortUnorderedArrays(omit(remoteData, ignoredFields), unorderedPaths));
|
|
13164
13289
|
return { schema: buildUnifiedDiff(remoteYaml, localYaml, "schema.yaml") };
|
|
13165
13290
|
}
|
|
13166
13291
|
function runAllAtOnce(tasks, label, onError, reporter) {
|
|
@@ -13195,12 +13320,26 @@ function formatError(e) {
|
|
|
13195
13320
|
return String(e);
|
|
13196
13321
|
}
|
|
13197
13322
|
|
|
13198
|
-
const
|
|
13323
|
+
const KEY_FIELDS = ["_id", "id"];
|
|
13324
|
+
function recordKeyField(record) {
|
|
13325
|
+
if (record === null || typeof record != "object") {
|
|
13326
|
+
return undefined;
|
|
13327
|
+
}
|
|
13328
|
+
return KEY_FIELDS.find(field => field in record);
|
|
13329
|
+
}
|
|
13330
|
+
function recordKey(record) {
|
|
13331
|
+
const field = recordKeyField(record);
|
|
13332
|
+
return field ? record[field] : undefined;
|
|
13333
|
+
}
|
|
13334
|
+
|
|
13335
|
+
const IGNORED_FIELDS$3 = [...KEY_FIELDS, "order"];
|
|
13336
|
+
const UNORDERED_PATHS$1 = ["required", "properties.**.required", "indexes"];
|
|
13199
13337
|
const bucketModule = {
|
|
13200
13338
|
name: "bucket",
|
|
13201
13339
|
displayName: "Bucket",
|
|
13202
13340
|
identityField: "title",
|
|
13203
13341
|
ignoredFields: IGNORED_FIELDS$3,
|
|
13342
|
+
unorderedPaths: UNORDERED_PATHS$1,
|
|
13204
13343
|
readLocal(rootDir, source) {
|
|
13205
13344
|
return readLocalSchemas(rootDir, "bucket", source);
|
|
13206
13345
|
},
|
|
@@ -13209,7 +13348,7 @@ const bucketModule = {
|
|
|
13209
13348
|
const buckets = unwrapList(res);
|
|
13210
13349
|
return buckets.map(b => ({
|
|
13211
13350
|
slug: sanitizeSlug(b.title),
|
|
13212
|
-
id: b
|
|
13351
|
+
id: recordKey(b),
|
|
13213
13352
|
data: b
|
|
13214
13353
|
}));
|
|
13215
13354
|
},
|
|
@@ -13229,21 +13368,21 @@ const bucketModule = {
|
|
|
13229
13368
|
deleteLocalSchema(rootDir, "bucket", slug);
|
|
13230
13369
|
},
|
|
13231
13370
|
diffFields(local, remote) {
|
|
13232
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$3);
|
|
13371
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13233
13372
|
},
|
|
13234
13373
|
renderDetail(local, remote) {
|
|
13235
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3);
|
|
13374
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13236
13375
|
},
|
|
13237
13376
|
summaryLine(resource) {
|
|
13238
13377
|
const propCount = Object.keys(resource.data.properties ?? {}).length;
|
|
13239
13378
|
return `${propCount} properties`;
|
|
13240
13379
|
},
|
|
13241
13380
|
extractLocalId(data) {
|
|
13242
|
-
return data
|
|
13381
|
+
return recordKey(data);
|
|
13243
13382
|
}
|
|
13244
13383
|
};
|
|
13245
13384
|
|
|
13246
|
-
const IGNORED_FIELDS$2 = [
|
|
13385
|
+
const IGNORED_FIELDS$2 = [...KEY_FIELDS, "updated_at"];
|
|
13247
13386
|
const envVarModule = {
|
|
13248
13387
|
name: "env-var",
|
|
13249
13388
|
displayName: "Environment Variable",
|
|
@@ -13257,7 +13396,7 @@ const envVarModule = {
|
|
|
13257
13396
|
const items = unwrapList(res);
|
|
13258
13397
|
return items.map(e => ({
|
|
13259
13398
|
slug: sanitizeSlug(e.key),
|
|
13260
|
-
id: e
|
|
13399
|
+
id: recordKey(e),
|
|
13261
13400
|
data: e
|
|
13262
13401
|
}));
|
|
13263
13402
|
},
|
|
@@ -13286,7 +13425,7 @@ const envVarModule = {
|
|
|
13286
13425
|
return `key: ${resource.data.key}`;
|
|
13287
13426
|
},
|
|
13288
13427
|
extractLocalId(data) {
|
|
13289
|
-
return data
|
|
13428
|
+
return recordKey(data);
|
|
13290
13429
|
}
|
|
13291
13430
|
};
|
|
13292
13431
|
|
|
@@ -16011,15 +16150,14 @@ function requireSemver () {
|
|
|
16011
16150
|
var semverExports = requireSemver();
|
|
16012
16151
|
var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
16013
16152
|
|
|
16014
|
-
const SCHEMA_IGNORED = [
|
|
16153
|
+
const SCHEMA_IGNORED = [...KEY_FIELDS, "env_vars", "secrets", "order"];
|
|
16154
|
+
const SCHEMA_UNORDERED = ["triggers.*.options.authenticate"];
|
|
16015
16155
|
function indexFilename(language) {
|
|
16016
16156
|
return language === "typescript" ? "index.ts" : "index.mjs";
|
|
16017
16157
|
}
|
|
16018
16158
|
function extractId(v) {
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
}
|
|
16022
|
-
return String(v);
|
|
16159
|
+
const key = recordKey(v);
|
|
16160
|
+
return key === undefined ? String(v) : String(key);
|
|
16023
16161
|
}
|
|
16024
16162
|
function byCodeUnit(a, b) {
|
|
16025
16163
|
if (a === b)
|
|
@@ -16068,6 +16206,7 @@ const functionModule = {
|
|
|
16068
16206
|
displayName: "Function",
|
|
16069
16207
|
identityField: "name",
|
|
16070
16208
|
ignoredFields: SCHEMA_IGNORED,
|
|
16209
|
+
unorderedPaths: SCHEMA_UNORDERED,
|
|
16071
16210
|
readSchema(rootDir, slug, source = diskSource) {
|
|
16072
16211
|
return readSourceYaml(source, path.join(rootDir, "function", slug, "schema.yaml"));
|
|
16073
16212
|
},
|
|
@@ -16103,7 +16242,7 @@ const functionModule = {
|
|
|
16103
16242
|
const res = await http.get("function");
|
|
16104
16243
|
const fns = unwrapList(res);
|
|
16105
16244
|
return Promise.all(fns.map(async (fn) => {
|
|
16106
|
-
const id = fn
|
|
16245
|
+
const id = recordKey(fn);
|
|
16107
16246
|
const [indexRes, depsRes] = await Promise.all([
|
|
16108
16247
|
http.get(`function/${id}/index`).catch(emptyIfMissing({ index: "" })),
|
|
16109
16248
|
http
|
|
@@ -16136,7 +16275,7 @@ const functionModule = {
|
|
|
16136
16275
|
},
|
|
16137
16276
|
async createSchema(http, schema) {
|
|
16138
16277
|
const created = await http.post("function", omit(schema, ["env_vars", "secrets"]));
|
|
16139
|
-
const id = (created
|
|
16278
|
+
const id = recordKey(created) ?? recordKey(schema);
|
|
16140
16279
|
if (!id)
|
|
16141
16280
|
return undefined;
|
|
16142
16281
|
const envVarIds = schema.env_vars ?? [];
|
|
@@ -16219,7 +16358,7 @@ const functionModule = {
|
|
|
16219
16358
|
},
|
|
16220
16359
|
diffFields(local, remote) {
|
|
16221
16360
|
const changed = [];
|
|
16222
|
-
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED);
|
|
16361
|
+
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED, SCHEMA_UNORDERED);
|
|
16223
16362
|
if (schemaChanged.length)
|
|
16224
16363
|
changed.push("schema");
|
|
16225
16364
|
if (local.index !== remote.index)
|
|
@@ -16238,8 +16377,8 @@ const functionModule = {
|
|
|
16238
16377
|
},
|
|
16239
16378
|
renderDetail(local, remote) {
|
|
16240
16379
|
const result = {};
|
|
16241
|
-
const localSchemaYaml =
|
|
16242
|
-
const remoteSchemaYaml =
|
|
16380
|
+
const localSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(local.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16381
|
+
const remoteSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(remote.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16243
16382
|
if (localSchemaYaml !== remoteSchemaYaml) {
|
|
16244
16383
|
result["schema"] = buildUnifiedDiff(remoteSchemaYaml, localSchemaYaml, "schema.yaml");
|
|
16245
16384
|
}
|
|
@@ -16259,7 +16398,7 @@ const functionModule = {
|
|
|
16259
16398
|
return `${triggerCount} trigger${triggerCount !== 1 ? "s" : ""}`;
|
|
16260
16399
|
},
|
|
16261
16400
|
extractLocalId(data) {
|
|
16262
|
-
return data.schema
|
|
16401
|
+
return recordKey(data.schema);
|
|
16263
16402
|
},
|
|
16264
16403
|
watchedFiles: ["schema.yaml", "index.ts", "index.mjs", "index.js", "package.json"],
|
|
16265
16404
|
async devHandleEvent(ctx) {
|
|
@@ -16286,7 +16425,7 @@ const functionModule = {
|
|
|
16286
16425
|
const schema = self.readSchema(rootDir, slug);
|
|
16287
16426
|
if (!schema)
|
|
16288
16427
|
return;
|
|
16289
|
-
const newLocalId = schema
|
|
16428
|
+
const newLocalId = recordKey(schema);
|
|
16290
16429
|
if (newLocalId) {
|
|
16291
16430
|
const pending = consumePendingDeleteByRemoteId(newLocalId);
|
|
16292
16431
|
if (pending) {
|
|
@@ -16347,12 +16486,18 @@ const functionModule = {
|
|
|
16347
16486
|
}
|
|
16348
16487
|
};
|
|
16349
16488
|
|
|
16350
|
-
const IGNORED_FIELDS$1 = [
|
|
16489
|
+
const IGNORED_FIELDS$1 = [...KEY_FIELDS, "system"];
|
|
16490
|
+
const UNORDERED_PATHS = [
|
|
16491
|
+
"statement",
|
|
16492
|
+
"statement.*.resource.include",
|
|
16493
|
+
"statement.*.resource.exclude"
|
|
16494
|
+
];
|
|
16351
16495
|
const policyModule = {
|
|
16352
16496
|
name: "policy",
|
|
16353
16497
|
displayName: "Policy",
|
|
16354
16498
|
identityField: "name",
|
|
16355
16499
|
ignoredFields: IGNORED_FIELDS$1,
|
|
16500
|
+
unorderedPaths: UNORDERED_PATHS,
|
|
16356
16501
|
readLocal(rootDir, source) {
|
|
16357
16502
|
return readLocalSchemas(rootDir, "policy", source);
|
|
16358
16503
|
},
|
|
@@ -16363,7 +16508,7 @@ const policyModule = {
|
|
|
16363
16508
|
.filter(p => !p.system)
|
|
16364
16509
|
.map(p => ({
|
|
16365
16510
|
slug: sanitizeSlug(p.name),
|
|
16366
|
-
id: p
|
|
16511
|
+
id: recordKey(p),
|
|
16367
16512
|
data: p
|
|
16368
16513
|
}));
|
|
16369
16514
|
},
|
|
@@ -16385,21 +16530,21 @@ const policyModule = {
|
|
|
16385
16530
|
deleteLocalSchema(rootDir, "policy", slug);
|
|
16386
16531
|
},
|
|
16387
16532
|
diffFields(local, remote) {
|
|
16388
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$1);
|
|
16533
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16389
16534
|
},
|
|
16390
16535
|
renderDetail(local, remote) {
|
|
16391
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1);
|
|
16536
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16392
16537
|
},
|
|
16393
16538
|
summaryLine(resource) {
|
|
16394
16539
|
const stmts = resource.data.statement?.length ?? 0;
|
|
16395
16540
|
return `${stmts} statement${stmts !== 1 ? "s" : ""}`;
|
|
16396
16541
|
},
|
|
16397
16542
|
extractLocalId(data) {
|
|
16398
|
-
return data
|
|
16543
|
+
return recordKey(data);
|
|
16399
16544
|
}
|
|
16400
16545
|
};
|
|
16401
16546
|
|
|
16402
|
-
const IGNORED_FIELDS = [
|
|
16547
|
+
const IGNORED_FIELDS = [...KEY_FIELDS, "value", "updated_at"];
|
|
16403
16548
|
const secretModule = {
|
|
16404
16549
|
name: "secret",
|
|
16405
16550
|
displayName: "Secret",
|
|
@@ -16413,7 +16558,7 @@ const secretModule = {
|
|
|
16413
16558
|
const items = unwrapList(res);
|
|
16414
16559
|
return items.map(s => ({
|
|
16415
16560
|
slug: sanitizeSlug(s.key),
|
|
16416
|
-
id: s
|
|
16561
|
+
id: recordKey(s),
|
|
16417
16562
|
data: s
|
|
16418
16563
|
}));
|
|
16419
16564
|
},
|
|
@@ -16442,7 +16587,7 @@ const secretModule = {
|
|
|
16442
16587
|
return `key: ${resource.data.key}`;
|
|
16443
16588
|
},
|
|
16444
16589
|
extractLocalId(data) {
|
|
16445
|
-
return data
|
|
16590
|
+
return recordKey(data);
|
|
16446
16591
|
}
|
|
16447
16592
|
};
|
|
16448
16593
|
|