@phis/ui 0.8.1 → 0.8.2

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 (77) hide show
  1. package/README.md +9 -2
  2. package/components/controls/phi-table-control.js +3 -3
  3. package/components/media/media-upload-flow.d.ts +62 -5
  4. package/components/media/media-upload-flow.js +62 -24
  5. package/components/media/phi-area-upload-widget.d.ts +44 -1
  6. package/components/media/phi-area-upload-widget.js +32 -7
  7. package/components/media/phi-media-upload.d.ts +10 -3
  8. package/components/media/phi-media-upload.js +11 -8
  9. package/components/shell/phi-widget-icon.js +1 -0
  10. package/components/widgets/client/html-editor-link-node.d.ts +12 -0
  11. package/components/widgets/client/html-editor-link-node.js +60 -0
  12. package/components/widgets/client/html-editor.js +10 -6
  13. package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
  14. package/constants/cms-widget-types.d.ts +1 -0
  15. package/constants/cms-widget-types.js +3 -0
  16. package/constants/runtime-module-ownership.js +1 -0
  17. package/gateway/site-proxy.d.ts +12 -0
  18. package/gateway/site-proxy.js +20 -0
  19. package/net/phi-next-proxy.d.ts +7 -0
  20. package/net/phi-next-proxy.js +1 -1
  21. package/package.json +27 -14
  22. package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
  23. package/plugins/runtime-modules/area-contributions/admin.js +2 -0
  24. package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
  25. package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
  26. package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
  27. package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
  28. package/plugins/runtime-modules/cdn/authoring.js +8 -0
  29. package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
  30. package/plugins/runtime-modules/cdn/bytes.js +17 -0
  31. package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
  32. package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
  33. package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
  34. package/plugins/runtime-modules/cdn/data-providers.js +117 -0
  35. package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
  36. package/plugins/runtime-modules/cdn/definition.js +23 -0
  37. package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
  38. package/plugins/runtime-modules/cdn/ids.js +20 -0
  39. package/plugins/runtime-modules/cdn/module.d.ts +131 -0
  40. package/plugins/runtime-modules/cdn/module.js +4 -0
  41. package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
  42. package/plugins/runtime-modules/cdn/platform.js +73 -0
  43. package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
  44. package/plugins/runtime-modules/cdn/presets.js +20 -0
  45. package/plugins/runtime-modules/cdn/server.d.ts +1 -0
  46. package/plugins/runtime-modules/cdn/server.js +14 -0
  47. package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
  48. package/plugins/runtime-modules/cdn/services/table.js +296 -0
  49. package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
  50. package/plugins/runtime-modules/cdn/services/upload.js +146 -0
  51. package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
  52. package/plugins/runtime-modules/cdn/table-params.js +10 -0
  53. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
  54. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
  55. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
  56. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
  57. package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
  58. package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
  59. package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
  60. package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
  61. package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
  62. package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
  63. package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
  64. package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
  65. package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
  66. package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
  67. package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
  68. package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
  69. package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
  70. package/plugins/runtime-modules/cdn/widgets.js +13 -0
  71. package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
  72. package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
  73. package/plugins/runtime-modules/client-manifests/admin.js +11 -1
  74. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  75. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +3 -1
  76. package/plugins/runtime-modules/core/widgets/table/client.js +6 -4
  77. package/types/table-widget.d.ts +2 -2
