@relyio/sdk 0.17.0 → 0.18.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/automations/index.cjs +70 -0
  3. package/dist/automations/index.d.cts +1309 -0
  4. package/dist/automations/index.d.ts +1309 -0
  5. package/dist/automations/index.js +5 -0
  6. package/dist/{chunk-RSHMA4KT.cjs → chunk-2SPPU2WG.cjs} +68 -68
  7. package/dist/chunk-7I3SC7SV.cjs +40 -0
  8. package/dist/chunk-DI6KFDBO.js +43 -0
  9. package/dist/chunk-EDE2H37D.js +686 -0
  10. package/dist/chunk-HDHBYYEY.js +36 -0
  11. package/dist/{chunk-6E22GYPB.cjs → chunk-IFKF72VJ.cjs} +705 -320
  12. package/dist/chunk-L6DXCKVQ.cjs +50 -0
  13. package/dist/chunk-LSI26ZN2.cjs +535 -0
  14. package/dist/{chunk-TZL374LS.cjs → chunk-M7MWNV3Q.cjs} +21 -21
  15. package/dist/{chunk-H6IBQSMM.js → chunk-NJQK5STK.js} +3 -3
  16. package/dist/chunk-R6E4HE7R.js +520 -0
  17. package/dist/chunk-SHSK7UUY.cjs +706 -0
  18. package/dist/{chunk-BBUB7C2Z.js → chunk-W2A4OTCI.js} +3 -3
  19. package/dist/chunk-W7JFHSFM.js +18718 -0
  20. package/dist/{chunk-5UMY6CS4.js → chunk-ZAKEY6DY.js} +3 -3
  21. package/dist/chunk-ZAMAR3X2.cjs +18759 -0
  22. package/dist/{chunk-VS2DEUTN.js → chunk-ZHTJ7GXH.js} +387 -8
  23. package/dist/{chunk-LSRPMNPT.cjs → chunk-ZO6QDYJG.cjs} +7 -7
  24. package/dist/client/index.cjs +8 -7
  25. package/dist/client/index.d.cts +4 -3
  26. package/dist/client/index.d.ts +4 -3
  27. package/dist/client/index.js +6 -5
  28. package/dist/{define-content-type-AuL9-oz6.d.cts → define-content-type-NEQDrvdq.d.cts} +3342 -805
  29. package/dist/{define-content-type-BGoQxqLf.d.ts → define-content-type-fb-WCD5e.d.ts} +3342 -805
  30. package/dist/{define-schema-DgCX9YB7.d.ts → define-schema-DZhtvLiK.d.cts} +157 -10
  31. package/dist/{define-schema-DkXwpp0I.d.cts → define-schema-Dlwh6l_J.d.ts} +157 -10
  32. package/dist/dev-handshake/index.cjs +9 -9
  33. package/dist/dev-handshake/index.js +2 -2
  34. package/dist/extensions/index.cjs +80 -0
  35. package/dist/extensions/index.d.cts +792 -0
  36. package/dist/extensions/index.d.ts +792 -0
  37. package/dist/extensions/index.js +76 -0
  38. package/dist/functions/index.cjs +68 -0
  39. package/dist/functions/index.d.cts +6 -0
  40. package/dist/functions/index.d.ts +6 -0
  41. package/dist/functions/index.js +59 -0
  42. package/dist/{index-DaMZ4FQ_.d.ts → index-C4LqrNd1.d.ts} +1 -1
  43. package/dist/{index-Bp4AiNT3.d.cts → index-Dnmt_UOo.d.cts} +1 -1
  44. package/dist/{index-DxRmKPrR.d.cts → index-DwHcL6x5.d.cts} +83 -428
  45. package/dist/{index-BBp8_tn9.d.ts → index-M3luH06A.d.ts} +83 -428
  46. package/dist/index.cjs +204 -185
  47. package/dist/index.d.cts +93 -13
  48. package/dist/index.d.ts +93 -13
  49. package/dist/index.js +11 -16
  50. package/dist/markdown/index.cjs +382 -382
  51. package/dist/markdown/index.js +1 -1
  52. package/dist/preview/index.cjs +11 -10
  53. package/dist/preview/index.js +3 -2
  54. package/dist/register-B53i97A9.d.ts +677 -0
  55. package/dist/register-BYCs0FpF.d.cts +677 -0
  56. package/dist/rich-text/index.cjs +12 -12
  57. package/dist/rich-text/index.d.cts +2 -2
  58. package/dist/rich-text/index.d.ts +2 -2
  59. package/dist/rich-text/index.js +2 -2
  60. package/dist/schema/index.cjs +62 -34
  61. package/dist/schema/index.d.cts +127 -5
  62. package/dist/schema/index.d.ts +127 -5
  63. package/dist/schema/index.js +2 -2
  64. package/dist/types/index.d.cts +1 -1
  65. package/dist/types/index.d.ts +1 -1
  66. package/dist/utils/index.cjs +20 -20
  67. package/dist/utils/index.js +2 -2
  68. package/package.json +23 -5
  69. package/dist/chunk-6PTRZP5U.cjs +0 -433
  70. package/dist/chunk-DIZY6CKM.js +0 -950
  71. package/dist/chunk-GHYB6IZK.cjs +0 -983
  72. package/dist/chunk-MWMSFIWN.cjs +0 -17
  73. package/dist/chunk-OVMIHAYK.js +0 -411
  74. package/dist/chunk-XQ4QHWZE.js +0 -13
