@looply/core 0.5.12 → 0.5.14
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/dist/ids.d.ts +1 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +1 -0
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/preview-environment.d.ts +95 -0
- package/dist/preview-environment.d.ts.map +1 -0
- package/dist/preview-environment.js +174 -0
- package/dist/preview-environment.js.map +1 -0
- package/dist/visual-proof.d.ts +61 -0
- package/dist/visual-proof.d.ts.map +1 -0
- package/dist/visual-proof.js +92 -0
- package/dist/visual-proof.js.map +1 -0
- package/package.json +1 -1
package/dist/ids.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare const ID_PREFIX: {
|
|
|
73
73
|
readonly handshake: "hsk";
|
|
74
74
|
/** One goal a machine's weekly maintenance plan proposes, before anyone tickets it. */
|
|
75
75
|
readonly maintenanceProposal: "mnt";
|
|
76
|
+
readonly screenshot: "scr";
|
|
76
77
|
};
|
|
77
78
|
export type IdKind = keyof typeof ID_PREFIX;
|
|
78
79
|
/**
|
package/dist/ids.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAEA,4FAA4F;AAC5F,eAAO,MAAM,SAAS;;;;;;;;;;IAUpB,uEAAuE;;IAEvE,+EAA+E;;IAE/E,oFAAoF;;IAEpF,oDAAoD;;IAEpD;;;;;;;;OAQG;;IAEH,qDAAqD;;IAErD;;;;;;OAMG;;IAEH,uDAAuD;;IAEvD,6EAA6E;;IAE7E,8EAA8E;;IAE9E,sDAAsD;;IAEtD,sDAAsD;;IAEtD,6FAA6F;;IAE7F,uEAAuE;;IAEvE,uDAAuD;;IAEvD;;;;;;;OAOG;;IA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al a machine's weekly maintenance plan proposes, before anyone tickets it. */
|
|
84
84
|
maintenanceProposal: 'mnt',
|
|
85
|
+
screenshot: 'scr',
|
|
85
86
|
};
|
|
86
87
|
const ALPHABET = '0123456789abcdefghjkmnpqrstvwxyz'; // Crockford-ish: no i, l, o, u
|
|
87
88
|
/**
|
package/dist/ids.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":";;;AAyFA,sBAEC;AAqBD,8BAKC;AAWD,wBAEC;AAED,gCASC;AAUD,oBAMC;AA7JD,mCAAiD;AAEjD,4FAA4F;AAC/E,QAAA,SAAS,GAAG;IACvB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,uEAAuE;IACvE,QAAQ,EAAE,KAAK;IACf,+EAA+E;IAC/E,QAAQ,EAAE,KAAK;IACf,oFAAoF;IACpF,KAAK,EAAE,KAAK;IACZ,oDAAoD;IACpD,aAAa,EAAE,KAAK;IACpB;;;;;;;;OAQG;IACH,SAAS,EAAE,KAAK;IAChB,qDAAqD;IACrD,cAAc,EAAE,KAAK;IACrB;;;;;;OAMG;IACH,UAAU,EAAE,KAAK;IACjB,uDAAuD;IACvD,UAAU,EAAE,KAAK;IACjB,6EAA6E;IAC7E,WAAW,EAAE,KAAK;IAClB,8EAA8E;IAC9E,MAAM,EAAE,KAAK;IACb,sDAAsD;IACtD,SAAS,EAAE,KAAK;IAChB,sDAAsD;IACtD,cAAc,EAAE,KAAK;IACrB,6FAA6F;IAC7F,WAAW,EAAE,KAAK;IACl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,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from './delivery-settings';
|
|
|
59
59
|
export * from './environment';
|
|
60
60
|
export * from './provider-accounts';
|
|
61
61
|
export * from './maintenance';
|
|
62
|
+
export * from './visual-proof';
|
|
62
63
|
export * from './action-canonical';
|
|
63
64
|
export * from './action';
|
|
64
65
|
export * from './approval';
|
|
@@ -84,4 +85,5 @@ export * from './graph-queries';
|
|
|
84
85
|
export * from './graph-context';
|
|
85
86
|
export * from './repo-url';
|
|
86
87
|
export * from './pursuit-end';
|
|
88
|
+
export * from './preview-environment';
|
|
87
89
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cA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AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,7 @@ __exportStar(require("./delivery-settings"), exports);
|
|
|
75
75
|
__exportStar(require("./environment"), exports);
|
|
76
76
|
__exportStar(require("./provider-accounts"), exports);
|
|
77
77
|
__exportStar(require("./maintenance"), exports);
|
|
78
|
+
__exportStar(require("./visual-proof"), exports);
|
|
78
79
|
__exportStar(require("./action-canonical"), exports);
|
|
79
80
|
__exportStar(require("./action"), exports);
|
|
80
81
|
__exportStar(require("./approval"), exports);
|
|
@@ -100,4 +101,5 @@ __exportStar(require("./graph-queries"), exports);
|
|
|
100
101
|
__exportStar(require("./graph-context"), exports);
|
|
101
102
|
__exportStar(require("./repo-url"), exports);
|
|
102
103
|
__exportStar(require("./pursuit-end"), exports);
|
|
104
|
+
__exportStar(require("./preview-environment"), exports);
|
|
103
105
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,kDAAgC;AAChC,kDAAgC;AAChC,uDAAqC;AACrC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,8CAA4B;AAC5B,oDAAkC;AAClC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,wDAAsC;AACtC,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,gDAA8B;AAC9B,sDAAoC;AACpC,gDAA8B;AAC9B,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,oDAAkC;AAClC,+CAA6B;AAC7B,6CAA2B;AAC3B,gDAA8B;AAC9B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,6CAA2B;AAC3B,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,oDAAkC;AAClC,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,yCAAuB;AACvB,+CAA6B;AAC7B,kDAAgC;AAChC,kDAAgC;AAChC,uDAAqC;AACrC,wDAAsC;AACtC,2DAAyC;AACzC,uDAAqC;AACrC,+CAA6B;AAC7B,uDAAqC;AACrC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,uDAAqC;AACrC,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,kDAAgC;AAChC,oDAAkC;AAClC,kDAAgC;AAChC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,8CAA4B;AAC5B,oDAAkC;AAClC,0DAAwC;AACxC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,wDAAsC;AACtC,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,gDAA8B;AAC9B,sDAAoC;AACpC,gDAA8B;AAC9B,iDAA+B;AAC/B,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,kDAAgC;AAChC,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC;AACtC,6CAA2B;AAC3B,gDAA8B;AAC9B,4CAA0B;AAC1B,6CAA2B;AAC3B,mDAAiC;AACjC,oDAAkC;AAClC,+CAA6B;AAC7B,6CAA2B;AAC3B,gDAA8B;AAC9B,mDAAiC;AACjC,kDAAgC;AAChC,mDAAiC;AACjC,mDAAiC;AACjC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,6CAA2B;AAC3B,gDAA8B;AAC9B,wDAAsC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A TEMPORARY SITE PER PULL REQUEST — the shape the server stores and the machine obeys.
|
|
3
|
+
*
|
|
4
|
+
* When Looply opens a pull request for a goal, the branch can be built into a
|
|
5
|
+
* preview site a person opens to try the change ("Test it here →"). Which
|
|
6
|
+
* mechanism builds it is chosen per project, explicitly, never guessed:
|
|
7
|
+
*
|
|
8
|
+
* none — no preview (THE DEFAULT).
|
|
9
|
+
* netlify — Netlify's own deploy previews. Netlify builds every pull request
|
|
10
|
+
* of a connected site by itself; Looply only READS the preview's
|
|
11
|
+
* address and state from what Netlify reports on the pull request.
|
|
12
|
+
* `site` (optional) picks one site when a repository has several.
|
|
13
|
+
* heroku — Heroku review apps on the named `pipeline`. Heroku's automatic
|
|
14
|
+
* review apps build them; Looply reads them. `create: true` lets
|
|
15
|
+
* Looply ask Heroku for one when the pipeline does not make them by
|
|
16
|
+
* itself — that is a new paid app, so it is never the default.
|
|
17
|
+
* command — a command that builds the preview and prints its https address.
|
|
18
|
+
* A remote setting can choose this provider but can NEVER carry the
|
|
19
|
+
* command: the command is only ever what the project's own
|
|
20
|
+
* `.looply/config.yaml` declares (`preview.command`), exactly like
|
|
21
|
+
* `deliver.release`. AutoRyn choosing "command" never runs code that
|
|
22
|
+
* AutoRyn wrote.
|
|
23
|
+
*
|
|
24
|
+
* 🔴 NO SECRETS HERE. Nothing in a setting or a report is a credential: the
|
|
25
|
+
* machine uses its own sign-ins (GitHub CLI / git credential helper, Heroku's
|
|
26
|
+
* own login) and never sends them anywhere but the provider's API. A preview
|
|
27
|
+
* address is reduced to scheme + host + path — any user:password, query string
|
|
28
|
+
* or fragment is dropped before it is stored or shown, because a signed link
|
|
29
|
+
* is a credential.
|
|
30
|
+
*/
|
|
31
|
+
export declare const PREVIEW_PROVIDERS: readonly ["none", "netlify", "heroku", "command"];
|
|
32
|
+
export type PreviewProvider = (typeof PREVIEW_PROVIDERS)[number];
|
|
33
|
+
export type PreviewSettings = {
|
|
34
|
+
provider: 'none';
|
|
35
|
+
} | {
|
|
36
|
+
provider: 'netlify';
|
|
37
|
+
site?: string;
|
|
38
|
+
} | {
|
|
39
|
+
provider: 'heroku';
|
|
40
|
+
pipeline: string;
|
|
41
|
+
create?: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
provider: 'command';
|
|
44
|
+
};
|
|
45
|
+
export declare const DEFAULT_PREVIEW_SETTINGS: PreviewSettings;
|
|
46
|
+
export declare function isPreviewProvider(x: unknown): x is PreviewProvider;
|
|
47
|
+
export type PreviewSettingsValidation = {
|
|
48
|
+
ok: true;
|
|
49
|
+
settings: PreviewSettings;
|
|
50
|
+
} | {
|
|
51
|
+
ok: false;
|
|
52
|
+
key: string;
|
|
53
|
+
because: string;
|
|
54
|
+
};
|
|
55
|
+
/** The one rule the server applies on write and the machine on read. */
|
|
56
|
+
export declare function validatePreviewSettings(x: unknown): PreviewSettingsValidation;
|
|
57
|
+
/** One sentence a person reads beside the choice. */
|
|
58
|
+
export declare function describePreview(s: PreviewSettings | null | undefined): string;
|
|
59
|
+
/**
|
|
60
|
+
* WHERE ONE PULL REQUEST'S PREVIEW STANDS.
|
|
61
|
+
*
|
|
62
|
+
* building — the provider is building it (or Looply's command is running)
|
|
63
|
+
* live — it is up; `url` is the address a person opens
|
|
64
|
+
* failed — it did not build, or never appeared; `detail` says why in words
|
|
65
|
+
* removed — the pull request merged or closed and the preview was torn down
|
|
66
|
+
* (or, where the provider keeps it, is no longer updated — `detail` says)
|
|
67
|
+
*/
|
|
68
|
+
export declare const PREVIEW_STATES: readonly ["building", "live", "failed", "removed"];
|
|
69
|
+
export type PreviewState = (typeof PREVIEW_STATES)[number];
|
|
70
|
+
export interface PreviewReport {
|
|
71
|
+
provider: Exclude<PreviewProvider, 'none'>;
|
|
72
|
+
state: PreviewState;
|
|
73
|
+
/** The preview's address (scheme + host + path only), or null while there is none. */
|
|
74
|
+
url: string | null;
|
|
75
|
+
/** The pull request it previews. */
|
|
76
|
+
pullRequestUrl: string | null;
|
|
77
|
+
/** The commit it was built from, when known. */
|
|
78
|
+
sha: string | null;
|
|
79
|
+
/** A plain sentence; never a command's output. */
|
|
80
|
+
detail: string | null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A preview address safe to store and show: https only, no user:password, no
|
|
84
|
+
* query string, no fragment. Null for anything else.
|
|
85
|
+
*/
|
|
86
|
+
export declare function safePreviewUrl(raw: unknown): string | null;
|
|
87
|
+
/** A report a machine sent, checked once, the same way on both sides. */
|
|
88
|
+
export declare function validatePreviewReport(x: unknown): {
|
|
89
|
+
ok: true;
|
|
90
|
+
report: PreviewReport;
|
|
91
|
+
} | {
|
|
92
|
+
ok: false;
|
|
93
|
+
because: string;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=preview-environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-environment.d.ts","sourceRoot":"","sources":["../src/preview-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAO,MAAM,iBAAiB,mDAAoD,CAAC;AACnF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1D;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAE5B,eAAO,MAAM,wBAAwB,EAAE,eAAsC,CAAC;AAM9E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAElE;AAED,MAAM,MAAM,yBAAyB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9H,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAmC7E;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAO7E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,oDAAqD,CAAC;AACjF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC3C,KAAK,EAAE,YAAY,CAAC;IACpB,sFAAsF;IACtF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,oCAAoC;IACpC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gDAAgD;IAChD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,kDAAkD;IAClD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAKD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAa1D;AAED,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgCtH"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A TEMPORARY SITE PER PULL REQUEST — the shape the server stores and the machine obeys.
|
|
4
|
+
*
|
|
5
|
+
* When Looply opens a pull request for a goal, the branch can be built into a
|
|
6
|
+
* preview site a person opens to try the change ("Test it here →"). Which
|
|
7
|
+
* mechanism builds it is chosen per project, explicitly, never guessed:
|
|
8
|
+
*
|
|
9
|
+
* none — no preview (THE DEFAULT).
|
|
10
|
+
* netlify — Netlify's own deploy previews. Netlify builds every pull request
|
|
11
|
+
* of a connected site by itself; Looply only READS the preview's
|
|
12
|
+
* address and state from what Netlify reports on the pull request.
|
|
13
|
+
* `site` (optional) picks one site when a repository has several.
|
|
14
|
+
* heroku — Heroku review apps on the named `pipeline`. Heroku's automatic
|
|
15
|
+
* review apps build them; Looply reads them. `create: true` lets
|
|
16
|
+
* Looply ask Heroku for one when the pipeline does not make them by
|
|
17
|
+
* itself — that is a new paid app, so it is never the default.
|
|
18
|
+
* command — a command that builds the preview and prints its https address.
|
|
19
|
+
* A remote setting can choose this provider but can NEVER carry the
|
|
20
|
+
* command: the command is only ever what the project's own
|
|
21
|
+
* `.looply/config.yaml` declares (`preview.command`), exactly like
|
|
22
|
+
* `deliver.release`. AutoRyn choosing "command" never runs code that
|
|
23
|
+
* AutoRyn wrote.
|
|
24
|
+
*
|
|
25
|
+
* 🔴 NO SECRETS HERE. Nothing in a setting or a report is a credential: the
|
|
26
|
+
* machine uses its own sign-ins (GitHub CLI / git credential helper, Heroku's
|
|
27
|
+
* own login) and never sends them anywhere but the provider's API. A preview
|
|
28
|
+
* address is reduced to scheme + host + path — any user:password, query string
|
|
29
|
+
* or fragment is dropped before it is stored or shown, because a signed link
|
|
30
|
+
* is a credential.
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.PREVIEW_STATES = exports.DEFAULT_PREVIEW_SETTINGS = exports.PREVIEW_PROVIDERS = void 0;
|
|
34
|
+
exports.isPreviewProvider = isPreviewProvider;
|
|
35
|
+
exports.validatePreviewSettings = validatePreviewSettings;
|
|
36
|
+
exports.describePreview = describePreview;
|
|
37
|
+
exports.safePreviewUrl = safePreviewUrl;
|
|
38
|
+
exports.validatePreviewReport = validatePreviewReport;
|
|
39
|
+
exports.PREVIEW_PROVIDERS = ['none', 'netlify', 'heroku', 'command'];
|
|
40
|
+
exports.DEFAULT_PREVIEW_SETTINGS = { provider: 'none' };
|
|
41
|
+
const SITE = /^[A-Za-z0-9][A-Za-z0-9-]{0,62}$/;
|
|
42
|
+
/** A Heroku pipeline's name or its uuid. */
|
|
43
|
+
const PIPELINE = /^(?:[a-z][a-z0-9-]{1,99}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/;
|
|
44
|
+
function isPreviewProvider(x) {
|
|
45
|
+
return typeof x === 'string' && exports.PREVIEW_PROVIDERS.includes(x);
|
|
46
|
+
}
|
|
47
|
+
/** The one rule the server applies on write and the machine on read. */
|
|
48
|
+
function validatePreviewSettings(x) {
|
|
49
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x)) {
|
|
50
|
+
return { ok: false, key: '<root>', because: 'must be an object like { "provider": "netlify" }' };
|
|
51
|
+
}
|
|
52
|
+
const o = x;
|
|
53
|
+
const provider = o['provider'];
|
|
54
|
+
if (!isPreviewProvider(provider))
|
|
55
|
+
return { ok: false, key: 'provider', because: `must be one of: ${exports.PREVIEW_PROVIDERS.join(', ')}` };
|
|
56
|
+
const allowed = provider === 'netlify' ? ['provider', 'site'] : provider === 'heroku' ? ['provider', 'pipeline', 'create'] : ['provider'];
|
|
57
|
+
for (const k of Object.keys(o)) {
|
|
58
|
+
if (!allowed.includes(k)) {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
key: k,
|
|
62
|
+
because: k === 'command' || k === 'teardown'
|
|
63
|
+
? "a preview command is read only from the project's own .looply/config.yaml (preview.command), never from a remote setting"
|
|
64
|
+
: `is not part of a ${provider} preview`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (provider === 'netlify') {
|
|
69
|
+
const site = o['site'];
|
|
70
|
+
if (site === undefined || site === null || site === '')
|
|
71
|
+
return { ok: true, settings: { provider } };
|
|
72
|
+
if (typeof site !== 'string' || !SITE.test(site))
|
|
73
|
+
return { ok: false, key: 'site', because: 'must be a Netlify site name, e.g. tabsy-web' };
|
|
74
|
+
return { ok: true, settings: { provider, site } };
|
|
75
|
+
}
|
|
76
|
+
if (provider === 'heroku') {
|
|
77
|
+
const pipeline = o['pipeline'];
|
|
78
|
+
if (typeof pipeline !== 'string' || !PIPELINE.test(pipeline)) {
|
|
79
|
+
return { ok: false, key: 'pipeline', because: 'must be a Heroku pipeline name or id, e.g. tabsy-pipeline' };
|
|
80
|
+
}
|
|
81
|
+
const create = o['create'];
|
|
82
|
+
if (create !== undefined && typeof create !== 'boolean')
|
|
83
|
+
return { ok: false, key: 'create', because: 'must be true or false' };
|
|
84
|
+
return { ok: true, settings: create === true ? { provider, pipeline, create: true } : { provider, pipeline } };
|
|
85
|
+
}
|
|
86
|
+
return { ok: true, settings: { provider } };
|
|
87
|
+
}
|
|
88
|
+
/** One sentence a person reads beside the choice. */
|
|
89
|
+
function describePreview(s) {
|
|
90
|
+
if (!s || s.provider === 'none')
|
|
91
|
+
return 'no preview site';
|
|
92
|
+
if (s.provider === 'netlify')
|
|
93
|
+
return `Netlify's deploy preview${s.site ? ` of ${s.site}` : ''} (Netlify builds it; Looply reads the link)`;
|
|
94
|
+
if (s.provider === 'heroku') {
|
|
95
|
+
return `a Heroku review app on ${s.pipeline}${s.create ? ' (Looply asks Heroku for one when the pipeline does not make it)' : " (the pipeline's automatic review apps)"}`;
|
|
96
|
+
}
|
|
97
|
+
return "the preview command the project's .looply/config.yaml declares";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* WHERE ONE PULL REQUEST'S PREVIEW STANDS.
|
|
101
|
+
*
|
|
102
|
+
* building — the provider is building it (or Looply's command is running)
|
|
103
|
+
* live — it is up; `url` is the address a person opens
|
|
104
|
+
* failed — it did not build, or never appeared; `detail` says why in words
|
|
105
|
+
* removed — the pull request merged or closed and the preview was torn down
|
|
106
|
+
* (or, where the provider keeps it, is no longer updated — `detail` says)
|
|
107
|
+
*/
|
|
108
|
+
exports.PREVIEW_STATES = ['building', 'live', 'failed', 'removed'];
|
|
109
|
+
const MAX_DETAIL = 400;
|
|
110
|
+
const MAX_URL = 400;
|
|
111
|
+
/**
|
|
112
|
+
* A preview address safe to store and show: https only, no user:password, no
|
|
113
|
+
* query string, no fragment. Null for anything else.
|
|
114
|
+
*/
|
|
115
|
+
function safePreviewUrl(raw) {
|
|
116
|
+
if (typeof raw !== 'string')
|
|
117
|
+
return null;
|
|
118
|
+
const s = raw.trim();
|
|
119
|
+
if (s === '' || s.length > 2000)
|
|
120
|
+
return null;
|
|
121
|
+
let u;
|
|
122
|
+
try {
|
|
123
|
+
u = new URL(s);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
if (u.protocol !== 'https:' || u.hostname === '')
|
|
129
|
+
return null;
|
|
130
|
+
const out = `https://${u.host.toLowerCase()}${u.pathname === '/' ? '' : u.pathname}`;
|
|
131
|
+
return out.length > MAX_URL || /\s/.test(out) ? null : out;
|
|
132
|
+
}
|
|
133
|
+
/** A report a machine sent, checked once, the same way on both sides. */
|
|
134
|
+
function validatePreviewReport(x) {
|
|
135
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x))
|
|
136
|
+
return { ok: false, because: 'must be an object' };
|
|
137
|
+
const o = x;
|
|
138
|
+
const provider = o['provider'];
|
|
139
|
+
if (!isPreviewProvider(provider) || provider === 'none')
|
|
140
|
+
return { ok: false, because: 'provider must be netlify, heroku or command' };
|
|
141
|
+
const state = o['state'];
|
|
142
|
+
if (typeof state !== 'string' || !exports.PREVIEW_STATES.includes(state)) {
|
|
143
|
+
return { ok: false, because: `state must be one of: ${exports.PREVIEW_STATES.join(', ')}` };
|
|
144
|
+
}
|
|
145
|
+
let url = null;
|
|
146
|
+
if (o['url'] !== null && o['url'] !== undefined) {
|
|
147
|
+
url = safePreviewUrl(o['url']);
|
|
148
|
+
if (url === null || url !== o['url'])
|
|
149
|
+
return { ok: false, because: 'url must be an https address without credentials, query or fragment' };
|
|
150
|
+
}
|
|
151
|
+
let pullRequestUrl = null;
|
|
152
|
+
if (o['pullRequestUrl'] !== null && o['pullRequestUrl'] !== undefined) {
|
|
153
|
+
const p = o['pullRequestUrl'];
|
|
154
|
+
if (typeof p !== 'string' || p.length > MAX_URL || !/^https:\/\/[^\s]+$/.test(p))
|
|
155
|
+
return { ok: false, because: 'pullRequestUrl must be an https address' };
|
|
156
|
+
pullRequestUrl = p;
|
|
157
|
+
}
|
|
158
|
+
let sha = null;
|
|
159
|
+
if (o['sha'] !== null && o['sha'] !== undefined) {
|
|
160
|
+
if (typeof o['sha'] !== 'string' || !/^[0-9a-f]{7,64}$/.test(o['sha']))
|
|
161
|
+
return { ok: false, because: 'sha must be a hex commit id' };
|
|
162
|
+
sha = o['sha'];
|
|
163
|
+
}
|
|
164
|
+
let detail = null;
|
|
165
|
+
if (o['detail'] !== null && o['detail'] !== undefined) {
|
|
166
|
+
if (typeof o['detail'] !== 'string' || o['detail'].length > MAX_DETAIL)
|
|
167
|
+
return { ok: false, because: `detail must be a string of at most ${MAX_DETAIL} characters` };
|
|
168
|
+
detail = o['detail'];
|
|
169
|
+
}
|
|
170
|
+
if (state === 'live' && url === null)
|
|
171
|
+
return { ok: false, because: 'a live preview needs its url' };
|
|
172
|
+
return { ok: true, report: { provider, state: state, url, pullRequestUrl, sha, detail } };
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=preview-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-environment.js","sourceRoot":"","sources":["../src/preview-environment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAiBH,8CAEC;AAKD,0DAmCC;AAGD,0CAOC;AAkCD,wCAaC;AAGD,sDAgCC;AArJY,QAAA,iBAAiB,GAAG,CAAC,MAAM,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CAAC,KAAK,SAAS,EAAE,CAAC;QAChD,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;QACrI,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IACD,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;QACtD,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,UAAU;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,sCAAsC,UAAU,aAAa,EAAE,CAAC;QACrK,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IACD,IAAI,KAAK,KAAK,MAAM,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC;IACpG,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAqB,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BEFORE/AFTER SCREENSHOTS OF A FINISHED UI GOAL — THE WIRE SHAPE.
|
|
3
|
+
*
|
|
4
|
+
* The machine that built and captured them uploads a few contact sheets (one
|
|
5
|
+
* per screen and width, before beside after) to the goal; a reader — the
|
|
6
|
+
* Looply console, AutoRyn's ticket — lists them from the goal's evidence and
|
|
7
|
+
* fetches each image by id. One rule, used on both sides.
|
|
8
|
+
*
|
|
9
|
+
* Bounded on purpose: these ride in the database, so a goal holds at most
|
|
10
|
+
* `MAX_PROOF_IMAGES` images of at most `MAX_PROOF_IMAGE_BYTES` each, JPEG or
|
|
11
|
+
* PNG, and a new upload REPLACES the goal's previous set.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MAX_PROOF_IMAGES = 12;
|
|
14
|
+
export declare const MAX_PROOF_IMAGE_BYTES = 1500000;
|
|
15
|
+
export declare const MAX_PROOF_TOTAL_BYTES = 8000000;
|
|
16
|
+
export declare const PROOF_IMAGE_TYPES: readonly ["image/jpeg", "image/png"];
|
|
17
|
+
export type ProofImageType = (typeof PROOF_IMAGE_TYPES)[number];
|
|
18
|
+
export interface VisualProofImageUpload {
|
|
19
|
+
/** A file name, unique within the upload: `admin-dashboard-desktop.jpg`. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** What it shows, for a person: `admin · Dashboard · desktop (1280×800)`. */
|
|
22
|
+
label: string;
|
|
23
|
+
mime: ProofImageType;
|
|
24
|
+
/** The bytes, base64. */
|
|
25
|
+
data: string;
|
|
26
|
+
}
|
|
27
|
+
export interface VisualProofUpload {
|
|
28
|
+
baseSha: string;
|
|
29
|
+
headSha: string;
|
|
30
|
+
/** What could not be shown, in words. */
|
|
31
|
+
notes: string[];
|
|
32
|
+
images: VisualProofImageUpload[];
|
|
33
|
+
/** Where the pull request shows them, when it does. */
|
|
34
|
+
pullRequestUrl?: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** What a reader sees: the images by id, without their bytes. */
|
|
37
|
+
export interface VisualProofSummary {
|
|
38
|
+
baseSha: string;
|
|
39
|
+
headSha: string;
|
|
40
|
+
notes: string[];
|
|
41
|
+
images: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
label: string;
|
|
45
|
+
mime: ProofImageType;
|
|
46
|
+
bytes: number;
|
|
47
|
+
}>;
|
|
48
|
+
at: string;
|
|
49
|
+
}
|
|
50
|
+
/** The decoded size of a base64 string, without decoding it. */
|
|
51
|
+
export declare function base64Bytes(b64: string): number;
|
|
52
|
+
export declare function validateVisualProofUpload(x: unknown): {
|
|
53
|
+
ok: true;
|
|
54
|
+
upload: VisualProofUpload;
|
|
55
|
+
} | {
|
|
56
|
+
ok: false;
|
|
57
|
+
because: string;
|
|
58
|
+
};
|
|
59
|
+
/** Does this look like the bytes of the type it claims? (PNG / JPEG magic numbers.) */
|
|
60
|
+
export declare function imageMatchesType(bytes: Uint8Array, mime: ProofImageType): boolean;
|
|
61
|
+
//# sourceMappingURL=visual-proof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual-proof.d.ts","sourceRoot":"","sources":["../src/visual-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,qBAAqB,UAAY,CAAC;AAC/C,eAAO,MAAM,qBAAqB,UAAY,CAAC;AAC/C,eAAO,MAAM,iBAAiB,sCAAuC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChG,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA4C9H;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAGjF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* BEFORE/AFTER SCREENSHOTS OF A FINISHED UI GOAL — THE WIRE SHAPE.
|
|
4
|
+
*
|
|
5
|
+
* The machine that built and captured them uploads a few contact sheets (one
|
|
6
|
+
* per screen and width, before beside after) to the goal; a reader — the
|
|
7
|
+
* Looply console, AutoRyn's ticket — lists them from the goal's evidence and
|
|
8
|
+
* fetches each image by id. One rule, used on both sides.
|
|
9
|
+
*
|
|
10
|
+
* Bounded on purpose: these ride in the database, so a goal holds at most
|
|
11
|
+
* `MAX_PROOF_IMAGES` images of at most `MAX_PROOF_IMAGE_BYTES` each, JPEG or
|
|
12
|
+
* PNG, and a new upload REPLACES the goal's previous set.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PROOF_IMAGE_TYPES = exports.MAX_PROOF_TOTAL_BYTES = exports.MAX_PROOF_IMAGE_BYTES = exports.MAX_PROOF_IMAGES = void 0;
|
|
16
|
+
exports.base64Bytes = base64Bytes;
|
|
17
|
+
exports.validateVisualProofUpload = validateVisualProofUpload;
|
|
18
|
+
exports.imageMatchesType = imageMatchesType;
|
|
19
|
+
exports.MAX_PROOF_IMAGES = 12;
|
|
20
|
+
exports.MAX_PROOF_IMAGE_BYTES = 1_500_000;
|
|
21
|
+
exports.MAX_PROOF_TOTAL_BYTES = 8_000_000;
|
|
22
|
+
exports.PROOF_IMAGE_TYPES = ['image/jpeg', 'image/png'];
|
|
23
|
+
const SHA = /^[0-9a-f]{7,64}$/;
|
|
24
|
+
const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$/;
|
|
25
|
+
const BASE64 = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
26
|
+
/** The decoded size of a base64 string, without decoding it. */
|
|
27
|
+
function base64Bytes(b64) {
|
|
28
|
+
const pad = b64.endsWith('==') ? 2 : b64.endsWith('=') ? 1 : 0;
|
|
29
|
+
return Math.floor((b64.length * 3) / 4) - pad;
|
|
30
|
+
}
|
|
31
|
+
function validateVisualProofUpload(x) {
|
|
32
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x))
|
|
33
|
+
return { ok: false, because: 'must be an object' };
|
|
34
|
+
const o = x;
|
|
35
|
+
const baseSha = o['baseSha'];
|
|
36
|
+
const headSha = o['headSha'];
|
|
37
|
+
if (typeof baseSha !== 'string' || !SHA.test(baseSha))
|
|
38
|
+
return { ok: false, because: 'baseSha must be a hex commit id' };
|
|
39
|
+
if (typeof headSha !== 'string' || !SHA.test(headSha))
|
|
40
|
+
return { ok: false, because: 'headSha must be a hex commit id' };
|
|
41
|
+
const notesRaw = o['notes'] ?? [];
|
|
42
|
+
if (!Array.isArray(notesRaw) || notesRaw.length > 20 || notesRaw.some((n) => typeof n !== 'string' || n.length > 600)) {
|
|
43
|
+
return { ok: false, because: 'notes must be at most 20 sentences of at most 600 characters' };
|
|
44
|
+
}
|
|
45
|
+
const imagesRaw = o['images'];
|
|
46
|
+
if (!Array.isArray(imagesRaw) || imagesRaw.length === 0 || imagesRaw.length > exports.MAX_PROOF_IMAGES) {
|
|
47
|
+
return { ok: false, because: `images must list 1 to ${exports.MAX_PROOF_IMAGES} images` };
|
|
48
|
+
}
|
|
49
|
+
const names = new Set();
|
|
50
|
+
const images = [];
|
|
51
|
+
let total = 0;
|
|
52
|
+
for (const [i, raw] of imagesRaw.entries()) {
|
|
53
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
54
|
+
return { ok: false, because: `images[${i}] must be an object` };
|
|
55
|
+
const r = raw;
|
|
56
|
+
const name = r['name'];
|
|
57
|
+
const label = r['label'];
|
|
58
|
+
const mime = r['mime'];
|
|
59
|
+
const data = r['data'];
|
|
60
|
+
if (typeof name !== 'string' || !NAME.test(name) || names.has(name))
|
|
61
|
+
return { ok: false, because: `images[${i}].name must be a unique plain file name` };
|
|
62
|
+
if (typeof label !== 'string' || label.trim() === '' || label.length > 200)
|
|
63
|
+
return { ok: false, because: `images[${i}].label must be a short description` };
|
|
64
|
+
if (typeof mime !== 'string' || !exports.PROOF_IMAGE_TYPES.includes(mime))
|
|
65
|
+
return { ok: false, because: `images[${i}].mime must be image/jpeg or image/png` };
|
|
66
|
+
if (typeof data !== 'string' || data.length === 0 || data.length % 4 !== 0 || !BASE64.test(data))
|
|
67
|
+
return { ok: false, because: `images[${i}].data must be base64` };
|
|
68
|
+
const bytes = base64Bytes(data);
|
|
69
|
+
if (bytes > exports.MAX_PROOF_IMAGE_BYTES)
|
|
70
|
+
return { ok: false, because: `images[${i}] is ${bytes} bytes; at most ${exports.MAX_PROOF_IMAGE_BYTES}` };
|
|
71
|
+
total += bytes;
|
|
72
|
+
names.add(name);
|
|
73
|
+
images.push({ name, label: label.trim(), mime: mime, data });
|
|
74
|
+
}
|
|
75
|
+
if (total > exports.MAX_PROOF_TOTAL_BYTES)
|
|
76
|
+
return { ok: false, because: `the images total ${total} bytes; at most ${exports.MAX_PROOF_TOTAL_BYTES}` };
|
|
77
|
+
const pr = o['pullRequestUrl'];
|
|
78
|
+
if (pr !== undefined && pr !== null && (typeof pr !== 'string' || pr.length > 400 || !/^https:\/\/\S+$/.test(pr))) {
|
|
79
|
+
return { ok: false, because: 'pullRequestUrl must be an https address' };
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
ok: true,
|
|
83
|
+
upload: { baseSha, headSha, notes: notesRaw, images, ...(typeof pr === 'string' ? { pullRequestUrl: pr } : {}) },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Does this look like the bytes of the type it claims? (PNG / JPEG magic numbers.) */
|
|
87
|
+
function imageMatchesType(bytes, mime) {
|
|
88
|
+
if (mime === 'image/png')
|
|
89
|
+
return bytes.length > 8 && bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47;
|
|
90
|
+
return bytes.length > 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=visual-proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual-proof.js","sourceRoot":"","sources":["../src/visual-proof.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA0CH,kCAGC;AAED,8DA4CC;AAGD,4CAGC;AA/FY,QAAA,gBAAgB,GAAG,EAAE,CAAC;AACtB,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,iBAAiB,GAAG,CAAC,YAAY,EAAE,WAAW,CAAU,CAAC;AAgCtE,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAC/B,MAAM,IAAI,GAAG,oC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