@distilled.cloud/fly-io 1.0.0-rc.4 → 1.0.0-rc.6

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 (56) hide show
  1. package/lib/credentials.d.ts +17 -0
  2. package/lib/credentials.d.ts.map +1 -1
  3. package/lib/credentials.js +39 -7
  4. package/lib/credentials.js.map +1 -1
  5. package/lib/errors.d.ts +32 -0
  6. package/lib/errors.d.ts.map +1 -1
  7. package/lib/errors.js +33 -0
  8. package/lib/errors.js.map +1 -1
  9. package/lib/index.d.ts +27 -2
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +27 -2
  12. package/lib/index.js.map +1 -1
  13. package/lib/pagination.d.ts +5 -0
  14. package/lib/pagination.d.ts.map +1 -0
  15. package/lib/pagination.js +5 -0
  16. package/lib/pagination.js.map +1 -0
  17. package/lib/protocol.d.ts +18 -7
  18. package/lib/protocol.d.ts.map +1 -1
  19. package/lib/protocol.js +505 -28
  20. package/lib/protocol.js.map +1 -1
  21. package/lib/services/addons.d.ts +466 -0
  22. package/lib/services/addons.d.ts.map +1 -0
  23. package/lib/services/addons.js +613 -0
  24. package/lib/services/addons.js.map +1 -0
  25. package/lib/services/index.d.ts +3 -0
  26. package/lib/services/index.d.ts.map +1 -1
  27. package/lib/services/index.js +3 -0
  28. package/lib/services/index.js.map +1 -1
  29. package/lib/services/machines.d.ts +1175 -1198
  30. package/lib/services/machines.d.ts.map +1 -1
  31. package/lib/services/machines.js +1297 -1310
  32. package/lib/services/machines.js.map +1 -1
  33. package/lib/services/mpg.d.ts +376 -0
  34. package/lib/services/mpg.d.ts.map +1 -0
  35. package/lib/services/mpg.js +570 -0
  36. package/lib/services/mpg.js.map +1 -0
  37. package/lib/services/sprites.d.ts +321 -0
  38. package/lib/services/sprites.d.ts.map +1 -0
  39. package/lib/services/sprites.js +407 -0
  40. package/lib/services/sprites.js.map +1 -0
  41. package/lib/traits.d.ts +18 -8
  42. package/lib/traits.d.ts.map +1 -1
  43. package/lib/traits.js +13 -3
  44. package/lib/traits.js.map +1 -1
  45. package/package.json +37 -13
  46. package/src/credentials.ts +53 -7
  47. package/src/errors.ts +39 -0
  48. package/src/index.ts +31 -1
  49. package/src/pagination.ts +12 -0
  50. package/src/protocol.ts +715 -32
  51. package/src/services/addons.ts +1313 -0
  52. package/src/services/index.ts +3 -0
  53. package/src/services/machines.ts +2998 -3049
  54. package/src/services/mpg.ts +1188 -0
  55. package/src/services/sprites.ts +917 -0
  56. package/src/traits.ts +37 -3
package/src/traits.ts CHANGED
@@ -2,10 +2,12 @@
2
2
  * Fly.io SDK trait surface — hand-written.
3
3
  *
4
4
  * Re-exports the generic protocol traits from core so generated operations
5
- * import everything from one place. Fly.io has no envelope; the only
6
- * additions beyond the generic REST vocabulary are the bare-payload and
7
- * sensitive-value traits from `core/protocol-rest`.
5
+ * import everything from one place. REST services use the bare-payload and
6
+ * sensitive-value traits; GraphQL add-ons add the operation/response-path
7
+ * envelope traits.
8
8
  */
9
+ import { makeAnnotation } from "@distilled.cloud/core/trait";
10
+
9
11
  export {
10
12
  Body,
11
13
  Header,
@@ -42,3 +44,35 @@ export {
42
44
  rawResponseRootSymbol,
43
45
  sensitiveValueSymbol,
44
46
  } from "@distilled.cloud/core/protocol-rest";
47
+
48
+ /**
49
+ * The baked GraphQL document for one add-on operation. The protocol wraps
50
+ * the operation's input as `{ query, operationName, variables }`.
51
+ */
52
+ export interface GraphQLOpTrait {
53
+ readonly query: string;
54
+ readonly operationName: string;
55
+ readonly type: "query" | "mutation";
56
+ }
57
+
58
+ export const graphqlOpSymbol = Symbol.for("@distilled.cloud/fly-io/graphql-op");
59
+
60
+ /** Marks an operation input with its GraphQL document (`com.flyio.graphql#operation`). */
61
+ export const GraphQLOp = (op: GraphQLOpTrait) =>
62
+ makeAnnotation(graphqlOpSymbol, op);
63
+
64
+ export const responsePathSymbol = Symbol.for(
65
+ "@distilled.cloud/fly-io/graphql-response-path",
66
+ );
67
+
68
+ /** Dotted path under GraphQL `data` (`com.flyio.graphql#responsePath`). */
69
+ export const ResponsePath = (path: string) =>
70
+ makeAnnotation(responsePathSymbol, path);
71
+
72
+ export const graphqlPayloadRootSymbol = Symbol.for(
73
+ "@distilled.cloud/fly-io/graphql-payload-root",
74
+ );
75
+
76
+ /** Marks a response whose entire value is `data.<responsePath>`. */
77
+ export const GraphQLPayloadRoot = () =>
78
+ makeAnnotation(graphqlPayloadRootSymbol, true);