breakaway 2.0.0-main.48 → 2.0.0-main.49
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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/infra-cloudflare-plan.js +3 -15
- package/src/infra-cloudflare.js +17 -4
- package/src/infra-provider.js +5 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "breakaway",
|
|
3
|
-
"version": "2.0.0-main.
|
|
3
|
+
"version": "2.0.0-main.49",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "breakaway",
|
|
9
|
-
"version": "2.0.0-main.
|
|
9
|
+
"version": "2.0.0-main.49",
|
|
10
10
|
"license": "FSL-1.1-Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"breakaway": "scripts/tasks.mjs"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "breakaway",
|
|
3
|
-
"version": "2.0.0-main.
|
|
3
|
+
"version": "2.0.0-main.49",
|
|
4
4
|
"description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
|
|
5
5
|
"license": "FSL-1.1-Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
API,
|
|
26
26
|
BINDING_TARGETS,
|
|
27
27
|
CloudflareError,
|
|
28
|
+
MANAGED,
|
|
28
29
|
PRICES,
|
|
29
30
|
accountOf,
|
|
30
31
|
bindingTarget,
|
|
@@ -44,21 +45,8 @@ import {
|
|
|
44
45
|
/** @typedef {import('./infra-provider.js').ApplyResult} ApplyResult */
|
|
45
46
|
/** @typedef {import('./infra-cloudflare.js').LiveAccount} LiveAccount */
|
|
46
47
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
* versions, a database's size, a container's instances) is Cloudflare's or the deploy's, and is never compared.
|
|
50
|
-
*/
|
|
51
|
-
export const MANAGED = {
|
|
52
|
-
worker: ['compatibilityDate', 'compatibilityFlags', 'usageModel', 'observability', 'placement', 'bindings', 'crons'],
|
|
53
|
-
'durable-object': [],
|
|
54
|
-
d1: [],
|
|
55
|
-
kv: [],
|
|
56
|
-
r2: ['cors', 'lifecycle'],
|
|
57
|
-
queue: ['deliveryDelay', 'deliveryPaused', 'retention'],
|
|
58
|
-
container: ['maxInstances'],
|
|
59
|
-
route: ['worker'],
|
|
60
|
-
'custom-domain': ['worker', 'environment'],
|
|
61
|
-
};
|
|
48
|
+
/** The settings Architect manages, by kind: infra-cloudflare.js keeps them, on each kind. */
|
|
49
|
+
export { MANAGED };
|
|
62
50
|
|
|
63
51
|
/** Kinds Cloudflare names by their name, so a rename is a change of its own (KV's title, a route's pattern). */
|
|
64
52
|
const RENAMES = new Set(['kv', 'route']);
|
package/src/infra-cloudflare.js
CHANGED
|
@@ -32,12 +32,25 @@ import { apply, estimate, plan } from './infra-cloudflare-plan.js';
|
|
|
32
32
|
export const API = 'https://api.cloudflare.com/client/v4';
|
|
33
33
|
|
|
34
34
|
const BASE = ['create', 'update', 'delete'];
|
|
35
|
+
/**
|
|
36
|
+
* The settings Architect manages, by kind. Everything else a resource carries (a Worker's handlers, secrets, and live
|
|
37
|
+
* versions, a database's size, a container's instances) is Cloudflare's or the deploy's, and is never compared.
|
|
38
|
+
*/
|
|
39
|
+
export const MANAGED = {
|
|
40
|
+
worker: ['compatibilityDate', 'compatibilityFlags', 'usageModel', 'observability', 'placement', 'bindings', 'crons'],
|
|
41
|
+
'durable-object': [],
|
|
42
|
+
d1: [],
|
|
43
|
+
kv: [],
|
|
44
|
+
r2: ['cors', 'lifecycle'],
|
|
45
|
+
queue: ['deliveryDelay', 'deliveryPaused', 'retention'],
|
|
46
|
+
container: ['maxInstances'],
|
|
47
|
+
route: ['worker'],
|
|
48
|
+
'custom-domain': ['worker', 'environment'],
|
|
49
|
+
};
|
|
50
|
+
|
|
35
51
|
/** BRK-227 adds `scale` to queues and `scale` and `restart` to containers. */
|
|
36
52
|
export const CLOUDFLARE_KINDS = Object.fromEntries(
|
|
37
|
-
[
|
|
38
|
-
k,
|
|
39
|
-
{ changes: [...BASE] },
|
|
40
|
-
]),
|
|
53
|
+
Object.entries(MANAGED).map(([k, settings]) => [k, { changes: [...BASE], settings: [...settings] }]),
|
|
41
54
|
);
|
|
42
55
|
|
|
43
56
|
/**
|
package/src/infra-provider.js
CHANGED
|
@@ -147,6 +147,9 @@ export const COST_NOTE_MAX = 500;
|
|
|
147
147
|
* owner for any change to one (BRK-181)
|
|
148
148
|
* @property {string[]} [accessSettings] settings of the kind that decide who or what can reach it (like `public`): policy
|
|
149
149
|
* asks the owner for a change to one
|
|
150
|
+
* @property {string[]} [settings] the settings a desired state sets for the kind; the rest of a resource's attrs are what
|
|
151
|
+
* the platform reports by itself (versions, sizes, deploys), which a draft of the desired state leaves out (BRK-240).
|
|
152
|
+
* Without it, every attr is a setting.
|
|
150
153
|
* @property {string} [scales] the whole-number setting a `scale` changes (like `instances`): required when the kind
|
|
151
154
|
* declares `scale`, so an envelope (BRK-186) knows what its bounds are bounds of
|
|
152
155
|
*/
|
|
@@ -241,6 +244,8 @@ export function checkProvider(provider) {
|
|
|
241
244
|
fail(what, `${kind}'s access is not true or false`);
|
|
242
245
|
if (spec.accessSettings !== undefined && (!Array.isArray(spec.accessSettings) || !spec.accessSettings.every(text)))
|
|
243
246
|
fail(what, `${kind}'s accessSettings is not a list of settings' names`);
|
|
247
|
+
if (spec.settings !== undefined && (!Array.isArray(spec.settings) || !spec.settings.every(text)))
|
|
248
|
+
fail(what, `${kind}'s settings is not a list of settings' names`);
|
|
244
249
|
if (spec.changes.includes('scale') ? !text(spec.scales) : spec.scales !== undefined)
|
|
245
250
|
fail(what, `${kind}'s scales names the setting a scale changes, and only a kind that scales has one`);
|
|
246
251
|
}
|