@@ -0,0 +1,117 @@
1
+ import { PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS, PHI_CDN_RUNTIME_MODULE_ID, PHI_CDN_TABLE_RESOURCE_KEYS, } from "./ids";
2
+ /**
3
+ * The Site's CDN catalogue and the check of its bucket, over Core's Admin routes
4
+ * (`/api/site/admin/cdn`, phis-server; Admins and Maintainers). Every write is Core's to allow: the
5
+ * Page only offers it.
6
+ *
7
+ * `files` is the catalogue: every file offered under the Site's name, copied into the bucket (`cdn`) or
8
+ * linked where its source keeps it (`link`), with what became of it. A key is the file's whole identity
9
+ * and is never written twice, so withdrawing and deleting keep the row: the key stays taken.
10
+ *
11
+ * `check` is one run of the bucket against the catalogue, read when its dialog opens. Its rows are what
12
+ * it found -- an object the catalogue does not hold, a file the bucket does not hold, a size that differs
13
+ * -- and an unrecorded object Core can take into the catalogue offers `adopt`.
14
+ */
15
+ export const PHI_CDN_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
16
+ {
17
+ key: PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS.table,
18
+ ownerModuleId: PHI_CDN_RUNTIME_MODULE_ID,
19
+ kind: "table",
20
+ executionMode: "live",
21
+ authoringMode: "none",
22
+ title: "CDN",
23
+ description: "The Site's CDN catalogue and the check of its bucket.",
24
+ resources: [
25
+ {
26
+ resourceKey: PHI_CDN_TABLE_RESOURCE_KEYS.files,
27
+ title: "CDN files",
28
+ rowIdentityPath: "key",
29
+ recordRead: true,
30
+ fields: [
31
+ { key: "key", title: "Key", type: "string", required: true },
32
+ { key: "name", title: "Name", type: "string", required: true },
33
+ { key: "version", title: "Version", type: "string", required: true },
34
+ { key: "fileName", title: "File", type: "string", required: true },
35
+ { key: "sizeBytes", title: "Size in bytes", type: "number" },
36
+ { key: "sizeLabel", title: "Size", type: "string" },
37
+ { key: "storage", title: "Storage", type: "string" },
38
+ // `PhisCdnFileOs` and `PhisCdnFileArch` bits as one tag each: `macos`, `arm64`.
39
+ { key: "platform", title: "Platform", type: "json" },
40
+ { key: "sha256", title: "SHA-256", type: "string" },
41
+ { key: "contentType", title: "Content type", type: "string" },
42
+ { key: "publishedAt", title: "Published", type: "datetime" },
43
+ { key: "url", title: "Address", type: "string" },
44
+ { key: "state", title: "State", type: "string" },
45
+ // The kind (`cli`, `upload`) or, for an Add-on's file, the Add-on's id.
46
+ { key: "origin", title: "Origin", type: "string" },
47
+ { key: "addonId", title: "Add-on", type: "string" },
48
+ { key: "actorUserId", title: "Uploaded by", type: "number" },
49
+ { key: "sourceUrl", title: "Source address", type: "string" },
50
+ { key: "withdrawDisabled", title: "Withdrawn already", type: "boolean" },
51
+ { key: "deleteDisabled", title: "Deleted already", type: "boolean" },
52
+ ],
53
+ query: {
54
+ search: true,
55
+ filterFields: ["state", "name"],
56
+ sorting: "single",
57
+ pagination: "offset",
58
+ total: true,
59
+ },
60
+ actions: [
61
+ { key: "copy-url", title: "Copy address", scope: "row", intent: "read" },
62
+ {
63
+ key: "withdraw",
64
+ title: "Withdraw",
65
+ scope: "row",
66
+ intent: "destructive",
67
+ confirmation: "required",
68
+ disabledWhen: { source: "row", valuePath: "withdrawDisabled", operator: "truthy" },
69
+ },
70
+ {
71
+ key: "delete",
72
+ title: "Delete",
73
+ scope: "row",
74
+ intent: "destructive",
75
+ confirmation: "required",
76
+ disabledWhen: { source: "row", valuePath: "deleteDisabled", operator: "truthy" },
77
+ },
78
+ ],
79
+ },
80
+ {
81
+ resourceKey: PHI_CDN_TABLE_RESOURCE_KEYS.check,
82
+ title: "CDN check",
83
+ rowIdentityPath: "id",
84
+ fields: [
85
+ { key: "id", title: "Finding", type: "string", required: true },
86
+ { key: "key", title: "Key", type: "string", required: true },
87
+ // `unrecorded`, `missing` or `size-mismatch`.
88
+ { key: "finding", title: "Finding", type: "string", required: true },
89
+ { key: "sizeLabel", title: "Size", type: "string" },
90
+ { key: "recordedLabel", title: "Recorded size", type: "string" },
91
+ { key: "reason", title: "Reason", type: "string" },
92
+ { key: "adoptable", title: "Can be adopted", type: "boolean" },
93
+ ],
94
+ summaryFields: [
95
+ { key: "objects", title: "Objects in the bucket", type: "number" },
96
+ { key: "recorded", title: "Copied files in the catalogue", type: "number" },
97
+ { key: "consistent", title: "Bucket and catalogue agree", type: "boolean" },
98
+ ],
99
+ query: {
100
+ search: false,
101
+ filterFields: [],
102
+ sorting: "none",
103
+ pagination: "none",
104
+ },
105
+ actions: [
106
+ {
107
+ key: "adopt",
108
+ title: "Adopt",
109
+ scope: "row",
110
+ intent: "write",
111
+ visibleWhen: { source: "row", valuePath: "adoptable", operator: "truthy" },
112
+ },
113
+ ],
114
+ },
115
+ ],
116
+ },
117
+ ];
@@ -0,0 +1,140 @@
1
+ /**
2
+ * The Site's CDN on the Admin page `CDN`: what is published, uploads, withdrawing and deleting, and the
3
+ * check of the bucket against the catalogue.
4
+ *
5
+ * Off by default and in no Area's default list: a Site switches it on in the Admin Area once its
6
+ * operator attached a CDN (`phis cdn attach`). It is bound to Core alone, like the other Core Modules;
7
+ * a Site without a CDN gets the page with the sentence that says how one is attached, rather than a
8
+ * Module it cannot choose -- whether a Site has one is per Site, and the Module catalogue is not.
9
+ */
10
+ export declare const PHI_CDN_RUNTIME_MODULE_DEFINITION: {
11
+ kind: "module";
12
+ eligibleAreas: readonly ["admin"];
13
+ serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
14
+ title: string;
15
+ description: string;
16
+ category: "foundation";
17
+ iconFamily: string;
18
+ dataProviders: {
19
+ key: `${string}/${string}`;
20
+ ownerModuleId: "@phis/ui/modules/cdn";
21
+ kind: "table";
22
+ executionMode: "live";
23
+ authoringMode: "none";
24
+ title: string;
25
+ description: string;
26
+ resources: ({
27
+ resourceKey: "files";
28
+ title: string;
29
+ rowIdentityPath: string;
30
+ recordRead: true;
31
+ fields: ({
32
+ key: string;
33
+ title: string;
34
+ type: "string";
35
+ required: true;
36
+ } | {
37
+ key: string;
38
+ title: string;
39
+ type: "number";
40
+ required?: undefined;
41
+ } | {
42
+ key: string;
43
+ title: string;
44
+ type: "string";
45
+ required?: undefined;
46
+ } | {
47
+ key: string;
48
+ title: string;
49
+ type: "json";
50
+ required?: undefined;
51
+ } | {
52
+ key: string;
53
+ title: string;
54
+ type: "datetime";
55
+ required?: undefined;
56
+ } | {
57
+ key: string;
58
+ title: string;
59
+ type: "boolean";
60
+ required?: undefined;
61
+ })[];
62
+ query: {
63
+ search: true;
64
+ filterFields: string[];
65
+ sorting: "single";
66
+ pagination: "offset";
67
+ total: true;
68
+ };
69
+ actions: ({
70
+ key: string;
71
+ title: string;
72
+ scope: "row";
73
+ intent: "read";
74
+ confirmation?: undefined;
75
+ disabledWhen?: undefined;
76
+ } | {
77
+ key: string;
78
+ title: string;
79
+ scope: "row";
80
+ intent: "destructive";
81
+ confirmation: "required";
82
+ disabledWhen: {
83
+ source: "row";
84
+ valuePath: string;
85
+ operator: "truthy";
86
+ };
87
+ })[];
88
+ summaryFields?: undefined;
89
+ } | {
90
+ resourceKey: "check";
91
+ title: string;
92
+ rowIdentityPath: string;
93
+ fields: ({
94
+ key: string;
95
+ title: string;
96
+ type: "string";
97
+ required: true;
98
+ } | {
99
+ key: string;
100
+ title: string;
101
+ type: "string";
102
+ required?: undefined;
103
+ } | {
104
+ key: string;
105
+ title: string;
106
+ type: "boolean";
107
+ required?: undefined;
108
+ })[];
109
+ summaryFields: ({
110
+ key: string;
111
+ title: string;
112
+ type: "number";
113
+ } | {
114
+ key: string;
115
+ title: string;
116
+ type: "boolean";
117
+ })[];
118
+ query: {
119
+ search: false;
120
+ filterFields: never[];
121
+ sorting: "none";
122
+ pagination: "none";
123
+ total?: undefined;
124
+ };
125
+ actions: {
126
+ key: string;
127
+ title: string;
128
+ scope: "row";
129
+ intent: "write";
130
+ visibleWhen: {
131
+ source: "row";
132
+ valuePath: string;
133
+ operator: "truthy";
134
+ };
135
+ }[];
136
+ recordRead?: undefined;
137
+ })[];
138
+ }[];
139
+ moduleId: "@phis/ui/modules/cdn";
140
+ };
@@ -0,0 +1,23 @@
1
+ import { PHI_CDN_RUNTIME_MODULE_IDENTITY } from "./ids";
2
+ import { PHI_CORE_SERVER_BINDING } from "../../../types/server-capabilities";
3
+ import { PHI_CDN_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "./data-providers";
4
+ /**
5
+ * The Site's CDN on the Admin page `CDN`: what is published, uploads, withdrawing and deleting, and the
6
+ * check of the bucket against the catalogue.
7
+ *
8
+ * Off by default and in no Area's default list: a Site switches it on in the Admin Area once its
9
+ * operator attached a CDN (`phis cdn attach`). It is bound to Core alone, like the other Core Modules;
10
+ * a Site without a CDN gets the page with the sentence that says how one is attached, rather than a
11
+ * Module it cannot choose -- whether a Site has one is per Site, and the Module catalogue is not.
12
+ */
13
+ export const PHI_CDN_RUNTIME_MODULE_DEFINITION = {
14
+ ...PHI_CDN_RUNTIME_MODULE_IDENTITY,
15
+ kind: "module",
16
+ eligibleAreas: ["admin"],
17
+ serverBinding: PHI_CORE_SERVER_BINDING,
18
+ title: "CDN",
19
+ description: "Files published once and served from the Site's CDN host.",
20
+ category: "foundation",
21
+ iconFamily: "cdn",
22
+ dataProviders: PHI_CDN_RUNTIME_DATA_PROVIDER_DESCRIPTORS,
23
+ };
@@ -0,0 +1,18 @@
1
+ export declare const PHI_CDN_RUNTIME_MODULE_ID: "@phis/ui/modules/cdn";
2
+ /**
3
+ * The Module's identity as its Label Sets inherit it (`definePhiRuntimeModuleLabelSet`), stated beside
4
+ * the id so a Label Set a tree reads does not import the definition that imports the tree.
5
+ */
6
+ export declare const PHI_CDN_RUNTIME_MODULE_IDENTITY: {
7
+ readonly moduleId: "@phis/ui/modules/cdn";
8
+ };
9
+ export declare const PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS: {
10
+ readonly table: `${string}/${string}`;
11
+ };
12
+ /** The resources of the table Provider: the catalogue, and what one check of the bucket found. */
13
+ export declare const PHI_CDN_TABLE_RESOURCE_KEYS: {
14
+ readonly files: "files";
15
+ readonly check: "check";
16
+ };
17
+ /** The Admin Page the Module brings, and the key its nodes' preset ids are derived from. */
18
+ export declare const PHI_CDN_ADMIN_PAGE_PRESET_KEY = "admin-cdn-page";
@@ -0,0 +1,20 @@
1
+ import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
2
+ import { createPhiSharedRuntimeDataProviderKey } from "../../../constants/runtime-data-provider-key";
3
+ export const PHI_CDN_RUNTIME_MODULE_ID = `${PHI_SHARED_PACKAGE_NAME}/modules/cdn`;
4
+ /**
5
+ * The Module's identity as its Label Sets inherit it (`definePhiRuntimeModuleLabelSet`), stated beside
6
+ * the id so a Label Set a tree reads does not import the definition that imports the tree.
7
+ */
8
+ export const PHI_CDN_RUNTIME_MODULE_IDENTITY = {
9
+ moduleId: PHI_CDN_RUNTIME_MODULE_ID,
10
+ };
11
+ export const PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS = {
12
+ table: createPhiSharedRuntimeDataProviderKey("tables", "cdn"),
13
+ };
14
+ /** The resources of the table Provider: the catalogue, and what one check of the bucket found. */
15
+ export const PHI_CDN_TABLE_RESOURCE_KEYS = {
16
+ files: "files",
17
+ check: "check",
18
+ };
19
+ /** The Admin Page the Module brings, and the key its nodes' preset ids are derived from. */
20
+ export const PHI_CDN_ADMIN_PAGE_PRESET_KEY = "admin-cdn-page";
@@ -0,0 +1,131 @@
1
+ export declare const PHI_CDN_RUNTIME_MODULE: {
2
+ kind: "module";
3
+ eligibleAreas: readonly ["admin"];
4
+ serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
5
+ title: string;
6
+ description: string;
7
+ category: "foundation";
8
+ iconFamily: string;
9
+ dataProviders: {
10
+ key: `${string}/${string}`;
11
+ ownerModuleId: "@phis/ui/modules/cdn";
12
+ kind: "table";
13
+ executionMode: "live";
14
+ authoringMode: "none";
15
+ title: string;
16
+ description: string;
17
+ resources: ({
18
+ resourceKey: "files";
19
+ title: string;
20
+ rowIdentityPath: string;
21
+ recordRead: true;
22
+ fields: ({
23
+ key: string;
24
+ title: string;
25
+ type: "string";
26
+ required: true;
27
+ } | {
28
+ key: string;
29
+ title: string;
30
+ type: "number";
31
+ required?: undefined;
32
+ } | {
33
+ key: string;
34
+ title: string;
35
+ type: "string";
36
+ required?: undefined;
37
+ } | {
38
+ key: string;
39
+ title: string;
40
+ type: "json";
41
+ required?: undefined;
42
+ } | {
43
+ key: string;
44
+ title: string;
45
+ type: "datetime";
46
+ required?: undefined;
47
+ } | {
48
+ key: string;
49
+ title: string;
50
+ type: "boolean";
51
+ required?: undefined;
52
+ })[];
53
+ query: {
54
+ search: true;
55
+ filterFields: string[];
56
+ sorting: "single";
57
+ pagination: "offset";
58
+ total: true;
59
+ };
60
+ actions: ({
61
+ key: string;
62
+ title: string;
63
+ scope: "row";
64
+ intent: "read";
65
+ confirmation?: undefined;
66
+ disabledWhen?: undefined;
67
+ } | {
68
+ key: string;
69
+ title: string;
70
+ scope: "row";
71
+ intent: "destructive";
72
+ confirmation: "required";
73
+ disabledWhen: {
74
+ source: "row";
75
+ valuePath: string;
76
+ operator: "truthy";
77
+ };
78
+ })[];
79
+ summaryFields?: undefined;
80
+ } | {
81
+ resourceKey: "check";
82
+ title: string;
83
+ rowIdentityPath: string;
84
+ fields: ({
85
+ key: string;
86
+ title: string;
87
+ type: "string";
88
+ required: true;
89
+ } | {
90
+ key: string;
91
+ title: string;
92
+ type: "string";
93
+ required?: undefined;
94
+ } | {
95
+ key: string;
96
+ title: string;
97
+ type: "boolean";
98
+ required?: undefined;
99
+ })[];
100
+ summaryFields: ({
101
+ key: string;
102
+ title: string;
103
+ type: "number";
104
+ } | {
105
+ key: string;
106
+ title: string;
107
+ type: "boolean";
108
+ })[];
109
+ query: {
110
+ search: false;
111
+ filterFields: never[];
112
+ sorting: "none";
113
+ pagination: "none";
114
+ total?: undefined;
115
+ };
116
+ actions: {
117
+ key: string;
118
+ title: string;
119
+ scope: "row";
120
+ intent: "write";
121
+ visibleWhen: {
122
+ source: "row";
123
+ valuePath: string;
124
+ operator: "truthy";
125
+ };
126
+ }[];
127
+ recordRead?: undefined;
128
+ })[];
129
+ }[];
130
+ moduleId: "@phis/ui/modules/cdn";
131
+ };
@@ -0,0 +1,4 @@
1
+ import { PHI_CDN_RUNTIME_MODULE_DEFINITION } from "./definition";
2
+ export const PHI_CDN_RUNTIME_MODULE = {
3
+ ...PHI_CDN_RUNTIME_MODULE_DEFINITION,
4
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A file's platform as the CDN page shows and asks it: the `PhisCdnFileOs` and `PhisCdnFileArch` bits of
3
+ * the contract, one word each. The words are keys, not names -- the Page's Label Set says what each is
4
+ * called -- so the table's tags, the record's and the upload dialog's checkboxes read from one list.
5
+ */
6
+ export declare const PHI_CDN_OS_KEYS: readonly [readonly ["linux", number], readonly ["windows", number], readonly ["macos", number], readonly ["android", number], readonly ["ios", number], readonly ["chromeos", number], readonly ["other", number]];
7
+ export declare const PHI_CDN_ARCH_KEYS: readonly [readonly ["x64", number], readonly ["arm64", number], readonly ["x86", number], readonly ["arm32", number], readonly ["riscv64", number]];
8
+ export type PhiCdnOsKey = (typeof PHI_CDN_OS_KEYS)[number][0];
9
+ export type PhiCdnArchKey = (typeof PHI_CDN_ARCH_KEYS)[number][0];
10
+ export declare function readPhiCdnOsKeys(bits: number): PhiCdnOsKey[];
11
+ export declare function readPhiCdnArchKeys(bits: number): PhiCdnArchKey[];
12
+ export declare function writePhiCdnOsBits(keys: readonly string[]): number;
13
+ export declare function writePhiCdnArchBits(keys: readonly string[]): number;
14
+ /** The OS tags, then the architecture tags, of one file: what the table's `platform` column draws. */
15
+ export declare function readPhiCdnPlatformTags(os: number, arch: number): string[];
16
+ /**
17
+ * What a file name says of its platform, for the upload dialog to start from: the OS from the extension
18
+ * (`.dmg`/`.pkg` macOS, `.exe`/`.msi` Windows, `.deb`/`.rpm` Linux, `.apk` Android), the architecture
19
+ * from a word in the name. A guess the person corrects, never what is recorded unasked; 0 where the
20
+ * name says nothing.
21
+ */
22
+ export declare function guessPhiCdnPlatform(fileName: string): {
23
+ os: number;
24
+ arch: number;
25
+ };
@@ -0,0 +1,73 @@
1
+ import { PhisCdnFileArch, PhisCdnFileOs } from "@phis/contracts/addon";
2
+ /**
3
+ * A file's platform as the CDN page shows and asks it: the `PhisCdnFileOs` and `PhisCdnFileArch` bits of
4
+ * the contract, one word each. The words are keys, not names -- the Page's Label Set says what each is
5
+ * called -- so the table's tags, the record's and the upload dialog's checkboxes read from one list.
6
+ */
7
+ export const PHI_CDN_OS_KEYS = [
8
+ ["linux", PhisCdnFileOs.Linux],
9
+ ["windows", PhisCdnFileOs.Windows],
10
+ ["macos", PhisCdnFileOs.MacOS],
11
+ ["android", PhisCdnFileOs.Android],
12
+ ["ios", PhisCdnFileOs.IOS],
13
+ ["chromeos", PhisCdnFileOs.ChromeOS],
14
+ ["other", PhisCdnFileOs.Other],
15
+ ];
16
+ export const PHI_CDN_ARCH_KEYS = [
17
+ ["x64", PhisCdnFileArch.X64],
18
+ ["arm64", PhisCdnFileArch.Arm64],
19
+ ["x86", PhisCdnFileArch.X86],
20
+ ["arm32", PhisCdnFileArch.Arm32],
21
+ ["riscv64", PhisCdnFileArch.RiscV64],
22
+ ];
23
+ function readBits(entries, bits) {
24
+ return entries.filter(([, bit]) => (bits & bit) !== 0).map(([key]) => key);
25
+ }
26
+ function writeBits(entries, keys) {
27
+ return entries.reduce((bits, [key, bit]) => (keys.includes(key) ? bits | bit : bits), 0);
28
+ }
29
+ export function readPhiCdnOsKeys(bits) {
30
+ return readBits(PHI_CDN_OS_KEYS, bits);
31
+ }
32
+ export function readPhiCdnArchKeys(bits) {
33
+ return readBits(PHI_CDN_ARCH_KEYS, bits);
34
+ }
35
+ export function writePhiCdnOsBits(keys) {
36
+ return writeBits(PHI_CDN_OS_KEYS, keys);
37
+ }
38
+ export function writePhiCdnArchBits(keys) {
39
+ return writeBits(PHI_CDN_ARCH_KEYS, keys);
40
+ }
41
+ /** The OS tags, then the architecture tags, of one file: what the table's `platform` column draws. */
42
+ export function readPhiCdnPlatformTags(os, arch) {
43
+ return [...readPhiCdnOsKeys(os), ...readPhiCdnArchKeys(arch)];
44
+ }
45
+ const OS_BY_EXTENSION = {
46
+ dmg: PhisCdnFileOs.MacOS,
47
+ pkg: PhisCdnFileOs.MacOS,
48
+ exe: PhisCdnFileOs.Windows,
49
+ msi: PhisCdnFileOs.Windows,
50
+ deb: PhisCdnFileOs.Linux,
51
+ rpm: PhisCdnFileOs.Linux,
52
+ apk: PhisCdnFileOs.Android,
53
+ };
54
+ /*
55
+ * The architecture a file name states, by the words packagers use: Debian's `amd64` and `arm64`, the
56
+ * kernel's `x86_64` and `aarch64`. Read as words between separators, so `x86_64` is x64 and never x86,
57
+ * and a name that only contains the letters (`farm64ers`) states nothing.
58
+ */
59
+ const ARCH_WORDS = [
60
+ [/(?:^|[^a-z0-9])(?:amd64|x86_64)(?:$|[^a-z0-9])/iu, PhisCdnFileArch.X64],
61
+ [/(?:^|[^a-z0-9])(?:arm64|aarch64)(?:$|[^a-z0-9])/iu, PhisCdnFileArch.Arm64],
62
+ ];
63
+ /**
64
+ * What a file name says of its platform, for the upload dialog to start from: the OS from the extension
65
+ * (`.dmg`/`.pkg` macOS, `.exe`/`.msi` Windows, `.deb`/`.rpm` Linux, `.apk` Android), the architecture
66
+ * from a word in the name. A guess the person corrects, never what is recorded unasked; 0 where the
67
+ * name says nothing.
68
+ */
69
+ export function guessPhiCdnPlatform(fileName) {
70
+ const extension = /\.([a-z0-9]+)$/iu.exec(fileName)?.[1]?.toLowerCase() ?? "";
71
+ const arch = ARCH_WORDS.reduce((bits, [pattern, bit]) => (pattern.test(fileName) ? bits | bit : bits), 0);
72
+ return { os: OS_BY_EXTENSION[extension] ?? 0, arch };
73
+ }
@@ -0,0 +1,2 @@
1
+ import type { PhiCmsRoutePresetDescriptor } from "../../../types/cms-module-descriptors";
2
+ export declare const PHI_CDN_RUNTIME_MODULE_ROUTES: PhiCmsRoutePresetDescriptor[];
@@ -0,0 +1,20 @@
1
+ import { buildPhiSidebarRoutePresetDescriptor } from "../sidebar-route";
2
+ import { PHI_CDN_ADMIN_PAGE_PRESET_KEY, PHI_CDN_RUNTIME_MODULE_ID } from "./ids";
3
+ /*
4
+ * The Admin Area's policy already admits Admins and Maintainers (`PHI_VIEWER_ACCESS_SITE_MAINTENANCE`),
5
+ * which is who Core lets use the CDN routes; the entry needs no policy of its own.
6
+ */
7
+ export const PHI_CDN_RUNTIME_MODULE_ROUTES = [
8
+ buildPhiSidebarRoutePresetDescriptor({
9
+ area: "admin",
10
+ anchor: "main",
11
+ ownerModuleId: PHI_CDN_RUNTIME_MODULE_ID,
12
+ presetKey: PHI_CDN_ADMIN_PAGE_PRESET_KEY,
13
+ title: "CDN",
14
+ path: "/cdn",
15
+ itemKey: "@phis/ui/modules/cdn/nav/admin/cdn",
16
+ icon: "antd:cloud-upload",
17
+ loadTree: ({ page, runtime }) => import("./trees/phi-default-admin-cdn-page-tree")
18
+ .then((module) => module.buildPhiDefaultAdminCdnPageTree({ page, runtime })),
19
+ }),
20
+ ];
@@ -0,0 +1 @@
1
+ export declare const PHI_CDN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION: import("../area-contributions").PhiRuntimeModuleServerAreaContribution;
@@ -0,0 +1,14 @@
1
+ import { definePhiRuntimeModuleServerAreaContribution } from "../area-contributions";
2
+ import { PHI_CDN_RUNTIME_MODULE_DEFINITION } from "./definition";
3
+ import { PHI_CDN_RUNTIME_MODULE_ROUTES } from "./presets";
4
+ import { PHI_CDN_RUNTIME_MODULE_WIDGETS } from "./widgets";
5
+ export const PHI_CDN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION = definePhiRuntimeModuleServerAreaContribution({
6
+ moduleId: PHI_CDN_RUNTIME_MODULE_DEFINITION.moduleId,
7
+ catalogEntry: {
8
+ definition: PHI_CDN_RUNTIME_MODULE_DEFINITION,
9
+ widgets: PHI_CDN_RUNTIME_MODULE_WIDGETS,
10
+ layouts: [],
11
+ routes: PHI_CDN_RUNTIME_MODULE_ROUTES,
12
+ load: () => import("./module").then((module) => module.PHI_CDN_RUNTIME_MODULE),
13
+ },
14
+ });
@@ -0,0 +1,11 @@
1
+ import { type PhisCdnAdminFileV1, type PhisCdnCheckReportV1 } from "@phis/contracts/addon";
2
+ export declare const PHI_CDN_ADMIN_API_PATH = "/api/site/admin/cdn";
3
+ /** One catalogue entry as the table and the record read it. */
4
+ export declare function toPhiCdnFileRow(file: PhisCdnAdminFileV1, locale: string): Record<string, unknown>;
5
+ /** What one check found, one row per finding. */
6
+ export declare function toPhiCdnCheckRows(report: PhisCdnCheckReportV1, locale: string): Record<string, unknown>[];
7
+ export declare const PhiCdnTableProviderClient: import("react").ComponentType<{
8
+ children: import("react").ReactNode;
9
+ }>;
10
+ /** For tests: forget the rows answered so far. */
11
+ export declare function resetPhiCdnTableRowsForTests(): void;