@di-framework/cli-plugin-platform 0.0.1 → 6.0.3

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 (169) hide show
  1. package/README.md +408 -0
  2. package/dist/actor-protocol.d.ts +4 -0
  3. package/dist/actor-protocol.js +162 -0
  4. package/dist/actors.d.ts +31 -0
  5. package/dist/actors.js +296 -0
  6. package/dist/args.d.ts +15 -0
  7. package/dist/args.js +66 -0
  8. package/dist/assets/http-adapter.js +876 -0
  9. package/dist/assets/platform/.gitignore.tmpl +6 -0
  10. package/dist/assets/platform/Pulumi.yaml.tmpl +6 -0
  11. package/dist/assets/platform/README.md +208 -0
  12. package/dist/assets/platform/index.ts.tmpl +2 -0
  13. package/dist/assets/platform/package.json.tmpl +18 -0
  14. package/dist/assets/platform/tsconfig.json +11 -0
  15. package/dist/assets/queue-adapter.js +60 -0
  16. package/dist/assets/sqlite/BUILD-INFO.txt +13 -0
  17. package/dist/assets/sqlite/SHA256SUMS +2 -0
  18. package/dist/assets/sqlite/di-framework-sqlite.wasm +0 -0
  19. package/dist/assets/sqlite/di-framework-sqlite.wit +337 -0
  20. package/dist/assets/wit/deps/LICENSE.md +8 -0
  21. package/dist/assets/wit/deps/di-framework-queues/package.wit +18 -0
  22. package/dist/assets/wit/deps/di-framework-sqlite/package.wit +211 -0
  23. package/dist/assets/wit/deps/wasi-cli/package.wit +70 -0
  24. package/dist/assets/wit/deps/wasi-clocks/package.wit +42 -0
  25. package/dist/assets/wit/deps/wasi-config/package.wit +15 -0
  26. package/dist/assets/wit/deps/wasi-filesystem/package.wit +184 -0
  27. package/dist/assets/wit/deps/wasi-http/package.wit +170 -0
  28. package/dist/assets/wit/deps/wasi-random/package.wit +17 -0
  29. package/dist/assets/wit/deps/wasi-sockets/package.wit +105 -0
  30. package/dist/assets/wit/deps/wasi-tls/package.wit +26 -0
  31. package/dist/assets/wit/deps/wasmcloud-blobstore/package.wit +153 -0
  32. package/dist/assets/wit/deps/wasmcloud-keyvalue/package.wit +370 -0
  33. package/dist/assets/wit/deps/wasmcloud-messaging/package.wit +125 -0
  34. package/dist/assets/wit/deps/wasmcloud-postgres/package.wit +435 -0
  35. package/dist/assets/wit/deps/wasmcloud-secrets/package.wit +80 -0
  36. package/dist/async-transform.d.ts +3 -0
  37. package/dist/async-transform.js +60 -0
  38. package/dist/bindings.d.ts +34 -0
  39. package/dist/bindings.js +307 -0
  40. package/dist/build.d.ts +29 -0
  41. package/dist/build.js +325 -0
  42. package/dist/command.d.ts +3 -0
  43. package/dist/command.js +141 -0
  44. package/dist/control/auth.d.ts +18 -0
  45. package/dist/control/auth.js +89 -0
  46. package/dist/control/cron.d.ts +7 -0
  47. package/dist/control/cron.js +86 -0
  48. package/dist/control/index.d.ts +4 -0
  49. package/dist/control/index.js +4 -0
  50. package/dist/control/network.d.ts +12 -0
  51. package/dist/control/network.js +49 -0
  52. package/dist/control/queues.d.ts +15 -0
  53. package/dist/control/queues.js +77 -0
  54. package/dist/cron.d.ts +26 -0
  55. package/dist/cron.js +239 -0
  56. package/dist/deploy.d.ts +29 -0
  57. package/dist/deploy.js +57 -0
  58. package/dist/deps.d.ts +96 -0
  59. package/dist/deps.js +303 -0
  60. package/dist/destroy.d.ts +3 -0
  61. package/dist/destroy.js +24 -0
  62. package/dist/dev-runner.d.ts +24 -0
  63. package/dist/dev-runner.js +83 -0
  64. package/dist/dev.d.ts +8 -0
  65. package/dist/dev.js +76 -0
  66. package/dist/discovery.d.ts +15 -0
  67. package/dist/discovery.js +182 -0
  68. package/dist/doctor.d.ts +8 -0
  69. package/dist/doctor.js +82 -0
  70. package/dist/guests.d.ts +9 -0
  71. package/dist/guests.js +56 -0
  72. package/dist/host-interface.d.ts +29 -0
  73. package/dist/host-interface.js +142 -0
  74. package/dist/index.d.ts +33 -0
  75. package/dist/index.js +39 -0
  76. package/dist/kubernetes.d.ts +9 -0
  77. package/dist/kubernetes.js +17 -0
  78. package/dist/managed-bindings.d.ts +9 -0
  79. package/dist/managed-bindings.js +150 -0
  80. package/dist/manifest.d.ts +36 -0
  81. package/dist/manifest.js +257 -0
  82. package/dist/namespace.d.ts +2 -0
  83. package/dist/namespace.js +4 -0
  84. package/dist/node-compat/async-hooks.d.ts +29 -0
  85. package/dist/node-compat/async-hooks.js +80 -0
  86. package/dist/node-compat/bootstrap.d.ts +1 -0
  87. package/dist/node-compat/bootstrap.js +9 -0
  88. package/dist/node-compat/bytes.d.ts +7 -0
  89. package/dist/node-compat/bytes.js +41 -0
  90. package/dist/node-compat/crypto-hash.d.ts +27 -0
  91. package/dist/node-compat/crypto-hash.js +108 -0
  92. package/dist/node-compat/crypto-subtle.d.ts +59 -0
  93. package/dist/node-compat/crypto-subtle.js +288 -0
  94. package/dist/node-compat/crypto.d.ts +136 -0
  95. package/dist/node-compat/crypto.js +142 -0
  96. package/dist/node-compat/dgram.d.ts +49 -0
  97. package/dist/node-compat/dgram.js +197 -0
  98. package/dist/node-compat/env.d.ts +6 -0
  99. package/dist/node-compat/env.js +88 -0
  100. package/dist/node-compat/fetch-runtime.d.ts +80 -0
  101. package/dist/node-compat/fetch-runtime.js +314 -0
  102. package/dist/node-compat/fs.d.ts +84 -0
  103. package/dist/node-compat/fs.js +285 -0
  104. package/dist/node-compat/http-parser.d.ts +40 -0
  105. package/dist/node-compat/http-parser.js +185 -0
  106. package/dist/node-compat/http.d.ts +130 -0
  107. package/dist/node-compat/http.js +688 -0
  108. package/dist/node-compat/https.d.ts +28 -0
  109. package/dist/node-compat/https.js +88 -0
  110. package/dist/node-compat/module.d.ts +11 -0
  111. package/dist/node-compat/module.js +35 -0
  112. package/dist/node-compat/net.d.ts +119 -0
  113. package/dist/node-compat/net.js +441 -0
  114. package/dist/node-compat/process.d.ts +25 -0
  115. package/dist/node-compat/process.js +63 -0
  116. package/dist/node-compat/runtime-application.d.ts +4 -0
  117. package/dist/node-compat/runtime-application.js +24 -0
  118. package/dist/node-compat/seed-virtual.d.ts +6 -0
  119. package/dist/node-compat/seed-virtual.js +6 -0
  120. package/dist/node-compat/seed.d.ts +20 -0
  121. package/dist/node-compat/seed.js +106 -0
  122. package/dist/node-compat/socket-address.d.ts +35 -0
  123. package/dist/node-compat/socket-address.js +162 -0
  124. package/dist/node-compat/timers.d.ts +32 -0
  125. package/dist/node-compat/timers.js +96 -0
  126. package/dist/node-compat/tls.d.ts +57 -0
  127. package/dist/node-compat/tls.js +290 -0
  128. package/dist/node-compat/wasi-random.d.ts +2 -0
  129. package/dist/node-compat/wasi-random.js +25 -0
  130. package/dist/node-compat/wasi-sockets.d.ts +47 -0
  131. package/dist/node-compat/wasi-sockets.js +134 -0
  132. package/dist/oci.d.ts +9 -0
  133. package/dist/oci.js +9 -0
  134. package/dist/paths.d.ts +7 -0
  135. package/dist/paths.js +13 -0
  136. package/dist/platform-init.d.ts +13 -0
  137. package/dist/platform-init.js +265 -0
  138. package/dist/platform.d.ts +22 -0
  139. package/dist/platform.js +170 -0
  140. package/dist/project.d.ts +39 -0
  141. package/dist/project.js +130 -0
  142. package/dist/publish.d.ts +15 -0
  143. package/dist/publish.js +57 -0
  144. package/dist/pulumi.d.ts +4 -0
  145. package/dist/pulumi.js +27 -0
  146. package/dist/queues-module.d.ts +4 -0
  147. package/dist/queues-module.js +89 -0
  148. package/dist/queues.d.ts +16 -0
  149. package/dist/queues.js +167 -0
  150. package/dist/registry.d.ts +16 -0
  151. package/dist/registry.js +27 -0
  152. package/dist/service.d.ts +162 -0
  153. package/dist/service.js +678 -0
  154. package/dist/support.d.ts +14 -0
  155. package/dist/support.js +37 -0
  156. package/dist/target.d.ts +18 -0
  157. package/dist/target.js +45 -0
  158. package/dist/toml.d.ts +6 -0
  159. package/dist/toml.js +245 -0
  160. package/dist/wash-dev.d.ts +18 -0
  161. package/dist/wash-dev.js +80 -0
  162. package/dist/wit.d.ts +76 -0
  163. package/dist/wit.js +248 -0
  164. package/dist/workload-members.d.ts +12 -0
  165. package/dist/workload-members.js +136 -0
  166. package/dist/workload.d.ts +45 -0
  167. package/dist/workload.js +457 -0
  168. package/package.json +55 -8
  169. package/src/index.ts +0 -2