@@ -0,0 +1,76 @@
1
+ import { extensionTrigger } from '../chunk-R6E4HE7R.js';
2
+ import '../chunk-W7JFHSFM.js';
3
+ import { EXTENSION_SURFACES } from '../chunk-EDE2H37D.js';
4
+ import { __name } from '../chunk-DI6KFDBO.js';
5
+
6
+ /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
7
+
8
+ // src/extensions/index.ts
9
+ var DECLARED = "declared";
10
+ var SURFACES = EXTENSION_SURFACES;
11
+ function handleOf(slug) {
12
+ const surface = SURFACES[slug];
13
+ if (surface === void 0) {
14
+ throw new TypeError(
15
+ `"${slug}" is no Extension relyio/extensions.ts can declare: ${Object.keys(SURFACES).join(", ")}`
16
+ );
17
+ }
18
+ return {
19
+ ...Object.fromEntries(
20
+ Object.entries(surface.actions).map(([name, { action }]) => [
21
+ name,
22
+ { _tag: "action", extension: slug, action }
23
+ ])
24
+ ),
25
+ ...Object.fromEntries(
26
+ Object.entries(surface.triggers).map(([name, { trigger }]) => [
27
+ name,
28
+ (options) => extensionTrigger(slug, trigger, options)
29
+ ])
30
+ )
31
+ };
32
+ }
33
+ __name(handleOf, "handleOf");
34
+ function settingsOf(slug, settings) {
35
+ if (typeof settings !== "object" || settings === null || Array.isArray(settings)) {
36
+ throw new TypeError(`${slug}'s settings are an object: ${slug}: { \u2026 }`);
37
+ }
38
+ return Object.fromEntries(
39
+ Object.entries(settings).filter(([, value]) => value !== void 0).map(([key, value]) => {
40
+ if (typeof value !== "string") {
41
+ throw new TypeError(`${slug}.${key} is text: a setting is never anything else`);
42
+ }
43
+ return [key, value];
44
+ })
45
+ );
46
+ }
47
+ __name(settingsOf, "settingsOf");
48
+ function defineExtensions(config) {
49
+ const slugs = Object.keys(config).filter(
50
+ (slug) => config[slug] !== void 0
51
+ );
52
+ const declared = Object.fromEntries(
53
+ slugs.map((slug) => [
54
+ slug,
55
+ { settings: settingsOf(slug, config[slug]) }
56
+ ])
57
+ );
58
+ return {
59
+ _tag: "extensions",
60
+ [DECLARED]: declared,
61
+ ...Object.fromEntries(slugs.map((slug) => [slug, handleOf(slug)]))
62
+ };
63
+ }
64
+ __name(defineExtensions, "defineExtensions");
65
+ function isExtensionsFile(value) {
66
+ return typeof value === "object" && value !== null && value._tag === "extensions" && typeof value[DECLARED] === "object";
67
+ }
68
+ __name(isExtensionsFile, "isExtensionsFile");
69
+ function extensionsDeclarationOf(file) {
70
+ return file[DECLARED];
71
+ }
72
+ __name(extensionsDeclarationOf, "extensionsDeclarationOf");
73
+
74
+ export { defineExtensions, extensionsDeclarationOf, isExtensionsFile };
75
+ //# sourceMappingURL=index.js.map
76
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var chunkZAMAR3X2_cjs = require('../chunk-ZAMAR3X2.cjs');
4
+ var chunkL6DXCKVQ_cjs = require('../chunk-L6DXCKVQ.cjs');
5
+
6
+ /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
7
+
8
+ // src/functions/index.ts
9
+ function isBatchRefused(error) {
10
+ return error instanceof Error && error.name === "BatchRefused" && "operation" in error;
11
+ }
12
+ chunkL6DXCKVQ_cjs.__name(isBatchRefused, "isBatchRefused");
13
+ function isActionRefused(error) {
14
+ return error instanceof Error && error.name === "ActionRefused" && "code" in error;
15
+ }
16
+ chunkL6DXCKVQ_cjs.__name(isActionRefused, "isActionRefused");
17
+ function respond(response) {
18
+ return {
19
+ _tag: "function-response",
20
+ status: response.status,
21
+ headers: { ...response.headers },
22
+ body: response.body ?? null
23
+ };
24
+ }
25
+ chunkL6DXCKVQ_cjs.__name(respond, "respond");
26
+ function defineFunction(config) {
27
+ const actions = (config.actions ?? []).map(({ extension, action }) => ({ extension, action }));
28
+ const declaration = {
29
+ ...config.description === void 0 ? {} : { description: config.description },
30
+ runtime: config.runtime ?? "isolate",
31
+ ...config.container === void 0 ? {} : { container: { size: config.container.size } },
32
+ ...config.limits === void 0 ? {} : { limits: { ...config.limits } },
33
+ input: chunkZAMAR3X2_cjs.compileKeyedMembers(config.input ?? {}),
34
+ ...config.output === void 0 ? {} : { output: chunkZAMAR3X2_cjs.compileKeyedMembers(config.output) },
35
+ records: { read: [...config.records?.read ?? []], write: [...config.records?.write ?? []] },
36
+ content: config.content ?? "none",
37
+ network: (config.network ?? []).map((host) => ({ ...host })),
38
+ secrets: Object.fromEntries(
39
+ Object.entries(config.secrets ?? {}).map(([name, secret]) => [
40
+ name,
41
+ { hosts: [...secret.hosts] }
42
+ ])
43
+ ),
44
+ // Absent when it declares none, so a Function declaring none hashes as it did before
45
+ ...actions.length === 0 ? {} : { actions },
46
+ ...config.route === void 0 ? {} : { route: config.route },
47
+ ...config.tool === void 0 ? {} : { tool: { description: config.tool.description } },
48
+ ...config.schedule === void 0 ? {} : { schedule: { ...config.schedule } }
49
+ };
50
+ return { _tag: "function", declaration, run: config.run };
51
+ }
52
+ chunkL6DXCKVQ_cjs.__name(defineFunction, "defineFunction");
53
+ function isFunctionDefinition(value) {
54
+ return typeof value === "object" && value !== null && value._tag === "function" && typeof value.run === "function" && typeof value.declaration === "object";
55
+ }
56
+ chunkL6DXCKVQ_cjs.__name(isFunctionDefinition, "isFunctionDefinition");
57
+
58
+ Object.defineProperty(exports, "fields", {
59
+ enumerable: true,
60
+ get: function () { return chunkZAMAR3X2_cjs.fields; }
61
+ });
62
+ exports.defineFunction = defineFunction;
63
+ exports.isActionRefused = isActionRefused;
64
+ exports.isBatchRefused = isBatchRefused;
65
+ exports.isFunctionDefinition = isFunctionDefinition;
66
+ exports.respond = respond;
67
+ //# sourceMappingURL=index.cjs.map
68
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,6 @@
1
+ export { f as FunctionActionHandle, e as FunctionActionReach, A as FunctionActionRefused, z as FunctionActions, t as FunctionBatchRefused, s as FunctionBatchResult, C as FunctionCapabilities, G as FunctionConfig, a as FunctionContainerSize, y as FunctionContent, o as FunctionCounterMove, l as FunctionDeclaration, H as FunctionDefinition, b as FunctionDuration, k as FunctionFieldDeclaration, n as FunctionFile, I as FunctionInputOf, d as FunctionNetworkHost, J as FunctionOutputOf, r as FunctionRecordBatch, p as FunctionRecordReader, m as FunctionRecordTypeName, q as FunctionRecordWriter, v as FunctionRecords, D as FunctionResponse, h as FunctionRoute, c as FunctionRouteMethod, x as FunctionRunInfo, F as FunctionRuntime, j as FunctionSchedule, g as FunctionSecretDeclaration, i as FunctionTool, w as FunctionWayIn, K as defineFunction, B as isActionRefused, u as isBatchRefused, L as isFunctionDefinition, E as respond } from '../automations/index.cjs';
2
+ import '../register-BYCs0FpF.cjs';
3
+ import '../define-schema-DZhtvLiK.cjs';
4
+ import '../define-content-type-NEQDrvdq.cjs';
5
+ export { fields } from '../schema/index.cjs';
6
+ import '../rich-text.d-BWc-5gX1.cjs';
@@ -0,0 +1,6 @@
1
+ export { f as FunctionActionHandle, e as FunctionActionReach, A as FunctionActionRefused, z as FunctionActions, t as FunctionBatchRefused, s as FunctionBatchResult, C as FunctionCapabilities, G as FunctionConfig, a as FunctionContainerSize, y as FunctionContent, o as FunctionCounterMove, l as FunctionDeclaration, H as FunctionDefinition, b as FunctionDuration, k as FunctionFieldDeclaration, n as FunctionFile, I as FunctionInputOf, d as FunctionNetworkHost, J as FunctionOutputOf, r as FunctionRecordBatch, p as FunctionRecordReader, m as FunctionRecordTypeName, q as FunctionRecordWriter, v as FunctionRecords, D as FunctionResponse, h as FunctionRoute, c as FunctionRouteMethod, x as FunctionRunInfo, F as FunctionRuntime, j as FunctionSchedule, g as FunctionSecretDeclaration, i as FunctionTool, w as FunctionWayIn, K as defineFunction, B as isActionRefused, u as isBatchRefused, L as isFunctionDefinition, E as respond } from '../automations/index.js';
2
+ import '../register-B53i97A9.js';
3
+ import '../define-schema-Dlwh6l_J.js';
4
+ import '../define-content-type-fb-WCD5e.js';
5
+ export { fields } from '../schema/index.js';
6
+ import '../rich-text.d-BWc-5gX1.js';
@@ -0,0 +1,59 @@
1
+ import { compileKeyedMembers } from '../chunk-W7JFHSFM.js';
2
+ export { fields } from '../chunk-W7JFHSFM.js';
3
+ import { __name } from '../chunk-DI6KFDBO.js';
4
+
5
+ /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
6
+
7
+ // src/functions/index.ts
8
+ function isBatchRefused(error) {
9
+ return error instanceof Error && error.name === "BatchRefused" && "operation" in error;
10
+ }
11
+ __name(isBatchRefused, "isBatchRefused");
12
+ function isActionRefused(error) {
13
+ return error instanceof Error && error.name === "ActionRefused" && "code" in error;
14
+ }
15
+ __name(isActionRefused, "isActionRefused");
16
+ function respond(response) {
17
+ return {
18
+ _tag: "function-response",
19
+ status: response.status,
20
+ headers: { ...response.headers },
21
+ body: response.body ?? null
22
+ };
23
+ }
24
+ __name(respond, "respond");
25
+ function defineFunction(config) {
26
+ const actions = (config.actions ?? []).map(({ extension, action }) => ({ extension, action }));
27
+ const declaration = {
28
+ ...config.description === void 0 ? {} : { description: config.description },
29
+ runtime: config.runtime ?? "isolate",
30
+ ...config.container === void 0 ? {} : { container: { size: config.container.size } },
31
+ ...config.limits === void 0 ? {} : { limits: { ...config.limits } },
32
+ input: compileKeyedMembers(config.input ?? {}),
33
+ ...config.output === void 0 ? {} : { output: compileKeyedMembers(config.output) },
34
+ records: { read: [...config.records?.read ?? []], write: [...config.records?.write ?? []] },
35
+ content: config.content ?? "none",
36
+ network: (config.network ?? []).map((host) => ({ ...host })),
37
+ secrets: Object.fromEntries(
38
+ Object.entries(config.secrets ?? {}).map(([name, secret]) => [
39
+ name,
40
+ { hosts: [...secret.hosts] }
41
+ ])
42
+ ),
43
+ // Absent when it declares none, so a Function declaring none hashes as it did before
44
+ ...actions.length === 0 ? {} : { actions },
45
+ ...config.route === void 0 ? {} : { route: config.route },
46
+ ...config.tool === void 0 ? {} : { tool: { description: config.tool.description } },
47
+ ...config.schedule === void 0 ? {} : { schedule: { ...config.schedule } }
48
+ };
49
+ return { _tag: "function", declaration, run: config.run };
50
+ }
51
+ __name(defineFunction, "defineFunction");
52
+ function isFunctionDefinition(value) {
53
+ return typeof value === "object" && value !== null && value._tag === "function" && typeof value.run === "function" && typeof value.declaration === "object";
54
+ }
55
+ __name(isFunctionDefinition, "isFunctionDefinition");
56
+
57
+ export { defineFunction, isActionRefused, isBatchRefused, isFunctionDefinition, respond };
58
+ //# sourceMappingURL=index.js.map
59
+ //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { k as RichTextHeading, b as RichTextValue, y as RichTextTable, h as RichTextCodeGroup, e as RichTextBlock, l as RichTextInline, t as RichTextNode, w as RichTextSpan, r as RichTextMark, A as AnyRichTextEntryLink, c as RichTextShapeValue } from './rich-text.d-BWc-5gX1.js';
2
- import { cs as BaseContent } from './define-content-type-BGoQxqLf.js';
2
+ import { cQ as BaseContent } from './define-content-type-fb-WCD5e.js';
3
3
 
4
4
  /**
5
5
  * The DOM↔field binding contract, as the one pure helper that emits it.
@@ -1,5 +1,5 @@
1
1
  import { k as RichTextHeading, b as RichTextValue, y as RichTextTable, h as RichTextCodeGroup, e as RichTextBlock, l as RichTextInline, t as RichTextNode, w as RichTextSpan, r as RichTextMark, A as AnyRichTextEntryLink, c as RichTextShapeValue } from './rich-text.d-BWc-5gX1.cjs';
2
- import { cs as BaseContent } from './define-content-type-AuL9-oz6.cjs';
2
+ import { cQ as BaseContent } from './define-content-type-NEQDrvdq.cjs';
3
3
 
4
4
  /**
5
5
  * The DOM↔field binding contract, as the one pure helper that emits it.