@di-framework/cli-plugin-platform 0.0.1 → 6.0.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 (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,170 @@
1
+ package wasi:http@0.3.0;
2
+ interface types {
3
+ use wasi:clocks/types@0.3.0.{duration};
4
+ variant method {
5
+ get,
6
+ head,
7
+ post,
8
+ put,
9
+ delete,
10
+ connect,
11
+ options,
12
+ trace,
13
+ patch,
14
+ other(string)
15
+ }
16
+ variant scheme {
17
+ HTTP,
18
+ HTTPS,
19
+ other(string)
20
+ }
21
+ variant error-code {
22
+ DNS-timeout,
23
+ DNS-error(DNS-error-payload),
24
+ destination-not-found,
25
+ destination-unavailable,
26
+ destination-IP-prohibited,
27
+ destination-IP-unroutable,
28
+ connection-refused,
29
+ connection-terminated,
30
+ connection-timeout,
31
+ connection-read-timeout,
32
+ connection-write-timeout,
33
+ connection-limit-reached,
34
+ TLS-protocol-error,
35
+ TLS-certificate-error,
36
+ TLS-alert-received(TLS-alert-received-payload),
37
+ HTTP-request-denied,
38
+ HTTP-request-length-required,
39
+ HTTP-request-body-size(option<u64>),
40
+ HTTP-request-method-invalid,
41
+ HTTP-request-URI-invalid,
42
+ HTTP-request-URI-too-long,
43
+ HTTP-request-header-section-size(option<u32>),
44
+ HTTP-request-header-size(option<field-size-payload>),
45
+ HTTP-request-trailer-section-size(option<u32>),
46
+ HTTP-request-trailer-size(field-size-payload),
47
+ HTTP-response-incomplete,
48
+ HTTP-response-header-section-size(option<u32>),
49
+ HTTP-response-header-size(field-size-payload),
50
+ HTTP-response-body-size(option<u64>),
51
+ HTTP-response-trailer-section-size(option<u32>),
52
+ HTTP-response-trailer-size(field-size-payload),
53
+ HTTP-response-transfer-coding(option<string>),
54
+ HTTP-response-content-coding(option<string>),
55
+ HTTP-response-timeout,
56
+ HTTP-upgrade-failed,
57
+ HTTP-protocol-error,
58
+ loop-detected,
59
+ configuration-error,
60
+ internal-error(option<string>)
61
+ }
62
+ record DNS-error-payload {
63
+ rcode: option<string>,
64
+ info-code: option<u16>
65
+ }
66
+ record TLS-alert-received-payload {
67
+ alert-id: option<u8>,
68
+ alert-message: option<string>
69
+ }
70
+ record field-size-payload {
71
+ field-name: option<string>,
72
+ field-size: option<u32>
73
+ }
74
+ variant header-error {
75
+ invalid-syntax,
76
+ forbidden,
77
+ immutable,
78
+ size-exceeded,
79
+ other(option<string>),
80
+ }
81
+ variant request-options-error {
82
+ not-supported,
83
+ immutable,
84
+ other(option<string>),
85
+ }
86
+ type field-name = string;
87
+ type field-value = list<u8>;
88
+ resource fields {
89
+ constructor();
90
+ from-list: static func(
91
+ entries: list<tuple<field-name,field-value>>
92
+ ) -> result<fields, header-error>;
93
+ get: func(name: field-name) -> list<field-value>;
94
+ has: func(name: field-name) -> bool;
95
+ set: func(name: field-name, value: list<field-value>) -> result<_, header-error>;
96
+ delete: func(name: field-name) -> result<_, header-error>;
97
+ get-and-delete: func(name: field-name) -> result<list<field-value>, header-error>;
98
+ append: func(name: field-name, value: field-value) -> result<_, header-error>;
99
+ copy-all: func() -> list<tuple<field-name,field-value>>;
100
+ clone: func() -> fields;
101
+ }
102
+ type headers = fields;
103
+ type trailers = fields;
104
+ resource request {
105
+ new: static func(
106
+ headers: headers,
107
+ contents: option<stream<u8>>,
108
+ trailers: future<result<option<trailers>, error-code>>,
109
+ options: option<request-options>
110
+ ) -> tuple<request, future<result<_, error-code>>>;
111
+ get-method: func() -> method;
112
+ set-method: func(method: method) -> result;
113
+ get-path-with-query: func() -> option<string>;
114
+ set-path-with-query: func(path-with-query: option<string>) -> result;
115
+ get-scheme: func() -> option<scheme>;
116
+ set-scheme: func(scheme: option<scheme>) -> result;
117
+ get-authority: func() -> option<string>;
118
+ set-authority: func(authority: option<string>) -> result;
119
+ get-options: func() -> option<request-options>;
120
+ get-headers: func() -> headers;
121
+ consume-body: static func(this: request, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
122
+ }
123
+ resource request-options {
124
+ constructor();
125
+ get-connect-timeout: func() -> option<duration>;
126
+ set-connect-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
127
+ get-first-byte-timeout: func() -> option<duration>;
128
+ set-first-byte-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
129
+ get-between-bytes-timeout: func() -> option<duration>;
130
+ set-between-bytes-timeout: func(duration: option<duration>) -> result<_, request-options-error>;
131
+ clone: func() -> request-options;
132
+ }
133
+ type status-code = u16;
134
+ resource response {
135
+ new: static func(
136
+ headers: headers,
137
+ contents: option<stream<u8>>,
138
+ trailers: future<result<option<trailers>, error-code>>,
139
+ ) -> tuple<response, future<result<_, error-code>>>;
140
+ get-status-code: func() -> status-code;
141
+ set-status-code: func(status-code: status-code) -> result;
142
+ get-headers: func() -> headers;
143
+ consume-body: static func(this: response, res: future<result<_, error-code>>) -> tuple<stream<u8>, future<result<option<trailers>, error-code>>>;
144
+ }
145
+ }
146
+ world service {
147
+ include wasi:clocks/imports@0.3.0;
148
+ include wasi:random/imports@0.3.0;
149
+ import wasi:cli/stdout@0.3.0;
150
+ import wasi:cli/stderr@0.3.0;
151
+ import wasi:cli/stdin@0.3.0;
152
+ import client;
153
+ export handler;
154
+ }
155
+ world middleware {
156
+ include service;
157
+ import handler;
158
+ }
159
+ interface handler {
160
+ use types.{request, response, error-code};
161
+ handle: async func(
162
+ request: request,
163
+ ) -> result<response, error-code>;
164
+ }
165
+ interface client {
166
+ use types.{request, response, error-code};
167
+ send: async func(
168
+ request: request,
169
+ ) -> result<response, error-code>;
170
+ }
@@ -0,0 +1,17 @@
1
+ package wasi:random@0.3.0;
2
+ interface insecure-seed {
3
+ get-insecure-seed: func() -> tuple<u64, u64>;
4
+ }
5
+ interface insecure {
6
+ get-insecure-random-bytes: func(max-len: u64) -> list<u8>;
7
+ get-insecure-random-u64: func() -> u64;
8
+ }
9
+ interface random {
10
+ get-random-bytes: func(max-len: u64) -> list<u8>;
11
+ get-random-u64: func() -> u64;
12
+ }
13
+ world imports {
14
+ import random;
15
+ import insecure;
16
+ import insecure-seed;
17
+ }
@@ -0,0 +1,105 @@
1
+ package wasi:sockets@0.3.0;
2
+ interface ip-name-lookup {
3
+ use types.{ip-address};
4
+ variant error-code {
5
+ access-denied,
6
+ invalid-argument,
7
+ name-unresolvable,
8
+ temporary-resolver-failure,
9
+ permanent-resolver-failure,
10
+ other(option<string>),
11
+ }
12
+ resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;
13
+ }
14
+ interface types {
15
+ use wasi:clocks/types@0.3.0.{duration};
16
+ variant error-code {
17
+ access-denied,
18
+ not-supported,
19
+ invalid-argument,
20
+ out-of-memory,
21
+ timeout,
22
+ invalid-state,
23
+ address-not-bindable,
24
+ address-in-use,
25
+ remote-unreachable,
26
+ connection-refused,
27
+ connection-broken,
28
+ connection-reset,
29
+ connection-aborted,
30
+ datagram-too-large,
31
+ other(option<string>),
32
+ }
33
+ enum ip-address-family {
34
+ ipv4,
35
+ ipv6,
36
+ }
37
+ type ipv4-address = tuple<u8, u8, u8, u8>;
38
+ type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>;
39
+ variant ip-address {
40
+ ipv4(ipv4-address),
41
+ ipv6(ipv6-address),
42
+ }
43
+ record ipv4-socket-address {
44
+ port: u16,
45
+ address: ipv4-address,
46
+ }
47
+ record ipv6-socket-address {
48
+ port: u16,
49
+ flow-info: u32,
50
+ address: ipv6-address,
51
+ scope-id: u32,
52
+ }
53
+ variant ip-socket-address {
54
+ ipv4(ipv4-socket-address),
55
+ ipv6(ipv6-socket-address),
56
+ }
57
+ resource tcp-socket {
58
+ create: static func(address-family: ip-address-family) -> result<tcp-socket, error-code>;
59
+ bind: func(local-address: ip-socket-address) -> result<_, error-code>;
60
+ connect: async func(remote-address: ip-socket-address) -> result<_, error-code>;
61
+ listen: func() -> result<stream<tcp-socket>, error-code>;
62
+ send: func(data: stream<u8>) -> future<result<_, error-code>>;
63
+ receive: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
64
+ get-local-address: func() -> result<ip-socket-address, error-code>;
65
+ get-remote-address: func() -> result<ip-socket-address, error-code>;
66
+ get-is-listening: func() -> bool;
67
+ get-address-family: func() -> ip-address-family;
68
+ set-listen-backlog-size: func(value: u64) -> result<_, error-code>;
69
+ get-keep-alive-enabled: func() -> result<bool, error-code>;
70
+ set-keep-alive-enabled: func(value: bool) -> result<_, error-code>;
71
+ get-keep-alive-idle-time: func() -> result<duration, error-code>;
72
+ set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>;
73
+ get-keep-alive-interval: func() -> result<duration, error-code>;
74
+ set-keep-alive-interval: func(value: duration) -> result<_, error-code>;
75
+ get-keep-alive-count: func() -> result<u32, error-code>;
76
+ set-keep-alive-count: func(value: u32) -> result<_, error-code>;
77
+ get-hop-limit: func() -> result<u8, error-code>;
78
+ set-hop-limit: func(value: u8) -> result<_, error-code>;
79
+ get-receive-buffer-size: func() -> result<u64, error-code>;
80
+ set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
81
+ get-send-buffer-size: func() -> result<u64, error-code>;
82
+ set-send-buffer-size: func(value: u64) -> result<_, error-code>;
83
+ }
84
+ resource udp-socket {
85
+ create: static func(address-family: ip-address-family) -> result<udp-socket, error-code>;
86
+ bind: func(local-address: ip-socket-address) -> result<_, error-code>;
87
+ connect: func(remote-address: ip-socket-address) -> result<_, error-code>;
88
+ disconnect: func() -> result<_, error-code>;
89
+ send: async func(data: list<u8>, remote-address: option<ip-socket-address>) -> result<_, error-code>;
90
+ receive: async func() -> result<tuple<list<u8>, ip-socket-address>, error-code>;
91
+ get-local-address: func() -> result<ip-socket-address, error-code>;
92
+ get-remote-address: func() -> result<ip-socket-address, error-code>;
93
+ get-address-family: func() -> ip-address-family;
94
+ get-unicast-hop-limit: func() -> result<u8, error-code>;
95
+ set-unicast-hop-limit: func(value: u8) -> result<_, error-code>;
96
+ get-receive-buffer-size: func() -> result<u64, error-code>;
97
+ set-receive-buffer-size: func(value: u64) -> result<_, error-code>;
98
+ get-send-buffer-size: func() -> result<u64, error-code>;
99
+ set-send-buffer-size: func(value: u64) -> result<_, error-code>;
100
+ }
101
+ }
102
+ world imports {
103
+ import types;
104
+ import ip-name-lookup;
105
+ }
@@ -0,0 +1,26 @@
1
+ // Pinned from wasmCloud/wasmCloud 68ebece9c537f8bb4b5c9999f274ec68d60f35a9:
2
+ // crates/wash-runtime/tests/fixtures/p3-wit-deps/wasi-tls-0.3.0-draft/{world,types,client}.wit
3
+ package wasi:tls@0.3.0-draft;
4
+
5
+ interface types {
6
+ resource error {
7
+ to-debug-string: func() -> string;
8
+ }
9
+ }
10
+
11
+ interface client {
12
+ use types.{error};
13
+
14
+ resource connector {
15
+ constructor();
16
+
17
+ /// Encrypt application data. Closing cleartext emits close_notify.
18
+ send: func(cleartext: stream<u8>) -> tuple<stream<u8>, future<result<_, error>>>;
19
+
20
+ /// Decrypt network data.
21
+ receive: func(ciphertext: stream<u8>) -> tuple<stream<u8>, future<result<_, error>>>;
22
+
23
+ /// Both stream transforms must be established before the handshake.
24
+ connect: static async func(this: connector, server-name: string) -> result<_, error>;
25
+ }
26
+ }
@@ -0,0 +1,153 @@
1
+ package wasmcloud:blobstore@0.1.0;
2
+
3
+ /// Types used by blobstore.
4
+ ///
5
+ /// Unlike `wasi:blobstore@0.2.0-draft`, this package does not depend on `wasi:io`. Object bodies
6
+ /// are carried as native component-model `stream<u8>` values, so the `incoming-value` and
7
+ /// `outgoing-value` wrapper resources are gone.
8
+ interface types {
9
+ /// name of a container, a collection of objects.
10
+ /// The container name may be any valid UTF-8 string.
11
+ type container-name = string;
12
+
13
+ /// name of an object within a container
14
+ /// The object name may be any valid UTF-8 string.
15
+ type object-name = string;
16
+
17
+ /// nanoseconds since the Unix epoch.
18
+ type timestamp = u64;
19
+
20
+ /// size of an object, in bytes
21
+ type object-size = u64;
22
+
23
+ /// The set of errors which may be raised by functions in this package.
24
+ ///
25
+ /// Following the wasip3 convention, this enumerates specific named cases
26
+ /// rather than a bare `string`. It is intentionally non-exhaustive: future
27
+ /// versions may add cases, and generated bindings are marked non-exhaustive
28
+ /// accordingly, so consumers must always include a catch-all arm.
29
+ /// Backend-specific failures that do not map to a named case are reported
30
+ /// via `other`.
31
+ variant error {
32
+ /// The referenced container does not exist.
33
+ no-such-container,
34
+ /// A container with the requested name already exists (e.g. on
35
+ /// `create-container`).
36
+ container-already-exists,
37
+ /// The referenced object does not exist.
38
+ no-such-object,
39
+ /// The requesting component does not have access to the container or
40
+ /// object (which may or may not exist).
41
+ access-denied,
42
+ /// The operation did not complete within the host- or backend-imposed
43
+ /// time limit.
44
+ timeout,
45
+ /// The store is currently unreachable or otherwise unavailable. The
46
+ /// operation may succeed if retried later.
47
+ store-unavailable,
48
+ /// The operation was rejected because a storage quota or rate limit was
49
+ /// exceeded.
50
+ quota-exceeded,
51
+ /// Some other implementation-specific error has occurred (e.g. I/O). Used
52
+ /// for backend-specific failures that do not map to a named case above.
53
+ other(string),
54
+ }
55
+
56
+ /// information about a container
57
+ record container-metadata {
58
+ /// the container's name
59
+ name: container-name,
60
+ /// date and time the container was created
61
+ created-at: timestamp,
62
+ }
63
+
64
+ /// information about an object
65
+ record object-metadata {
66
+ /// the object's name
67
+ name: object-name,
68
+ /// the object's parent container
69
+ container: container-name,
70
+ /// date and time the object was created
71
+ created-at: timestamp,
72
+ /// size of the object, in bytes
73
+ size: object-size,
74
+ }
75
+
76
+ /// identifier for an object that includes its container name
77
+ record object-id {
78
+ container: container-name,
79
+ object: object-name,
80
+ }
81
+ }
82
+
83
+ /// a Container is a collection of objects
84
+ interface container {
85
+ use types.{container-metadata, error, object-metadata, object-name};
86
+
87
+ /// this defines the `container` resource
88
+ resource container {
89
+ /// returns container name
90
+ name: async func() -> result<string, error>;
91
+ /// returns container metadata
92
+ info: async func() -> result<container-metadata, error>;
93
+ /// retrieves an object, or a portion of an object, as a byte stream.
94
+ ///
95
+ /// Start and end offsets are inclusive. The returned `stream<u8>` yields the object's bytes
96
+ /// as they become available; the caller owns the stream and drives it to completion (or drops
97
+ /// it early to cancel the transfer).
98
+ get-data: async func(name: object-name, start: u64, end: u64) -> result<stream<u8>, error>;
99
+ /// creates or replaces an object with the data read from the provided byte stream.
100
+ ///
101
+ /// The callee consumes the `stream<u8>`; the write completes once the stream is exhausted.
102
+ write-data: async func(name: object-name, data: stream<u8>) -> result<_, error>;
103
+ /// returns the names of the objects in the container as a stream. Order is undefined.
104
+ list-objects: async func() -> result<stream<object-name>, error>;
105
+ /// deletes an object.
106
+ /// does not return an error if the object did not exist.
107
+ delete-object: async func(name: object-name) -> result<_, error>;
108
+ /// deletes multiple objects in the container
109
+ delete-objects: async func(names: list<object-name>) -> result<_, error>;
110
+ /// returns true if the object exists in this container
111
+ has-object: async func(name: object-name) -> result<bool, error>;
112
+ /// returns metadata for the object
113
+ object-info: async func(name: object-name) -> result<object-metadata, error>;
114
+ /// removes all objects within the container, leaving the container empty.
115
+ clear: async func() -> result<_, error>;
116
+ }
117
+ }
118
+
119
+ /// wasmCloud blobstore service definition
120
+ interface blobstore {
121
+ use container.{container};
122
+ use types.{error, container-name, object-id};
123
+
124
+ /// creates a new empty container
125
+ create-container: async func(name: container-name) -> result<container, error>;
126
+
127
+ /// retrieves a container by name
128
+ get-container: async func(name: container-name) -> result<container, error>;
129
+
130
+ /// deletes a container and all objects within it
131
+ delete-container: async func(name: container-name) -> result<_, error>;
132
+
133
+ /// returns true if the container exists
134
+ container-exists: async func(name: container-name) -> result<bool, error>;
135
+
136
+ /// copies (duplicates) an object, to the same or a different container.
137
+ /// returns an error if the target container does not exist.
138
+ /// overwrites the destination object if it already existed.
139
+ copy-object: async func(src: object-id, dest: object-id) -> result<_, error>;
140
+
141
+ /// moves or renames an object, to the same or a different container.
142
+ /// returns an error if the destination container does not exist.
143
+ /// overwrites the destination object if it already existed.
144
+ move-object: async func(src: object-id, dest: object-id) -> result<_, error>;
145
+ }
146
+
147
+ /// The `wasmcloud:blobstore/imports` world provides common APIs for interacting with blob stores.
148
+ world imports {
149
+ import types;
150
+ import container;
151
+ import blobstore;
152
+ }
153
+