@spica-devkit/sync 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.mjs
CHANGED
|
@@ -173,7 +173,7 @@ const REMOVE$1 = Symbol('remove node');
|
|
|
173
173
|
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
|
|
174
174
|
* specific defined one will be used for each node.
|
|
175
175
|
*/
|
|
176
|
-
function visit$
|
|
176
|
+
function visit$2(node, visitor) {
|
|
177
177
|
const visitor_ = initVisitor(visitor);
|
|
178
178
|
if (isDocument(node)) {
|
|
179
179
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
@@ -187,11 +187,11 @@ function visit$1(node, visitor) {
|
|
|
187
187
|
// namespace using `var`, but then complains about that because
|
|
188
188
|
// `unique symbol` must be `const`.
|
|
189
189
|
/** Terminate visit traversal completely */
|
|
190
|
-
visit$
|
|
190
|
+
visit$2.BREAK = BREAK$1;
|
|
191
191
|
/** Do not visit the children of the current node */
|
|
192
|
-
visit$
|
|
192
|
+
visit$2.SKIP = SKIP$1;
|
|
193
193
|
/** Remove the current node */
|
|
194
|
-
visit$
|
|
194
|
+
visit$2.REMOVE = REMOVE$1;
|
|
195
195
|
function visit_(key, node, visitor, path) {
|
|
196
196
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
197
197
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
@@ -522,7 +522,7 @@ class Directives {
|
|
|
522
522
|
let tagNames;
|
|
523
523
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
524
524
|
const tags = {};
|
|
525
|
-
visit$
|
|
525
|
+
visit$2(doc.contents, (_key, node) => {
|
|
526
526
|
if (isNode(node) && node.tag)
|
|
527
527
|
tags[node.tag] = true;
|
|
528
528
|
});
|
|
@@ -557,7 +557,7 @@ function anchorIsValid(anchor) {
|
|
|
557
557
|
}
|
|
558
558
|
function anchorNames(root) {
|
|
559
559
|
const anchors = new Set();
|
|
560
|
-
visit$
|
|
560
|
+
visit$2(root, {
|
|
561
561
|
Value(_key, node) {
|
|
562
562
|
if (node.anchor)
|
|
563
563
|
anchors.add(node.anchor);
|
|
@@ -751,7 +751,7 @@ class Alias extends NodeBase {
|
|
|
751
751
|
}
|
|
752
752
|
else {
|
|
753
753
|
nodes = [];
|
|
754
|
-
visit$
|
|
754
|
+
visit$2(doc, {
|
|
755
755
|
Node: (_key, node) => {
|
|
756
756
|
if (isAlias(node) || hasAnchor(node))
|
|
757
757
|
nodes.push(node);
|
|
@@ -5548,7 +5548,7 @@ const REMOVE = Symbol('remove item');
|
|
|
5548
5548
|
* visitor is called on item entry, next visitors are called after handling
|
|
5549
5549
|
* a non-empty `key` and when exiting the item.
|
|
5550
5550
|
*/
|
|
5551
|
-
function visit(cst, visitor) {
|
|
5551
|
+
function visit$1(cst, visitor) {
|
|
5552
5552
|
if ('type' in cst && cst.type === 'document')
|
|
5553
5553
|
cst = { start: cst.start, value: cst.value };
|
|
5554
5554
|
_visit(Object.freeze([]), cst, visitor);
|
|
@@ -5557,13 +5557,13 @@ function visit(cst, visitor) {
|
|
|
5557
5557
|
// namespace using `var`, but then complains about that because
|
|
5558
5558
|
// `unique symbol` must be `const`.
|
|
5559
5559
|
/** Terminate visit traversal completely */
|
|
5560
|
-
visit.BREAK = BREAK;
|
|
5560
|
+
visit$1.BREAK = BREAK;
|
|
5561
5561
|
/** Do not visit the children of the current item */
|
|
5562
|
-
visit.SKIP = SKIP;
|
|
5562
|
+
visit$1.SKIP = SKIP;
|
|
5563
5563
|
/** Remove the current item */
|
|
5564
|
-
visit.REMOVE = REMOVE;
|
|
5564
|
+
visit$1.REMOVE = REMOVE;
|
|
5565
5565
|
/** Find the item at `path` from `cst` as the root */
|
|
5566
|
-
visit.itemAtPath = (cst, path) => {
|
|
5566
|
+
visit$1.itemAtPath = (cst, path) => {
|
|
5567
5567
|
let item = cst;
|
|
5568
5568
|
for (const [field, index] of path) {
|
|
5569
5569
|
const tok = item?.[field];
|
|
@@ -5580,8 +5580,8 @@ visit.itemAtPath = (cst, path) => {
|
|
|
5580
5580
|
*
|
|
5581
5581
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
5582
5582
|
*/
|
|
5583
|
-
visit.parentCollection = (cst, path) => {
|
|
5584
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
5583
|
+
visit$1.parentCollection = (cst, path) => {
|
|
5584
|
+
const parent = visit$1.itemAtPath(cst, path.slice(0, -1));
|
|
5585
5585
|
const field = path[path.length - 1][0];
|
|
5586
5586
|
const coll = parent?.[field];
|
|
5587
5587
|
if (coll && 'items' in coll)
|
|
@@ -5720,7 +5720,7 @@ var cst = /*#__PURE__*/Object.freeze({
|
|
|
5720
5720
|
setScalarValue: setScalarValue,
|
|
5721
5721
|
stringify: stringify$1,
|
|
5722
5722
|
tokenType: tokenType,
|
|
5723
|
-
visit: visit
|
|
5723
|
+
visit: visit$1
|
|
5724
5724
|
});
|
|
5725
5725
|
|
|
5726
5726
|
/*
|
|
@@ -7560,7 +7560,7 @@ var YAML = /*#__PURE__*/Object.freeze({
|
|
|
7560
7560
|
parseAllDocuments: parseAllDocuments,
|
|
7561
7561
|
parseDocument: parseDocument,
|
|
7562
7562
|
stringify: stringify,
|
|
7563
|
-
visit: visit$
|
|
7563
|
+
visit: visit$2,
|
|
7564
7564
|
visitAsync: visitAsync
|
|
7565
7565
|
});
|
|
7566
7566
|
|
|
@@ -12793,6 +12793,126 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
12793
12793
|
return ret.join('\n') + '\n';
|
|
12794
12794
|
}
|
|
12795
12795
|
|
|
12796
|
+
var isPlainObject_1;
|
|
12797
|
+
var hasRequiredIsPlainObject;
|
|
12798
|
+
|
|
12799
|
+
function requireIsPlainObject () {
|
|
12800
|
+
if (hasRequiredIsPlainObject) return isPlainObject_1;
|
|
12801
|
+
hasRequiredIsPlainObject = 1;
|
|
12802
|
+
var baseGetTag = require_baseGetTag(),
|
|
12803
|
+
getPrototype = require_getPrototype(),
|
|
12804
|
+
isObjectLike = requireIsObjectLike();
|
|
12805
|
+
|
|
12806
|
+
/** `Object#toString` result references. */
|
|
12807
|
+
var objectTag = '[object Object]';
|
|
12808
|
+
|
|
12809
|
+
/** Used for built-in method references. */
|
|
12810
|
+
var funcProto = Function.prototype,
|
|
12811
|
+
objectProto = Object.prototype;
|
|
12812
|
+
|
|
12813
|
+
/** Used to resolve the decompiled source of functions. */
|
|
12814
|
+
var funcToString = funcProto.toString;
|
|
12815
|
+
|
|
12816
|
+
/** Used to check objects for own properties. */
|
|
12817
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
12818
|
+
|
|
12819
|
+
/** Used to infer the `Object` constructor. */
|
|
12820
|
+
var objectCtorString = funcToString.call(Object);
|
|
12821
|
+
|
|
12822
|
+
/**
|
|
12823
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
12824
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
12825
|
+
*
|
|
12826
|
+
* @static
|
|
12827
|
+
* @memberOf _
|
|
12828
|
+
* @since 0.8.0
|
|
12829
|
+
* @category Lang
|
|
12830
|
+
* @param {*} value The value to check.
|
|
12831
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
12832
|
+
* @example
|
|
12833
|
+
*
|
|
12834
|
+
* function Foo() {
|
|
12835
|
+
* this.a = 1;
|
|
12836
|
+
* }
|
|
12837
|
+
*
|
|
12838
|
+
* _.isPlainObject(new Foo);
|
|
12839
|
+
* // => false
|
|
12840
|
+
*
|
|
12841
|
+
* _.isPlainObject([1, 2, 3]);
|
|
12842
|
+
* // => false
|
|
12843
|
+
*
|
|
12844
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
12845
|
+
* // => true
|
|
12846
|
+
*
|
|
12847
|
+
* _.isPlainObject(Object.create(null));
|
|
12848
|
+
* // => true
|
|
12849
|
+
*/
|
|
12850
|
+
function isPlainObject(value) {
|
|
12851
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
12852
|
+
return false;
|
|
12853
|
+
}
|
|
12854
|
+
var proto = getPrototype(value);
|
|
12855
|
+
if (proto === null) {
|
|
12856
|
+
return true;
|
|
12857
|
+
}
|
|
12858
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
12859
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
12860
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
12861
|
+
}
|
|
12862
|
+
|
|
12863
|
+
isPlainObject_1 = isPlainObject;
|
|
12864
|
+
return isPlainObject_1;
|
|
12865
|
+
}
|
|
12866
|
+
|
|
12867
|
+
var isPlainObjectExports = requireIsPlainObject();
|
|
12868
|
+
var isPlainObject = /*@__PURE__*/getDefaultExportFromCjs(isPlainObjectExports);
|
|
12869
|
+
|
|
12870
|
+
function sortUnorderedArrays(data, paths = []) {
|
|
12871
|
+
if (!paths.length)
|
|
12872
|
+
return data;
|
|
12873
|
+
return visit(data, [], paths.map(p => p.split(".")));
|
|
12874
|
+
}
|
|
12875
|
+
function visit(node, path, patterns) {
|
|
12876
|
+
let visited = node;
|
|
12877
|
+
if (Array.isArray(node)) {
|
|
12878
|
+
visited = node.map((item, i) => visit(item, [...path, String(i)], patterns));
|
|
12879
|
+
}
|
|
12880
|
+
else if (isPlainObject(node)) {
|
|
12881
|
+
visited = Object.fromEntries(Object.entries(node).map(([k, v]) => [
|
|
12882
|
+
k,
|
|
12883
|
+
visit(v, [...path, k], patterns)
|
|
12884
|
+
]));
|
|
12885
|
+
}
|
|
12886
|
+
if (Array.isArray(visited) && patterns.some(p => matches(p, path))) {
|
|
12887
|
+
return visited
|
|
12888
|
+
.map(item => ({ item, key: canonical(item) }))
|
|
12889
|
+
.sort((a, b) => (a.key < b.key ? -1 : a.key > b.key ? 1 : 0))
|
|
12890
|
+
.map(({ item }) => item);
|
|
12891
|
+
}
|
|
12892
|
+
return visited;
|
|
12893
|
+
}
|
|
12894
|
+
function matches(pattern, path) {
|
|
12895
|
+
if (!pattern.length)
|
|
12896
|
+
return !path.length;
|
|
12897
|
+
const [head, ...rest] = pattern;
|
|
12898
|
+
if (head === "**") {
|
|
12899
|
+
return matches(rest, path) || (path.length > 0 && matches(pattern, path.slice(1)));
|
|
12900
|
+
}
|
|
12901
|
+
return path.length > 0 && (head === "*" || head === path[0]) && matches(rest, path.slice(1));
|
|
12902
|
+
}
|
|
12903
|
+
function canonical(value) {
|
|
12904
|
+
if (Array.isArray(value))
|
|
12905
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
12906
|
+
if (isPlainObject(value)) {
|
|
12907
|
+
const obj = value;
|
|
12908
|
+
const entries = Object.keys(obj)
|
|
12909
|
+
.sort()
|
|
12910
|
+
.map(k => `${JSON.stringify(k)}:${canonical(obj[k])}`);
|
|
12911
|
+
return `{${entries.join(",")}}`;
|
|
12912
|
+
}
|
|
12913
|
+
return JSON.stringify(value) ?? "undefined";
|
|
12914
|
+
}
|
|
12915
|
+
|
|
12796
12916
|
async function buildPlan(modules, unlimitedHttp, rootDir, options = {}) {
|
|
12797
12917
|
const { detailed = false, detectRenames = true, reporter = silentReporter, concurrency = DEFAULT_CONCURRENCY, source } = options;
|
|
12798
12918
|
const http = limitConcurrency(unlimitedHttp, concurrency);
|
|
@@ -12906,7 +13026,9 @@ async function applyPlan(plan, unlimitedHttp, opts = {}) {
|
|
|
12906
13026
|
}
|
|
12907
13027
|
return { errors };
|
|
12908
13028
|
}
|
|
12909
|
-
function diffObjectFields(
|
|
13029
|
+
function diffObjectFields(rawLocal, rawRemote, ignoredFields, unorderedPaths = []) {
|
|
13030
|
+
const local = sortUnorderedArrays(rawLocal, unorderedPaths);
|
|
13031
|
+
const remote = sortUnorderedArrays(rawRemote, unorderedPaths);
|
|
12910
13032
|
const allKeys = new Set([...Object.keys(local), ...Object.keys(remote)]);
|
|
12911
13033
|
const changed = [];
|
|
12912
13034
|
for (const key of allKeys) {
|
|
@@ -12918,15 +13040,18 @@ function diffObjectFields(local, remote, ignoredFields) {
|
|
|
12918
13040
|
}
|
|
12919
13041
|
return changed;
|
|
12920
13042
|
}
|
|
12921
|
-
function diffSchemaFields(local, remote, ignoredFields) {
|
|
12922
|
-
return diffObjectFields(local, remote, ignoredFields);
|
|
13043
|
+
function diffSchemaFields(local, remote, ignoredFields, unorderedPaths = []) {
|
|
13044
|
+
return diffObjectFields(local, remote, ignoredFields, unorderedPaths);
|
|
13045
|
+
}
|
|
13046
|
+
function stringifyForDiff(data) {
|
|
13047
|
+
return YAML.stringify(data, { sortMapEntries: true });
|
|
12923
13048
|
}
|
|
12924
13049
|
function buildUnifiedDiff(oldContent, newContent, filename) {
|
|
12925
13050
|
return createTwoFilesPatch(`remote/${filename}`, `local/${filename}`, oldContent, newContent);
|
|
12926
13051
|
}
|
|
12927
|
-
function renderSchemaDetail(localData, remoteData, ignoredFields) {
|
|
12928
|
-
const localYaml =
|
|
12929
|
-
const remoteYaml =
|
|
13052
|
+
function renderSchemaDetail(localData, remoteData, ignoredFields, unorderedPaths = []) {
|
|
13053
|
+
const localYaml = stringifyForDiff(sortUnorderedArrays(omit(localData, ignoredFields), unorderedPaths));
|
|
13054
|
+
const remoteYaml = stringifyForDiff(sortUnorderedArrays(omit(remoteData, ignoredFields), unorderedPaths));
|
|
12930
13055
|
return { schema: buildUnifiedDiff(remoteYaml, localYaml, "schema.yaml") };
|
|
12931
13056
|
}
|
|
12932
13057
|
function runAllAtOnce(tasks, label, onError, reporter) {
|
|
@@ -12961,12 +13086,26 @@ function formatError(e) {
|
|
|
12961
13086
|
return String(e);
|
|
12962
13087
|
}
|
|
12963
13088
|
|
|
12964
|
-
const
|
|
13089
|
+
const KEY_FIELDS = ["_id", "id"];
|
|
13090
|
+
function recordKeyField(record) {
|
|
13091
|
+
if (record === null || typeof record != "object") {
|
|
13092
|
+
return undefined;
|
|
13093
|
+
}
|
|
13094
|
+
return KEY_FIELDS.find(field => field in record);
|
|
13095
|
+
}
|
|
13096
|
+
function recordKey(record) {
|
|
13097
|
+
const field = recordKeyField(record);
|
|
13098
|
+
return field ? record[field] : undefined;
|
|
13099
|
+
}
|
|
13100
|
+
|
|
13101
|
+
const IGNORED_FIELDS$3 = [...KEY_FIELDS, "order"];
|
|
13102
|
+
const UNORDERED_PATHS$1 = ["required", "properties.**.required", "indexes"];
|
|
12965
13103
|
const bucketModule = {
|
|
12966
13104
|
name: "bucket",
|
|
12967
13105
|
displayName: "Bucket",
|
|
12968
13106
|
identityField: "title",
|
|
12969
13107
|
ignoredFields: IGNORED_FIELDS$3,
|
|
13108
|
+
unorderedPaths: UNORDERED_PATHS$1,
|
|
12970
13109
|
readLocal(rootDir, source) {
|
|
12971
13110
|
return readLocalSchemas(rootDir, "bucket", source);
|
|
12972
13111
|
},
|
|
@@ -12975,7 +13114,7 @@ const bucketModule = {
|
|
|
12975
13114
|
const buckets = unwrapList(res);
|
|
12976
13115
|
return buckets.map(b => ({
|
|
12977
13116
|
slug: sanitizeSlug(b.title),
|
|
12978
|
-
id: b
|
|
13117
|
+
id: recordKey(b),
|
|
12979
13118
|
data: b
|
|
12980
13119
|
}));
|
|
12981
13120
|
},
|
|
@@ -12995,21 +13134,21 @@ const bucketModule = {
|
|
|
12995
13134
|
deleteLocalSchema(rootDir, "bucket", slug);
|
|
12996
13135
|
},
|
|
12997
13136
|
diffFields(local, remote) {
|
|
12998
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$3);
|
|
13137
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
12999
13138
|
},
|
|
13000
13139
|
renderDetail(local, remote) {
|
|
13001
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3);
|
|
13140
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$3, UNORDERED_PATHS$1);
|
|
13002
13141
|
},
|
|
13003
13142
|
summaryLine(resource) {
|
|
13004
13143
|
const propCount = Object.keys(resource.data.properties ?? {}).length;
|
|
13005
13144
|
return `${propCount} properties`;
|
|
13006
13145
|
},
|
|
13007
13146
|
extractLocalId(data) {
|
|
13008
|
-
return data
|
|
13147
|
+
return recordKey(data);
|
|
13009
13148
|
}
|
|
13010
13149
|
};
|
|
13011
13150
|
|
|
13012
|
-
const IGNORED_FIELDS$2 = [
|
|
13151
|
+
const IGNORED_FIELDS$2 = [...KEY_FIELDS, "updated_at"];
|
|
13013
13152
|
const envVarModule = {
|
|
13014
13153
|
name: "env-var",
|
|
13015
13154
|
displayName: "Environment Variable",
|
|
@@ -13023,7 +13162,7 @@ const envVarModule = {
|
|
|
13023
13162
|
const items = unwrapList(res);
|
|
13024
13163
|
return items.map(e => ({
|
|
13025
13164
|
slug: sanitizeSlug(e.key),
|
|
13026
|
-
id: e
|
|
13165
|
+
id: recordKey(e),
|
|
13027
13166
|
data: e
|
|
13028
13167
|
}));
|
|
13029
13168
|
},
|
|
@@ -13052,7 +13191,7 @@ const envVarModule = {
|
|
|
13052
13191
|
return `key: ${resource.data.key}`;
|
|
13053
13192
|
},
|
|
13054
13193
|
extractLocalId(data) {
|
|
13055
|
-
return data
|
|
13194
|
+
return recordKey(data);
|
|
13056
13195
|
}
|
|
13057
13196
|
};
|
|
13058
13197
|
|
|
@@ -15777,15 +15916,14 @@ function requireSemver () {
|
|
|
15777
15916
|
var semverExports = requireSemver();
|
|
15778
15917
|
var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
15779
15918
|
|
|
15780
|
-
const SCHEMA_IGNORED = [
|
|
15919
|
+
const SCHEMA_IGNORED = [...KEY_FIELDS, "env_vars", "secrets", "order"];
|
|
15920
|
+
const SCHEMA_UNORDERED = ["triggers.*.options.authenticate"];
|
|
15781
15921
|
function indexFilename(language) {
|
|
15782
15922
|
return language === "typescript" ? "index.ts" : "index.mjs";
|
|
15783
15923
|
}
|
|
15784
15924
|
function extractId(v) {
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
}
|
|
15788
|
-
return String(v);
|
|
15925
|
+
const key = recordKey(v);
|
|
15926
|
+
return key === undefined ? String(v) : String(key);
|
|
15789
15927
|
}
|
|
15790
15928
|
function byCodeUnit$1(a, b) {
|
|
15791
15929
|
if (a === b)
|
|
@@ -15834,6 +15972,7 @@ const functionModule = {
|
|
|
15834
15972
|
displayName: "Function",
|
|
15835
15973
|
identityField: "name",
|
|
15836
15974
|
ignoredFields: SCHEMA_IGNORED,
|
|
15975
|
+
unorderedPaths: SCHEMA_UNORDERED,
|
|
15837
15976
|
readSchema(rootDir, slug, source = diskSource) {
|
|
15838
15977
|
return readSourceYaml(source, path.join(rootDir, "function", slug, "schema.yaml"));
|
|
15839
15978
|
},
|
|
@@ -15869,7 +16008,7 @@ const functionModule = {
|
|
|
15869
16008
|
const res = await http.get("function");
|
|
15870
16009
|
const fns = unwrapList(res);
|
|
15871
16010
|
return Promise.all(fns.map(async (fn) => {
|
|
15872
|
-
const id = fn
|
|
16011
|
+
const id = recordKey(fn);
|
|
15873
16012
|
const [indexRes, depsRes] = await Promise.all([
|
|
15874
16013
|
http.get(`function/${id}/index`).catch(emptyIfMissing({ index: "" })),
|
|
15875
16014
|
http
|
|
@@ -15902,7 +16041,7 @@ const functionModule = {
|
|
|
15902
16041
|
},
|
|
15903
16042
|
async createSchema(http, schema) {
|
|
15904
16043
|
const created = await http.post("function", omit(schema, ["env_vars", "secrets"]));
|
|
15905
|
-
const id = (created
|
|
16044
|
+
const id = recordKey(created) ?? recordKey(schema);
|
|
15906
16045
|
if (!id)
|
|
15907
16046
|
return undefined;
|
|
15908
16047
|
const envVarIds = schema.env_vars ?? [];
|
|
@@ -15985,7 +16124,7 @@ const functionModule = {
|
|
|
15985
16124
|
},
|
|
15986
16125
|
diffFields(local, remote) {
|
|
15987
16126
|
const changed = [];
|
|
15988
|
-
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED);
|
|
16127
|
+
const schemaChanged = diffObjectFields(local.schema, remote.schema, SCHEMA_IGNORED, SCHEMA_UNORDERED);
|
|
15989
16128
|
if (schemaChanged.length)
|
|
15990
16129
|
changed.push("schema");
|
|
15991
16130
|
if (local.index !== remote.index)
|
|
@@ -16004,8 +16143,8 @@ const functionModule = {
|
|
|
16004
16143
|
},
|
|
16005
16144
|
renderDetail(local, remote) {
|
|
16006
16145
|
const result = {};
|
|
16007
|
-
const localSchemaYaml =
|
|
16008
|
-
const remoteSchemaYaml =
|
|
16146
|
+
const localSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(local.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16147
|
+
const remoteSchemaYaml = stringifyForDiff(sortUnorderedArrays(omit(remote.data.schema, SCHEMA_IGNORED), SCHEMA_UNORDERED));
|
|
16009
16148
|
if (localSchemaYaml !== remoteSchemaYaml) {
|
|
16010
16149
|
result["schema"] = buildUnifiedDiff(remoteSchemaYaml, localSchemaYaml, "schema.yaml");
|
|
16011
16150
|
}
|
|
@@ -16025,7 +16164,7 @@ const functionModule = {
|
|
|
16025
16164
|
return `${triggerCount} trigger${triggerCount !== 1 ? "s" : ""}`;
|
|
16026
16165
|
},
|
|
16027
16166
|
extractLocalId(data) {
|
|
16028
|
-
return data.schema
|
|
16167
|
+
return recordKey(data.schema);
|
|
16029
16168
|
},
|
|
16030
16169
|
watchedFiles: ["schema.yaml", "index.ts", "index.mjs", "index.js", "package.json"],
|
|
16031
16170
|
async devHandleEvent(ctx) {
|
|
@@ -16052,7 +16191,7 @@ const functionModule = {
|
|
|
16052
16191
|
const schema = self.readSchema(rootDir, slug);
|
|
16053
16192
|
if (!schema)
|
|
16054
16193
|
return;
|
|
16055
|
-
const newLocalId = schema
|
|
16194
|
+
const newLocalId = recordKey(schema);
|
|
16056
16195
|
if (newLocalId) {
|
|
16057
16196
|
const pending = consumePendingDeleteByRemoteId(newLocalId);
|
|
16058
16197
|
if (pending) {
|
|
@@ -16113,12 +16252,18 @@ const functionModule = {
|
|
|
16113
16252
|
}
|
|
16114
16253
|
};
|
|
16115
16254
|
|
|
16116
|
-
const IGNORED_FIELDS$1 = [
|
|
16255
|
+
const IGNORED_FIELDS$1 = [...KEY_FIELDS, "system"];
|
|
16256
|
+
const UNORDERED_PATHS = [
|
|
16257
|
+
"statement",
|
|
16258
|
+
"statement.*.resource.include",
|
|
16259
|
+
"statement.*.resource.exclude"
|
|
16260
|
+
];
|
|
16117
16261
|
const policyModule = {
|
|
16118
16262
|
name: "policy",
|
|
16119
16263
|
displayName: "Policy",
|
|
16120
16264
|
identityField: "name",
|
|
16121
16265
|
ignoredFields: IGNORED_FIELDS$1,
|
|
16266
|
+
unorderedPaths: UNORDERED_PATHS,
|
|
16122
16267
|
readLocal(rootDir, source) {
|
|
16123
16268
|
return readLocalSchemas(rootDir, "policy", source);
|
|
16124
16269
|
},
|
|
@@ -16129,7 +16274,7 @@ const policyModule = {
|
|
|
16129
16274
|
.filter(p => !p.system)
|
|
16130
16275
|
.map(p => ({
|
|
16131
16276
|
slug: sanitizeSlug(p.name),
|
|
16132
|
-
id: p
|
|
16277
|
+
id: recordKey(p),
|
|
16133
16278
|
data: p
|
|
16134
16279
|
}));
|
|
16135
16280
|
},
|
|
@@ -16151,21 +16296,21 @@ const policyModule = {
|
|
|
16151
16296
|
deleteLocalSchema(rootDir, "policy", slug);
|
|
16152
16297
|
},
|
|
16153
16298
|
diffFields(local, remote) {
|
|
16154
|
-
return diffSchemaFields(local, remote, IGNORED_FIELDS$1);
|
|
16299
|
+
return diffSchemaFields(local, remote, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16155
16300
|
},
|
|
16156
16301
|
renderDetail(local, remote) {
|
|
16157
|
-
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1);
|
|
16302
|
+
return renderSchemaDetail(local.data, remote.data, IGNORED_FIELDS$1, UNORDERED_PATHS);
|
|
16158
16303
|
},
|
|
16159
16304
|
summaryLine(resource) {
|
|
16160
16305
|
const stmts = resource.data.statement?.length ?? 0;
|
|
16161
16306
|
return `${stmts} statement${stmts !== 1 ? "s" : ""}`;
|
|
16162
16307
|
},
|
|
16163
16308
|
extractLocalId(data) {
|
|
16164
|
-
return data
|
|
16309
|
+
return recordKey(data);
|
|
16165
16310
|
}
|
|
16166
16311
|
};
|
|
16167
16312
|
|
|
16168
|
-
const IGNORED_FIELDS = [
|
|
16313
|
+
const IGNORED_FIELDS = [...KEY_FIELDS, "value", "updated_at"];
|
|
16169
16314
|
const secretModule = {
|
|
16170
16315
|
name: "secret",
|
|
16171
16316
|
displayName: "Secret",
|
|
@@ -16179,7 +16324,7 @@ const secretModule = {
|
|
|
16179
16324
|
const items = unwrapList(res);
|
|
16180
16325
|
return items.map(s => ({
|
|
16181
16326
|
slug: sanitizeSlug(s.key),
|
|
16182
|
-
id: s
|
|
16327
|
+
id: recordKey(s),
|
|
16183
16328
|
data: s
|
|
16184
16329
|
}));
|
|
16185
16330
|
},
|
|
@@ -16208,7 +16353,7 @@ const secretModule = {
|
|
|
16208
16353
|
return `key: ${resource.data.key}`;
|
|
16209
16354
|
},
|
|
16210
16355
|
extractLocalId(data) {
|
|
16211
|
-
return data
|
|
16356
|
+
return recordKey(data);
|
|
16212
16357
|
}
|
|
16213
16358
|
};
|
|
16214
16359
|
|