@wickermoney/plugin-sdk 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +202 -0
  2. package/dist/index.d.ts +16 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +13 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/manifest/CORE_TABLES.d.ts +8 -0
  7. package/dist/manifest/CORE_TABLES.d.ts.map +1 -0
  8. package/dist/manifest/CORE_TABLES.js +16 -0
  9. package/dist/manifest/CORE_TABLES.js.map +1 -0
  10. package/dist/manifest/CoreTableName.d.ts +4 -0
  11. package/dist/manifest/CoreTableName.d.ts.map +1 -0
  12. package/dist/manifest/CoreTableName.js +2 -0
  13. package/dist/manifest/CoreTableName.js.map +1 -0
  14. package/dist/manifest/ManifestParseResult.d.ts +13 -0
  15. package/dist/manifest/ManifestParseResult.d.ts.map +1 -0
  16. package/dist/manifest/ManifestParseResult.js +2 -0
  17. package/dist/manifest/ManifestParseResult.js.map +1 -0
  18. package/dist/manifest/PERMISSIONS.d.ts +9 -0
  19. package/dist/manifest/PERMISSIONS.d.ts.map +1 -0
  20. package/dist/manifest/PERMISSIONS.js +9 -0
  21. package/dist/manifest/PERMISSIONS.js.map +1 -0
  22. package/dist/manifest/PageContribution.d.ts +5 -0
  23. package/dist/manifest/PageContribution.d.ts.map +1 -0
  24. package/dist/manifest/PageContribution.js +2 -0
  25. package/dist/manifest/PageContribution.js.map +1 -0
  26. package/dist/manifest/Permission.d.ts +4 -0
  27. package/dist/manifest/Permission.d.ts.map +1 -0
  28. package/dist/manifest/Permission.js +2 -0
  29. package/dist/manifest/Permission.js.map +1 -0
  30. package/dist/manifest/PluginManifest.d.ts +5 -0
  31. package/dist/manifest/PluginManifest.d.ts.map +1 -0
  32. package/dist/manifest/PluginManifest.js +2 -0
  33. package/dist/manifest/PluginManifest.js.map +1 -0
  34. package/dist/manifest/REMOTE_ENTRY_TYPE.d.ts +15 -0
  35. package/dist/manifest/REMOTE_ENTRY_TYPE.d.ts.map +1 -0
  36. package/dist/manifest/REMOTE_ENTRY_TYPE.js +15 -0
  37. package/dist/manifest/REMOTE_ENTRY_TYPE.js.map +1 -0
  38. package/dist/manifest/SDK_MAJOR_VERSION.d.ts +8 -0
  39. package/dist/manifest/SDK_MAJOR_VERSION.d.ts.map +1 -0
  40. package/dist/manifest/SDK_MAJOR_VERSION.js +8 -0
  41. package/dist/manifest/SDK_MAJOR_VERSION.js.map +1 -0
  42. package/dist/manifest/TableGrant.d.ts +5 -0
  43. package/dist/manifest/TableGrant.d.ts.map +1 -0
  44. package/dist/manifest/TableGrant.js +2 -0
  45. package/dist/manifest/TableGrant.js.map +1 -0
  46. package/dist/manifest/WIDGET_SIZES.d.ts +6 -0
  47. package/dist/manifest/WIDGET_SIZES.d.ts.map +1 -0
  48. package/dist/manifest/WIDGET_SIZES.js +6 -0
  49. package/dist/manifest/WIDGET_SIZES.js.map +1 -0
  50. package/dist/manifest/WIDGET_SLOTS.d.ts +9 -0
  51. package/dist/manifest/WIDGET_SLOTS.d.ts.map +1 -0
  52. package/dist/manifest/WIDGET_SLOTS.js +13 -0
  53. package/dist/manifest/WIDGET_SLOTS.js.map +1 -0
  54. package/dist/manifest/WidgetContribution.d.ts +5 -0
  55. package/dist/manifest/WidgetContribution.d.ts.map +1 -0
  56. package/dist/manifest/WidgetContribution.js +2 -0
  57. package/dist/manifest/WidgetContribution.js.map +1 -0
  58. package/dist/manifest/WidgetSize.d.ts +4 -0
  59. package/dist/manifest/WidgetSize.d.ts.map +1 -0
  60. package/dist/manifest/WidgetSize.js +2 -0
  61. package/dist/manifest/WidgetSize.js.map +1 -0
  62. package/dist/manifest/WidgetSlot.d.ts +4 -0
  63. package/dist/manifest/WidgetSlot.d.ts.map +1 -0
  64. package/dist/manifest/WidgetSlot.js +2 -0
  65. package/dist/manifest/WidgetSlot.js.map +1 -0
  66. package/dist/manifest/checkRemoteEntry.d.ts +16 -0
  67. package/dist/manifest/checkRemoteEntry.d.ts.map +1 -0
  68. package/dist/manifest/checkRemoteEntry.js +29 -0
  69. package/dist/manifest/checkRemoteEntry.js.map +1 -0
  70. package/dist/manifest/federationName.d.ts +13 -0
  71. package/dist/manifest/federationName.d.ts.map +1 -0
  72. package/dist/manifest/federationName.js +15 -0
  73. package/dist/manifest/federationName.js.map +1 -0
  74. package/dist/manifest/index.d.ts +26 -0
  75. package/dist/manifest/index.d.ts.map +1 -0
  76. package/dist/manifest/index.js +17 -0
  77. package/dist/manifest/index.js.map +1 -0
  78. package/dist/manifest/isCompatible.d.ts +11 -0
  79. package/dist/manifest/isCompatible.d.ts.map +1 -0
  80. package/dist/manifest/isCompatible.js +14 -0
  81. package/dist/manifest/isCompatible.js.map +1 -0
  82. package/dist/manifest/pageContributionSchema.d.ts +18 -0
  83. package/dist/manifest/pageContributionSchema.d.ts.map +1 -0
  84. package/dist/manifest/pageContributionSchema.js +24 -0
  85. package/dist/manifest/pageContributionSchema.js.map +1 -0
  86. package/dist/manifest/pagePath.d.ts +11 -0
  87. package/dist/manifest/pagePath.d.ts.map +1 -0
  88. package/dist/manifest/pagePath.js +13 -0
  89. package/dist/manifest/pagePath.js.map +1 -0
  90. package/dist/manifest/parseManifest.d.ts +15 -0
  91. package/dist/manifest/parseManifest.d.ts.map +1 -0
  92. package/dist/manifest/parseManifest.js +31 -0
  93. package/dist/manifest/parseManifest.js.map +1 -0
  94. package/dist/manifest/pluginManifestSchema.d.ts +73 -0
  95. package/dist/manifest/pluginManifestSchema.d.ts.map +1 -0
  96. package/dist/manifest/pluginManifestSchema.js +66 -0
  97. package/dist/manifest/pluginManifestSchema.js.map +1 -0
  98. package/dist/manifest/remoteEntrySchema.d.ts +17 -0
  99. package/dist/manifest/remoteEntrySchema.d.ts.map +1 -0
  100. package/dist/manifest/remoteEntrySchema.js +47 -0
  101. package/dist/manifest/remoteEntrySchema.js.map +1 -0
  102. package/dist/manifest/tableGrantSchema.d.ts +18 -0
  103. package/dist/manifest/tableGrantSchema.d.ts.map +1 -0
  104. package/dist/manifest/tableGrantSchema.js +10 -0
  105. package/dist/manifest/tableGrantSchema.js.map +1 -0
  106. package/dist/manifest/widgetContributionSchema.d.ts +20 -0
  107. package/dist/manifest/widgetContributionSchema.d.ts.map +1 -0
  108. package/dist/manifest/widgetContributionSchema.js +19 -0
  109. package/dist/manifest/widgetContributionSchema.js.map +1 -0
  110. package/dist/manifest.d.ts +175 -0
  111. package/dist/manifest.d.ts.map +1 -0
  112. package/dist/manifest.js +148 -0
  113. package/dist/manifest.js.map +1 -0
  114. package/dist/range.d.ts +75 -0
  115. package/dist/range.d.ts.map +1 -0
  116. package/dist/range.js +86 -0
  117. package/dist/range.js.map +1 -0
  118. package/dist/runtime.d.ts +142 -0
  119. package/dist/runtime.d.ts.map +1 -0
  120. package/dist/runtime.js +36 -0
  121. package/dist/runtime.js.map +1 -0
  122. package/package.json +47 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Decides whether a shape-valid `remoteEntry` may be loaded on this host.
