@spica-devkit/sync 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.js
CHANGED
|
@@ -194,7 +194,7 @@ const REMOVE$1 = Symbol('remove node');
|
|
|
194
194
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
195
195
|
* specific defined one will be used for each node.
|
|
196
196
|
*/
|
|
197
|
-
function visit$
|
|
197
|
+
function visit$2(node, visitor) {
|
|
198
198
|
const visitor_ = initVisitor(visitor);
|
|
199
199
|
if (isDocument(node)) {
|
|
200
200
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
@@ -208,11 +208,11 @@ function visit$1(node, visitor) {
|
|
|
208
208
|
// namespace using `var`, but then complains about that because
|
|
209
209
|
// `unique symbol` must be `const`.
|
|
210
210
|
/** Terminate visit traversal completely */
|
|
211
|
-
visit$
|
|
211
|
+
visit$2.BREAK = BREAK$1;
|
|
212
212
|
/** Do not visit the children of the current node */
|
|
213
|
-
visit$
|
|
213
|
+
visit$2.SKIP = SKIP$1;
|
|
214
214
|
/** Remove the current node */
|
|
215
|
-
visit$
|
|
215
|
+
visit$2.REMOVE = REMOVE$1;
|
|
216
216
|
function visit_(key, node, visitor, path) {
|
|
217
217
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
218
218
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
@@ -543,7 +543,7 @@ class Directives {
|
|
|
543
543
|
let tagNames;
|
|
544
544
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
545
545
|
const tags = {};
|
|
546
|
-
visit$
|
|
546
|
+
visit$2(doc.contents, (_key, node) => {
|
|
547
547
|
if (isNode(node) && node.tag)
|
|
548
548
|
tags[node.tag] = true;
|
|
549
549
|
});
|
|
@@ -578,7 +578,7 @@ function anchorIsValid(anchor) {
|
|
|
578
578
|
}
|
|
579
579
|
function anchorNames(root) {
|
|
580
580
|
const anchors = new Set();
|
|
581
|
-
visit$
|
|
581
|
+
visit$2(root, {
|
|
582
582
|
Value(_key, node) {
|
|
583
583
|
if (node.anchor)
|
|
584
584
|
anchors.add(node.anchor);
|
|
@@ -772,7 +772,7 @@ class Alias extends NodeBase {
|
|
|
772
772
|
}
|
|
773
773
|
else {
|
|
774
774
|
nodes = [];
|
|
775
|
-
visit$
|
|
775
|
+
visit$2(doc, {
|
|
776
776
|
Node: (_key, node) => {
|
|
777
777
|
if (isAlias(node) || hasAnchor(node))
|
|
778
778
|
nodes.push(node);
|
|
@@ -5569,7 +5569,7 @@ const REMOVE = Symbol('remove item');
|
|
|
5569
5569
|
* visitor is called on item entry, next visitors are called after handling
|
|
5570
5570
|
* a non-empty `key` and when exiting the item.
|
|
5571
5571
|
*/
|
|
5572
|
-
function visit(cst, visitor) {
|
|
5572
|
+
function visit$1(cst, visitor) {
|
|
5573
5573
|
if ('type' in cst && cst.type === 'document')
|
|
5574
5574
|
cst = { start: cst.start, value: cst.value };
|
|
5575
5575
|
_visit(Object.freeze([]), cst, visitor);
|
|
@@ -5578,13 +5578,13 @@ function visit(cst, visitor) {
|
|
|
5578
5578
|
// namespace using `var`, but then complains about that because
|
|
5579
5579
|
// `unique symbol` must be `const`.
|
|
5580
5580
|
/** Terminate visit traversal completely */
|
|
5581
|
-
visit.BREAK = BREAK;
|
|
5581
|
+
visit$1.BREAK = BREAK;
|
|
5582
5582
|
/** Do not visit the children of the current item */
|
|
5583
|
-
visit.SKIP = SKIP;
|
|
5583
|
+
visit$1.SKIP = SKIP;
|
|
5584
5584
|
/** Remove the current item */
|
|
5585
|
-
visit.REMOVE = REMOVE;
|
|
5585
|
+
visit$1.REMOVE = REMOVE;
|
|
5586
5586
|
/** Find the item at `path` from `cst` as the root */
|
|
5587
|
-
visit.itemAtPath = (cst, path) => {
|
|
5587
|
+
visit$1.itemAtPath = (cst, path) => {
|
|
5588
5588
|
let item = cst;
|
|
5589
5589
|
for (const [field, index] of path) {
|
|
5590
5590
|
const tok = item?.[field];
|
|
@@ -5601,8 +5601,8 @@ visit.itemAtPath = (cst, path) => {
|
|
|
5601
5601
|
*
|
|
5602
5602
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
5603
5603
|
*/
|
|
5604
|
-
visit.parentCollection = (cst, path) => {
|
|
5605
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5604
|
+
visit$1.parentCollection = (cst, path) => {
|
|
5605
|
+
const parent = visit$1.itemAtPath(cst, path.slice(0, -1));
|
|
5606
5606
|
const field = path[path.length - 1][0];
|
|
5607
5607
|
const coll = parent?.[field];
|
|
5608
5608
|
if (coll && 'items' in coll)
|
|
@@ -5741,7 +5741,7 @@ var cst = /*#__PURE__*/Object.freeze({
|
|
|
5741
5741
|
setScalarValue: setScalarValue,
|
|
5742
5742
|
stringify: stringify$1,
|
|
5743
5743
|
tokenType: tokenType,
|
|
5744
|
-
visit: visit
|
|
5744
|
+
visit: visit$1
|
|
5745
5745
|
});
|
|
5746
5746
|
|
|
5747
5747
|
/*
|
|
@@ -7581,7 +7581,7 @@ var YAML = /*#__PURE__*/Object.freeze({
|
|
|
7581
7581
|
parseAllDocuments: parseAllDocuments,
|
|
7582
7582
|
parseDocument: parseDocument,
|
|
7583
7583
|
stringify: stringify,
|
|
7584
|
-
visit: visit$
|
|
7584
|
+
visit: visit$2,
|
|
7585
7585
|
visitAsync: visitAsync
|
|
7586
7586
|
});
|
|
7587
7587
|
|
|
@@ -12814,6 +12814,126 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
12814
12814
|
return ret.join('\n') + '\n';
|
|
12815
12815
|
}
|
|
12816
12816
|
|
|
12817
|
+
var isPlainObject_1;
|
|
12818
|
+
var hasRequiredIsPlainObject;
|
|
12819
|
+
|
|
12820
|
+
function requireIsPlainObject () {
|
|
12821
|
+
if (hasRequiredIsPlainObject) return isPlainObject_1;
|
|
12822
|
+
hasRequiredIsPlainObject = 1;
|
|
12823
|
+
var baseGetTag = require_baseGetTag(),
|
|
12824
|
+
getPrototype = require_getPrototype(),
|
|
12825
|
+
isObjectLike = requireIsObjectLike();
|
|
12826
|
+
|
|
12827
|
+
/** `Object#toString` result references. */
|
|
12828
|
+
var objectTag = '[object Object]';
|
|
12829
|
+
|
|
12830
|
+
/** Used for built-in method references. */
|
|
12831
|
+
var funcProto = Function.prototype,
|
|
12832
|
+
objectProto = Object.prototype;
|
|
12833
|
+
|
|
12834
|
+
/** Used to resolve the decompiled source of functions. */
|
|
12835
|
+
var funcToString = funcProto.toString;
|
|
12836
|
+
|
|
12837
|
+
/** Used to check objects for own properties. */
|
|
12838
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
12839
|
+
|
|
12840
|
+
/** Used to infer the `Object` constructor. */
|
|
12841
|
+
var objectCtorString = funcToString.call(Object);
|
|
12842
|
+
|
|
12843
|
+
/**
|
|
12844
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
12845
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
12846
|
+
*
|
|
12847
|
+
* @static
|
|
12848
|
+
* @memberOf _
|
|
12849
|
+
* @since 0.8.0
|
|
12850
|
+
* @category Lang
|
|
12851
|
+
* @param {*} value The value to check.
|
|
12852
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
12853
|
+
* @example
|
|
12854
|
+
*
|
|
12855
|
+
* function Foo() {
|
|
12856
|
+
* this.a = 1;
|
|
12857
|
+
* }
|
|
12858
|
+
*
|
|
12859
|
+
* _.isPlainObject(new Foo);
|
|
12860
|
+
* // => false
|
|
12861
|
+
*
|
|
12862
|
+
* _.isPlainObject([1, 2, 3]);
|
|
12863
|
+
* // => false
|
|
12864
|
+
*
|
|
12865
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
12866
|
+
* // => true
|
|
12867
|
+
*
|
|
12868
|
+
* _.isPlainObject(Object.create(null));
|
|
12869
|
+
* // => true
|
|
12870
|
+
*/
|
|
12871
|
+
function isPlainObject(value) {
|
|
12872
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
12873
|
+
return false;
|
|
12874
|
+
}
|
|
12875
|
+
var proto = getPrototype(value);
|
|
12876
|
+
if (proto === null) {
|
|
12877
|
+
return true;
|
|
12878
|
+
}
|
|
12879
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
12880
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
12881
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
12882
|
+
}
|
|
12883
|
+
|
|
12884
|
+
isPlainObject_1 = isPlainObject;
|
|
12885
|
+
return isPlainObject_1;
|
|
12886
|
+
}
|
|
12887
|
+
|
|
12888
|
+
var isPlainObjectExports = requireIsPlainObject();
|
|
12889
|
+
var isPlainObject = /*@__PURE__*/getDefaultExportFromCjs(isPlainObjectExports);
|
|
12890
|
+
|
|
12891
|
+
function sortUnorderedArrays(data, paths = []) {
|
|
12892
|
+
if (!paths.length)
|
|
12893
|
+
return data;
|
|
12894
|
+
return visit(data, [], paths.map(p => p.split(".")));
|
|
12895
|
+
}
|
|
12896
|
+
function visit(node, path, patterns) {
|
|
12897
|
+
let visited = node;
|
|
12898
|
+
if (Array.isArray(node)) {
|
|
12899
|
+
visited = node.map((item, i) => visit(item, [...path, String(i)], patterns));
|
|
12900
|
+
}
|
|
12901
|
+
else if (isPlainObject(node)) {
|
|
12902
|
+
visited = Object.fromEntries(Object.entries(node).map(([k, v]) => [
|
|
12903
|
+
k,
|
|
12904
|
+
visit(v, [...path, k], patterns)
|
|
12905
|
+
]));
|
|
12906
|
+
}
|
|
12907
|
+
if (Array.isArray(visited) && patterns.some(p => matches(p, path))) {
|
|
12908
|
+
return visited
|
|
12909
|
+
.map(item => ({ item, key: canonical(item) }))
|
|
12910
|
+
.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))
|
|
12911
|
+
.map(({ item }) => item);
|
|
12912
|
+
}
|
|
12913
|
+
return visited;
|
|
12914
|
+
}
|
|
12915
|
+
function matches(pattern, path) {
|
|
12916
|
+
if (!pattern.length)
|
|
12917
|
+
return !path.length;
|
|
12918
|
+
const [head, ...rest] = pattern;
|
|
12919
|
+
if (head === "**") {
|
|
12920
|
+
return matches(rest, path) || (path.length > 0 && matches(pattern, path.slice(1)));
|
|
12921
|
+
}
|
|
12922
|
+
return path.length > 0 && (head === "*" || head === path[0]) && matches(rest, path.slice(1));
|
|
12923
|
+
}
|
|
12924
|
+
function canonical(value) {
|
|
12925
|
+
if (Array.isArray(value))
|
|
12926
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
12927
|
+
if (isPlainObject(value)) {
|
|
12928
|
+
const obj = value;
|
|
12929
|
+
const entries = Object.keys(obj)
|
|
12930
|
+
.sort()
|
|
12931
|
+
.map(k => `${JSON.stringify(k)}:${canonical(obj[k])}`);
|
|
12932
|
+
return `{${entries.join(",")}}`;
|
|
12933
|
+
}
|
|
12934
|
+
return JSON.stringify(value) ?? "undefined";
|
|
12935
|
+
}
|
|
12936
|
+
|
|
12817
12937
|
async function buildPlan(modules, unlimitedHttp, rootDir, options = {}) {
|
|
12818
12938
|
const { detailed = false, detectRenames = true, reporter = silentReporter, concurrency = DEFAULT_CONCURRENCY, source } = options;
|
|
12819
12939
|
const http = limitConcurrency(unlimitedHttp, concurrency);
|
|
@@ -12927,7 +13047,9 @@ async function applyPlan(plan, unlimitedHttp, opts = {}) {
|
|
|
12927
13047
|
}
|
|
12928
13048
|
return { errors };
|
|
12929
13049
|
}
|
|
12930
|
-
function diffObjectFields(
|
|
13050
|
+
function diffObjectFields(rawLocal, rawRemote, ignoredFields, unorderedPaths = []) {
|
|
13051
|
+
const local = sortUnorderedArrays(rawLocal, unorderedPaths);
|
|
13052
|
+
const remote = sortUnorderedArrays(rawRemote, unorderedPaths);
|
|
12931
13053
|
const allKeys = new Set([...Object.keys(local), ...Object.keys(remote)]);
|
|
12932
13054
|
const changed = [];
|
|
12933
13055
|
for (const key of allKeys) {
|
|
@@ -12939,15 +13061,18 @@ function diffObjectFields(local, remote, ignoredFields) {
|
|
|
12939
13061
|
}
|
|
12940
13062
|
return changed;
|
|
12941
13063
|
}
|
|
12942
|
-
function diffSchemaFields(local, remote, ignoredFields) {
|
|
12943
|
-
return diffObjectFields(local, remote, ignoredFields);
|
|
13064
|
+
function diffSchemaFields(local, remote, ignoredFields, unorderedPaths = []) {
|
|
13065
|
+
return diffObjectFields(local, remote, ignoredFields, unorderedPaths);
|
|
13066
|
+
}
|
|
13067
|
+
function stringifyForDiff(data) {
|
|
13068
|
+
return YAML.stringify(data, { sortMapEntries: true });
|
|
12944
13069
|
}
|
|
12945
13070
|
function buildUnifiedDiff(oldContent, newContent, filename) {
|
|
12946
13071
|
return createTwoFilesPatch(`remote/${filename}`, `local/${filename}`, oldContent, newContent);
|
|
12947
13072
|
}
|
|
12948
|
-
function renderSchemaDetail(localData, remoteData, ignoredFields) {
|
|
12949
|
-
const localYaml =
|
|
12950
|
-
const remoteYaml =
|
|
13073
|
+
function renderSchemaDetail(localData, remoteData, ignoredFields, unorderedPaths = []) {
|
|
13074
|
+
const localYaml = stringifyForDiff(sortUnorderedArrays(omit(localData, ignoredFields), unorderedPaths));
|
|
13075
|
+
const remoteYaml = stringifyForDiff(sortUnorderedArrays(omit(remoteData, ignoredFields), unorderedPaths));
|
|
12951
13076
|
return { schema: buildUnifiedDiff(remoteYaml, localYaml, "schema.yaml") };
|
|
12952
13077
|
}
|
|
12953
13078
|
function runAllAtOnce(tasks, label, onError, reporter) {
|
|
@@ -12982,12 +13107,26 @@ function formatError(e) {
|
|
|
12982
13107
|
return String(e);
|
|
12983
13108
|
}
|
|
12984
13109
|
|
|
12985
|
-
const
|
|
13110
|
+
const KEY_FIELDS = ["_id", "id"];
|
|
13111
|
+
function recordKeyField(record) {
|
|
13112
|
+
if (record === null || typeof record != "object") {
|
|
13113
|
+
return undefined;
|
|
13114
|
+
}
|
|
13115
|
+
return KEY_FIELDS.find(field => field in record);
|
|
13116
|
+
}
|
|
13117
|
+
function recordKey(record) {
|
|
13118
|
+
const field = recordKeyField(record);
|
|
13119
|
+
return field ? record[field] : undefined;
|
|
13120
|
+
}
|
|
13121
|
+
|
|
13122
|
+
const IGNORED_FIELDS$3 = [...KEY_FIELDS, "order"];
|
|
13123
|
+
const UNORDERED_PATHS$1 = ["required", "properties.**.required", "indexes"];
|
|
12986
13124
|
const bucketModule = {
|
|
12987
13125
|
name: "bucket",
|
|
12988
13126
|
displayName: "Bucket",
|
|
12989
13127
|
identityField: "title",
|
|
12990
13128
|
ignoredFields: IGNORED_FIELDS$3,
|
|
13129
|
+
unorderedPaths: UNORDERED_PATHS$1,
|
|
12991
13130
|
readLocal(rootDir, source) {
|
|
12992
13131
|
return readLocalSchemas(rootDir, "bucket", source);
|
|
12993
13132
|
},
|
|
@@ -12996,7 +13135,7 @@ const bucketModule = {
|
|
|
12996
13135
|
const buckets = unwrapList(res);
|
|
12997
13136
|
return buckets.map(b => ({
|
|
12998
13137
|
slug: sanitizeSlug(b.title),
|
|
12999
|
-
id: b
|
|
13138
|
+
id: recordKey(b),
|
|
13000
13139
|
data: b
|
|
13001
13140
|
}));
|
|
13002
13141
|
},
|
|
@@ -13016,21 +13155,21 @@ const bucketModule = {
|
|
|
13016
13155
|
deleteLocalSchema(rootDir, "bucket", slug);
|
|
13017
13156
|
},
|
|
13018
13157
|
diffFields(local, remote) {
|
|
13019
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$3);
|
|
13158
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13020
13159
|
},
|
|
13021
13160
|
renderDetail(local, remote) {
|
|
13022
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3);
|
|
13161
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13023
13162
|
},
|
|
13024
13163
|
summaryLine(resource) {
|
|
13025
13164
|
const propCount = Object.keys(resource.data.properties ?? {}).length;
|
|
13026
13165
|
return `${propCount} properties`;
|
|
13027
13166
|
},
|
|
13028
13167
|
extractLocalId(data) {
|
|
13029
|
-
return data
|
|
13168
|
+
return recordKey(data);
|
|
13030
13169
|
}
|
|
13031
13170
|
};
|
|
13032
13171
|
|
|
13033
|
-
const IGNORED_FIELDS$2 = [
|
|
13172
|
+
const IGNORED_FIELDS$2 = [...KEY_FIELDS, "updated_at"];
|
|
13034
13173
|
const envVarModule = {
|
|
13035
13174
|
name: "env-var",
|
|
13036
13175
|
displayName: "Environment Variable",
|
|
@@ -13044,7 +13183,7 @@ const envVarModule = {
|
|
|
13044
13183
|
const items = unwrapList(res);
|
|
13045
13184
|
return items.map(e => ({
|
|
13046
13185
|
slug: sanitizeSlug(e.key),
|
|
13047
|
-
id: e
|
|
13186
|
+
id: recordKey(e),
|
|
13048
13187
|
data: e
|
|
13049
13188
|
}));
|
|
13050
13189
|
},
|
|
@@ -13073,7 +13212,7 @@ const envVarModule = {
|
|
|
13073
13212
|
return `key: ${resource.data.key}`;
|
|
13074
13213
|
},
|
|
13075
13214
|
extractLocalId(data) {
|
|
13076
|
-
return data
|
|
13215
|
+
return recordKey(data);
|
|
13077
13216
|
}
|
|
13078
13217
|
};
|
|
13079
13218
|
|
|
@@ -15798,15 +15937,14 @@ function requireSemver () {
|
|
|
15798
15937
|
var semverExports = requireSemver();
|
|
15799
15938
|
var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
15800
15939
|
|
|
15801
|
-
const SCHEMA_IGNORED = [
|
|
15940
|
+
const SCHEMA_IGNORED = [...KEY_FIELDS, "env_vars", "secrets", "order"];
|
|
15941
|
+
const SCHEMA_UNORDERED = ["triggers.*.options.authenticate"];
|
|
15802
15942
|
function indexFilename(language) {
|
|
15803
15943
|
return language === "typescript" ? "index.ts" : "index.mjs";
|
|
15804
15944
|
}
|
|
15805
15945
|
function extractId(v) {
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
}
|
|
15809
|
-
return String(v);
|
|
15946
|
+
const key = recordKey(v);
|
|
15947
|
+
return key === undefined ? String(v) : String(key);
|
|
15810
15948
|
}
|
|
15811
15949
|
function byCodeUnit$1(a, b) {
|
|
15812
15950
|
if (a === b)
|
|
@@ -15855,6 +15993,7 @@ const functionModule = {
|
|
|
15855
15993
|
displayName: "Function",
|
|
15856
15994
|
identityField: "name",
|
|
15857
15995
|
ignoredFields: SCHEMA_IGNORED,
|
|
15996
|
+
unorderedPaths: SCHEMA_UNORDERED,
|
|
15858
15997
|
readSchema(rootDir, slug, source = diskSource) {
|
|
15859
15998
|
return readSourceYaml(source, path.join(rootDir, "function", slug, "schema.yaml"));
|
|
15860
15999
|
},
|
|
@@ -15890,7 +16029,7 @@ const functionModule = {
|
|
|
15890
16029
|
const res = await http.get("function");
|
|
15891
16030
|
const fns = unwrapList(res);
|
|
15892
16031
|
return Promise.all(fns.map(async (fn) => {
|
|
15893
|
-
const id = fn
|
|
16032
|
+
const id = recordKey(fn);
|
|
15894
16033
|
const [indexRes, depsRes] = await Promise.all([
|
|
15895
16034
|
http.get(`function/${id}/index`).catch(emptyIfMissing({ index: "" })),
|
|
15896
16035
|
http
|
|
@@ -15923,7 +16062,7 @@ const functionModule = {
|
|
|
15923
16062
|
},
|
|
15924
16063
|
async createSchema(http, schema) {
|
|
15925
16064
|
const created = await http.post("function", omit(schema, ["env_vars", "secrets"]));
|
|
15926
|
-
const id = (created
|
|
16065
|
+
const id = recordKey(created) ?? recordKey(schema);
|
|
15927
16066
|
if (!id)
|
|
15928
16067
|
return undefined;
|
|
15929
16068
|
const envVarIds = schema.env_vars ?? [];
|
|
@@ -16006,7 +16145,7 @@ const functionModule = {
|
|
|
16006
16145
|
},
|
|
16007
16146
|
diffFields(local, remote) {
|
|
16008
16147
|
const changed = [];
|
|
16009
|
-
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED);
|
|
16148
|
+
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED, SCHEMA_UNORDERED);
|
|
16010
16149
|
if (schemaChanged.length)
|
|
16011
16150
|
changed.push("schema");
|
|
16012
16151
|
if (local.index !== remote.index)
|
|
@@ -16025,8 +16164,8 @@ const functionModule = {
|
|
|
16025
16164
|
},
|
|
16026
16165
|
renderDetail(local, remote) {
|
|
16027
16166
|
const result = {};
|
|
16028
|
-
const localSchemaYaml =
|
|
16029
|
-
const remoteSchemaYaml =
|
|
16167
|
+
const localSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(local.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16168
|
+
const remoteSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(remote.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16030
16169
|
if (localSchemaYaml !== remoteSchemaYaml) {
|
|
16031
16170
|
result["schema"] = buildUnifiedDiff(remoteSchemaYaml, localSchemaYaml, "schema.yaml");
|
|
16032
16171
|
}
|
|
@@ -16046,7 +16185,7 @@ const functionModule = {
|
|
|
16046
16185
|
return `${triggerCount} trigger${triggerCount !== 1 ? "s" : ""}`;
|
|
16047
16186
|
},
|
|
16048
16187
|
extractLocalId(data) {
|
|
16049
|
-
return data.schema
|
|
16188
|
+
return recordKey(data.schema);
|
|
16050
16189
|
},
|
|
16051
16190
|
watchedFiles: ["schema.yaml", "index.ts", "index.mjs", "index.js", "package.json"],
|
|
16052
16191
|
async devHandleEvent(ctx) {
|
|
@@ -16073,7 +16212,7 @@ const functionModule = {
|
|
|
16073
16212
|
const schema = self.readSchema(rootDir, slug);
|
|
16074
16213
|
if (!schema)
|
|
16075
16214
|
return;
|
|
16076
|
-
const newLocalId = schema
|
|
16215
|
+
const newLocalId = recordKey(schema);
|
|
16077
16216
|
if (newLocalId) {
|
|
16078
16217
|
const pending = consumePendingDeleteByRemoteId(newLocalId);
|
|
16079
16218
|
if (pending) {
|
|
@@ -16134,12 +16273,18 @@ const functionModule = {
|
|
|
16134
16273
|
}
|
|
16135
16274
|
};
|
|
16136
16275
|
|
|
16137
|
-
const IGNORED_FIELDS$1 = [
|
|
16276
|
+
const IGNORED_FIELDS$1 = [...KEY_FIELDS, "system"];
|
|
16277
|
+
const UNORDERED_PATHS = [
|
|
16278
|
+
"statement",
|
|
16279
|
+
"statement.*.resource.include",
|
|
16280
|
+
"statement.*.resource.exclude"
|
|
16281
|
+
];
|
|
16138
16282
|
const policyModule = {
|
|
16139
16283
|
name: "policy",
|
|
16140
16284
|
displayName: "Policy",
|
|
16141
16285
|
identityField: "name",
|
|
16142
16286
|
ignoredFields: IGNORED_FIELDS$1,
|
|
16287
|
+
unorderedPaths: UNORDERED_PATHS,
|
|
16143
16288
|
readLocal(rootDir, source) {
|
|
16144
16289
|
return readLocalSchemas(rootDir, "policy", source);
|
|
16145
16290
|
},
|
|
@@ -16150,7 +16295,7 @@ const policyModule = {
|
|
|
16150
16295
|
.filter(p => !p.system)
|
|
16151
16296
|
.map(p => ({
|
|
16152
16297
|
slug: sanitizeSlug(p.name),
|
|
16153
|
-
id: p
|
|
16298
|
+
id: recordKey(p),
|
|
16154
16299
|
data: p
|
|
16155
16300
|
}));
|
|
16156
16301
|
},
|
|
@@ -16172,21 +16317,21 @@ const policyModule = {
|
|
|
16172
16317
|
deleteLocalSchema(rootDir, "policy", slug);
|
|
16173
16318
|
},
|
|
16174
16319
|
diffFields(local, remote) {
|
|
16175
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$1);
|
|
16320
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16176
16321
|
},
|
|
16177
16322
|
renderDetail(local, remote) {
|
|
16178
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1);
|
|
16323
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16179
16324
|
},
|
|
16180
16325
|
summaryLine(resource) {
|
|
16181
16326
|
const stmts = resource.data.statement?.length ?? 0;
|
|
16182
16327
|
return `${stmts} statement${stmts !== 1 ? "s" : ""}`;
|
|
16183
16328
|
},
|
|
16184
16329
|
extractLocalId(data) {
|
|
16185
|
-
return data
|
|
16330
|
+
return recordKey(data);
|
|
16186
16331
|
}
|
|
16187
16332
|
};
|
|
16188
16333
|
|
|
16189
|
-
const IGNORED_FIELDS = [
|
|
16334
|
+
const IGNORED_FIELDS = [...KEY_FIELDS, "value", "updated_at"];
|
|
16190
16335
|
const secretModule = {
|
|
16191
16336
|
name: "secret",
|
|
16192
16337
|
displayName: "Secret",
|
|
@@ -16200,7 +16345,7 @@ const secretModule = {
|
|
|
16200
16345
|
const items = unwrapList(res);
|
|
16201
16346
|
return items.map(s => ({
|
|
16202
16347
|
slug: sanitizeSlug(s.key),
|
|
16203
|
-
id: s
|
|
16348
|
+
id: recordKey(s),
|
|
16204
16349
|
data: s
|
|
16205
16350
|
}));
|
|
16206
16351
|
},
|
|
@@ -16229,7 +16374,7 @@ const secretModule = {
|
|
|
16229
16374
|
return `key: ${resource.data.key}`;
|
|
16230
16375
|
},
|
|
16231
16376
|
extractLocalId(data) {
|
|
16232
|
-
return data
|
|
16377
|
+
return recordKey(data);
|
|
16233
16378
|
}
|
|
16234
16379
|
};
|
|
16235
16380
|
|