@particle-academy/google-slides-js 0.1.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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/chunk-3WQSJ3XH.js +71 -0
- package/dist/chunk-3WQSJ3XH.js.map +1 -0
- package/dist/flow.cjs +95 -0
- package/dist/flow.cjs.map +1 -0
- package/dist/flow.d.cts +26 -0
- package/dist/flow.d.ts +26 -0
- package/dist/flow.js +25 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.cjs +80 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +117 -0
- package/dist/index.d.ts +117 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +85 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@particle-academy/google-slides-ui`,
|
|
4
|
+
`@particle-academy/google-slides-js`, `particle-academy/google-slides-php` and
|
|
5
|
+
`fancy-google-slides`.
|
|
6
|
+
|
|
7
|
+
The four packages share one version, because they are generated from one
|
|
8
|
+
`provider/` definition and a version that meant something different in each
|
|
9
|
+
would be a version nobody could reason about.
|
|
10
|
+
|
|
11
|
+
## [0.1.0] — 2026-08-23
|
|
12
|
+
|
|
13
|
+
First release.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `presentation_create` — create a blank Google Slides presentation from a
|
|
18
|
+
title. `POST /v1/presentations`.
|
|
19
|
+
- A top-level `Presentation` faker, so the node runs on a canvas with no Google
|
|
20
|
+
account.
|
|
21
|
+
|
|
22
|
+
### Content in the request is ignored
|
|
23
|
+
|
|
24
|
+
The request type is the full `Presentation`, but Google's discovery method says
|
|
25
|
+
provided content is ignored. It can accept a caller-supplied `presentationId`;
|
|
26
|
+
this simple action leaves ID generation to Google and sends only `title`.
|
|
27
|
+
|
|
28
|
+
### No sandbox, and no idempotency
|
|
29
|
+
|
|
30
|
+
Google has no Slides test estate. A test presentation is a real presentation in
|
|
31
|
+
a real Drive. `presentations.create` also declares no idempotency key, so a retry
|
|
32
|
+
can create a second presentation and the action is honestly
|
|
33
|
+
`unsafe-to-replay`.
|
|
34
|
+
|
|
35
|
+
[0.1.0]: https://github.com/Fancy-Friends/google-slides/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Particle Academy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Google Slides
|
|
2
|
+
|
|
3
|
+
Google Slides for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
4
|
+
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
5
|
+
change.
|
|
6
|
+
|
|
7
|
+
[flow]: https://github.com/Particle-Academy/fancy-flow
|
|
8
|
+
|
|
9
|
+
| Runtime | Package | Install |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Authoring surface (every host) | `@particle-academy/google-slides-ui` | `npm install @particle-academy/google-slides-ui` |
|
|
12
|
+
| Node | `@particle-academy/google-slides-js` | `npm install @particle-academy/google-slides-js` |
|
|
13
|
+
| PHP 8.4+ | `particle-academy/google-slides-php` | `composer require particle-academy/google-slides-php` |
|
|
14
|
+
| Python 3.11+ | `fancy-google-slides` | `pip install fancy-google-slides` |
|
|
15
|
+
|
|
16
|
+
The `ui` package is the editor surface and is React on every host — a PHP or
|
|
17
|
+
Python project installs it *and* its own runtime package, and never the `js` one.
|
|
18
|
+
|
|
19
|
+
## What it costs you
|
|
20
|
+
|
|
21
|
+
One dependency: `@particle-academy/fancy-connector-core` (or
|
|
22
|
+
`particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
|
|
23
|
+
packages pull in themselves. The Python package has **zero** runtime
|
|
24
|
+
dependencies.
|
|
25
|
+
|
|
26
|
+
**No Google Slides SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
|
|
27
|
+
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
28
|
+
dependencies nobody is tracking.
|
|
29
|
+
|
|
30
|
+
## Run it before you have credentials
|
|
31
|
+
|
|
32
|
+
Every operation ships a **faker**, whether or not Google Slides has a sandbox. Set a
|
|
33
|
+
node's mode to `fake` and it returns the shape Google Slides actually publishes — the
|
|
34
|
+
same field names, deterministically — so you can wire the downstream nodes before
|
|
35
|
+
touching an account, a key, or a network.
|
|
36
|
+
|
|
37
|
+
## This repository is generated
|
|
38
|
+
|
|
39
|
+
`provider/` is the source. Everything under `packages/` is emitted from it and
|
|
40
|
+
**must not be hand-edited** — CI regenerates and diffs on every push, and the
|
|
41
|
+
next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
|
|
42
|
+
|
|
43
|
+
## Two namespaces, which do not match on purpose
|
|
44
|
+
|
|
45
|
+
The repo is `github.com/Fancy-Friends/google-slides`; the packages publish under
|
|
46
|
+
`particle-academy`. Nothing derives one from the other — the names come from
|
|
47
|
+
weaver's `friends.json` and nowhere else.
|
|
48
|
+
|
|
49
|
+
## Licence
|
|
50
|
+
|
|
51
|
+
MIT.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { callConnector } from '@particle-academy/fancy-connector-core';
|
|
2
|
+
|
|
3
|
+
// src/faker.ts
|
|
4
|
+
function fakePresentationCreate({ config, fake }) {
|
|
5
|
+
return {
|
|
6
|
+
"presentationId": fake.id("1Slide"),
|
|
7
|
+
"title": config.title !== void 0 && config.title !== null && config.title !== "" ? String(config.title) : "Untitled presentation"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
var googleSlidesFaker = (operation, request) => {
|
|
11
|
+
switch (operation) {
|
|
12
|
+
case "presentation_create":
|
|
13
|
+
return fakePresentationCreate(request);
|
|
14
|
+
default:
|
|
15
|
+
throw new Error(
|
|
16
|
+
`google_slides: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/service.ts
|
|
22
|
+
var CONNECTOR_API_VERSION = 1;
|
|
23
|
+
var GOOGLE_SLIDES_BASE_URLS = {
|
|
24
|
+
"live": "https://slides.googleapis.com"
|
|
25
|
+
};
|
|
26
|
+
var GOOGLE_SLIDES_REQUIRES = [
|
|
27
|
+
"accessToken",
|
|
28
|
+
"refreshToken",
|
|
29
|
+
"clientId",
|
|
30
|
+
"clientSecret"
|
|
31
|
+
];
|
|
32
|
+
function googleSlidesAuthorize(credentials, request, _mode) {
|
|
33
|
+
request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
|
|
34
|
+
}
|
|
35
|
+
var GOOGLE_SLIDES = {
|
|
36
|
+
service: "google_slides",
|
|
37
|
+
title: "Google Slides",
|
|
38
|
+
sandbox: "none",
|
|
39
|
+
baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },
|
|
40
|
+
requires: [...GOOGLE_SLIDES_REQUIRES],
|
|
41
|
+
authorize: googleSlidesAuthorize,
|
|
42
|
+
faker: googleSlidesFaker
|
|
43
|
+
};
|
|
44
|
+
var PRESENTATION_CREATE_OPERATION = "presentation_create";
|
|
45
|
+
async function googleSlidesPresentationCreate(options) {
|
|
46
|
+
const config = options.config ?? {};
|
|
47
|
+
if (config.title === void 0 || config.title === null || config.title === "") {
|
|
48
|
+
throw new Error(`presentation_create: "title" is required (Title).`);
|
|
49
|
+
}
|
|
50
|
+
return callConnector(GOOGLE_SLIDES, {
|
|
51
|
+
operation: PRESENTATION_CREATE_OPERATION,
|
|
52
|
+
config,
|
|
53
|
+
input: options.input,
|
|
54
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
55
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
56
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
57
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
58
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
59
|
+
request: {
|
|
60
|
+
method: "POST",
|
|
61
|
+
path: "/v1/presentations",
|
|
62
|
+
json: {
|
|
63
|
+
"title": String(config.title)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SLIDES, GOOGLE_SLIDES_BASE_URLS, GOOGLE_SLIDES_REQUIRES, PRESENTATION_CREATE_OPERATION, googleSlidesAuthorize, googleSlidesFaker, googleSlidesPresentationCreate };
|
|
70
|
+
//# sourceMappingURL=chunk-3WQSJ3XH.js.map
|
|
71
|
+
//# sourceMappingURL=chunk-3WQSJ3XH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/presentation-create.ts"],"names":[],"mappings":";;;AA0BA,SAAS,sBAAA,CAAuB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACtE,EAAA,OAAO;AAAA,IACL,gBAAA,EAAkB,IAAA,CAAK,EAAA,CAAG,QAAQ,CAAA;AAAA,IAClC,OAAA,EAAU,MAAA,CAAO,KAAA,KAAU,MAAA,IAAa,MAAA,CAAO,KAAA,KAAU,IAAA,IAAQ,MAAA,CAAO,KAAA,KAAU,EAAA,GAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA,GAAI;AAAA,GAChH;AACF;AAEO,IAAM,iBAAA,GAAoC,CAAC,SAAA,EAAW,OAAA,KAAY;AACvE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,qBAAA;AACH,MAAA,OAAO,uBAAuB,OAAO,CAAA;AAAA,IAEvC;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,mDAAmD,SAAS,CAAA,iJAAA;AAAA,OAG9D;AAAA;AAEN;;;ACXO,IAAM,qBAAA,GAAwB;AAE9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ;AACV;AAGO,IAAM,sBAAA,GAAyB;AAAA,EACpC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAWO,SAAS,qBAAA,CACd,WAAA,EACA,OAAA,EACA,KAAA,EACM;AACN,EAAA,OAAA,CAAQ,OAAA,CAAQ,aAAA,GAAgB,CAAA,OAAA,EAAU,WAAA,CAAY,eAAe,EAAE,CAAA,CAAA;AACzE;AAGO,IAAM,aAAA,GAAmC;AAAA,EAC9C,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO,eAAA;AAAA,EACP,OAAA,EAAS,MAAA;AAAA,EACT,QAAA,EAAU,EAAE,GAAG,uBAAA,EAAwB;AAAA,EACvC,QAAA,EAAU,CAAC,GAAG,sBAAsB,CAAA;AAAA,EACpC,SAAA,EAAW,qBAAA;AAAA,EACX,KAAA,EAAO;AACT;AC5CO,IAAM,6BAAA,GAAgC;AAc7C,eAAsB,+BAA+B,OAAA,EAA8D;AACjH,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAElC,EAAA,IAAI,MAAA,CAAO,UAAU,MAAA,IAAa,MAAA,CAAO,UAAU,IAAA,IAAQ,MAAA,CAAO,UAAU,EAAA,EAAI;AAC9E,IAAA,MAAM,IAAI,MAAM,CAAA,iDAAA,CAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,OAAO,cAAc,aAAA,EAAe;AAAA,IAClC,SAAA,EAAW,6BAAA;AAAA,IACX,MAAA;AAAA,IACA,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,GAAI,QAAQ,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,mBAAA;AAAA,MACN,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK;AAAA;AAC9B;AACF,GACD,CAAA;AACH","file":"chunk-3WQSJ3XH.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * The Google Slides faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Slides actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePresentationCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"presentationId\": fake.id(\"1Slide\"),\n \"title\": (config.title !== undefined && config.title !== null && config.title !== \"\" ? String(config.title) : \"Untitled presentation\"),\n };\n}\n\nexport const googleSlidesFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"presentation_create\":\n return fakePresentationCreate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_slides: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Google Slides, as one service descriptor shared by every Google Slides\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Slides: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for Slides. A test presentation is a real one in a\n * real Drive, so every create is real -- use the faker while developing and\n * clean up any live test presentations.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSlidesFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SLIDES_BASE_URLS = {\n \"live\": \"https://slides.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SLIDES_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Slides's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSlidesAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Slides service, for the TypeScript runtime. */\nexport const GOOGLE_SLIDES: ServiceDescriptor = {\n service: \"google_slides\",\n title: \"Google Slides\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },\n requires: [...GOOGLE_SLIDES_REQUIRES],\n authorize: googleSlidesAuthorize,\n faker: googleSlidesFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/presentation-create.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/presentation-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Create a blank Google Slides presentation.\n *\n * POST /v1/presentations —\n * https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/create\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Slides or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SLIDES } from \"../service.js\";\n\nexport const PRESENTATION_CREATE_OPERATION = \"presentation_create\";\n\nexport type PresentationCreateOptions = {\n /** The node's resolved config. Keys: title. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSlidesPresentationCreate(options: PresentationCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.title === undefined || config.title === null || config.title === \"\") {\n throw new Error(`presentation_create: \"title\" is required (Title).`);\n }\n\n return callConnector(GOOGLE_SLIDES, {\n operation: PRESENTATION_CREATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: \"/v1/presentations\",\n json: {\n \"title\": String(config.title),\n },\n },\n });\n}\n"]}
|
package/dist/flow.cjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
|
|
4
|
+
var googleSlidesUi = require('@particle-academy/google-slides-ui');
|
|
5
|
+
|
|
6
|
+
// src/flow.ts
|
|
7
|
+
|
|
8
|
+
// src/faker.ts
|
|
9
|
+
function fakePresentationCreate({ config, fake }) {
|
|
10
|
+
return {
|
|
11
|
+
"presentationId": fake.id("1Slide"),
|
|
12
|
+
"title": config.title !== void 0 && config.title !== null && config.title !== "" ? String(config.title) : "Untitled presentation"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
var googleSlidesFaker = (operation, request) => {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "presentation_create":
|
|
18
|
+
return fakePresentationCreate(request);
|
|
19
|
+
default:
|
|
20
|
+
throw new Error(
|
|
21
|
+
`google_slides: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/service.ts
|
|
27
|
+
var GOOGLE_SLIDES_BASE_URLS = {
|
|
28
|
+
"live": "https://slides.googleapis.com"
|
|
29
|
+
};
|
|
30
|
+
var GOOGLE_SLIDES_REQUIRES = [
|
|
31
|
+
"accessToken",
|
|
32
|
+
"refreshToken",
|
|
33
|
+
"clientId",
|
|
34
|
+
"clientSecret"
|
|
35
|
+
];
|
|
36
|
+
function googleSlidesAuthorize(credentials, request, _mode) {
|
|
37
|
+
request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
|
|
38
|
+
}
|
|
39
|
+
var GOOGLE_SLIDES = {
|
|
40
|
+
service: "google_slides",
|
|
41
|
+
title: "Google Slides",
|
|
42
|
+
sandbox: "none",
|
|
43
|
+
baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },
|
|
44
|
+
requires: [...GOOGLE_SLIDES_REQUIRES],
|
|
45
|
+
authorize: googleSlidesAuthorize,
|
|
46
|
+
faker: googleSlidesFaker
|
|
47
|
+
};
|
|
48
|
+
var PRESENTATION_CREATE_OPERATION = "presentation_create";
|
|
49
|
+
async function googleSlidesPresentationCreate(options) {
|
|
50
|
+
const config = options.config ?? {};
|
|
51
|
+
if (config.title === void 0 || config.title === null || config.title === "") {
|
|
52
|
+
throw new Error(`presentation_create: "title" is required (Title).`);
|
|
53
|
+
}
|
|
54
|
+
return fancyConnectorCore.callConnector(GOOGLE_SLIDES, {
|
|
55
|
+
operation: PRESENTATION_CREATE_OPERATION,
|
|
56
|
+
config,
|
|
57
|
+
input: options.input,
|
|
58
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
59
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
60
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
61
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
62
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
63
|
+
request: {
|
|
64
|
+
method: "POST",
|
|
65
|
+
path: "/v1/presentations",
|
|
66
|
+
json: {
|
|
67
|
+
"title": String(config.title)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/flow.ts
|
|
74
|
+
var googleSlidesPresentationExecutor = async (ctx) => {
|
|
75
|
+
const config = ctx.node.data?.config ?? {};
|
|
76
|
+
const result = await googleSlidesPresentationCreate({
|
|
77
|
+
config,
|
|
78
|
+
input: ctx.inputs?.in
|
|
79
|
+
});
|
|
80
|
+
ctx.emit({
|
|
81
|
+
type: "log",
|
|
82
|
+
level: "info",
|
|
83
|
+
nodeId: ctx.node.id,
|
|
84
|
+
message: `google_slides presentation_create ${result.data?.id} (${result.mode})`
|
|
85
|
+
});
|
|
86
|
+
return { __port: "out", value: result };
|
|
87
|
+
};
|
|
88
|
+
var GOOGLE_SLIDES_RUNNABLE_KINDS = [
|
|
89
|
+
{ ...googleSlidesUi.googleSlidesPresentationKind, executor: googleSlidesPresentationExecutor }
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
exports.GOOGLE_SLIDES_RUNNABLE_KINDS = GOOGLE_SLIDES_RUNNABLE_KINDS;
|
|
93
|
+
exports.googleSlidesPresentationExecutor = googleSlidesPresentationExecutor;
|
|
94
|
+
//# sourceMappingURL=flow.cjs.map
|
|
95
|
+
//# sourceMappingURL=flow.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/presentation-create.ts","../src/flow.ts"],"names":["callConnector","googleSlidesPresentationKind"],"mappings":";;;;;;;;AA0BA,SAAS,sBAAA,CAAuB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACtE,EAAA,OAAO;AAAA,IACL,gBAAA,EAAkB,IAAA,CAAK,EAAA,CAAG,QAAQ,CAAA;AAAA,IAClC,OAAA,EAAU,MAAA,CAAO,KAAA,KAAU,MAAA,IAAa,MAAA,CAAO,KAAA,KAAU,IAAA,IAAQ,MAAA,CAAO,KAAA,KAAU,EAAA,GAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA,GAAI;AAAA,GAChH;AACF;AAEO,IAAM,iBAAA,GAAoC,CAAC,SAAA,EAAW,OAAA,KAAY;AACvE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,qBAAA;AACH,MAAA,OAAO,uBAAuB,OAAO,CAAA;AAAA,IAEvC;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,mDAAmD,SAAS,CAAA,iJAAA;AAAA,OAG9D;AAAA;AAEN,CAAA;;;ACTO,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ;AACV,CAAA;AAGO,IAAM,sBAAA,GAAyB;AAAA,EACpC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA;AAWO,SAAS,qBAAA,CACd,WAAA,EACA,OAAA,EACA,KAAA,EACM;AACN,EAAA,OAAA,CAAQ,OAAA,CAAQ,aAAA,GAAgB,CAAA,OAAA,EAAU,WAAA,CAAY,eAAe,EAAE,CAAA,CAAA;AACzE;AAGO,IAAM,aAAA,GAAmC;AAAA,EAC9C,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO,eAAA;AAAA,EACP,OAAA,EAAS,MAAA;AAAA,EACT,QAAA,EAAU,EAAE,GAAG,uBAAA,EAAwB;AAAA,EACvC,QAAA,EAAU,CAAC,GAAG,sBAAsB,CAAA;AAAA,EACpC,SAAA,EAAW,qBAAA;AAAA,EACX,KAAA,EAAO;AACT,CAAA;AC5CO,IAAM,6BAAA,GAAgC,qBAAA;AAc7C,eAAsB,+BAA+B,OAAA,EAA8D;AACjH,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAElC,EAAA,IAAI,MAAA,CAAO,UAAU,MAAA,IAAa,MAAA,CAAO,UAAU,IAAA,IAAQ,MAAA,CAAO,UAAU,EAAA,EAAI;AAC9E,IAAA,MAAM,IAAI,MAAM,CAAA,iDAAA,CAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,OAAOA,iCAAc,aAAA,EAAe;AAAA,IAClC,SAAA,EAAW,6BAAA;AAAA,IACX,MAAA;AAAA,IACA,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,GAAI,QAAQ,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,mBAAA;AAAA,MACN,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK;AAAA;AAC9B;AACF,GACD,CAAA;AACH;;;ACnCO,IAAM,gCAAA,GAAiD,OAAO,GAAA,KAAQ;AAC3E,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,8BAAA,CAA+B;AAAA,IAClD,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,kCAAA,EAAsC,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GACnG,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,EAAE,GAAGC,2CAAA,EAA8B,QAAA,EAAU,gCAAA;AAC/C","file":"flow.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * The Google Slides faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Slides actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePresentationCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"presentationId\": fake.id(\"1Slide\"),\n \"title\": (config.title !== undefined && config.title !== null && config.title !== \"\" ? String(config.title) : \"Untitled presentation\"),\n };\n}\n\nexport const googleSlidesFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"presentation_create\":\n return fakePresentationCreate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_slides: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Google Slides, as one service descriptor shared by every Google Slides\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Slides: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for Slides. A test presentation is a real one in a\n * real Drive, so every create is real -- use the faker while developing and\n * clean up any live test presentations.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSlidesFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SLIDES_BASE_URLS = {\n \"live\": \"https://slides.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SLIDES_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Slides's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSlidesAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Slides service, for the TypeScript runtime. */\nexport const GOOGLE_SLIDES: ServiceDescriptor = {\n service: \"google_slides\",\n title: \"Google Slides\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },\n requires: [...GOOGLE_SLIDES_REQUIRES],\n authorize: googleSlidesAuthorize,\n faker: googleSlidesFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/presentation-create.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/presentation-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Create a blank Google Slides presentation.\n *\n * POST /v1/presentations —\n * https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/create\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Slides or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SLIDES } from \"../service.js\";\n\nexport const PRESENTATION_CREATE_OPERATION = \"presentation_create\";\n\nexport type PresentationCreateOptions = {\n /** The node's resolved config. Keys: title. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSlidesPresentationCreate(options: PresentationCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.title === undefined || config.title === null || config.title === \"\") {\n throw new Error(`presentation_create: \"title\" is required (Title).`);\n }\n\n return callConnector(GOOGLE_SLIDES, {\n operation: PRESENTATION_CREATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: \"/v1/presentations\",\n json: {\n \"title\": String(config.title),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Google Slides's node kinds with their TypeScript executors attached — for\n * hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-slides-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SLIDES } from \"./service.js\";\n\nimport {\n googleSlidesPresentationKind,\n} from \"@particle-academy/google-slides-ui\";\n\nimport { googleSlidesPresentationCreate } from \"./actions/presentation-create.js\";\n\nexport const googleSlidesPresentationExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSlidesPresentationCreate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_slides presentation_create ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SLIDES_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSlidesPresentationKind, executor: googleSlidesPresentationExecutor },\n];\n"]}
|
package/dist/flow.d.cts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GENERATED FILE — do not edit.
|
|
5
|
+
*
|
|
6
|
+
* Emitted from provider/actions/ + triggers/ by weaver's generator.
|
|
7
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
8
|
+
* being rejected, because it works until it silently does not. Fix
|
|
9
|
+
* provider/actions/ + triggers/ (or weaver's template/) and regenerate:
|
|
10
|
+
*
|
|
11
|
+
* npm run provider -- google_slides
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Google Slides's node kinds with their TypeScript executors attached — for
|
|
15
|
+
* hosts that EXECUTE on TS.
|
|
16
|
+
*
|
|
17
|
+
* The authoring surface in @particle-academy/google-slides-ui carries no
|
|
18
|
+
* executor: the editor is React on every host, so a PHP or Python project
|
|
19
|
+
* installs the ui package and never this one.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
declare const googleSlidesPresentationExecutor: NodeExecutor;
|
|
23
|
+
/** The kinds a TypeScript host registers. */
|
|
24
|
+
declare const GOOGLE_SLIDES_RUNNABLE_KINDS: NodeKindDefinition[];
|
|
25
|
+
|
|
26
|
+
export { GOOGLE_SLIDES_RUNNABLE_KINDS, googleSlidesPresentationExecutor };
|
package/dist/flow.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GENERATED FILE — do not edit.
|
|
5
|
+
*
|
|
6
|
+
* Emitted from provider/actions/ + triggers/ by weaver's generator.
|
|
7
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
8
|
+
* being rejected, because it works until it silently does not. Fix
|
|
9
|
+
* provider/actions/ + triggers/ (or weaver's template/) and regenerate:
|
|
10
|
+
*
|
|
11
|
+
* npm run provider -- google_slides
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Google Slides's node kinds with their TypeScript executors attached — for
|
|
15
|
+
* hosts that EXECUTE on TS.
|
|
16
|
+
*
|
|
17
|
+
* The authoring surface in @particle-academy/google-slides-ui carries no
|
|
18
|
+
* executor: the editor is React on every host, so a PHP or Python project
|
|
19
|
+
* installs the ui package and never this one.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
declare const googleSlidesPresentationExecutor: NodeExecutor;
|
|
23
|
+
/** The kinds a TypeScript host registers. */
|
|
24
|
+
declare const GOOGLE_SLIDES_RUNNABLE_KINDS: NodeKindDefinition[];
|
|
25
|
+
|
|
26
|
+
export { GOOGLE_SLIDES_RUNNABLE_KINDS, googleSlidesPresentationExecutor };
|
package/dist/flow.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { googleSlidesPresentationCreate } from './chunk-3WQSJ3XH.js';
|
|
2
|
+
import '@particle-academy/fancy-connector-core';
|
|
3
|
+
import { googleSlidesPresentationKind } from '@particle-academy/google-slides-ui';
|
|
4
|
+
|
|
5
|
+
var googleSlidesPresentationExecutor = async (ctx) => {
|
|
6
|
+
const config = ctx.node.data?.config ?? {};
|
|
7
|
+
const result = await googleSlidesPresentationCreate({
|
|
8
|
+
config,
|
|
9
|
+
input: ctx.inputs?.in
|
|
10
|
+
});
|
|
11
|
+
ctx.emit({
|
|
12
|
+
type: "log",
|
|
13
|
+
level: "info",
|
|
14
|
+
nodeId: ctx.node.id,
|
|
15
|
+
message: `google_slides presentation_create ${result.data?.id} (${result.mode})`
|
|
16
|
+
});
|
|
17
|
+
return { __port: "out", value: result };
|
|
18
|
+
};
|
|
19
|
+
var GOOGLE_SLIDES_RUNNABLE_KINDS = [
|
|
20
|
+
{ ...googleSlidesPresentationKind, executor: googleSlidesPresentationExecutor }
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export { GOOGLE_SLIDES_RUNNABLE_KINDS, googleSlidesPresentationExecutor };
|
|
24
|
+
//# sourceMappingURL=flow.js.map
|
|
25
|
+
//# sourceMappingURL=flow.js.map
|
package/dist/flow.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,gCAAA,GAAiD,OAAO,GAAA,KAAQ;AAC3E,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,8BAAA,CAA+B;AAAA,IAClD,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,kCAAA,EAAsC,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GACnG,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,EAAE,GAAG,4BAAA,EAA8B,QAAA,EAAU,gCAAA;AAC/C","file":"flow.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Google Slides's node kinds with their TypeScript executors attached — for\n * hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-slides-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SLIDES } from \"./service.js\";\n\nimport {\n googleSlidesPresentationKind,\n} from \"@particle-academy/google-slides-ui\";\n\nimport { googleSlidesPresentationCreate } from \"./actions/presentation-create.js\";\n\nexport const googleSlidesPresentationExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSlidesPresentationCreate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_slides presentation_create ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SLIDES_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSlidesPresentationKind, executor: googleSlidesPresentationExecutor },\n];\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
|
|
4
|
+
|
|
5
|
+
// src/faker.ts
|
|
6
|
+
function fakePresentationCreate({ config, fake }) {
|
|
7
|
+
return {
|
|
8
|
+
"presentationId": fake.id("1Slide"),
|
|
9
|
+
"title": config.title !== void 0 && config.title !== null && config.title !== "" ? String(config.title) : "Untitled presentation"
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
var googleSlidesFaker = (operation, request) => {
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case "presentation_create":
|
|
15
|
+
return fakePresentationCreate(request);
|
|
16
|
+
default:
|
|
17
|
+
throw new Error(
|
|
18
|
+
`google_slides: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/service.ts
|
|
24
|
+
var CONNECTOR_API_VERSION = 1;
|
|
25
|
+
var GOOGLE_SLIDES_BASE_URLS = {
|
|
26
|
+
"live": "https://slides.googleapis.com"
|
|
27
|
+
};
|
|
28
|
+
var GOOGLE_SLIDES_REQUIRES = [
|
|
29
|
+
"accessToken",
|
|
30
|
+
"refreshToken",
|
|
31
|
+
"clientId",
|
|
32
|
+
"clientSecret"
|
|
33
|
+
];
|
|
34
|
+
function googleSlidesAuthorize(credentials, request, _mode) {
|
|
35
|
+
request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
|
|
36
|
+
}
|
|
37
|
+
var GOOGLE_SLIDES = {
|
|
38
|
+
service: "google_slides",
|
|
39
|
+
title: "Google Slides",
|
|
40
|
+
sandbox: "none",
|
|
41
|
+
baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },
|
|
42
|
+
requires: [...GOOGLE_SLIDES_REQUIRES],
|
|
43
|
+
authorize: googleSlidesAuthorize,
|
|
44
|
+
faker: googleSlidesFaker
|
|
45
|
+
};
|
|
46
|
+
var PRESENTATION_CREATE_OPERATION = "presentation_create";
|
|
47
|
+
async function googleSlidesPresentationCreate(options) {
|
|
48
|
+
const config = options.config ?? {};
|
|
49
|
+
if (config.title === void 0 || config.title === null || config.title === "") {
|
|
50
|
+
throw new Error(`presentation_create: "title" is required (Title).`);
|
|
51
|
+
}
|
|
52
|
+
return fancyConnectorCore.callConnector(GOOGLE_SLIDES, {
|
|
53
|
+
operation: PRESENTATION_CREATE_OPERATION,
|
|
54
|
+
config,
|
|
55
|
+
input: options.input,
|
|
56
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
57
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
58
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
59
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
60
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
61
|
+
request: {
|
|
62
|
+
method: "POST",
|
|
63
|
+
path: "/v1/presentations",
|
|
64
|
+
json: {
|
|
65
|
+
"title": String(config.title)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
72
|
+
exports.GOOGLE_SLIDES = GOOGLE_SLIDES;
|
|
73
|
+
exports.GOOGLE_SLIDES_BASE_URLS = GOOGLE_SLIDES_BASE_URLS;
|
|
74
|
+
exports.GOOGLE_SLIDES_REQUIRES = GOOGLE_SLIDES_REQUIRES;
|
|
75
|
+
exports.PRESENTATION_CREATE_OPERATION = PRESENTATION_CREATE_OPERATION;
|
|
76
|
+
exports.googleSlidesAuthorize = googleSlidesAuthorize;
|
|
77
|
+
exports.googleSlidesFaker = googleSlidesFaker;
|
|
78
|
+
exports.googleSlidesPresentationCreate = googleSlidesPresentationCreate;
|
|
79
|
+
//# sourceMappingURL=index.cjs.map
|
|
80
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/presentation-create.ts"],"names":["callConnector"],"mappings":";;;;;AA0BA,SAAS,sBAAA,CAAuB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AACtE,EAAA,OAAO;AAAA,IACL,gBAAA,EAAkB,IAAA,CAAK,EAAA,CAAG,QAAQ,CAAA;AAAA,IAClC,OAAA,EAAU,MAAA,CAAO,KAAA,KAAU,MAAA,IAAa,MAAA,CAAO,KAAA,KAAU,IAAA,IAAQ,MAAA,CAAO,KAAA,KAAU,EAAA,GAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA,GAAI;AAAA,GAChH;AACF;AAEO,IAAM,iBAAA,GAAoC,CAAC,SAAA,EAAW,OAAA,KAAY;AACvE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,qBAAA;AACH,MAAA,OAAO,uBAAuB,OAAO,CAAA;AAAA,IAEvC;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,mDAAmD,SAAS,CAAA,iJAAA;AAAA,OAG9D;AAAA;AAEN;;;ACXO,IAAM,qBAAA,GAAwB;AAE9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ;AACV;AAGO,IAAM,sBAAA,GAAyB;AAAA,EACpC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAWO,SAAS,qBAAA,CACd,WAAA,EACA,OAAA,EACA,KAAA,EACM;AACN,EAAA,OAAA,CAAQ,OAAA,CAAQ,aAAA,GAAgB,CAAA,OAAA,EAAU,WAAA,CAAY,eAAe,EAAE,CAAA,CAAA;AACzE;AAGO,IAAM,aAAA,GAAmC;AAAA,EAC9C,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO,eAAA;AAAA,EACP,OAAA,EAAS,MAAA;AAAA,EACT,QAAA,EAAU,EAAE,GAAG,uBAAA,EAAwB;AAAA,EACvC,QAAA,EAAU,CAAC,GAAG,sBAAsB,CAAA;AAAA,EACpC,SAAA,EAAW,qBAAA;AAAA,EACX,KAAA,EAAO;AACT;AC5CO,IAAM,6BAAA,GAAgC;AAc7C,eAAsB,+BAA+B,OAAA,EAA8D;AACjH,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAElC,EAAA,IAAI,MAAA,CAAO,UAAU,MAAA,IAAa,MAAA,CAAO,UAAU,IAAA,IAAQ,MAAA,CAAO,UAAU,EAAA,EAAI;AAC9E,IAAA,MAAM,IAAI,MAAM,CAAA,iDAAA,CAAmD,CAAA;AAAA,EACrE;AAEA,EAAA,OAAOA,iCAAc,aAAA,EAAe;AAAA,IAClC,SAAA,EAAW,6BAAA;AAAA,IACX,MAAA;AAAA,IACA,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,GAAI,QAAQ,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,mBAAA;AAAA,MACN,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK;AAAA;AAC9B;AACF,GACD,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * The Google Slides faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Slides actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakePresentationCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"presentationId\": fake.id(\"1Slide\"),\n \"title\": (config.title !== undefined && config.title !== null && config.title !== \"\" ? String(config.title) : \"Untitled presentation\"),\n };\n}\n\nexport const googleSlidesFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"presentation_create\":\n return fakePresentationCreate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_slides: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Google Slides, as one service descriptor shared by every Google Slides\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Slides: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for Slides. A test presentation is a real one in a\n * real Drive, so every create is real -- use the faker while developing and\n * clean up any live test presentations.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSlidesFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SLIDES_BASE_URLS = {\n \"live\": \"https://slides.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SLIDES_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Slides's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSlidesAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Slides service, for the TypeScript runtime. */\nexport const GOOGLE_SLIDES: ServiceDescriptor = {\n service: \"google_slides\",\n title: \"Google Slides\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SLIDES_BASE_URLS },\n requires: [...GOOGLE_SLIDES_REQUIRES],\n authorize: googleSlidesAuthorize,\n faker: googleSlidesFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/presentation-create.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/presentation-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_slides\n */\n\n/**\n * Create a blank Google Slides presentation.\n *\n * POST /v1/presentations —\n * https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/create\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Slides or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SLIDES } from \"../service.js\";\n\nexport const PRESENTATION_CREATE_OPERATION = \"presentation_create\";\n\nexport type PresentationCreateOptions = {\n /** The node's resolved config. Keys: title. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSlidesPresentationCreate(options: PresentationCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.title === undefined || config.title === null || config.title === \"\") {\n throw new Error(`presentation_create: \"title\" is required (Title).`);\n }\n\n return callConnector(GOOGLE_SLIDES, {\n operation: PRESENTATION_CREATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: \"/v1/presentations\",\n json: {\n \"title\": String(config.title),\n },\n },\n });\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GENERATED FILE — do not edit.
|
|
5
|
+
*
|
|
6
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
7
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
8
|
+
* being rejected, because it works until it silently does not. Fix
|
|
9
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
10
|
+
*
|
|
11
|
+
* npm run provider -- google_slides
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Google Slides, as one service descriptor shared by every Google Slides
|
|
15
|
+
* operation.
|
|
16
|
+
*
|
|
17
|
+
* @particle-academy/fancy-connector-core carries what is true of ALL
|
|
18
|
+
* connectors. This carries what is true of Google Slides: its base URL, its
|
|
19
|
+
* auth scheme, its idempotency header, and its faker.
|
|
20
|
+
*
|
|
21
|
+
* ## The sandbox trap, written down where it is used
|
|
22
|
+
*
|
|
23
|
+
* Google has no sandbox for Slides. A test presentation is a real one in a
|
|
24
|
+
* real Drive, so every create is real -- use the faker while developing and
|
|
25
|
+
* clean up any live test presentations.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The connector API version this package was GENERATED against.
|
|
30
|
+
*
|
|
31
|
+
* A literal, never imported. An imported constant lets an upgrade rewrite the
|
|
32
|
+
* very claim it exists to detect, after which the copy agrees with itself
|
|
33
|
+
* forever.
|
|
34
|
+
*/
|
|
35
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
36
|
+
declare const GOOGLE_SLIDES_BASE_URLS: {
|
|
37
|
+
readonly live: "https://slides.googleapis.com";
|
|
38
|
+
};
|
|
39
|
+
/** Credential keys a remote call cannot proceed without. */
|
|
40
|
+
declare const GOOGLE_SLIDES_REQUIRES: readonly ["accessToken", "refreshToken", "clientId", "clientSecret"];
|
|
41
|
+
/**
|
|
42
|
+
* Apply Google Slides's auth scheme to an outgoing request.
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
*
|
|
46
|
+
* The mode is passed in because for some providers auth and estate are the
|
|
47
|
+
* same decision expressed in the URL; here it is unused, and saying so is
|
|
48
|
+
* cheaper than wondering later whether it was forgotten.
|
|
49
|
+
*/
|
|
50
|
+
declare function googleSlidesAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
|
|
51
|
+
/** The Google Slides service, for the TypeScript runtime. */
|
|
52
|
+
declare const GOOGLE_SLIDES: ServiceDescriptor;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* GENERATED FILE — do not edit.
|
|
56
|
+
*
|
|
57
|
+
* Emitted from provider/fixtures/ by weaver's generator.
|
|
58
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
59
|
+
* being rejected, because it works until it silently does not. Fix
|
|
60
|
+
* provider/fixtures/ (or weaver's template/) and regenerate:
|
|
61
|
+
*
|
|
62
|
+
* npm run provider -- google_slides
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* The Google Slides faker.
|
|
66
|
+
*
|
|
67
|
+
* Shapes, not behaviour: the goal is that a downstream node sees the field
|
|
68
|
+
* NAMES Google Slides actually publishes, so an author can wire {{
|
|
69
|
+
* $json.data.id }} against a fake and have it keep working against the real
|
|
70
|
+
* thing.
|
|
71
|
+
*
|
|
72
|
+
* Deterministic — same inputs, same output. A faker returning a fresh uuid
|
|
73
|
+
* every call cannot be asserted on, so its fixtures degrade to "it did not
|
|
74
|
+
* throw", which is the assertion that catches nothing.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
declare const googleSlidesFaker: ConnectorFaker;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* GENERATED FILE — do not edit.
|
|
81
|
+
*
|
|
82
|
+
* Emitted from provider/actions/presentation-create.json by weaver's generator.
|
|
83
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
84
|
+
* being rejected, because it works until it silently does not. Fix
|
|
85
|
+
* provider/actions/presentation-create.json (or weaver's template/) and regenerate:
|
|
86
|
+
*
|
|
87
|
+
* npm run provider -- google_slides
|
|
88
|
+
*/
|
|
89
|
+
/**
|
|
90
|
+
* Create a blank Google Slides presentation.
|
|
91
|
+
*
|
|
92
|
+
* POST /v1/presentations —
|
|
93
|
+
* https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/create
|
|
94
|
+
*
|
|
95
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
96
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
97
|
+
* connection, picks the estate, and either calls Google Slides or calls the
|
|
98
|
+
* faker.
|
|
99
|
+
*
|
|
100
|
+
* sideEffects: unsafe-to-replay.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
declare const PRESENTATION_CREATE_OPERATION = "presentation_create";
|
|
104
|
+
type PresentationCreateOptions = {
|
|
105
|
+
/** The node's resolved config. Keys: title. */
|
|
106
|
+
config: Record<string, unknown>;
|
|
107
|
+
credentials?: Record<string, string | undefined>;
|
|
108
|
+
mode?: RequestedMode;
|
|
109
|
+
connectionId?: string | null;
|
|
110
|
+
input?: unknown;
|
|
111
|
+
attempts?: number;
|
|
112
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
113
|
+
transport?: Transport;
|
|
114
|
+
};
|
|
115
|
+
declare function googleSlidesPresentationCreate(options: PresentationCreateOptions): Promise<ConnectorResult>;
|
|
116
|
+
|
|
117
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SLIDES, GOOGLE_SLIDES_BASE_URLS, GOOGLE_SLIDES_REQUIRES, PRESENTATION_CREATE_OPERATION, type PresentationCreateOptions, googleSlidesAuthorize, googleSlidesFaker, googleSlidesPresentationCreate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GENERATED FILE — do not edit.
|
|
5
|
+
*
|
|
6
|
+
* Emitted from provider/manifest.json by weaver's generator.
|
|
7
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
8
|
+
* being rejected, because it works until it silently does not. Fix
|
|
9
|
+
* provider/manifest.json (or weaver's template/) and regenerate:
|
|
10
|
+
*
|
|
11
|
+
* npm run provider -- google_slides
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Google Slides, as one service descriptor shared by every Google Slides
|
|
15
|
+
* operation.
|
|
16
|
+
*
|
|
17
|
+
* @particle-academy/fancy-connector-core carries what is true of ALL
|
|
18
|
+
* connectors. This carries what is true of Google Slides: its base URL, its
|
|
19
|
+
* auth scheme, its idempotency header, and its faker.
|
|
20
|
+
*
|
|
21
|
+
* ## The sandbox trap, written down where it is used
|
|
22
|
+
*
|
|
23
|
+
* Google has no sandbox for Slides. A test presentation is a real one in a
|
|
24
|
+
* real Drive, so every create is real -- use the faker while developing and
|
|
25
|
+
* clean up any live test presentations.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The connector API version this package was GENERATED against.
|
|
30
|
+
*
|
|
31
|
+
* A literal, never imported. An imported constant lets an upgrade rewrite the
|
|
32
|
+
* very claim it exists to detect, after which the copy agrees with itself
|
|
33
|
+
* forever.
|
|
34
|
+
*/
|
|
35
|
+
declare const CONNECTOR_API_VERSION = 1;
|
|
36
|
+
declare const GOOGLE_SLIDES_BASE_URLS: {
|
|
37
|
+
readonly live: "https://slides.googleapis.com";
|
|
38
|
+
};
|
|
39
|
+
/** Credential keys a remote call cannot proceed without. */
|
|
40
|
+
declare const GOOGLE_SLIDES_REQUIRES: readonly ["accessToken", "refreshToken", "clientId", "clientSecret"];
|
|
41
|
+
/**
|
|
42
|
+
* Apply Google Slides's auth scheme to an outgoing request.
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
*
|
|
46
|
+
* The mode is passed in because for some providers auth and estate are the
|
|
47
|
+
* same decision expressed in the URL; here it is unused, and saying so is
|
|
48
|
+
* cheaper than wondering later whether it was forgotten.
|
|
49
|
+
*/
|
|
50
|
+
declare function googleSlidesAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
|
|
51
|
+
/** The Google Slides service, for the TypeScript runtime. */
|
|
52
|
+
declare const GOOGLE_SLIDES: ServiceDescriptor;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* GENERATED FILE — do not edit.
|
|
56
|
+
*
|
|
57
|
+
* Emitted from provider/fixtures/ by weaver's generator.
|
|
58
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
59
|
+
* being rejected, because it works until it silently does not. Fix
|
|
60
|
+
* provider/fixtures/ (or weaver's template/) and regenerate:
|
|
61
|
+
*
|
|
62
|
+
* npm run provider -- google_slides
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* The Google Slides faker.
|
|
66
|
+
*
|
|
67
|
+
* Shapes, not behaviour: the goal is that a downstream node sees the field
|
|
68
|
+
* NAMES Google Slides actually publishes, so an author can wire {{
|
|
69
|
+
* $json.data.id }} against a fake and have it keep working against the real
|
|
70
|
+
* thing.
|
|
71
|
+
*
|
|
72
|
+
* Deterministic — same inputs, same output. A faker returning a fresh uuid
|
|
73
|
+
* every call cannot be asserted on, so its fixtures degrade to "it did not
|
|
74
|
+
* throw", which is the assertion that catches nothing.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
declare const googleSlidesFaker: ConnectorFaker;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* GENERATED FILE — do not edit.
|
|
81
|
+
*
|
|
82
|
+
* Emitted from provider/actions/presentation-create.json by weaver's generator.
|
|
83
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
84
|
+
* being rejected, because it works until it silently does not. Fix
|
|
85
|
+
* provider/actions/presentation-create.json (or weaver's template/) and regenerate:
|
|
86
|
+
*
|
|
87
|
+
* npm run provider -- google_slides
|
|
88
|
+
*/
|
|
89
|
+
/**
|
|
90
|
+
* Create a blank Google Slides presentation.
|
|
91
|
+
*
|
|
92
|
+
* POST /v1/presentations —
|
|
93
|
+
* https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/create
|
|
94
|
+
*
|
|
95
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
96
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
97
|
+
* connection, picks the estate, and either calls Google Slides or calls the
|
|
98
|
+
* faker.
|
|
99
|
+
*
|
|
100
|
+
* sideEffects: unsafe-to-replay.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
declare const PRESENTATION_CREATE_OPERATION = "presentation_create";
|
|
104
|
+
type PresentationCreateOptions = {
|
|
105
|
+
/** The node's resolved config. Keys: title. */
|
|
106
|
+
config: Record<string, unknown>;
|
|
107
|
+
credentials?: Record<string, string | undefined>;
|
|
108
|
+
mode?: RequestedMode;
|
|
109
|
+
connectionId?: string | null;
|
|
110
|
+
input?: unknown;
|
|
111
|
+
attempts?: number;
|
|
112
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
113
|
+
transport?: Transport;
|
|
114
|
+
};
|
|
115
|
+
declare function googleSlidesPresentationCreate(options: PresentationCreateOptions): Promise<ConnectorResult>;
|
|
116
|
+
|
|
117
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SLIDES, GOOGLE_SLIDES_BASE_URLS, GOOGLE_SLIDES_REQUIRES, PRESENTATION_CREATE_OPERATION, type PresentationCreateOptions, googleSlidesAuthorize, googleSlidesFaker, googleSlidesPresentationCreate };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CONNECTOR_API_VERSION, GOOGLE_SLIDES, GOOGLE_SLIDES_BASE_URLS, GOOGLE_SLIDES_REQUIRES, PRESENTATION_CREATE_OPERATION, googleSlidesAuthorize, googleSlidesFaker, googleSlidesPresentationCreate } from './chunk-3WQSJ3XH.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@particle-academy/google-slides-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Google Slides for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Fancy-Friends/google-slides.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Fancy-Friends/google-slides#readme",
|
|
10
|
+
"bugs": "https://github.com/Fancy-Friends/google-slides/issues",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./dist/index.d.cts",
|
|
23
|
+
"default": "./dist/index.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./flow": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/flow.d.ts",
|
|
29
|
+
"default": "./dist/flow.js"
|
|
30
|
+
},
|
|
31
|
+
"require": {
|
|
32
|
+
"types": "./dist/flow.d.cts",
|
|
33
|
+
"default": "./dist/flow.cjs"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"CHANGELOG.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "tsc --noEmit",
|
|
47
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
48
|
+
"prepublishOnly": "tsup"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@particle-academy/fancy-connector-core": ">=0.3.1 <2.0",
|
|
52
|
+
"@particle-academy/google-slides-ui": "0.1.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@particle-academy/fancy-flow": ">=0.47.1 <2.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@particle-academy/fancy-flow": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@particle-academy/fancy-flow": ">=0.47.1 <2.0",
|
|
64
|
+
"@types/node": "^26.2.0",
|
|
65
|
+
"tsup": "^8.5.0",
|
|
66
|
+
"tsx": "^4.19.0",
|
|
67
|
+
"typescript": "^5.8.0"
|
|
68
|
+
},
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"keywords": [
|
|
73
|
+
"google_slides",
|
|
74
|
+
"productivity",
|
|
75
|
+
"connector",
|
|
76
|
+
"api",
|
|
77
|
+
"fancy-ui",
|
|
78
|
+
"particle-academy"
|
|
79
|
+
],
|
|
80
|
+
"license": "MIT",
|
|
81
|
+
"sideEffects": false,
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=22"
|
|
84
|
+
}
|
|
85
|
+
}
|