3
+ *
4
+ * A same-origin path is always allowed: it is served by the host itself. An
5
+ * `https:` URL is allowed only when its origin is in `allowedOrigins`, which is
6
+ * empty by default (same-origin only).
7
+ *
8
+ * Run by the host when a manifest is registered, after `parseManifest` has
9
+ * checked the entry's shape.
10
+ *
11
+ * @param remoteEntry - The manifest's `remoteEntry`.
12
+ * @param allowedOrigins - Origins (`https://host[:port]`) that may serve plugin code.
13
+ * @returns `undefined` when the entry may be loaded, otherwise a message saying why not.
14
+ */
15
+ export declare function checkRemoteEntry(remoteEntry: string, allowedOrigins?: readonly string[]): string | undefined;
16
+ //# sourceMappingURL=checkRemoteEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkRemoteEntry.d.ts","sourceRoot":"","sources":["../../src/manifest/checkRemoteEntry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,SAAS,MAAM,EAAO,GACrC,MAAM,GAAG,SAAS,CAUpB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Decides whether a shape-valid `remoteEntry` may be loaded on this host.
3
+ *
4
+ * A same-origin path is always allowed: it is served by the host itself. An
5
+ * `https:` URL is allowed only when its origin is in `allowedOrigins`, which is
6
+ * empty by default (same-origin only).
7
+ *
8
+ * Run by the host when a manifest is registered, after `parseManifest` has
9
+ * checked the entry's shape.
10
+ *
11
+ * @param remoteEntry - The manifest's `remoteEntry`.
12
+ * @param allowedOrigins - Origins (`https://host[:port]`) that may serve plugin code.
13
+ * @returns `undefined` when the entry may be loaded, otherwise a message saying why not.
14
+ */
15
+ export function checkRemoteEntry(remoteEntry, allowedOrigins = []) {
16
+ if (remoteEntry.startsWith('/'))
17
+ return undefined;
18
+ let origin;
19
+ try {
20
+ origin = new URL(remoteEntry).origin;
21
+ }
22
+ catch {
23
+ return `remoteEntry '${remoteEntry}' is not a valid URL`;
24
+ }
25
+ if (allowedOrigins.includes(origin))
26
+ return undefined;
27
+ return `remoteEntry origin '${origin}' is not in the allowed plugin origins (PLUGIN_REMOTE_ORIGINS)`;
28
+ }
29
+ //# sourceMappingURL=checkRemoteEntry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkRemoteEntry.js","sourceRoot":"","sources":["../../src/manifest/checkRemoteEntry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB,CAC9B,WAAmB,EACnB,iBAAoC,EAAE;IAEtC,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAA;IACjD,IAAI,MAAc,CAAA;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAA;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,gBAAgB,WAAW,sBAAsB,CAAA;IAC1D,CAAC;IACD,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IACrD,OAAO,uBAAuB,MAAM,gEAAgE,CAAA;AACtG,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Derives the Module Federation container name for a plugin id.
3
+ *
4
+ * Federation names must be valid JS identifiers, but plugin ids are
5
+ * reverse-domain. Both the host and the plugin's build derive the name with
6
+ * this function rather than writing it twice: a mismatch fails at runtime with
7
+ * an opaque "remote not found".
8
+ *
9
+ * @param pluginId - The plugin's manifest id, e.g. `wickermoney.insights`.
10
+ * @returns The id with every character outside `[a-zA-Z0-9_]` replaced by `_`.
11
+ */
12
+ export declare function federationName(pluginId: string): string;
13
+ //# sourceMappingURL=federationName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federationName.d.ts","sourceRoot":"","sources":["../../src/manifest/federationName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Derives the Module Federation container name for a plugin id.
3
+ *
4
+ * Federation names must be valid JS identifiers, but plugin ids are
5
+ * reverse-domain. Both the host and the plugin's build derive the name with
6
+ * this function rather than writing it twice: a mismatch fails at runtime with
7
+ * an opaque "remote not found".
8
+ *
9
+ * @param pluginId - The plugin's manifest id, e.g. `wickermoney.insights`.
10
+ * @returns The id with every character outside `[a-zA-Z0-9_]` replaced by `_`.
11
+ */
12
+ export function federationName(pluginId) {
13
+ return pluginId.replace(/[^a-zA-Z0-9_]/g, '_');
14
+ }
15
+ //# sourceMappingURL=federationName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"federationName.js","sourceRoot":"","sources":["../../src/manifest/federationName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;AAChD,CAAC"}
@@ -0,0 +1,26 @@
1
+ export { checkRemoteEntry } from './checkRemoteEntry.js';
2
+ export { CORE_TABLES } from './CORE_TABLES.js';
3
+ export type { CoreTableName } from './CoreTableName.js';
4
+ export { federationName } from './federationName.js';
5
+ export { isCompatible } from './isCompatible.js';
6
+ export type { ManifestParseResult } from './ManifestParseResult.js';
7
+ export { pageContributionSchema } from './pageContributionSchema.js';
8
+ export type { PageContribution } from './PageContribution.js';
9
+ export { pagePath } from './pagePath.js';
10
+ export { parseManifest } from './parseManifest.js';
11
+ export { PERMISSIONS } from './PERMISSIONS.js';
12
+ export type { Permission } from './Permission.js';
13
+ export type { PluginManifest } from './PluginManifest.js';
14
+ export { pluginManifestSchema } from './pluginManifestSchema.js';
15
+ export { remoteEntrySchema } from './remoteEntrySchema.js';
16
+ export { REMOTE_ENTRY_TYPE } from './REMOTE_ENTRY_TYPE.js';
17
+ export { SDK_MAJOR_VERSION } from './SDK_MAJOR_VERSION.js';
18
+ export type { TableGrant } from './TableGrant.js';
19
+ export { tableGrantSchema } from './tableGrantSchema.js';
20
+ export type { WidgetContribution } from './WidgetContribution.js';
21
+ export { widgetContributionSchema } from './widgetContributionSchema.js';
22
+ export { WIDGET_SIZES } from './WIDGET_SIZES.js';
23
+ export type { WidgetSize } from './WidgetSize.js';
24
+ export { WIDGET_SLOTS } from './WIDGET_SLOTS.js';
25
+ export type { WidgetSlot } from './WidgetSlot.js';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,17 @@
1
+ export { checkRemoteEntry } from './checkRemoteEntry.js';
2
+ export { CORE_TABLES } from './CORE_TABLES.js';
3
+ export { federationName } from './federationName.js';
4
+ export { isCompatible } from './isCompatible.js';
5
+ export { pageContributionSchema } from './pageContributionSchema.js';
6
+ export { pagePath } from './pagePath.js';
7
+ export { parseManifest } from './parseManifest.js';
8
+ export { PERMISSIONS } from './PERMISSIONS.js';
9
+ export { pluginManifestSchema } from './pluginManifestSchema.js';
10
+ export { remoteEntrySchema } from './remoteEntrySchema.js';
11
+ export { REMOTE_ENTRY_TYPE } from './REMOTE_ENTRY_TYPE.js';
12
+ export { SDK_MAJOR_VERSION } from './SDK_MAJOR_VERSION.js';
13
+ export { tableGrantSchema } from './tableGrantSchema.js';
14
+ export { widgetContributionSchema } from './widgetContributionSchema.js';
15
+ export { WIDGET_SIZES } from './WIDGET_SIZES.js';
16
+ export { WIDGET_SLOTS } from './WIDGET_SLOTS.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tells whether the host can load a plugin built against a given SDK major.
3
+ *
4
+ * Older majors are accepted; newer ones are refused.
5
+ *
6
+ * @param pluginSdkMajor - The SDK major the plugin declares in its manifest.
7
+ * @param hostSdkMajor - The SDK major the host implements. Defaults to `SDK_MAJOR_VERSION`.
8
+ * @returns `true` when `pluginSdkMajor` is an integer no greater than `hostSdkMajor`.
9
+ */
10
+ export declare function isCompatible(pluginSdkMajor: number, hostSdkMajor?: number): boolean;
11
+ //# sourceMappingURL=isCompatible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCompatible.d.ts","sourceRoot":"","sources":["../../src/manifest/isCompatible.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,YAAY,GAAE,MAA0B,GACvC,OAAO,CAET"}
@@ -0,0 +1,14 @@
1
+ import { SDK_MAJOR_VERSION } from './SDK_MAJOR_VERSION.js';
2
+ /**
3
+ * Tells whether the host can load a plugin built against a given SDK major.
4
+ *
5
+ * Older majors are accepted; newer ones are refused.
6
+ *
7
+ * @param pluginSdkMajor - The SDK major the plugin declares in its manifest.
8
+ * @param hostSdkMajor - The SDK major the host implements. Defaults to `SDK_MAJOR_VERSION`.
9
+ * @returns `true` when `pluginSdkMajor` is an integer no greater than `hostSdkMajor`.
10
+ */
11
+ export function isCompatible(pluginSdkMajor, hostSdkMajor = SDK_MAJOR_VERSION) {
12
+ return Number.isInteger(pluginSdkMajor) && pluginSdkMajor <= hostSdkMajor;
13
+ }
14
+ //# sourceMappingURL=isCompatible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isCompatible.js","sourceRoot":"","sources":["../../src/manifest/isCompatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,cAAsB,EACtB,eAAuB,iBAAiB;IAExC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,cAAc,IAAI,YAAY,CAAA;AAC3E,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ /** Validates one entry of a manifest's `contributes.pages`: a full page the plugin adds to the shell. */
3
+ export declare const pageContributionSchema: z.ZodObject<{
4
+ path: z.ZodString;
5
+ title: z.ZodString;
6
+ nav: z.ZodOptional<z.ZodObject<{
7
+ label: z.ZodString;
8
+ icon: z.ZodOptional<z.ZodString>;
9
+ section: z.ZodDefault<z.ZodEnum<{
10
+ main: "main";
11
+ reports: "reports";
12
+ settings: "settings";
13
+ }>>;
14
+ order: z.ZodDefault<z.ZodNumber>;
15
+ }, z.core.$strip>>;
16
+ module: z.ZodString;
17
+ }, z.core.$strip>;
18
+ //# sourceMappingURL=pageContributionSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageContributionSchema.d.ts","sourceRoot":"","sources":["../../src/manifest/pageContributionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,yGAAyG;AACzG,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;iBAoBjC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ /** Validates one entry of a manifest's `contributes.pages`: a full page the plugin adds to the shell. */
3
+ export const pageContributionSchema = z.object({
4
+ /** Path the page is mounted at, appended to `/p/<pluginId>/`. The host owns that prefix. */
5
+ path: z.string().min(1),
6
+ /** Human-readable page title. */
7
+ title: z.string().min(1),
8
+ /** When present, adds the page to the navigation. Omit for a page reachable only by link. */
9
+ nav: z
10
+ .object({
11
+ /** Text shown for the navigation entry. */
12
+ label: z.string().min(1),
13
+ /** Name of the icon shown beside the label, if any. */
14
+ icon: z.string().min(1).optional(),
15
+ /** Navigation group the entry is listed under. Defaults to `main`. */
16
+ section: z.enum(['main', 'reports', 'settings']).default('main'),
17
+ /** Sort position within the section, lowest first. Defaults to 100. */
18
+ order: z.number().int().default(100),
19
+ })
20
+ .optional(),
21
+ /** Name of the module the plugin's Module Federation build exposes for this page. */
22
+ module: z.string().min(1),
23
+ });
24
+ //# sourceMappingURL=pageContributionSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageContributionSchema.js","sourceRoot":"","sources":["../../src/manifest/pageContributionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,yGAAyG;AACzG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,4FAA4F;IAC5F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,iCAAiC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,6FAA6F;IAC7F,GAAG,EAAE,CAAC;SACH,MAAM,CAAC;QACN,2CAA2C;QAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,uDAAuD;QACvD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QAClC,sEAAsE;QACtE,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QAChE,uEAAuE;QACvE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;KACrC,CAAC;SACD,QAAQ,EAAE;IACb,qFAAqF;IACrF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC1B,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { PageContribution } from './PageContribution.js';
2
+ /**
3
+ * Builds the route a page contribution is mounted at.
4
+ *
5
+ * @param pluginId - The owning plugin's manifest id.
6
+ * @param contribution - The page contribution whose `path` is being mounted.
7
+ * @returns `/p/<pluginId>/<path>`, with any leading slashes on the contribution's
8
+ * path removed. The host owns the `/p/<pluginId>/` prefix.
9
+ */
10
+ export declare function pagePath(pluginId: string, contribution: PageContribution): string;
11
+ //# sourceMappingURL=pagePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagePath.d.ts","sourceRoot":"","sources":["../../src/manifest/pagePath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,GAAG,MAAM,CAGjF"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Builds the route a page contribution is mounted at.
3
+ *
4
+ * @param pluginId - The owning plugin's manifest id.
5
+ * @param contribution - The page contribution whose `path` is being mounted.
6
+ * @returns `/p/<pluginId>/<path>`, with any leading slashes on the contribution's
7
+ * path removed. The host owns the `/p/<pluginId>/` prefix.
8
+ */
9
+ export function pagePath(pluginId, contribution) {
10
+ const clean = contribution.path.replace(/^\/+/, '');
11
+ return `/p/${pluginId}/${clean}`;
12
+ }
13
+ //# sourceMappingURL=pagePath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagePath.js","sourceRoot":"","sources":["../../src/manifest/pagePath.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,QAAgB,EAAE,YAA8B;IACvE,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACnD,OAAO,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAA;AAClC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { ManifestParseResult } from './ManifestParseResult.js';
2
+ /**
3
+ * Validates an untrusted manifest.
4
+ *
5
+ * Manifests arrive from the database and, later, from third-party packages, so
6
+ * they are parsed rather than cast. A malformed one is a load failure for that
7
+ * plugin alone, never a crash of the host.
8
+ *
9
+ * @param input - The raw manifest value to validate.
10
+ * @returns The validated manifest, or an `error` message when the shape is
11
+ * invalid (issues joined as `path: message`, separated by `; `) or the
12
+ * manifest was built against a newer SDK major than the host's.
13
+ */
14
+ export declare function parseManifest(input: unknown): ManifestParseResult;
15
+ //# sourceMappingURL=parseManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseManifest.d.ts","sourceRoot":"","sources":["../../src/manifest/parseManifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAGnE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAejE"}
@@ -0,0 +1,31 @@
1
+ import { SDK_MAJOR_VERSION } from './SDK_MAJOR_VERSION.js';
2
+ import { isCompatible } from './isCompatible.js';
3
+ import { pluginManifestSchema } from './pluginManifestSchema.js';
4
+ /**
5
+ * Validates an untrusted manifest.
6
+ *
7
+ * Manifests arrive from the database and, later, from third-party packages, so
8
+ * they are parsed rather than cast. A malformed one is a load failure for that
9
+ * plugin alone, never a crash of the host.
10
+ *
11
+ * @param input - The raw manifest value to validate.
12
+ * @returns The validated manifest, or an `error` message when the shape is
13
+ * invalid (issues joined as `path: message`, separated by `; `) or the
14
+ * manifest was built against a newer SDK major than the host's.
15
+ */
16
+ export function parseManifest(input) {
17
+ const parsed = pluginManifestSchema.safeParse(input);
18
+ if (!parsed.success) {
19
+ return {
20
+ error: parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; '),
21
+ };
22
+ }
23
+ if (!isCompatible(parsed.data.sdkVersion)) {
24
+ return {
25
+ error: `built against SDK v${parsed.data.sdkVersion}, host is v${SDK_MAJOR_VERSION} — ` +
26
+ `upgrade the host to load this plugin`,
27
+ };
28
+ }
29
+ return { manifest: parsed.data };
30
+ }
31
+ //# sourceMappingURL=parseManifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseManifest.js","sourceRoot":"","sources":["../../src/manifest/parseManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACtF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,OAAO;YACL,KAAK,EACH,sBAAsB,MAAM,CAAC,IAAI,CAAC,UAAU,cAAc,iBAAiB,KAAK;gBAChF,sCAAsC;SACzC,CAAA;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,CAAA;AAClC,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validates a plugin manifest, applying defaults for every optional field.
4
+ *
5
+ * Use `parseManifest` to validate an untrusted value and also enforce SDK
6
+ * version compatibility.
7
+ */
8
+ export declare const pluginManifestSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ version: z.ZodString;
12
+ description: z.ZodDefault<z.ZodString>;
13
+ author: z.ZodDefault<z.ZodString>;
14
+ sdkVersion: z.ZodNumber;
15
+ requiredTables: z.ZodDefault<z.ZodArray<z.ZodObject<{
16
+ table: z.ZodEnum<{
17
+ accounts: "accounts";
18
+ transactions: "transactions";
19
+ transaction_splits: "transaction_splits";
20
+ categories: "categories";
21
+ category_rules: "category_rules";
22
+ category_rule_conditions: "category_rule_conditions";
23
+ recurring_items: "recurring_items";
24
+ }>;
25
+ access: z.ZodEnum<{
26
+ read: "read";
27
+ write: "write";
28
+ }>;
29
+ }, z.core.$strip>>>;
30
+ permissions: z.ZodDefault<z.ZodArray<z.ZodEnum<{
31
+ "network:outbound": "network:outbound";
32
+ "schedule:daily": "schedule:daily";
33
+ notify: "notify";
34
+ }>>>;
35
+ remoteEntry: z.ZodString;
36
+ contributes: z.ZodDefault<z.ZodObject<{
37
+ pages: z.ZodDefault<z.ZodArray<z.ZodObject<{
38
+ path: z.ZodString;
39
+ title: z.ZodString;
40
+ nav: z.ZodOptional<z.ZodObject<{
41
+ label: z.ZodString;
42
+ icon: z.ZodOptional<z.ZodString>;
43
+ section: z.ZodDefault<z.ZodEnum<{
44
+ main: "main";
45
+ reports: "reports";
46
+ settings: "settings";
47
+ }>>;
48
+ order: z.ZodDefault<z.ZodNumber>;
49
+ }, z.core.$strip>>;
50
+ module: z.ZodString;
51
+ }, z.core.$strip>>>;
52
+ widgets: z.ZodDefault<z.ZodArray<z.ZodObject<{
53
+ id: z.ZodString;
54
+ slot: z.ZodEnum<{
55
+ "dashboard.primary": "dashboard.primary";
56
+ "dashboard.secondary": "dashboard.secondary";
57
+ "account.detail": "account.detail";
58
+ }>;
59
+ title: z.ZodString;
60
+ defaultSize: z.ZodDefault<z.ZodEnum<{
61
+ sm: "sm";
62
+ md: "md";
63
+ lg: "lg";
64
+ full: "full";
65
+ }>>;
66
+ order: z.ZodDefault<z.ZodNumber>;
67
+ module: z.ZodString;
68
+ }, z.core.$strip>>>;
69
+ endpoints: z.ZodDefault<z.ZodBoolean>;
70
+ exporters: z.ZodDefault<z.ZodBoolean>;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
73
+ //# sourceMappingURL=pluginManifestSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManifestSchema.d.ts","sourceRoot":"","sources":["../../src/manifest/pluginManifestSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoD/B,CAAA"}
@@ -0,0 +1,66 @@
1
+ import { z } from 'zod';
2
+ import { PERMISSIONS } from './PERMISSIONS.js';
3
+ import { pageContributionSchema } from './pageContributionSchema.js';
4
+ import { remoteEntrySchema } from './remoteEntrySchema.js';
5
+ import { tableGrantSchema } from './tableGrantSchema.js';
6
+ import { widgetContributionSchema } from './widgetContributionSchema.js';
7
+ /**
8
+ * Validates a plugin manifest, applying defaults for every optional field.
9
+ *
10
+ * Use `parseManifest` to validate an untrusted value and also enforce SDK
11
+ * version compatibility.
12
+ */
13
+ export const pluginManifestSchema = z.object({
14
+ /** Reverse-domain identifier, stable across versions, e.g. `wickermoney.insights`. */
15
+ id: z.string().regex(/^[a-z0-9]+(\.[a-z0-9-]+)+$/, 'Must be reverse-domain, e.g. wickermoney.insights'),
16
+ /** Human-readable plugin name. */
17
+ name: z.string().min(1),
18
+ /** Version of the plugin itself. */
19
+ version: z.string().min(1),
20
+ /** Short description of what the plugin does. Defaults to an empty string. */
21
+ description: z.string().default(''),
22
+ /** Who wrote the plugin. Defaults to an empty string. */
23
+ author: z.string().default(''),
24
+ /** Major version of the SDK the plugin was built against. */
25
+ sdkVersion: z.number().int().nonnegative(),
26
+ /** Core tables the plugin needs, each with the access level requested. Defaults to none. */
27
+ requiredTables: z.array(tableGrantSchema).default([]),
28
+ /** Capabilities beyond table access the plugin asks for. Defaults to none. */
29
+ permissions: z.array(z.enum(PERMISSIONS)).default([]),
30
+ /**
31
+ * URL of the Module Federation entry: a same-origin `/plugins/<folder>/...`
32
+ * path, or an `https:` URL whose origin the host has allowlisted.
33
+ *
34
+ * The entry must be an ES module: the host registers every remote with
35
+ * `type: 'module'` and loads it with a dynamic `import()`, never a classic
36
+ * script tag.
37
+ */
38
+ remoteEntry: remoteEntrySchema,
39
+ /** What the plugin adds to the application. Defaults to nothing. */
40
+ contributes: z
41
+ .object({
42
+ /** Pages the plugin adds to the shell. */
43
+ pages: z.array(pageContributionSchema).default([]),
44
+ /** Widgets the plugin mounts into shell slots. */
45
+ widgets: z.array(widgetContributionSchema).default([]),
46
+ /**
47
+ * True if the plugin serves its own HTTP endpoints.
48
+ *
49
+ * Endpoints run server-side code, so only a bundled plugin's code is
50
+ * trusted to provide them.
51
+ */
52
+ endpoints: z.boolean().default(false),
53
+ /**
54
+ * True if the plugin can produce its own rows for a full data export.
55
+ *
56
+ * Same trust boundary as `endpoints`, and for the same reason: an
57
+ * exporter runs server-side code that reads a plugin's own schema, which
58
+ * only a bundled plugin's code is reviewed and sandboxed enough to do.
59
+ * This is the contribution point that lets an "export everything"
60
+ * feature include plugin data without core naming any plugin.
61
+ */
62
+ exporters: z.boolean().default(false),
63
+ })
64
+ .default({ pages: [], widgets: [], endpoints: false, exporters: false }),
65
+ });
66
+ //# sourceMappingURL=pluginManifestSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginManifestSchema.js","sourceRoot":"","sources":["../../src/manifest/pluginManifestSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,sFAAsF;IACtF,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAA4B,EAAE,mDAAmD,CAAC;IACvG,kCAAkC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,oCAAoC;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,8EAA8E;IAC9E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,yDAAyD;IACzD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9B,6DAA6D;IAC7D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC1C,4FAA4F;IAC5F,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACrD,8EAA8E;IAC9E,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACrD;;;;;;;OAOG;IACH,WAAW,EAAE,iBAAiB;IAC9B,oEAAoE;IACpE,WAAW,EAAE,CAAC;SACX,MAAM,CAAC;QACN,0CAA0C;QAC1C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QAClD,kDAAkD;QAClD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD;;;;;WAKG;QACH,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACrC;;;;;;;;WAQG;QACH,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;KACtC,CAAC;SACD,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;CAC3E,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validates the *shape* of a plugin's `remoteEntry`.
4
+ *
5
+ * Two forms are accepted:
6
+ *
7
+ * - a same-origin path under `/plugins/<folder>/`, served by the host itself;
8
+ * - an `https:` URL without embedded credentials.
9
+ *
10
+ * Everything else is refused: `http:`, `data:`, `javascript:`, protocol-relative
11
+ * (`//host/x`) and backslash forms, and any path containing `..`, `//` or
12
+ * percent-encoding. Whether an `https:` origin is *trusted* is deployment
13
+ * policy, not manifest shape, so it is decided by the host with
14
+ * `checkRemoteEntry` against its configured allowlist.
15
+ */
16
+ export declare const remoteEntrySchema: z.ZodString;
17
+ //# sourceMappingURL=remoteEntrySchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteEntrySchema.d.ts","sourceRoot":"","sources":["../../src/manifest/remoteEntrySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,aAyB5B,CAAA"}
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ /** A same-origin path to a plugin's built assets: `/plugins/<folder>/...`, no traversal, no encoding tricks. */
3
+ const SAME_ORIGIN_PATH = /^\/plugins\/[A-Za-z0-9][A-Za-z0-9_-]*\/[A-Za-z0-9._/-]*$/;
4
+ /**
5
+ * Validates the *shape* of a plugin's `remoteEntry`.
6
+ *
7
+ * Two forms are accepted:
8
+ *
9
+ * - a same-origin path under `/plugins/<folder>/`, served by the host itself;
10
+ * - an `https:` URL without embedded credentials.
11
+ *
12
+ * Everything else is refused: `http:`, `data:`, `javascript:`, protocol-relative
13
+ * (`//host/x`) and backslash forms, and any path containing `..`, `//` or
14
+ * percent-encoding. Whether an `https:` origin is *trusted* is deployment
15
+ * policy, not manifest shape, so it is decided by the host with
16
+ * `checkRemoteEntry` against its configured allowlist.
17
+ */
18
+ export const remoteEntrySchema = z.string().min(1).superRefine((value, ctx) => {
19
+ if (value.startsWith('/')) {
20
+ const clean = SAME_ORIGIN_PATH.test(value) && !value.includes('..') && !value.includes('//');
21
+ if (!clean) {
22
+ ctx.addIssue({
23
+ code: 'custom',
24
+ message: 'A relative remoteEntry must be a plain path under /plugins/<folder>/.',
25
+ });
26
+ }
27
+ return;
28
+ }
29
+ let url;
30
+ try {
31
+ url = new URL(value);
32
+ }
33
+ catch {
34
+ ctx.addIssue({ code: 'custom', message: 'remoteEntry must be a /plugins/... path or an https URL.' });
35
+ return;
36
+ }
37
+ if (url.protocol !== 'https:') {
38
+ ctx.addIssue({ code: 'custom', message: 'A remote remoteEntry must use https.' });
39
+ }
40
+ else if (url.username !== '' || url.password !== '') {
41
+ ctx.addIssue({ code: 'custom', message: 'remoteEntry must not embed credentials.' });
42
+ }
43
+ else if (value.includes('\\')) {
44
+ ctx.addIssue({ code: 'custom', message: 'remoteEntry must not contain backslashes.' });
45
+ }
46
+ });
47
+ //# sourceMappingURL=remoteEntrySchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remoteEntrySchema.js","sourceRoot":"","sources":["../../src/manifest/remoteEntrySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gHAAgH;AAChH,MAAM,gBAAgB,GAAG,0DAA0D,CAAA;AAEnF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC5E,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC5F,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uEAAuE;aACjF,CAAC,CAAA;QACJ,CAAC;QACD,OAAM;IACR,CAAC;IACD,IAAI,GAAQ,CAAA;IACZ,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,0DAA0D,EAAE,CAAC,CAAA;QACrG,OAAM;IACR,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC,CAAA;IACnF,CAAC;SAAM,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;QACtD,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC,CAAA;IACtF,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC,CAAA;IACxF,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ /** Validates one entry of a manifest's `requiredTables`: a core table and the access level requested on it. */
3
+ export declare const tableGrantSchema: z.ZodObject<{
4
+ table: z.ZodEnum<{
5
+ accounts: "accounts";
6
+ transactions: "transactions";
7
+ transaction_splits: "transaction_splits";
8
+ categories: "categories";
9
+ category_rules: "category_rules";
10
+ category_rule_conditions: "category_rule_conditions";
11
+ recurring_items: "recurring_items";
12
+ }>;
13
+ access: z.ZodEnum<{
14
+ read: "read";
15
+ write: "write";
16
+ }>;
17
+ }, z.core.$strip>;
18
+ //# sourceMappingURL=tableGrantSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableGrantSchema.d.ts","sourceRoot":"","sources":["../../src/manifest/tableGrantSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,+GAA+G;AAC/G,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;iBAK3B,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { CORE_TABLES } from './CORE_TABLES.js';
3
+ /** Validates one entry of a manifest's `requiredTables`: a core table and the access level requested on it. */
4
+ export const tableGrantSchema = z.object({
5
+ /** The core table the plugin wants to reach. */
6
+ table: z.enum(CORE_TABLES),
7
+ /** `read` allows selecting rows; `write` also allows inserting, updating and deleting them. */
8
+ access: z.enum(['read', 'write']),
9
+ });
10
+ //# sourceMappingURL=tableGrantSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableGrantSchema.js","sourceRoot":"","sources":["../../src/manifest/tableGrantSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,+GAA+G;AAC/G,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,gDAAgD;IAChD,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;IAC1B,+FAA+F;IAC/F,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ /** Validates one entry of a manifest's `contributes.widgets`: a component the plugin mounts into a shell slot. */
3
+ export declare const widgetContributionSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ slot: z.ZodEnum<{
6
+ "dashboard.primary": "dashboard.primary";
7
+ "dashboard.secondary": "dashboard.secondary";
8
+ "account.detail": "account.detail";
9
+ }>;
10
+ title: z.ZodString;
11
+ defaultSize: z.ZodDefault<z.ZodEnum<{
12
+ sm: "sm";
13
+ md: "md";
14
+ lg: "lg";
15
+ full: "full";
16
+ }>>;
17
+ order: z.ZodDefault<z.ZodNumber>;
18
+ module: z.ZodString;
19
+ }, z.core.$strip>;
20
+ //# sourceMappingURL=widgetContributionSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgetContributionSchema.d.ts","sourceRoot":"","sources":["../../src/manifest/widgetContributionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,kHAAkH;AAClH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;iBAanC,CAAA"}