@maravilla-labs/adapter-core 3.4.0 → 4.0.0
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/build-failure.d.ts +31 -0
- package/dist/build-failure.d.ts.map +1 -0
- package/dist/build-failure.js +37 -0
- package/dist/build-failure.js.map +1 -0
- package/dist/events.d.ts +10 -8
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +23 -17
- package/dist/events.js.map +1 -1
- package/dist/workflows.d.ts +9 -6
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +22 -15
- package/dist/workflows.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared failure reporting for the workflows / events adapter steps.
|
|
3
|
+
*
|
|
4
|
+
* Both steps used to catch build errors, call `log?.error(...)`, and return —
|
|
5
|
+
* so the adapter build finished green and the deployment shipped without the
|
|
6
|
+
* bundle. Worse, `log` is optional and three of the four adapters pass nothing,
|
|
7
|
+
* so on those frameworks the failure produced no output at all (issue #94).
|
|
8
|
+
*
|
|
9
|
+
* A build error here is always fatal: the caller only gets this far after
|
|
10
|
+
* confirming the project actually has sources to build.
|
|
11
|
+
*/
|
|
12
|
+
export type AdapterLog = {
|
|
13
|
+
minor: (msg: string) => void;
|
|
14
|
+
error: (msg: string) => void;
|
|
15
|
+
warn: (msg: string) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Report a fatal build failure and throw.
|
|
19
|
+
*
|
|
20
|
+
* Writes to `console.error` unconditionally — not just through the optional
|
|
21
|
+
* `log` — so the message survives on adapters that pass no logger.
|
|
22
|
+
*/
|
|
23
|
+
export declare function failBuild(what: 'workflows' | 'events', error: unknown, log?: AdapterLog): never;
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when the build API itself can't be resolved. That means a
|
|
26
|
+
* broken or partial install of `@maravilla-labs/functions`, which is very
|
|
27
|
+
* different from "this project has no workflows" — the old code returned
|
|
28
|
+
* silent no-op stubs and the two were indistinguishable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function missingBuildApi(what: 'workflows' | 'events', attempted: string[]): Error;
|
|
31
|
+
//# sourceMappingURL=build-failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-failure.d.ts","sourceRoot":"","sources":["../src/build-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,KAAK,CAQ/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAOxF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared failure reporting for the workflows / events adapter steps.
|
|
3
|
+
*
|
|
4
|
+
* Both steps used to catch build errors, call `log?.error(...)`, and return —
|
|
5
|
+
* so the adapter build finished green and the deployment shipped without the
|
|
6
|
+
* bundle. Worse, `log` is optional and three of the four adapters pass nothing,
|
|
7
|
+
* so on those frameworks the failure produced no output at all (issue #94).
|
|
8
|
+
*
|
|
9
|
+
* A build error here is always fatal: the caller only gets this far after
|
|
10
|
+
* confirming the project actually has sources to build.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Report a fatal build failure and throw.
|
|
14
|
+
*
|
|
15
|
+
* Writes to `console.error` unconditionally — not just through the optional
|
|
16
|
+
* `log` — so the message survives on adapters that pass no logger.
|
|
17
|
+
*/
|
|
18
|
+
export function failBuild(what, error, log) {
|
|
19
|
+
const message = error?.message || String(error);
|
|
20
|
+
const banner = `Failed to build ${what} — aborting build so this is not silently deployed.`;
|
|
21
|
+
log?.error(banner);
|
|
22
|
+
console.error(`\n${banner}\n${message}\n`);
|
|
23
|
+
throw error instanceof Error ? error : new Error(message);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Error thrown when the build API itself can't be resolved. That means a
|
|
27
|
+
* broken or partial install of `@maravilla-labs/functions`, which is very
|
|
28
|
+
* different from "this project has no workflows" — the old code returned
|
|
29
|
+
* silent no-op stubs and the two were indistinguishable.
|
|
30
|
+
*/
|
|
31
|
+
export function missingBuildApi(what, attempted) {
|
|
32
|
+
return new Error(`Cannot load the ${what} build API — @maravilla-labs/functions did not resolve.\n` +
|
|
33
|
+
`Tried: ${attempted.join(', ')}\n\n` +
|
|
34
|
+
`This project has ${what} sources, so they cannot be skipped.\n` +
|
|
35
|
+
'Install the package (npm i -D @maravilla-labs/functions) and rebuild.');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=build-failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-failure.js","sourceRoot":"","sources":["../src/build-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAA4B,EAAE,KAAc,EAAE,GAAgB;IACtF,MAAM,OAAO,GAAI,KAAe,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,mBAAmB,IAAI,qDAAqD,CAAC;IAE5F,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC;IAE3C,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAA4B,EAAE,SAAmB;IAC/E,OAAO,IAAI,KAAK,CACd,mBAAmB,IAAI,2DAA2D;QAChF,UAAU,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;QACpC,oBAAoB,IAAI,wCAAwC;QAChE,uEAAuE,CAC1E,CAAC;AACJ,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TransformsConfig } from './transforms/index.js';
|
|
2
|
+
import type { AdapterLog } from './build-failure.js';
|
|
2
3
|
type EventsAPI = {
|
|
3
4
|
buildEvents: (opts: any) => Promise<any>;
|
|
4
5
|
integrateEventsWithManifest: (manifestPath: string, em: any) => Promise<void>;
|
|
@@ -6,7 +7,10 @@ type EventsAPI = {
|
|
|
6
7
|
/**
|
|
7
8
|
* Dynamically load the events build API from `@maravilla-labs/functions`.
|
|
8
9
|
* Mirrors {@link loadFunctionsAPI} — prefers the installed package, falls
|
|
9
|
-
* back to workspace paths
|
|
10
|
+
* back to workspace paths.
|
|
11
|
+
*
|
|
12
|
+
* Throws when nothing resolves; it previously returned no-op stubs, which made
|
|
13
|
+
* a broken install indistinguishable from a project with no events (issue #94).
|
|
10
14
|
*/
|
|
11
15
|
export declare function loadEventsAPI(): Promise<EventsAPI>;
|
|
12
16
|
/**
|
|
@@ -25,13 +29,11 @@ export interface BuildEventsOptions {
|
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Build events from a project directory and merge into the manifest.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* Safe no-op if no `events.ts` / `events/` present *and* no transforms config
|
|
34
|
+
* supplied. Once sources are known to exist, any failure aborts the adapter
|
|
35
|
+
* build rather than silently shipping a deployment without them (issue #94).
|
|
30
36
|
*/
|
|
31
|
-
export declare function buildAndIntegrateEvents(projectDir: string, outDir: string, log?:
|
|
32
|
-
minor: (msg: string) => void;
|
|
33
|
-
error: (msg: string) => void;
|
|
34
|
-
warn: (msg: string) => void;
|
|
35
|
-
}, opts?: BuildEventsOptions): Promise<void>;
|
|
37
|
+
export declare function buildAndIntegrateEvents(projectDir: string, outDir: string, log?: AdapterLog, opts?: BuildEventsOptions): Promise<void>;
|
|
36
38
|
export {};
|
|
37
39
|
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,2BAA2B,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/E,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzC,2BAA2B,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/E,CAAC;AAQF;;;;;;;GAOG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC,CAaxD;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,kBAAkB,GACxB,OAAO,CAAC,IAAI,CAAC,CA2Ef"}
|
package/dist/events.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { compileTransforms } from './transforms/index.js';
|
|
4
|
+
import { failBuild, missingBuildApi } from './build-failure.js';
|
|
5
|
+
const EVENTS_API_SPECIFIERS = [
|
|
6
|
+
'@maravilla-labs/functions',
|
|
7
|
+
'../../functions/dist/index.js',
|
|
8
|
+
'../../functions/src/index.ts',
|
|
9
|
+
];
|
|
4
10
|
/**
|
|
5
11
|
* Dynamically load the events build API from `@maravilla-labs/functions`.
|
|
6
12
|
* Mirrors {@link loadFunctionsAPI} — prefers the installed package, falls
|
|
7
|
-
* back to workspace paths
|
|
13
|
+
* back to workspace paths.
|
|
14
|
+
*
|
|
15
|
+
* Throws when nothing resolves; it previously returned no-op stubs, which made
|
|
16
|
+
* a broken install indistinguishable from a project with no events (issue #94).
|
|
8
17
|
*/
|
|
9
18
|
export async function loadEventsAPI() {
|
|
10
|
-
const
|
|
11
|
-
'@maravilla-labs/functions',
|
|
12
|
-
'../../functions/dist/index.js',
|
|
13
|
-
'../../functions/src/index.ts',
|
|
14
|
-
];
|
|
15
|
-
for (const spec of fallbacks) {
|
|
19
|
+
for (const spec of EVENTS_API_SPECIFIERS) {
|
|
16
20
|
try {
|
|
17
21
|
const mod = await import(spec);
|
|
18
22
|
if (mod.buildEvents && mod.integrateEventsWithManifest) {
|
|
@@ -24,15 +28,14 @@ export async function loadEventsAPI() {
|
|
|
24
28
|
}
|
|
25
29
|
catch (_) { /* try next */ }
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
buildEvents: async () => null,
|
|
29
|
-
integrateEventsWithManifest: async () => { },
|
|
30
|
-
};
|
|
31
|
+
throw missingBuildApi('events', EVENTS_API_SPECIFIERS);
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Build events from a project directory and merge into the manifest.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
35
|
+
*
|
|
36
|
+
* Safe no-op if no `events.ts` / `events/` present *and* no transforms config
|
|
37
|
+
* supplied. Once sources are known to exist, any failure aborts the adapter
|
|
38
|
+
* build rather than silently shipping a deployment without them (issue #94).
|
|
36
39
|
*/
|
|
37
40
|
export async function buildAndIntegrateEvents(projectDir, outDir, log, opts) {
|
|
38
41
|
const compiled = compileTransforms(opts?.transforms);
|
|
@@ -84,11 +87,14 @@ export async function buildAndIntegrateEvents(projectDir, outDir, log, opts) {
|
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
catch (error) {
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
failBuild('events', error, log);
|
|
91
|
+
}
|
|
92
|
+
// `null` means discovery found no sources. The guard above already
|
|
93
|
+
// established that an events entry (or a transforms block) exists.
|
|
94
|
+
if (!eventsManifest) {
|
|
95
|
+
failBuild('events', new Error(`An events entry exists in ${projectDir} but no event sources were discovered.\n` +
|
|
96
|
+
'Expected events.{ts,js,mjs} or files under events/.'), log);
|
|
89
97
|
}
|
|
90
|
-
if (!eventsManifest)
|
|
91
|
-
return;
|
|
92
98
|
await integrateEventsWithManifest(`${outDir}/manifest.json`, eventsManifest);
|
|
93
99
|
}
|
|
94
100
|
finally {
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MA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H,CAAC;AACH,CAAC"}
|
package/dist/workflows.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdapterLog } from './build-failure.js';
|
|
1
2
|
type WorkflowsAPI = {
|
|
2
3
|
buildWorkflows: (opts: any) => Promise<any>;
|
|
3
4
|
integrateWorkflowsWithManifest: (manifestPath: string, wm: any) => Promise<void>;
|
|
@@ -5,16 +6,18 @@ type WorkflowsAPI = {
|
|
|
5
6
|
/**
|
|
6
7
|
* Dynamically load the workflows build API from `@maravilla-labs/functions`.
|
|
7
8
|
* Mirrors {@link loadEventsAPI}.
|
|
9
|
+
*
|
|
10
|
+
* Throws when nothing resolves. It previously returned no-op stubs, which made
|
|
11
|
+
* a broken install look exactly like a project with no workflows (issue #94).
|
|
8
12
|
*/
|
|
9
13
|
export declare function loadWorkflowsAPI(): Promise<WorkflowsAPI>;
|
|
10
14
|
/**
|
|
11
15
|
* Build workflows from a project directory and merge into the manifest.
|
|
12
|
-
*
|
|
16
|
+
*
|
|
17
|
+
* Safe no-op if no `workflows.ts` / `workflows/` present. If they *are*
|
|
18
|
+
* present, any failure aborts the adapter build — a deployment that silently
|
|
19
|
+
* drops its workflows is worse than one that fails to build (issue #94).
|
|
13
20
|
*/
|
|
14
|
-
export declare function buildAndIntegrateWorkflows(projectDir: string, outDir: string, log?:
|
|
15
|
-
minor: (msg: string) => void;
|
|
16
|
-
error: (msg: string) => void;
|
|
17
|
-
warn: (msg: string) => void;
|
|
18
|
-
}): Promise<void>;
|
|
21
|
+
export declare function buildAndIntegrateWorkflows(projectDir: string, outDir: string, log?: AdapterLog): Promise<void>;
|
|
19
22
|
export {};
|
|
20
23
|
//# sourceMappingURL=workflows.d.ts.map
|
package/dist/workflows.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,YAAY,GAAG;IAClB,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,8BAA8B,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF,CAAC;AAQF;;;;;;GAMG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,CAa9D;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,UAAU,GACf,OAAO,CAAC,IAAI,CAAC,CAuCf"}
|
package/dist/workflows.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
+
import { failBuild, missingBuildApi } from './build-failure.js';
|
|
3
|
+
const WORKFLOWS_API_SPECIFIERS = [
|
|
4
|
+
'@maravilla-labs/functions',
|
|
5
|
+
'../../functions/dist/index.js',
|
|
6
|
+
'../../functions/src/index.ts',
|
|
7
|
+
];
|
|
2
8
|
/**
|
|
3
9
|
* Dynamically load the workflows build API from `@maravilla-labs/functions`.
|
|
4
10
|
* Mirrors {@link loadEventsAPI}.
|
|
11
|
+
*
|
|
12
|
+
* Throws when nothing resolves. It previously returned no-op stubs, which made
|
|
13
|
+
* a broken install look exactly like a project with no workflows (issue #94).
|
|
5
14
|
*/
|
|
6
15
|
export async function loadWorkflowsAPI() {
|
|
7
|
-
const
|
|
8
|
-
'@maravilla-labs/functions',
|
|
9
|
-
'../../functions/dist/index.js',
|
|
10
|
-
'../../functions/src/index.ts',
|
|
11
|
-
];
|
|
12
|
-
for (const spec of fallbacks) {
|
|
16
|
+
for (const spec of WORKFLOWS_API_SPECIFIERS) {
|
|
13
17
|
try {
|
|
14
18
|
const mod = await import(spec);
|
|
15
19
|
if (mod.buildWorkflows && mod.integrateWorkflowsWithManifest) {
|
|
@@ -21,14 +25,14 @@ export async function loadWorkflowsAPI() {
|
|
|
21
25
|
}
|
|
22
26
|
catch (_) { /* try next */ }
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
buildWorkflows: async () => null,
|
|
26
|
-
integrateWorkflowsWithManifest: async () => { },
|
|
27
|
-
};
|
|
28
|
+
throw missingBuildApi('workflows', WORKFLOWS_API_SPECIFIERS);
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Build workflows from a project directory and merge into the manifest.
|
|
31
|
-
*
|
|
32
|
+
*
|
|
33
|
+
* Safe no-op if no `workflows.ts` / `workflows/` present. If they *are*
|
|
34
|
+
* present, any failure aborts the adapter build — a deployment that silently
|
|
35
|
+
* drops its workflows is worse than one that fails to build (issue #94).
|
|
32
36
|
*/
|
|
33
37
|
export async function buildAndIntegrateWorkflows(projectDir, outDir, log) {
|
|
34
38
|
const hasRoot = existsSync(`${projectDir}/workflows.ts`)
|
|
@@ -51,11 +55,14 @@ export async function buildAndIntegrateWorkflows(projectDir, outDir, log) {
|
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
catch (error) {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
failBuild('workflows', error, log);
|
|
59
|
+
}
|
|
60
|
+
// `null` means discovery found no sources at all. The guard above already
|
|
61
|
+
// established that a workflows entry exists, so this is a real failure.
|
|
62
|
+
if (!workflowsManifest) {
|
|
63
|
+
failBuild('workflows', new Error(`A workflows entry exists in ${projectDir} but no workflow sources were discovered.\n` +
|
|
64
|
+
'Expected workflows.{ts,js,mjs} or files under workflows/.'), log);
|
|
56
65
|
}
|
|
57
|
-
if (!workflowsManifest)
|
|
58
|
-
return;
|
|
59
66
|
await integrateWorkflowsWithManifest(`${outDir}/manifest.json`, workflowsManifest);
|
|
60
67
|
}
|
|
61
68
|
//# sourceMappingURL=workflows.js.map
|
package/dist/workflows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQhE,MAAM,wBAAwB,GAAG;IAC/B,2BAA2B;IAC3B,+BAA+B;IAC/B,8BAA8B;CAC/B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,KAAK,MAAM,IAAI,IAAI,wBAAwB,EAAE,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,GAAG,GAAQ,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACpC,IAAI,GAAG,CAAC,cAAc,IAAI,GAAG,CAAC,8BAA8B,EAAE,CAAC;gBAC7D,OAAO;oBACL,cAAc,EAAE,GAAG,CAAC,cAAc;oBAClC,8BAA8B,EAAE,GAAG,CAAC,8BAA8B;iBACnE,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,eAAe,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,UAAkB,EAClB,MAAc,EACd,GAAgB;IAEhB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,UAAU,eAAe,CAAC;WACnD,UAAU,CAAC,GAAG,UAAU,eAAe,CAAC;WACxC,UAAU,CAAC,GAAG,UAAU,gBAAgB,CAAC,CAAC;IAC/C,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