attio 0.0.1-experimental.20240909 → 0.0.1-experimental.20240913
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/attio.js +1 -0
- package/client.d.ts +1 -0
- package/global.d.ts +19 -0
- package/lib/api/add-connection-definition.js +0 -1
- package/lib/api/complete-bundle-upload.js +0 -1
- package/lib/api/complete-prod-bundle-upload.js +0 -1
- package/lib/api/create-app.js +0 -1
- package/lib/api/create-dev-version.js +0 -1
- package/lib/api/create-developer-account.js +0 -1
- package/lib/api/create-version.js +0 -1
- package/lib/api/fetch-versions.js +0 -1
- package/lib/api/generate-invite-link.js +0 -1
- package/lib/api/handle-error.js +0 -1
- package/lib/api/is-app-slug-valid.js +0 -1
- package/lib/api/make-headers.js +0 -1
- package/lib/api/publish-version.js +0 -1
- package/lib/api/remove-connection-definition.js +0 -1
- package/lib/api/start-upload.js +0 -1
- package/lib/attio.js +0 -1
- package/lib/build/client/create-client-build-config.js +3 -8
- package/lib/build/client/generate-client-entry.js +29 -3
- package/lib/build/get-module-hash.js +0 -1
- package/lib/build/proxy-server-modules-plugin.js +0 -1
- package/lib/build/server/create-server-build-config.js +3 -8
- package/lib/build/server/generate-server-entry.js +61 -28
- package/lib/build.js +0 -1
- package/lib/client/components/action.d.ts +10 -0
- package/lib/client/components/combobox.d.ts +9 -0
- package/lib/client/components/dialog.d.ts +10 -0
- package/lib/client/components/index.d.ts +6 -0
- package/lib/client/components/multistep.d.ts +17 -0
- package/lib/client/components/section.d.ts +8 -0
- package/lib/client/components/text-block.d.ts +8 -0
- package/lib/client/forms/array.d.ts +12 -0
- package/lib/client/forms/build.d.ts +48 -0
- package/lib/client/forms/index.d.ts +4 -0
- package/lib/client/forms/number.d.ts +14 -0
- package/lib/client/forms/path.d.ts +34 -0
- package/lib/client/forms/string.d.ts +15 -0
- package/lib/client/hooks/index.d.ts +4 -0
- package/lib/client/hooks/use-graphql.d.ts +4 -0
- package/lib/client/hooks/use-loader.d.ts +13 -0
- package/lib/client/hooks/use-query.d.ts +5 -0
- package/lib/client/hooks/use-record.d.ts +9 -0
- package/lib/client/index.d.ts +8 -0
- package/lib/client/object-slug.d.ts +3 -0
- package/lib/client/util/prettify.d.ts +3 -0
- package/lib/commands/build.js +0 -1
- package/lib/commands/connection/add.js +0 -1
- package/lib/commands/connection/index.js +0 -1
- package/lib/commands/connection/remove.js +0 -1
- package/lib/commands/create.js +0 -1
- package/lib/commands/dev.js +0 -1
- package/lib/commands/version/create.js +0 -1
- package/lib/commands/version/index.js +0 -1
- package/lib/commands/version/invite.js +0 -1
- package/lib/commands/version/list.js +0 -1
- package/lib/commands/version/publish.js +0 -1
- package/lib/components/BuildError.js +0 -1
- package/lib/components/BuildLog.js +0 -1
- package/lib/components/Disclaimer.js +0 -1
- package/lib/components/InitialInstructions.js +0 -1
- package/lib/components/Logo.js +0 -1
- package/lib/components/MultiSelect.js +0 -1
- package/lib/components/ScrollBox.js +0 -1
- package/lib/components/ScrollBox.store.js +0 -1
- package/lib/components/ScrollBox.util.js +0 -1
- package/lib/components/Select.js +0 -1
- package/lib/components/Table.js +0 -1
- package/lib/components/TypeScriptErrors.js +0 -1
- package/lib/env.js +0 -1
- package/lib/hooks/useFullScreen.js +0 -1
- package/lib/hooks/useTerminalTitle.js +0 -1
- package/lib/machines/actors.js +0 -1
- package/lib/machines/add-connection-machine.js +0 -1
- package/lib/machines/build-machine.js +0 -1
- package/lib/machines/build-orchestrator.js +0 -1
- package/lib/machines/create-machine.js +0 -1
- package/lib/machines/create-version-machine.js +0 -1
- package/lib/machines/dev-machine.js +1 -2
- package/lib/machines/generate-invite-machine.js +0 -1
- package/lib/machines/js-machine.js +77 -11
- package/lib/machines/list-versions-machine.js +0 -1
- package/lib/machines/publish-version-machine.js +0 -1
- package/lib/machines/remove-connection-machine.js +0 -1
- package/lib/machines/ts-machine.js +0 -1
- package/lib/schema.js +0 -1
- package/lib/server/index.d.ts +1 -0
- package/lib/templates/javascript/package.json +0 -1
- package/lib/templates/javascript/src/app/record/counter-action.jsx +1 -1
- package/lib/templates/typescript/package.json +0 -1
- package/lib/templates/typescript/src/app/record/counter-action.tsx +1 -1
- package/lib/templates/typescript/tsconfig.json +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/util/app-config.js +0 -1
- package/lib/util/copy-with-replace.js +0 -1
- package/lib/util/create-directory.js +0 -1
- package/lib/util/load-developer-config.js +0 -1
- package/lib/util/load-env.js +0 -1
- package/lib/util/slugify-extension.js +0 -1
- package/lib/util/typescript.js +0 -1
- package/lib/util/validate-slug.js +0 -1
- package/package.json +9 -63
- package/server.d.ts +1 -0
- package/lib/api/add-connection-definition.d.ts +0 -26
- package/lib/api/add-connection-definition.d.ts.map +0 -1
- package/lib/api/add-connection-definition.js.map +0 -1
- package/lib/api/complete-bundle-upload.d.ts +0 -8
- package/lib/api/complete-bundle-upload.d.ts.map +0 -1
- package/lib/api/complete-bundle-upload.js.map +0 -1
- package/lib/api/complete-prod-bundle-upload.d.ts +0 -9
- package/lib/api/complete-prod-bundle-upload.d.ts.map +0 -1
- package/lib/api/complete-prod-bundle-upload.js.map +0 -1
- package/lib/api/create-app.d.ts +0 -14
- package/lib/api/create-app.d.ts.map +0 -1
- package/lib/api/create-app.js.map +0 -1
- package/lib/api/create-dev-version.d.ts +0 -28
- package/lib/api/create-dev-version.d.ts.map +0 -1
- package/lib/api/create-dev-version.js.map +0 -1
- package/lib/api/create-developer-account.d.ts +0 -12
- package/lib/api/create-developer-account.d.ts.map +0 -1
- package/lib/api/create-developer-account.js.map +0 -1
- package/lib/api/create-version.d.ts +0 -33
- package/lib/api/create-version.d.ts.map +0 -1
- package/lib/api/create-version.js.map +0 -1
- package/lib/api/fetch-versions.d.ts +0 -47
- package/lib/api/fetch-versions.d.ts.map +0 -1
- package/lib/api/fetch-versions.js.map +0 -1
- package/lib/api/generate-invite-link.d.ts +0 -18
- package/lib/api/generate-invite-link.d.ts.map +0 -1
- package/lib/api/generate-invite-link.js.map +0 -1
- package/lib/api/handle-error.d.ts +0 -3
- package/lib/api/handle-error.d.ts.map +0 -1
- package/lib/api/handle-error.js.map +0 -1
- package/lib/api/is-app-slug-valid.d.ts +0 -6
- package/lib/api/is-app-slug-valid.d.ts.map +0 -1
- package/lib/api/is-app-slug-valid.js.map +0 -1
- package/lib/api/make-headers.d.ts +0 -6
- package/lib/api/make-headers.d.ts.map +0 -1
- package/lib/api/make-headers.js.map +0 -1
- package/lib/api/publish-version.d.ts +0 -18
- package/lib/api/publish-version.d.ts.map +0 -1
- package/lib/api/publish-version.js.map +0 -1
- package/lib/api/remove-connection-definition.d.ts +0 -6
- package/lib/api/remove-connection-definition.d.ts.map +0 -1
- package/lib/api/remove-connection-definition.js.map +0 -1
- package/lib/api/start-upload.d.ts +0 -12
- package/lib/api/start-upload.d.ts.map +0 -1
- package/lib/api/start-upload.js.map +0 -1
- package/lib/attio.d.ts +0 -3
- package/lib/attio.d.ts.map +0 -1
- package/lib/attio.js.map +0 -1
- package/lib/build/client/create-client-build-config.d.ts +0 -6
- package/lib/build/client/create-client-build-config.d.ts.map +0 -1
- package/lib/build/client/create-client-build-config.js.map +0 -1
- package/lib/build/client/generate-client-entry.d.ts +0 -6
- package/lib/build/client/generate-client-entry.d.ts.map +0 -1
- package/lib/build/client/generate-client-entry.js.map +0 -1
- package/lib/build/get-module-hash.d.ts +0 -2
- package/lib/build/get-module-hash.d.ts.map +0 -1
- package/lib/build/get-module-hash.js.map +0 -1
- package/lib/build/proxy-server-modules-plugin.d.ts +0 -5
- package/lib/build/proxy-server-modules-plugin.d.ts.map +0 -1
- package/lib/build/proxy-server-modules-plugin.js.map +0 -1
- package/lib/build/server/create-server-build-config.d.ts +0 -3
- package/lib/build/server/create-server-build-config.d.ts.map +0 -1
- package/lib/build/server/create-server-build-config.js.map +0 -1
- package/lib/build/server/generate-server-entry.d.ts +0 -5
- package/lib/build/server/generate-server-entry.d.ts.map +0 -1
- package/lib/build/server/generate-server-entry.js.map +0 -1
- package/lib/build.d.ts +0 -156
- package/lib/build.d.ts.map +0 -1
- package/lib/build.js.map +0 -1
- package/lib/commands/build.d.ts +0 -4
- package/lib/commands/build.d.ts.map +0 -1
- package/lib/commands/build.js.map +0 -1
- package/lib/commands/connection/add.d.ts +0 -37
- package/lib/commands/connection/add.d.ts.map +0 -1
- package/lib/commands/connection/add.js.map +0 -1
- package/lib/commands/connection/index.d.ts +0 -2
- package/lib/commands/connection/index.d.ts.map +0 -1
- package/lib/commands/connection/index.js.map +0 -1
- package/lib/commands/connection/remove.d.ts +0 -16
- package/lib/commands/connection/remove.d.ts.map +0 -1
- package/lib/commands/connection/remove.js.map +0 -1
- package/lib/commands/create.d.ts +0 -31
- package/lib/commands/create.d.ts.map +0 -1
- package/lib/commands/create.js.map +0 -1
- package/lib/commands/dev.d.ts +0 -16
- package/lib/commands/dev.d.ts.map +0 -1
- package/lib/commands/dev.js.map +0 -1
- package/lib/commands/version/create.d.ts +0 -16
- package/lib/commands/version/create.d.ts.map +0 -1
- package/lib/commands/version/create.js.map +0 -1
- package/lib/commands/version/index.d.ts +0 -2
- package/lib/commands/version/index.d.ts.map +0 -1
- package/lib/commands/version/index.js.map +0 -1
- package/lib/commands/version/invite.d.ts +0 -18
- package/lib/commands/version/invite.d.ts.map +0 -1
- package/lib/commands/version/invite.js.map +0 -1
- package/lib/commands/version/list.d.ts +0 -17
- package/lib/commands/version/list.d.ts.map +0 -1
- package/lib/commands/version/list.js.map +0 -1
- package/lib/commands/version/publish.d.ts +0 -18
- package/lib/commands/version/publish.d.ts.map +0 -1
- package/lib/commands/version/publish.js.map +0 -1
- package/lib/components/BuildError.d.ts +0 -4
- package/lib/components/BuildError.d.ts.map +0 -1
- package/lib/components/BuildError.js.map +0 -1
- package/lib/components/BuildLog.d.ts +0 -7
- package/lib/components/BuildLog.d.ts.map +0 -1
- package/lib/components/BuildLog.js.map +0 -1
- package/lib/components/Disclaimer.d.ts +0 -3
- package/lib/components/Disclaimer.d.ts.map +0 -1
- package/lib/components/Disclaimer.js.map +0 -1
- package/lib/components/InitialInstructions.d.ts +0 -5
- package/lib/components/InitialInstructions.d.ts.map +0 -1
- package/lib/components/InitialInstructions.js.map +0 -1
- package/lib/components/Logo.d.ts +0 -3
- package/lib/components/Logo.d.ts.map +0 -1
- package/lib/components/Logo.js.map +0 -1
- package/lib/components/MultiSelect.d.ts +0 -13
- package/lib/components/MultiSelect.d.ts.map +0 -1
- package/lib/components/MultiSelect.js.map +0 -1
- package/lib/components/ScrollBox.d.ts +0 -4
- package/lib/components/ScrollBox.d.ts.map +0 -1
- package/lib/components/ScrollBox.js.map +0 -1
- package/lib/components/ScrollBox.store.d.ts +0 -15
- package/lib/components/ScrollBox.store.d.ts.map +0 -1
- package/lib/components/ScrollBox.store.js.map +0 -1
- package/lib/components/ScrollBox.util.d.ts +0 -4
- package/lib/components/ScrollBox.util.d.ts.map +0 -1
- package/lib/components/ScrollBox.util.js.map +0 -1
- package/lib/components/Select.d.ts +0 -13
- package/lib/components/Select.d.ts.map +0 -1
- package/lib/components/Select.js.map +0 -1
- package/lib/components/Table.d.ts +0 -5
- package/lib/components/Table.d.ts.map +0 -1
- package/lib/components/Table.js.map +0 -1
- package/lib/components/TypeScriptErrors.d.ts +0 -4
- package/lib/components/TypeScriptErrors.d.ts.map +0 -1
- package/lib/components/TypeScriptErrors.js.map +0 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +0 -1
- package/lib/env.js.map +0 -1
- package/lib/hooks/useFullScreen.d.ts +0 -3
- package/lib/hooks/useFullScreen.d.ts.map +0 -1
- package/lib/hooks/useFullScreen.js.map +0 -1
- package/lib/hooks/useTerminalTitle.d.ts +0 -2
- package/lib/hooks/useTerminalTitle.d.ts.map +0 -1
- package/lib/hooks/useTerminalTitle.js.map +0 -1
- package/lib/machines/actors.d.ts +0 -3
- package/lib/machines/actors.d.ts.map +0 -1
- package/lib/machines/actors.js.map +0 -1
- package/lib/machines/add-connection-machine.d.ts +0 -290
- package/lib/machines/add-connection-machine.d.ts.map +0 -1
- package/lib/machines/add-connection-machine.js.map +0 -1
- package/lib/machines/build-machine.d.ts +0 -673
- package/lib/machines/build-machine.d.ts.map +0 -1
- package/lib/machines/build-machine.js.map +0 -1
- package/lib/machines/build-orchestrator.d.ts +0 -16
- package/lib/machines/build-orchestrator.d.ts.map +0 -1
- package/lib/machines/build-orchestrator.js.map +0 -1
- package/lib/machines/create-machine.d.ts +0 -240
- package/lib/machines/create-machine.d.ts.map +0 -1
- package/lib/machines/create-machine.js.map +0 -1
- package/lib/machines/create-version-machine.d.ts +0 -872
- package/lib/machines/create-version-machine.d.ts.map +0 -1
- package/lib/machines/create-version-machine.js.map +0 -1
- package/lib/machines/dev-machine.d.ts +0 -971
- package/lib/machines/dev-machine.d.ts.map +0 -1
- package/lib/machines/dev-machine.js.map +0 -1
- package/lib/machines/generate-invite-machine.d.ts +0 -168
- package/lib/machines/generate-invite-machine.d.ts.map +0 -1
- package/lib/machines/generate-invite-machine.js.map +0 -1
- package/lib/machines/js-machine.d.ts +0 -142
- package/lib/machines/js-machine.d.ts.map +0 -1
- package/lib/machines/js-machine.js.map +0 -1
- package/lib/machines/list-versions-machine.d.ts +0 -119
- package/lib/machines/list-versions-machine.d.ts.map +0 -1
- package/lib/machines/list-versions-machine.js.map +0 -1
- package/lib/machines/publish-version-machine.d.ts +0 -159
- package/lib/machines/publish-version-machine.d.ts.map +0 -1
- package/lib/machines/publish-version-machine.js.map +0 -1
- package/lib/machines/remove-connection-machine.d.ts +0 -103
- package/lib/machines/remove-connection-machine.d.ts.map +0 -1
- package/lib/machines/remove-connection-machine.js.map +0 -1
- package/lib/machines/ts-machine.d.ts +0 -81
- package/lib/machines/ts-machine.d.ts.map +0 -1
- package/lib/machines/ts-machine.js.map +0 -1
- package/lib/schema.d.ts +0 -46
- package/lib/schema.d.ts.map +0 -1
- package/lib/schema.js.map +0 -1
- package/lib/util/app-config.d.ts +0 -11
- package/lib/util/app-config.d.ts.map +0 -1
- package/lib/util/app-config.js.map +0 -1
- package/lib/util/copy-with-replace.d.ts +0 -2
- package/lib/util/copy-with-replace.d.ts.map +0 -1
- package/lib/util/copy-with-replace.js.map +0 -1
- package/lib/util/create-directory.d.ts +0 -2
- package/lib/util/create-directory.d.ts.map +0 -1
- package/lib/util/create-directory.js.map +0 -1
- package/lib/util/load-developer-config.d.ts +0 -41
- package/lib/util/load-developer-config.d.ts.map +0 -1
- package/lib/util/load-developer-config.js.map +0 -1
- package/lib/util/load-env.d.ts +0 -3
- package/lib/util/load-env.d.ts.map +0 -1
- package/lib/util/load-env.js.map +0 -1
- package/lib/util/slugify-extension.d.ts +0 -2
- package/lib/util/slugify-extension.d.ts.map +0 -1
- package/lib/util/slugify-extension.js.map +0 -1
- package/lib/util/typescript.d.ts +0 -41
- package/lib/util/typescript.d.ts.map +0 -1
- package/lib/util/typescript.js.map +0 -1
- package/lib/util/validate-slug.d.ts +0 -3
- package/lib/util/validate-slug.d.ts.map +0 -1
- package/lib/util/validate-slug.js.map +0 -1
package/attio.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./lib/attio.js")
|
package/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib/client"
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export {}
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
// Ignoring React because this is consumed as a peerDependency in extensions
|
|
5
|
+
|
|
6
|
+
function setTimeout(fn: () => void, ms: number): unknown
|
|
7
|
+
|
|
8
|
+
function clearTimeout(timeout: ReturnType<typeof setTimeout>): void
|
|
9
|
+
|
|
10
|
+
function setInterval(fn: () => void, ms: number): unknown
|
|
11
|
+
|
|
12
|
+
function clearInterval(interval: ReturnType<typeof setInterval>): void
|
|
13
|
+
|
|
14
|
+
function queueMicrotask(callback: () => void): void
|
|
15
|
+
|
|
16
|
+
const window: {
|
|
17
|
+
open(url?: string, target?: string, features?: string): void
|
|
18
|
+
}
|
|
19
|
+
}
|
package/lib/api/create-app.js
CHANGED
package/lib/api/handle-error.js
CHANGED
package/lib/api/make-headers.js
CHANGED
package/lib/api/start-upload.js
CHANGED
package/lib/attio.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import globalExternals from "@fal-works/esbuild-plugin-global-externals";
|
|
2
2
|
import { proxyServerModulesPlugin } from "../proxy-server-modules-plugin.js";
|
|
3
|
-
export function createClientBuildConfig({ appDir,
|
|
3
|
+
export function createClientBuildConfig({ appDir, entryPoint, }) {
|
|
4
4
|
return {
|
|
5
|
-
|
|
6
|
-
contents,
|
|
7
|
-
resolveDir: ".",
|
|
8
|
-
loader: "tsx",
|
|
9
|
-
},
|
|
5
|
+
entryPoints: [entryPoint],
|
|
10
6
|
logLevel: "silent",
|
|
11
7
|
bundle: true,
|
|
12
8
|
platform: "browser",
|
|
@@ -14,7 +10,7 @@ export function createClientBuildConfig({ appDir, contents, }) {
|
|
|
14
10
|
plugins: [
|
|
15
11
|
globalExternals({
|
|
16
12
|
"react": "React",
|
|
17
|
-
"
|
|
13
|
+
"attio/client": {
|
|
18
14
|
varName: "ATTIO_CLIENT_EXTENSION_SDK",
|
|
19
15
|
type: "cjs",
|
|
20
16
|
},
|
|
@@ -23,4 +19,3 @@ export function createClientBuildConfig({ appDir, contents, }) {
|
|
|
23
19
|
],
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
|
-
//# sourceMappingURL=create-client-build-config.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
1
2
|
import { glob } from "glob";
|
|
2
3
|
import path from "path";
|
|
3
4
|
const ROUTE_FILE_EXTENSIONS = ["tsx", "jsx", "ts", "js"];
|
|
4
|
-
|
|
5
|
+
const ASSET_FILE_EXTENSIONS = ["png"];
|
|
6
|
+
export async function generateClientEntry({ filePath, appDir, assetsDir, routes, log, }) {
|
|
5
7
|
log?.(`💥 Found entry point at ${path.resolve(appDir)}`);
|
|
6
8
|
const paths = routes.flatMap((route) => ROUTE_FILE_EXTENSIONS.map((fileExtension) => route + "." + fileExtension));
|
|
7
9
|
const concreteRoutes = (await Promise.all(paths.map(async (path) => {
|
|
@@ -22,14 +24,38 @@ export async function generateClientEntry({ appDir, routes, log, }) {
|
|
|
22
24
|
return [];
|
|
23
25
|
}
|
|
24
26
|
}))).flat();
|
|
27
|
+
let assetFiles;
|
|
28
|
+
try {
|
|
29
|
+
assetFiles = await fs.readdir(assetsDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
assetFiles = [];
|
|
33
|
+
}
|
|
34
|
+
const assets = assetFiles
|
|
35
|
+
.filter((relativeAssetPath) => ASSET_FILE_EXTENSIONS.some((extension) => relativeAssetPath.endsWith(extension)))
|
|
36
|
+
.map((relativeAssetPath) => ({
|
|
37
|
+
path: path.join(assetsDir, relativeAssetPath),
|
|
38
|
+
name: relativeAssetPath,
|
|
39
|
+
}));
|
|
25
40
|
return `
|
|
26
41
|
${concreteRoutes
|
|
27
|
-
.map((routeAndPath, index) => `import C${index} from ${JSON.stringify(
|
|
42
|
+
.map((routeAndPath, index) => `import C${index} from ${JSON.stringify(path.relative(filePath, path.join(appDir, routeAndPath.path)))}`)
|
|
28
43
|
.join("\n")}
|
|
29
44
|
|
|
45
|
+
const assets = []
|
|
46
|
+
|
|
47
|
+
${assets
|
|
48
|
+
.map((asset, index) => `
|
|
49
|
+
import A${index} from ${JSON.stringify(path.relative(filePath, asset.path))};
|
|
50
|
+
|
|
51
|
+
assets.push({name: ${JSON.stringify(asset.name)}, data: A${index}})
|
|
52
|
+
`)
|
|
53
|
+
.join("\n")}
|
|
54
|
+
|
|
55
|
+
registerAssets(assets)
|
|
56
|
+
|
|
30
57
|
${concreteRoutes
|
|
31
58
|
.map((routeAndPath, index) => `registerExtensionComponent({route: ${JSON.stringify(routeAndPath.route)}, component: C${index}})`)
|
|
32
59
|
.join("\n")}
|
|
33
60
|
`;
|
|
34
61
|
}
|
|
35
|
-
//# sourceMappingURL=generate-client-entry.js.map
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import globalExternals from "@fal-works/esbuild-plugin-global-externals";
|
|
2
|
-
export function createServerBuildConfig(
|
|
2
|
+
export function createServerBuildConfig(entryPoint) {
|
|
3
3
|
return {
|
|
4
|
-
|
|
5
|
-
contents,
|
|
6
|
-
resolveDir: ".",
|
|
7
|
-
loader: "ts",
|
|
8
|
-
},
|
|
4
|
+
entryPoints: [entryPoint],
|
|
9
5
|
bundle: true,
|
|
10
6
|
platform: "browser",
|
|
11
7
|
format: "esm",
|
|
12
8
|
plugins: [
|
|
13
9
|
globalExternals({
|
|
14
|
-
"
|
|
10
|
+
"attio/client": {
|
|
15
11
|
varName: "ATTIO_CLIENT_EXTENSION_SDK",
|
|
16
12
|
type: "cjs",
|
|
17
13
|
},
|
|
@@ -19,4 +15,3 @@ export function createServerBuildConfig(contents) {
|
|
|
19
15
|
],
|
|
20
16
|
};
|
|
21
17
|
}
|
|
22
|
-
//# sourceMappingURL=create-server-build-config.js.map
|
|
@@ -1,56 +1,89 @@
|
|
|
1
1
|
import { glob } from "glob";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { getModuleHash } from "../get-module-hash.js";
|
|
4
|
-
export async function generateServerEntry({ appDir, log, }) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export async function generateServerEntry({ appDir, webhooksDir, filePath, log, }) {
|
|
5
|
+
const [serverFunctionConcretePaths, webhookConcretePaths] = await Promise.all([
|
|
6
|
+
Promise.all([
|
|
7
|
+
glob("**/*.server.ts", { nodir: true, cwd: appDir }),
|
|
8
|
+
glob("**/*.server.js", { nodir: true, cwd: appDir }),
|
|
9
|
+
]).then((paths) => paths.flat()),
|
|
10
|
+
Promise.all([
|
|
11
|
+
glob("**/*.webhook.ts", { nodir: true, cwd: webhooksDir }),
|
|
12
|
+
glob("**/*.webhook.js", { nodir: true, cwd: webhooksDir }),
|
|
13
|
+
]).then((paths) => paths.flat()),
|
|
14
|
+
]);
|
|
15
|
+
const serverFunctionModules = serverFunctionConcretePaths.map((path) => ({
|
|
10
16
|
path,
|
|
11
17
|
hash: getModuleHash(path.replace(/\.(js|ts)$/, "")),
|
|
12
18
|
}));
|
|
13
|
-
|
|
19
|
+
const webhookModules = webhookConcretePaths.map((path) => ({
|
|
20
|
+
path,
|
|
21
|
+
id: path.replace(/\.webhook\.(js|ts)$/, ""),
|
|
22
|
+
}));
|
|
23
|
+
for (const module of serverFunctionModules) {
|
|
14
24
|
log?.(`🔎 Found server module "${module.path}"`);
|
|
15
25
|
}
|
|
16
26
|
return `
|
|
17
27
|
|
|
18
28
|
const modules = new Map()
|
|
19
|
-
|
|
29
|
+
const webhookModules = new Map()
|
|
20
30
|
|
|
21
31
|
|
|
22
|
-
${
|
|
23
|
-
.map((module) => `modules.set("${module.hash}", () => import(${JSON.stringify(
|
|
32
|
+
${serverFunctionModules
|
|
33
|
+
.map((module) => `modules.set("${module.hash}", () => import(${JSON.stringify(path.relative(filePath, path.join(appDir, module.path)))}))`)
|
|
24
34
|
.join("\n")}
|
|
25
35
|
|
|
36
|
+
${webhookModules
|
|
37
|
+
.map((module) => `webhookModules.set("${module.id}", () => import(${JSON.stringify(path.relative(filePath, path.join(webhooksDir, module.path)))}))`)
|
|
38
|
+
.join("\n")}
|
|
26
39
|
|
|
27
|
-
var stdin_default;
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
var stdin_default;
|
|
41
|
+
var stdin_webhooks_default;
|
|
42
|
+
function main() {
|
|
43
|
+
stdin_default = async function(moduleHash, args) {
|
|
44
|
+
const module = modules.get(moduleHash)
|
|
30
45
|
|
|
46
|
+
if (!module) {
|
|
47
|
+
throw new Error(\`Module \${moduleHash} not found\`)
|
|
48
|
+
}
|
|
31
49
|
|
|
32
|
-
|
|
50
|
+
const func = (await module()).default
|
|
33
51
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
if (!func) {
|
|
53
|
+
throw new Error(\`Default export not found in module \${moduleHash}\`)
|
|
54
|
+
}
|
|
37
55
|
|
|
38
|
-
|
|
56
|
+
if (typeof func !== "function") {
|
|
57
|
+
throw new Error(\`\${moduleHash} does not export a function\`)
|
|
58
|
+
}
|
|
39
59
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
60
|
+
return func(...args)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
stdin_webhooks_default = async function(webhookModuleId, args) {
|
|
64
|
+
const module = webhookModules.get(webhookModuleId)
|
|
43
65
|
|
|
44
|
-
|
|
45
|
-
|
|
66
|
+
if (!module) {
|
|
67
|
+
throw new Error(\`Webhook handler not found: \${webhookModuleId}\`)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const func = (await module()).default
|
|
71
|
+
|
|
72
|
+
if (!func) {
|
|
73
|
+
throw new Error(\`Default export not found in module \${webhookModuleId}\`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof func !== "function") {
|
|
77
|
+
throw new Error(\`\${webhookModuleId} does not export a function\`)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return func(...args)
|
|
81
|
+
}
|
|
46
82
|
}
|
|
47
83
|
|
|
48
|
-
return func(...args)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
84
|
|
|
52
|
-
|
|
85
|
+
|
|
86
|
+
main()
|
|
53
87
|
|
|
54
88
|
`;
|
|
55
89
|
}
|
|
56
|
-
//# sourceMappingURL=generate-server-entry.js.map
|
package/lib/build.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ComboboxOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ComboboxOptionsProvider {
|
|
7
|
+
getOption: (value: string) => Promise<Omit<ComboboxOption, "value">>;
|
|
8
|
+
search: (query: string) => Promise<Array<ComboboxOption>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Action } from "./action.js";
|
|
2
|
+
export { ComboboxOption, ComboboxOptionsProvider } from "./combobox.js";
|
|
3
|
+
export { Dialog } from "./dialog.js";
|
|
4
|
+
export { Multistep, Step } from "./multistep.js";
|
|
5
|
+
export { Section } from "./section.js";
|
|
6
|
+
export { TextBlock } from "./text-block.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Step {
|
|
3
|
+
title: string;
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
isValid?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A multi-step component
|
|
9
|
+
*/
|
|
10
|
+
export declare function Multistep(props: {
|
|
11
|
+
initialStep?: number;
|
|
12
|
+
steps: ReadonlyArray<Step>;
|
|
13
|
+
onDone: () => void;
|
|
14
|
+
nextLabel?: string;
|
|
15
|
+
previousLabel?: string;
|
|
16
|
+
doneLabel?: string;
|
|
17
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComboboxOption, ComboboxOptionsProvider } from "../components";
|
|
2
|
+
import { ValueOf, PathTo } from "./path";
|
|
3
|
+
export interface Form<TSchema> {
|
|
4
|
+
Provider: (props: {
|
|
5
|
+
initialValues: ValueOf<TSchema>;
|
|
6
|
+
onSubmit: (data: ValueOf<TSchema>) => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
WithSubmit: (props: {
|
|
10
|
+
children: (submit: () => void) => React.ReactNode;
|
|
11
|
+
}) => JSX.Element;
|
|
12
|
+
WithValues: (props: {
|
|
13
|
+
children: (values: ValueOf<TSchema>) => React.ReactNode;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
Input: React.FC<{
|
|
16
|
+
label: string;
|
|
17
|
+
data: PathTo<TSchema, "string" | "number">;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
Combobox: React.FC<{
|
|
22
|
+
label: string;
|
|
23
|
+
data: PathTo<TSchema, "string">;
|
|
24
|
+
options: Array<ComboboxOption> | ComboboxOptionsProvider;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
Collection: <TPath extends PathTo<TSchema, "array">>(props: {
|
|
29
|
+
label: string;
|
|
30
|
+
data: TPath;
|
|
31
|
+
children: (args: {
|
|
32
|
+
path: `${TPath}.${number}`;
|
|
33
|
+
index: number;
|
|
34
|
+
}) => React.ReactNode;
|
|
35
|
+
}) => React.ReactElement;
|
|
36
|
+
CollectionItem: React.FC<{
|
|
37
|
+
label: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}>;
|
|
40
|
+
SubmitButton: React.FC<{
|
|
41
|
+
label: string;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Build a new form from a schema.
|
|
47
|
+
*/
|
|
48
|
+
export declare function build<TSchema>(schema: TSchema): Form<TSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A number form value.
|
|
3
|
+
*/
|
|
4
|
+
export interface FormNumber {
|
|
5
|
+
type: "number";
|
|
6
|
+
isOptional: boolean;
|
|
7
|
+
default(value: number): FormNumber;
|
|
8
|
+
max(max: number): FormNumber;
|
|
9
|
+
min(min: number): FormNumber;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a new number form value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function number(): FormNumber;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Prettify } from "../util/prettify";
|
|
2
|
+
import { FormArray } from "./array";
|
|
3
|
+
import { FormNumber } from "./number";
|
|
4
|
+
import { FormString } from "./string";
|
|
5
|
+
type Assert<TCat, TAnimal> = TCat extends TAnimal ? TCat : never;
|
|
6
|
+
type Join<A extends string | number | null, B extends string | number> = A extends null ? B : `${A}.${B}`;
|
|
7
|
+
export type ValueType = "string" | "number" | "array";
|
|
8
|
+
export type SchemaNode = FormString | FormNumber | FormArray<any> | {
|
|
9
|
+
type: "object";
|
|
10
|
+
};
|
|
11
|
+
type PathWithTypeRecursive<TState, TRoot extends string | number | null> = TState extends FormString ? {
|
|
12
|
+
path: TRoot;
|
|
13
|
+
type: "string";
|
|
14
|
+
} : TState extends FormNumber ? {
|
|
15
|
+
path: TRoot;
|
|
16
|
+
type: "number";
|
|
17
|
+
} : TState extends FormArray<infer TElement> ? {
|
|
18
|
+
path: TRoot;
|
|
19
|
+
type: "array";
|
|
20
|
+
} | PathWithTypeRecursive<TElement, Join<TRoot, number>> : {
|
|
21
|
+
[K in keyof TState]: K extends string ? PathWithTypeRecursive<TState[K], Join<TRoot, K>> : never;
|
|
22
|
+
}[keyof TState];
|
|
23
|
+
type PathWithType<TState> = Assert<Prettify<PathWithTypeRecursive<TState, null>>, {
|
|
24
|
+
path: string;
|
|
25
|
+
type: ValueType;
|
|
26
|
+
}>;
|
|
27
|
+
export type Path<TState> = PathWithType<TState>["path"];
|
|
28
|
+
export type PathTo<TState, TType extends ValueType> = Extract<PathWithType<TState>, {
|
|
29
|
+
type: TType;
|
|
30
|
+
}>["path"];
|
|
31
|
+
export type ValueOf<TState> = TState extends FormString ? string : TState extends FormNumber ? number : TState extends FormArray<infer TElement> ? Array<ValueOf<TElement>> : {
|
|
32
|
+
[K in keyof TState]: K extends string ? ValueOf<TState[K]> : never;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A string form value.
|
|
3
|
+
*/
|
|
4
|
+
export interface FormString {
|
|
5
|
+
type: "string";
|
|
6
|
+
isMultiline: boolean;
|
|
7
|
+
isOptional: boolean;
|
|
8
|
+
default(value: string): FormString;
|
|
9
|
+
multiline(): FormString;
|
|
10
|
+
optional(): FormString;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a new string form value.
|
|
14
|
+
*/
|
|
15
|
+
export declare function string(): FormString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An async function that loads data.
|
|
3
|
+
*/
|
|
4
|
+
export type Loader<Input extends Array<any>, Output> = (...args: Input) => Promise<Output>;
|
|
5
|
+
/**
|
|
6
|
+
* A hook that returns the result of calling a loader.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLoader<Input extends Array<any>, Output>(
|
|
9
|
+
/** A unique name for this function for caching */
|
|
10
|
+
name: string, loader: Loader<Input, Output>, ...args: Input): {
|
|
11
|
+
value: Output;
|
|
12
|
+
invalidate: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./hooks/index.js";
|
|
2
|
+
export * from "./components/index.js";
|
|
3
|
+
export * as Forms from "./forms/index.js";
|
|
4
|
+
export { FormArray } from "./forms/array.js";
|
|
5
|
+
export { FormNumber } from "./forms/number.js";
|
|
6
|
+
export { FormString } from "./forms/string.js";
|
|
7
|
+
export * from "./forms/path.js";
|
|
8
|
+
export { Form } from "./forms/build.js";
|