@@ -0,0 +1,18 @@
1
+ package di-framework:queues@0.1.0;
2
+
3
+ interface dispatch {
4
+ record job {
5
+ id: string,
6
+ queue: string,
7
+ payload: string,
8
+ attempt: u32,
9
+ created-at: s64,
10
+ }
11
+
12
+ /// Dispatch a job payload to the worker handler.
13
+ dispatch: async func(job: job) -> result<_, string>;
14
+ }
15
+
16
+ world worker {
17
+ export dispatch;
18
+ }
@@ -0,0 +1,211 @@
1
+ package di-framework:sqlite@0.1.0;
2
+
3
+ /// Types shared by the `database` interface.
4
+ ///
5
+ /// Kept in a separate interface (mirroring `wasmcloud:postgres/types`) so that
6
+ /// values and errors unify when a consumer and a provider are composed with
7
+ /// WAC, and so a future `prepared` or `async` interface can reuse them.
8
+ interface types {
9
+ /// A structured error reported by SQLite itself.
10
+ record sqlite-error {
11
+ /// Primary SQLite result code (e.g. `19` = SQLITE_CONSTRAINT).
12
+ code: s32,
13
+ /// Extended result code (e.g. `2067` = SQLITE_CONSTRAINT_UNIQUE).
14
+ /// Equal to `code` when SQLite provides no extended information.
15
+ extended-code: s32,
16
+ /// Human-readable message from `sqlite3_errmsg`.
17
+ message: string,
18
+ }
19
+
20
+ /// Errors raised by functions in this package. Intentionally non-exhaustive:
21
+ /// consumers must keep a catch-all arm.
22
+ variant error {
23
+ /// The database file could not be opened or created. The guest path must
24
+ /// live under a directory the host has preopened (a mounted volume).
25
+ open-failed(string),
26
+ /// The connection has been closed with `close` and cannot be used again.
27
+ closed,
28
+ /// The statement could not be prepared: syntax error, unknown table or
29
+ /// column, or more than one statement passed to `run`/`query`/`first`.
30
+ invalid-sql(string),
31
+ /// Wrong number of parameters or a value that could not be bound.
32
+ invalid-params(string),
33
+ /// SQLite failed while executing a prepared statement (constraint
34
+ /// violation, read-only database, I/O error, ...). Branch on
35
+ /// `sqlite-error.code` / `extended-code` for machine-readable handling.
36
+ execution-failed(sqlite-error),
37
+ /// A column value could not be converted into a `value` (e.g. TEXT that is
38
+ /// not valid UTF-8).
39
+ value-conversion-failed(string),
40
+ /// The database file is locked or busy after the configured busy timeout.
41
+ /// With the WASI VFS this can only arise from another connection *inside
42
+ /// the same component instance*; the VFS does not perform file locking.
43
+ busy,
44
+ /// `begin`, `commit`, `rollback` (or a savepoint call) was issued in a
45
+ /// state that does not permit it (e.g. `commit` with no open transaction).
46
+ invalid-transaction-state(string),
47
+ /// Any other implementation-specific failure.
48
+ other(string),
49
+ }
50
+
51
+ /// A dynamically-typed SQLite value, used for parameters and results.
52
+ variant value {
53
+ null,
54
+ integer(s64),
55
+ real(f64),
56
+ text(string),
57
+ blob(list<u8>),
58
+ }
59
+
60
+ /// A result row: `(column-name, value)` pairs in column order. Column names
61
+ /// are repeated per row on purpose: result sets in the framework (actor
62
+ /// state, queue jobs, migration bookkeeping) are small and JS consumers turn
63
+ /// each row straight into an object.
64
+ type row = list<tuple<string, value>>;
65
+
66
+ /// `PRAGMA synchronous` level. `full` is the default and is what the
67
+ /// framework expects for durable actor / queue state; `normal` trades a
68
+ /// small durability window (power loss mid-commit) for fewer fsyncs. `off`
69
+ /// exists for tests only.
70
+ enum sync-mode {
71
+ off,
72
+ normal,
73
+ full,
74
+ }
75
+
76
+ /// Rollback-journal mode. WAL is intentionally not offered: the WASI VFS
77
+ /// has neither file locking nor shared memory, both of which WAL needs, and
78
+ /// SQLite is compiled with `SQLITE_OMIT_WAL`. `delete` is the default and
79
+ /// the safest choice on WASI preopens (the journal is unlinked after every
80
+ /// commit); `persist` keeps the journal file and zeroes its header; `memory`
81
+ /// is for tests only. TRUNCATE is deliberately left out of the surface.
82
+ enum journal-mode {
83
+ delete,
84
+ persist,
85
+ memory,
86
+ }
87
+
88
+ /// How `begin` acquires its lock. Maps to `BEGIN DEFERRED|IMMEDIATE|EXCLUSIVE`.
89
+ enum transaction-behavior {
90
+ deferred,
91
+ immediate,
92
+ exclusive,
93
+ }
94
+
95
+ /// Options accepted by `open`. Every field is optional; `none` means the
96
+ /// documented default.
97
+ record open-options {
98
+ /// Create the database file if it does not exist. Default: true.
99
+ create: option<bool>,
100
+ /// Open read-only. Default: false.
101
+ read-only: option<bool>,
102
+ /// `PRAGMA synchronous`. Default: `full`.
103
+ synchronous: option<sync-mode>,
104
+ /// `PRAGMA journal_mode`. Default: `delete`.
105
+ journal-mode: option<journal-mode>,
106
+ /// `PRAGMA busy_timeout` in milliseconds. Default: 5000.
107
+ busy-timeout-ms: option<u32>,
108
+ /// `PRAGMA foreign_keys`. Default: true.
109
+ foreign-keys: option<bool>,
110
+ }
111
+ }
112
+
113
+ /// Synchronous, single-writer SQLite access backed by the WASI filesystem.
114
+ ///
115
+ /// The implementer of this interface is the `di-framework:sqlite` Rust
116
+ /// component. It bundles SQLite (amalgamation) with a minimal WASI VFS: no
117
+ /// file locking, no mmap, no WAL, in-memory temp store. Consequently exactly
118
+ /// one component instance may own a given database file at a time; the
119
+ /// framework enforces `replicas: 1` for actor workloads for this reason.
120
+ ///
121
+ /// Paths are guest paths. The host mounts a volume at `mountPath` and the same
122
+ /// string is the guest-visible directory (a WASI preopen), e.g.
123
+ /// `/data/actors/orders/order-42.sqlite`.
124
+ interface database {
125
+ use types.{error, value, row, open-options, transaction-behavior};
126
+
127
+ /// Open (and by default create) the database at `path`, applying the
128
+ /// pragmas described in `open-options` (rollback journal, `synchronous=FULL`,
129
+ /// `foreign_keys=ON`, 5 s busy timeout when `options` is `none`). Use
130
+ /// `:memory:` for an in-memory database.
131
+ open: func(path: string, options: option<open-options>) -> result<connection, error>;
132
+
133
+ /// The bundled SQLite library version, e.g. `3.53.2`.
134
+ sqlite-version: func() -> string;
135
+
136
+ /// An open SQLite connection. Dropping the resource closes it; an open
137
+ /// transaction is rolled back by SQLite in that case.
138
+ resource connection {
139
+ /// Execute one or more `;`-separated statements without parameters and
140
+ /// discard any results. Intended for DDL / migrations / pragmas. Untrusted
141
+ /// input must never be interpolated into `sql`.
142
+ exec: func(sql: string) -> result<_, error>;
143
+
144
+ /// Execute a single parameterized statement and return the number of rows
145
+ /// changed (`sqlite3_changes`). Parameters bind positionally to `?`/`?NNN`.
146
+ /// Statements that return rows (e.g. `INSERT ... RETURNING`) run to
147
+ /// completion; their rows are discarded.
148
+ run: func(sql: string, params: list<value>) -> result<u64, error>;
149
+
150
+ /// Execute a single parameterized statement and return all rows.
151
+ query: func(sql: string, params: list<value>) -> result<list<row>, error>;
152
+
153
+ /// Execute a single parameterized statement and return only the first row,
154
+ /// or `none` when the statement produced no rows.
155
+ first: func(sql: string, params: list<value>) -> result<option<row>, error>;
156
+
157
+ /// `BEGIN [DEFERRED|IMMEDIATE|EXCLUSIVE]`. Default: `immediate`, which is
158
+ /// the right choice for a single-writer file with no lock arbitration.
159
+ /// Fails with `invalid-transaction-state` if a transaction is already open;
160
+ /// nest with `savepoint` instead.
161
+ begin: func(behavior: option<transaction-behavior>) -> result<_, error>;
162
+
163
+ /// `COMMIT` the open transaction.
164
+ commit: func() -> result<_, error>;
165
+
166
+ /// `ROLLBACK` the open transaction.
167
+ rollback: func() -> result<_, error>;
168
+
169
+ /// `SAVEPOINT <name>`; usable for nested transactions. `name` must match
170
+ /// `[A-Za-z_][A-Za-z0-9_]*`.
171
+ savepoint: func(name: string) -> result<_, error>;
172
+
173
+ /// `RELEASE SAVEPOINT <name>`.
174
+ release-savepoint: func(name: string) -> result<_, error>;
175
+
176
+ /// `ROLLBACK TO SAVEPOINT <name>` followed by `RELEASE`, so the savepoint
177
+ /// is fully unwound.
178
+ rollback-to-savepoint: func(name: string) -> result<_, error>;
179
+
180
+ /// True while a transaction (or savepoint) is open on this connection.
181
+ in-transaction: func() -> bool;
182
+
183
+ /// Rows changed by the most recent `run`/`exec`.
184
+ changes: func() -> u64;
185
+
186
+ /// `sqlite3_last_insert_rowid`.
187
+ last-insert-rowid: func() -> s64;
188
+
189
+ /// Explicitly close the connection. Subsequent calls fail with `closed`.
190
+ close: func() -> result<_, error>;
191
+ }
192
+ }
193
+
194
+ /// The world implemented by the Rust component. WASI imports (filesystem,
195
+ /// clocks, cli, io) are pulled in by the Rust `wasm32-wasip2` target and
196
+ /// therefore do not need to be listed here. `types` is exported explicitly so
197
+ /// the component is self-contained: without it WIT elaboration would turn the
198
+ /// `use types.{...}` into an *import* of `types`, which `wac plug` could not
199
+ /// satisfy from this component.
200
+ world sqlite-provider {
201
+ export types;
202
+ export database;
203
+ }
204
+
205
+ /// The world a consumer (e.g. the componentize-qjs JS component) targets when
206
+ /// it wants a SQLite database. `wac plug` satisfies these imports with the
207
+ /// `sqlite-provider` component's exports.
208
+ world imports {
209
+ import types;
210
+ import database;
211
+ }
@@ -0,0 +1,70 @@
1
+ package wasi:cli@0.3.0;
2
+ world command {
3
+ include imports;
4
+ export run;
5
+ }
6
+ interface environment {
7
+ get-environment: func() -> list<tuple<string, string>>;
8
+ get-arguments: func() -> list<string>;
9
+ get-initial-cwd: func() -> option<string>;
10
+ }
11
+ interface exit {
12
+ exit: func(status: result);
13
+ exit-with-code: func(status-code: u8);
14
+ }
15
+ world imports {
16
+ include wasi:clocks/imports@0.3.0;
17
+ include wasi:filesystem/imports@0.3.0;
18
+ include wasi:sockets/imports@0.3.0;
19
+ include wasi:random/imports@0.3.0;
20
+ import environment;
21
+ import exit;
22
+ import stdin;
23
+ import stdout;
24
+ import stderr;
25
+ import terminal-input;
26
+ import terminal-output;
27
+ import terminal-stdin;
28
+ import terminal-stdout;
29
+ import terminal-stderr;
30
+ }
31
+ interface run {
32
+ run: async func() -> result;
33
+ }
34
+ interface types {
35
+ enum error-code {
36
+ io,
37
+ illegal-byte-sequence,
38
+ pipe,
39
+ }
40
+ }
41
+ interface stdin {
42
+ use types.{error-code};
43
+ read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
44
+ }
45
+ interface stdout {
46
+ use types.{error-code};
47
+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
48
+ }
49
+ interface stderr {
50
+ use types.{error-code};
51
+ write-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
52
+ }
53
+ interface terminal-input {
54
+ resource terminal-input;
55
+ }
56
+ interface terminal-output {
57
+ resource terminal-output;
58
+ }
59
+ interface terminal-stdin {
60
+ use terminal-input.{terminal-input};
61
+ get-terminal-stdin: func() -> option<terminal-input>;
62
+ }
63
+ interface terminal-stdout {
64
+ use terminal-output.{terminal-output};
65
+ get-terminal-stdout: func() -> option<terminal-output>;
66
+ }
67
+ interface terminal-stderr {
68
+ use terminal-output.{terminal-output};
69
+ get-terminal-stderr: func() -> option<terminal-output>;
70
+ }
@@ -0,0 +1,42 @@
1
+ package wasi:clocks@0.3.0;
2
+ interface monotonic-clock {
3
+ use types.{duration};
4
+ type mark = u64;
5
+ now: func() -> mark;
6
+ get-resolution: func() -> duration;
7
+ wait-until: async func(
8
+ when: mark,
9
+ );
10
+ wait-for: async func(
11
+ how-long: duration,
12
+ );
13
+ }
14
+ interface system-clock {
15
+ use types.{duration};
16
+ record instant {
17
+ seconds: s64,
18
+ nanoseconds: u32,
19
+ }
20
+ now: func() -> instant;
21
+ get-resolution: func() -> duration;
22
+ }
23
+ @unstable(feature = clocks-timezone)
24
+ interface timezone {
25
+ @unstable(feature = clocks-timezone)
26
+ use system-clock.{instant};
27
+ @unstable(feature = clocks-timezone)
28
+ iana-id: func() -> option<string>;
29
+ @unstable(feature = clocks-timezone)
30
+ utc-offset: func(when: instant) -> option<s64>;
31
+ @unstable(feature = clocks-timezone)
32
+ to-debug-string: func() -> string;
33
+ }
34
+ interface types {
35
+ type duration = u64;
36
+ }
37
+ world imports {
38
+ import monotonic-clock;
39
+ import system-clock;
40
+ @unstable(feature = clocks-timezone)
41
+ import timezone;
42
+ }
@@ -0,0 +1,15 @@
1
+ package wasi:config@0.2.0-rc.1;
2
+
3
+ interface store {
4
+ variant error {
5
+ upstream(string),
6
+ io(string),
7
+ }
8
+
9
+ get: func(key: string) -> result<option<string>, error>;
10
+ get-all: func() -> result<list<tuple<string, string>>, error>;
11
+ }
12
+
13
+ world imports {
14
+ import store;
15
+ }
@@ -0,0 +1,184 @@
1
+ package wasi:filesystem@0.3.0;
2
+ interface preopens {
3
+ use types.{descriptor};
4
+ get-directories: func() -> list<tuple<descriptor, string>>;
5
+ }
6
+ interface types {
7
+ use wasi:clocks/system-clock@0.3.0.{instant};
8
+ type filesize = u64;
9
+ variant descriptor-type {
10
+ block-device,
11
+ character-device,
12
+ directory,
13
+ fifo,
14
+ symbolic-link,
15
+ regular-file,
16
+ socket,
17
+ other(option<string>),
18
+ }
19
+ flags descriptor-flags {
20
+ read,
21
+ write,
22
+ file-integrity-sync,
23
+ data-integrity-sync,
24
+ requested-write-sync,
25
+ mutate-directory,
26
+ }
27
+ record descriptor-stat {
28
+ %type: descriptor-type,
29
+ link-count: link-count,
30
+ size: filesize,
31
+ data-access-timestamp: option<instant>,
32
+ data-modification-timestamp: option<instant>,
33
+ status-change-timestamp: option<instant>,
34
+ }
35
+ flags path-flags {
36
+ symlink-follow,
37
+ }
38
+ flags open-flags {
39
+ create,
40
+ directory,
41
+ exclusive,
42
+ truncate,
43
+ }
44
+ type link-count = u64;
45
+ variant new-timestamp {
46
+ no-change,
47
+ now,
48
+ timestamp(instant),
49
+ }
50
+ record directory-entry {
51
+ %type: descriptor-type,
52
+ name: string,
53
+ }
54
+ variant error-code {
55
+ access,
56
+ already,
57
+ bad-descriptor,
58
+ busy,
59
+ deadlock,
60
+ quota,
61
+ exist,
62
+ file-too-large,
63
+ illegal-byte-sequence,
64
+ in-progress,
65
+ interrupted,
66
+ invalid,
67
+ io,
68
+ is-directory,
69
+ loop,
70
+ too-many-links,
71
+ message-size,
72
+ name-too-long,
73
+ no-device,
74
+ no-entry,
75
+ no-lock,
76
+ insufficient-memory,
77
+ insufficient-space,
78
+ not-directory,
79
+ not-empty,
80
+ not-recoverable,
81
+ unsupported,
82
+ no-tty,
83
+ no-such-device,
84
+ overflow,
85
+ not-permitted,
86
+ pipe,
87
+ read-only,
88
+ invalid-seek,
89
+ text-file-busy,
90
+ cross-device,
91
+ other(option<string>),
92
+ }
93
+ enum advice {
94
+ normal,
95
+ sequential,
96
+ random,
97
+ will-need,
98
+ dont-need,
99
+ no-reuse,
100
+ }
101
+ record metadata-hash-value {
102
+ lower: u64,
103
+ upper: u64,
104
+ }
105
+ resource descriptor {
106
+ read-via-stream: func(
107
+ offset: filesize,
108
+ ) -> tuple<stream<u8>, future<result<_, error-code>>>;
109
+ write-via-stream: func(
110
+ data: stream<u8>,
111
+ offset: filesize,
112
+ ) -> future<result<_, error-code>>;
113
+ append-via-stream: func(data: stream<u8>) -> future<result<_, error-code>>;
114
+ advise: async func(
115
+ offset: filesize,
116
+ length: filesize,
117
+ advice: advice
118
+ ) -> result<_, error-code>;
119
+ sync-data: async func() -> result<_, error-code>;
120
+ get-flags: async func() -> result<descriptor-flags, error-code>;
121
+ get-type: async func() -> result<descriptor-type, error-code>;
122
+ set-size: async func(size: filesize) -> result<_, error-code>;
123
+ set-times: async func(
124
+ data-access-timestamp: new-timestamp,
125
+ data-modification-timestamp: new-timestamp,
126
+ ) -> result<_, error-code>;
127
+ read-directory: func() -> tuple<stream<directory-entry>, future<result<_, error-code>>>;
128
+ sync: async func() -> result<_, error-code>;
129
+ create-directory-at: async func(
130
+ path: string,
131
+ ) -> result<_, error-code>;
132
+ stat: async func() -> result<descriptor-stat, error-code>;
133
+ stat-at: async func(
134
+ path-flags: path-flags,
135
+ path: string,
136
+ ) -> result<descriptor-stat, error-code>;
137
+ set-times-at: async func(
138
+ path-flags: path-flags,
139
+ path: string,
140
+ data-access-timestamp: new-timestamp,
141
+ data-modification-timestamp: new-timestamp,
142
+ ) -> result<_, error-code>;
143
+ link-at: async func(
144
+ old-path-flags: path-flags,
145
+ old-path: string,
146
+ new-descriptor: borrow<descriptor>,
147
+ new-path: string,
148
+ ) -> result<_, error-code>;
149
+ open-at: async func(
150
+ path-flags: path-flags,
151
+ path: string,
152
+ open-flags: open-flags,
153
+ %flags: descriptor-flags,
154
+ ) -> result<descriptor, error-code>;
155
+ readlink-at: async func(
156
+ path: string,
157
+ ) -> result<string, error-code>;
158
+ remove-directory-at: async func(
159
+ path: string,
160
+ ) -> result<_, error-code>;
161
+ rename-at: async func(
162
+ old-path: string,
163
+ new-descriptor: borrow<descriptor>,
164
+ new-path: string,
165
+ ) -> result<_, error-code>;
166
+ symlink-at: async func(
167
+ old-path: string,
168
+ new-path: string,
169
+ ) -> result<_, error-code>;
170
+ unlink-file-at: async func(
171
+ path: string,
172
+ ) -> result<_, error-code>;
173
+ is-same-object: async func(other: borrow<descriptor>) -> bool;
174
+ metadata-hash: async func() -> result<metadata-hash-value, error-code>;
175
+ metadata-hash-at: async func(
176
+ path-flags: path-flags,
177
+ path: string,
178
+ ) -> result<metadata-hash-value, error-code>;
179
+ }
180
+ }
181
+ world imports {
182
+ import types;
183
+ import preopens;
184
+ }