@spica-devkit/testing 0.20.8 → 0.21.0-beta.2
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.mjs
CHANGED
|
@@ -418,7 +418,7 @@ const REMOVE$1 = Symbol('remove node');
|
|
|
418
418
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
419
419
|
* specific defined one will be used for each node.
|
|
420
420
|
*/
|
|
421
|
-
function visit$
|
|
421
|
+
function visit$2(node, visitor) {
|
|
422
422
|
const visitor_ = initVisitor(visitor);
|
|
423
423
|
if (isDocument(node)) {
|
|
424
424
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
@@ -432,11 +432,11 @@ function visit$1(node, visitor) {
|
|
|
432
432
|
// namespace using `var`, but then complains about that because
|
|
433
433
|
// `unique symbol` must be `const`.
|
|
434
434
|
/** Terminate visit traversal completely */
|
|
435
|
-
visit$
|
|
435
|
+
visit$2.BREAK = BREAK$1;
|
|
436
436
|
/** Do not visit the children of the current node */
|
|
437
|
-
visit$
|
|
437
|
+
visit$2.SKIP = SKIP$1;
|
|
438
438
|
/** Remove the current node */
|
|
439
|
-
visit$
|
|
439
|
+
visit$2.REMOVE = REMOVE$1;
|
|
440
440
|
function visit_(key, node, visitor, path) {
|
|
441
441
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
442
442
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
@@ -767,7 +767,7 @@ class Directives {
|
|
|
767
767
|
let tagNames;
|
|
768
768
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
769
769
|
const tags = {};
|
|
770
|
-
visit$
|
|
770
|
+
visit$2(doc.contents, (_key, node) => {
|
|
771
771
|
if (isNode(node) && node.tag)
|
|
772
772
|
tags[node.tag] = true;
|
|
773
773
|
});
|
|
@@ -802,7 +802,7 @@ function anchorIsValid(anchor) {
|
|
|
802
802
|
}
|
|
803
803
|
function anchorNames(root) {
|
|
804
804
|
const anchors = new Set();
|
|
805
|
-
visit$
|
|
805
|
+
visit$2(root, {
|
|
806
806
|
Value(_key, node) {
|
|
807
807
|
if (node.anchor)
|
|
808
808
|
anchors.add(node.anchor);
|
|
@@ -996,7 +996,7 @@ class Alias extends NodeBase {
|
|
|
996
996
|
}
|
|
997
997
|
else {
|
|
998
998
|
nodes = [];
|
|
999
|
-
visit$
|
|
999
|
+
visit$2(doc, {
|
|
1000
1000
|
Node: (_key, node) => {
|
|
1001
1001
|
if (isAlias(node) || hasAnchor(node))
|
|
1002
1002
|
nodes.push(node);
|
|
@@ -5793,7 +5793,7 @@ const REMOVE = Symbol('remove item');
|
|
|
5793
5793
|
* visitor is called on item entry, next visitors are called after handling
|
|
5794
5794
|
* a non-empty `key` and when exiting the item.
|
|
5795
5795
|
*/
|
|
5796
|
-
function visit(cst, visitor) {
|
|
5796
|
+
function visit$1(cst, visitor) {
|
|
5797
5797
|
if ('type' in cst && cst.type === 'document')
|
|
5798
5798
|
cst = { start: cst.start, value: cst.value };
|
|
5799
5799
|
_visit(Object.freeze([]), cst, visitor);
|
|
@@ -5802,13 +5802,13 @@ function visit(cst, visitor) {
|
|
|
5802
5802
|
// namespace using `var`, but then complains about that because
|
|
5803
5803
|
// `unique symbol` must be `const`.
|
|
5804
5804
|
/** Terminate visit traversal completely */
|
|
5805
|
-
visit.BREAK = BREAK;
|
|
5805
|
+
visit$1.BREAK = BREAK;
|
|
5806
5806
|
/** Do not visit the children of the current item */
|
|
5807
|
-
visit.SKIP = SKIP;
|
|
5807
|
+
visit$1.SKIP = SKIP;
|
|
5808
5808
|
/** Remove the current item */
|
|
5809
|
-
visit.REMOVE = REMOVE;
|
|
5809
|
+
visit$1.REMOVE = REMOVE;
|
|
5810
5810
|
/** Find the item at `path` from `cst` as the root */
|
|
5811
|
-
visit.itemAtPath = (cst, path) => {
|
|
5811
|
+
visit$1.itemAtPath = (cst, path) => {
|
|
5812
5812
|
let item = cst;
|
|
5813
5813
|
for (const [field, index] of path) {
|
|
5814
5814
|
const tok = item?.[field];
|
|
@@ -5825,8 +5825,8 @@ visit.itemAtPath = (cst, path) => {
|
|
|
5825
5825
|
*
|
|
5826
5826
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
5827
5827
|
*/
|
|
5828
|
-
visit.parentCollection = (cst, path) => {
|
|
5829
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5828
|
+
visit$1.parentCollection = (cst, path) => {
|
|
5829
|
+
const parent = visit$1.itemAtPath(cst, path.slice(0, -1));
|
|
5830
5830
|
const field = path[path.length - 1][0];
|
|
5831
5831
|
const coll = parent?.[field];
|
|
5832
5832
|
if (coll && 'items' in coll)
|
|
@@ -5965,7 +5965,7 @@ var cst = /*#__PURE__*/Object.freeze({
|
|
|
5965
5965
|
setScalarValue: setScalarValue,
|
|
5966
5966
|
stringify: stringify$1,
|
|
5967
5967
|
tokenType: tokenType,
|
|
5968
|
-
visit: visit
|
|
5968
|
+
visit: visit$1
|
|
5969
5969
|
});
|
|
5970
5970
|
|
|
5971
5971
|
/*
|
|
@@ -7805,7 +7805,7 @@ var YAML = /*#__PURE__*/Object.freeze({
|
|
|
7805
7805
|
parseAllDocuments: parseAllDocuments,
|
|
7806
7806
|
parseDocument: parseDocument,
|
|
7807
7807
|
stringify: stringify,
|
|
7808
|
-
visit: visit$
|
|
7808
|
+
visit: visit$2,
|
|
7809
7809
|
visitAsync: visitAsync
|
|
7810
7810
|
});
|
|
7811
7811
|
|
|
@@ -13006,6 +13006,126 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
13006
13006
|
return ret.join('\n') + '\n';
|
|
13007
13007
|
}
|
|
13008
13008
|
|
|
13009
|
+
var isPlainObject_1;
|
|
13010
|
+
var hasRequiredIsPlainObject;
|
|
13011
|
+
|
|
13012
|
+
function requireIsPlainObject () {
|
|
13013
|
+
if (hasRequiredIsPlainObject) return isPlainObject_1;
|
|
13014
|
+
hasRequiredIsPlainObject = 1;
|
|
13015
|
+
var baseGetTag = require_baseGetTag(),
|
|
13016
|
+
getPrototype = require_getPrototype(),
|
|
13017
|
+
isObjectLike = requireIsObjectLike();
|
|
13018
|
+
|
|
13019
|
+
/** `Object#toString` result references. */
|
|
13020
|
+
var objectTag = '[object Object]';
|
|
13021
|
+
|
|
13022
|
+
/** Used for built-in method references. */
|
|
13023
|
+
var funcProto = Function.prototype,
|
|
13024
|
+
objectProto = Object.prototype;
|
|
13025
|
+
|
|
13026
|
+
/** Used to resolve the decompiled source of functions. */
|
|
13027
|
+
var funcToString = funcProto.toString;
|
|
13028
|
+
|
|
13029
|
+
/** Used to check objects for own properties. */
|
|
13030
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
13031
|
+
|
|
13032
|
+
/** Used to infer the `Object` constructor. */
|
|
13033
|
+
var objectCtorString = funcToString.call(Object);
|
|
13034
|
+
|
|
13035
|
+
/**
|
|
13036
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
13037
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
13038
|
+
*
|
|
13039
|
+
* @static
|
|
13040
|
+
* @memberOf _
|
|
13041
|
+
* @since 0.8.0
|
|
13042
|
+
* @category Lang
|
|
13043
|
+
* @param {*} value The value to check.
|
|
13044
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
13045
|
+
* @example
|
|
13046
|
+
*
|
|
13047
|
+
* function Foo() {
|
|
13048
|
+
* this.a = 1;
|
|
13049
|
+
* }
|
|
13050
|
+
*
|
|
13051
|
+
* _.isPlainObject(new Foo);
|
|
13052
|
+
* // => false
|
|
13053
|
+
*
|
|
13054
|
+
* _.isPlainObject([1, 2, 3]);
|
|
13055
|
+
* // => false
|
|
13056
|
+
*
|
|
13057
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
13058
|
+
* // => true
|
|
13059
|
+
*
|
|
13060
|
+
* _.isPlainObject(Object.create(null));
|
|
13061
|
+
* // => true
|
|
13062
|
+
*/
|
|
13063
|
+
function isPlainObject(value) {
|
|
13064
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
13065
|
+
return false;
|
|
13066
|
+
}
|
|
13067
|
+
var proto = getPrototype(value);
|
|
13068
|
+
if (proto === null) {
|
|
13069
|
+
return true;
|
|
13070
|
+
}
|
|
13071
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
13072
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
13073
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
13074
|
+
}
|
|
13075
|
+
|
|
13076
|
+
isPlainObject_1 = isPlainObject;
|
|
13077
|
+
return isPlainObject_1;
|
|
13078
|
+
}
|
|
13079
|
+
|
|
13080
|
+
var isPlainObjectExports = requireIsPlainObject();
|
|
13081
|
+
var isPlainObject = /*@__PURE__*/getDefaultExportFromCjs(isPlainObjectExports);
|
|
13082
|
+
|
|
13083
|
+
function sortUnorderedArrays(data, paths = []) {
|
|
13084
|
+
if (!paths.length)
|
|
13085
|
+
return data;
|
|
13086
|
+
return visit(data, [], paths.map(p => p.split(".")));
|
|
13087
|
+
}
|
|
13088
|
+
function visit(node, path, patterns) {
|
|
13089
|
+
let visited = node;
|
|
13090
|
+
if (Array.isArray(node)) {
|
|
13091
|
+
visited = node.map((item, i) => visit(item, [...path, String(i)], patterns));
|
|
13092
|
+
}
|
|
13093
|
+
else if (isPlainObject(node)) {
|
|
13094
|
+
visited = Object.fromEntries(Object.entries(node).map(([k, v]) => [
|
|
13095
|
+
k,
|
|
13096
|
+
visit(v, [...path, k], patterns)
|
|
13097
|
+
]));
|
|
13098
|
+
}
|
|
13099
|
+
if (Array.isArray(visited) && patterns.some(p => matches(p, path))) {
|
|
13100
|
+
return visited
|
|
13101
|
+
.map(item => ({ item, key: canonical(item) }))
|
|
13102
|
+
.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))
|
|
13103
|
+
.map(({ item }) => item);
|
|
13104
|
+
}
|
|
13105
|
+
return visited;
|
|
13106
|
+
}
|
|
13107
|
+
function matches(pattern, path) {
|
|
13108
|
+
if (!pattern.length)
|
|
13109
|
+
return !path.length;
|
|
13110
|
+
const [head, ...rest] = pattern;
|
|
13111
|
+
if (head === "**") {
|
|
13112
|
+
return matches(rest, path) || (path.length > 0 && matches(pattern, path.slice(1)));
|
|
13113
|
+
}
|
|
13114
|
+
return path.length > 0 && (head === "*" || head === path[0]) && matches(rest, path.slice(1));
|
|
13115
|
+
}
|
|
13116
|
+
function canonical(value) {
|
|
13117
|
+
if (Array.isArray(value))
|
|
13118
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
13119
|
+
if (isPlainObject(value)) {
|
|
13120
|
+
const obj = value;
|
|
13121
|
+
const entries = Object.keys(obj)
|
|
13122
|
+
.sort()
|
|
13123
|
+
.map(k => `${JSON.stringify(k)}:${canonical(obj[k])}`);
|
|
13124
|
+
return `{${entries.join(",")}}`;
|
|
13125
|
+
}
|
|
13126
|
+
return JSON.stringify(value) ?? "undefined";
|
|
13127
|
+
}
|
|
13128
|
+
|
|
13009
13129
|
async function buildPlan(modules, unlimitedHttp, rootDir, options = {}) {
|
|
13010
13130
|
const { detailed = false, detectRenames = true, reporter = silentReporter, concurrency = DEFAULT_CONCURRENCY, source } = options;
|
|
13011
13131
|
const http = limitConcurrency(unlimitedHttp, concurrency);
|
|
@@ -13119,7 +13239,9 @@ async function applyPlan(plan, unlimitedHttp, opts = {}) {
|
|
|
13119
13239
|
}
|
|
13120
13240
|
return { errors };
|
|
13121
13241
|
}
|
|
13122
|
-
function diffObjectFields(
|
|
13242
|
+
function diffObjectFields(rawLocal, rawRemote, ignoredFields, unorderedPaths = []) {
|
|
13243
|
+
const local = sortUnorderedArrays(rawLocal, unorderedPaths);
|
|
13244
|
+
const remote = sortUnorderedArrays(rawRemote, unorderedPaths);
|
|
13123
13245
|
const allKeys = new Set([...Object.keys(local), ...Object.keys(remote)]);
|
|
13124
13246
|
const changed = [];
|
|
13125
13247
|
for (const key of allKeys) {
|
|
@@ -13131,15 +13253,18 @@ function diffObjectFields(local, remote, ignoredFields) {
|
|
|
13131
13253
|
}
|
|
13132
13254
|
return changed;
|
|
13133
13255
|
}
|
|
13134
|
-
function diffSchemaFields(local, remote, ignoredFields) {
|
|
13135
|
-
return diffObjectFields(local, remote, ignoredFields);
|
|
13256
|
+
function diffSchemaFields(local, remote, ignoredFields, unorderedPaths = []) {
|
|
13257
|
+
return diffObjectFields(local, remote, ignoredFields, unorderedPaths);
|
|
13258
|
+
}
|
|
13259
|
+
function stringifyForDiff(data) {
|
|
13260
|
+
return YAML.stringify(data, { sortMapEntries: true });
|
|
13136
13261
|
}
|
|
13137
13262
|
function buildUnifiedDiff(oldContent, newContent, filename) {
|
|
13138
13263
|
return createTwoFilesPatch(`remote/${filename}`, `local/${filename}`, oldContent, newContent);
|
|
13139
13264
|
}
|
|
13140
|
-
function renderSchemaDetail(localData, remoteData, ignoredFields) {
|
|
13141
|
-
const localYaml =
|
|
13142
|
-
const remoteYaml =
|
|
13265
|
+
function renderSchemaDetail(localData, remoteData, ignoredFields, unorderedPaths = []) {
|
|
13266
|
+
const localYaml = stringifyForDiff(sortUnorderedArrays(omit(localData, ignoredFields), unorderedPaths));
|
|
13267
|
+
const remoteYaml = stringifyForDiff(sortUnorderedArrays(omit(remoteData, ignoredFields), unorderedPaths));
|
|
13143
13268
|
return { schema: buildUnifiedDiff(remoteYaml, localYaml, "schema.yaml") };
|
|
13144
13269
|
}
|
|
13145
13270
|
function runAllAtOnce(tasks, label, onError, reporter) {
|
|
@@ -13174,12 +13299,26 @@ function formatError(e) {
|
|
|
13174
13299
|
return String(e);
|
|
13175
13300
|
}
|
|
13176
13301
|
|
|
13177
|
-
const
|
|
13302
|
+
const KEY_FIELDS = ["_id", "id"];
|
|
13303
|
+
function recordKeyField(record) {
|
|
13304
|
+
if (record === null || typeof record != "object") {
|
|
13305
|
+
return undefined;
|
|
13306
|
+
}
|
|
13307
|
+
return KEY_FIELDS.find(field => field in record);
|
|
13308
|
+
}
|
|
13309
|
+
function recordKey(record) {
|
|
13310
|
+
const field = recordKeyField(record);
|
|
13311
|
+
return field ? record[field] : undefined;
|
|
13312
|
+
}
|
|
13313
|
+
|
|
13314
|
+
const IGNORED_FIELDS$3 = [...KEY_FIELDS, "order"];
|
|
13315
|
+
const UNORDERED_PATHS$1 = ["required", "properties.**.required", "indexes"];
|
|
13178
13316
|
const bucketModule = {
|
|
13179
13317
|
name: "bucket",
|
|
13180
13318
|
displayName: "Bucket",
|
|
13181
13319
|
identityField: "title",
|
|
13182
13320
|
ignoredFields: IGNORED_FIELDS$3,
|
|
13321
|
+
unorderedPaths: UNORDERED_PATHS$1,
|
|
13183
13322
|
readLocal(rootDir, source) {
|
|
13184
13323
|
return readLocalSchemas(rootDir, "bucket", source);
|
|
13185
13324
|
},
|
|
@@ -13188,7 +13327,7 @@ const bucketModule = {
|
|
|
13188
13327
|
const buckets = unwrapList(res);
|
|
13189
13328
|
return buckets.map(b => ({
|
|
13190
13329
|
slug: sanitizeSlug(b.title),
|
|
13191
|
-
id: b
|
|
13330
|
+
id: recordKey(b),
|
|
13192
13331
|
data: b
|
|
13193
13332
|
}));
|
|
13194
13333
|
},
|
|
@@ -13208,21 +13347,21 @@ const bucketModule = {
|
|
|
13208
13347
|
deleteLocalSchema(rootDir, "bucket", slug);
|
|
13209
13348
|
},
|
|
13210
13349
|
diffFields(local, remote) {
|
|
13211
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$3);
|
|
13350
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13212
13351
|
},
|
|
13213
13352
|
renderDetail(local, remote) {
|
|
13214
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3);
|
|
13353
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13215
13354
|
},
|
|
13216
13355
|
summaryLine(resource) {
|
|
13217
13356
|
const propCount = Object.keys(resource.data.properties ?? {}).length;
|
|
13218
13357
|
return `${propCount} properties`;
|
|
13219
13358
|
},
|
|
13220
13359
|
extractLocalId(data) {
|
|
13221
|
-
return data
|
|
13360
|
+
return recordKey(data);
|
|
13222
13361
|
}
|
|
13223
13362
|
};
|
|
13224
13363
|
|
|
13225
|
-
const IGNORED_FIELDS$2 = [
|
|
13364
|
+
const IGNORED_FIELDS$2 = [...KEY_FIELDS, "updated_at"];
|
|
13226
13365
|
const envVarModule = {
|
|
13227
13366
|
name: "env-var",
|
|
13228
13367
|
displayName: "Environment Variable",
|
|
@@ -13236,7 +13375,7 @@ const envVarModule = {
|
|
|
13236
13375
|
const items = unwrapList(res);
|
|
13237
13376
|
return items.map(e => ({
|
|
13238
13377
|
slug: sanitizeSlug(e.key),
|
|
13239
|
-
id: e
|
|
13378
|
+
id: recordKey(e),
|
|
13240
13379
|
data: e
|
|
13241
13380
|
}));
|
|
13242
13381
|
},
|
|
@@ -13265,7 +13404,7 @@ const envVarModule = {
|
|
|
13265
13404
|
return `key: ${resource.data.key}`;
|
|
13266
13405
|
},
|
|
13267
13406
|
extractLocalId(data) {
|
|
13268
|
-
return data
|
|
13407
|
+
return recordKey(data);
|
|
13269
13408
|
}
|
|
13270
13409
|
};
|
|
13271
13410
|
|
|
@@ -15990,15 +16129,14 @@ function requireSemver () {
|
|
|
15990
16129
|
var semverExports = requireSemver();
|
|
15991
16130
|
var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
15992
16131
|
|
|
15993
|
-
const SCHEMA_IGNORED = [
|
|
16132
|
+
const SCHEMA_IGNORED = [...KEY_FIELDS, "env_vars", "secrets", "order"];
|
|
16133
|
+
const SCHEMA_UNORDERED = ["triggers.*.options.authenticate"];
|
|
15994
16134
|
function indexFilename(language) {
|
|
15995
16135
|
return language === "typescript" ? "index.ts" : "index.mjs";
|
|
15996
16136
|
}
|
|
15997
16137
|
function extractId(v) {
|
|
15998
|
-
|
|
15999
|
-
|
|
16000
|
-
}
|
|
16001
|
-
return String(v);
|
|
16138
|
+
const key = recordKey(v);
|
|
16139
|
+
return key === undefined ? String(v) : String(key);
|
|
16002
16140
|
}
|
|
16003
16141
|
function byCodeUnit(a, b) {
|
|
16004
16142
|
if (a === b)
|
|
@@ -16047,6 +16185,7 @@ const functionModule = {
|
|
|
16047
16185
|
displayName: "Function",
|
|
16048
16186
|
identityField: "name",
|
|
16049
16187
|
ignoredFields: SCHEMA_IGNORED,
|
|
16188
|
+
unorderedPaths: SCHEMA_UNORDERED,
|
|
16050
16189
|
readSchema(rootDir, slug, source = diskSource) {
|
|
16051
16190
|
return readSourceYaml(source, path.join(rootDir, "function", slug, "schema.yaml"));
|
|
16052
16191
|
},
|
|
@@ -16082,7 +16221,7 @@ const functionModule = {
|
|
|
16082
16221
|
const res = await http.get("function");
|
|
16083
16222
|
const fns = unwrapList(res);
|
|
16084
16223
|
return Promise.all(fns.map(async (fn) => {
|
|
16085
|
-
const id = fn
|
|
16224
|
+
const id = recordKey(fn);
|
|
16086
16225
|
const [indexRes, depsRes] = await Promise.all([
|
|
16087
16226
|
http.get(`function/${id}/index`).catch(emptyIfMissing({ index: "" })),
|
|
16088
16227
|
http
|
|
@@ -16115,7 +16254,7 @@ const functionModule = {
|
|
|
16115
16254
|
},
|
|
16116
16255
|
async createSchema(http, schema) {
|
|
16117
16256
|
const created = await http.post("function", omit(schema, ["env_vars", "secrets"]));
|
|
16118
|
-
const id = (created
|
|
16257
|
+
const id = recordKey(created) ?? recordKey(schema);
|
|
16119
16258
|
if (!id)
|
|
16120
16259
|
return undefined;
|
|
16121
16260
|
const envVarIds = schema.env_vars ?? [];
|
|
@@ -16198,7 +16337,7 @@ const functionModule = {
|
|
|
16198
16337
|
},
|
|
16199
16338
|
diffFields(local, remote) {
|
|
16200
16339
|
const changed = [];
|
|
16201
|
-
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED);
|
|
16340
|
+
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED, SCHEMA_UNORDERED);
|
|
16202
16341
|
if (schemaChanged.length)
|
|
16203
16342
|
changed.push("schema");
|
|
16204
16343
|
if (local.index !== remote.index)
|
|
@@ -16217,8 +16356,8 @@ const functionModule = {
|
|
|
16217
16356
|
},
|
|
16218
16357
|
renderDetail(local, remote) {
|
|
16219
16358
|
const result = {};
|
|
16220
|
-
const localSchemaYaml =
|
|
16221
|
-
const remoteSchemaYaml =
|
|
16359
|
+
const localSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(local.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16360
|
+
const remoteSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(remote.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16222
16361
|
if (localSchemaYaml !== remoteSchemaYaml) {
|
|
16223
16362
|
result["schema"] = buildUnifiedDiff(remoteSchemaYaml, localSchemaYaml, "schema.yaml");
|
|
16224
16363
|
}
|
|
@@ -16238,7 +16377,7 @@ const functionModule = {
|
|
|
16238
16377
|
return `${triggerCount} trigger${triggerCount !== 1 ? "s" : ""}`;
|
|
16239
16378
|
},
|
|
16240
16379
|
extractLocalId(data) {
|
|
16241
|
-
return data.schema
|
|
16380
|
+
return recordKey(data.schema);
|
|
16242
16381
|
},
|
|
16243
16382
|
watchedFiles: ["schema.yaml", "index.ts", "index.mjs", "index.js", "package.json"],
|
|
16244
16383
|
async devHandleEvent(ctx) {
|
|
@@ -16265,7 +16404,7 @@ const functionModule = {
|
|
|
16265
16404
|
const schema = self.readSchema(rootDir, slug);
|
|
16266
16405
|
if (!schema)
|
|
16267
16406
|
return;
|
|
16268
|
-
const newLocalId = schema
|
|
16407
|
+
const newLocalId = recordKey(schema);
|
|
16269
16408
|
if (newLocalId) {
|
|
16270
16409
|
const pending = consumePendingDeleteByRemoteId(newLocalId);
|
|
16271
16410
|
if (pending) {
|
|
@@ -16326,12 +16465,18 @@ const functionModule = {
|
|
|
16326
16465
|
}
|
|
16327
16466
|
};
|
|
16328
16467
|
|
|
16329
|
-
const IGNORED_FIELDS$1 = [
|
|
16468
|
+
const IGNORED_FIELDS$1 = [...KEY_FIELDS, "system"];
|
|
16469
|
+
const UNORDERED_PATHS = [
|
|
16470
|
+
"statement",
|
|
16471
|
+
"statement.*.resource.include",
|
|
16472
|
+
"statement.*.resource.exclude"
|
|
16473
|
+
];
|
|
16330
16474
|
const policyModule = {
|
|
16331
16475
|
name: "policy",
|
|
16332
16476
|
displayName: "Policy",
|
|
16333
16477
|
identityField: "name",
|
|
16334
16478
|
ignoredFields: IGNORED_FIELDS$1,
|
|
16479
|
+
unorderedPaths: UNORDERED_PATHS,
|
|
16335
16480
|
readLocal(rootDir, source) {
|
|
16336
16481
|
return readLocalSchemas(rootDir, "policy", source);
|
|
16337
16482
|
},
|
|
@@ -16342,7 +16487,7 @@ const policyModule = {
|
|
|
16342
16487
|
.filter(p => !p.system)
|
|
16343
16488
|
.map(p => ({
|
|
16344
16489
|
slug: sanitizeSlug(p.name),
|
|
16345
|
-
id: p
|
|
16490
|
+
id: recordKey(p),
|
|
16346
16491
|
data: p
|
|
16347
16492
|
}));
|
|
16348
16493
|
},
|
|
@@ -16364,21 +16509,21 @@ const policyModule = {
|
|
|
16364
16509
|
deleteLocalSchema(rootDir, "policy", slug);
|
|
16365
16510
|
},
|
|
16366
16511
|
diffFields(local, remote) {
|
|
16367
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$1);
|
|
16512
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16368
16513
|
},
|
|
16369
16514
|
renderDetail(local, remote) {
|
|
16370
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1);
|
|
16515
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16371
16516
|
},
|
|
16372
16517
|
summaryLine(resource) {
|
|
16373
16518
|
const stmts = resource.data.statement?.length ?? 0;
|
|
16374
16519
|
return `${stmts} statement${stmts !== 1 ? "s" : ""}`;
|
|
16375
16520
|
},
|
|
16376
16521
|
extractLocalId(data) {
|
|
16377
|
-
return data
|
|
16522
|
+
return recordKey(data);
|
|
16378
16523
|
}
|
|
16379
16524
|
};
|
|
16380
16525
|
|
|
16381
|
-
const IGNORED_FIELDS = [
|
|
16526
|
+
const IGNORED_FIELDS = [...KEY_FIELDS, "value", "updated_at"];
|
|
16382
16527
|
const secretModule = {
|
|
16383
16528
|
name: "secret",
|
|
16384
16529
|
displayName: "Secret",
|
|
@@ -16392,7 +16537,7 @@ const secretModule = {
|
|
|
16392
16537
|
const items = unwrapList(res);
|
|
16393
16538
|
return items.map(s => ({
|
|
16394
16539
|
slug: sanitizeSlug(s.key),
|
|
16395
|
-
id: s
|
|
16540
|
+
id: recordKey(s),
|
|
16396
16541
|
data: s
|
|
16397
16542
|
}));
|
|
16398
16543
|
},
|
|
@@ -16421,7 +16566,7 @@ const secretModule = {
|
|
|
16421
16566
|
return `key: ${resource.data.key}`;
|
|
16422
16567
|
},
|
|
16423
16568
|
extractLocalId(data) {
|
|
16424
|
-
return data
|
|
16569
|
+
return recordKey(data);
|
|
16425
16570
|
}
|
|
16426
16571
|
};
|
|
16427
16572
|
|